执行report,输入要查询的日期和user,

工具会按照使用次数从高到低列出输入日期所在的月份内所有该user 曾经使用过的tcode 和report list:

REPORT zusertcode.
PARAMETER: month TYPE dats DEFAULT sy-datum OBLIGATORY,
           user type usr02-bname OBLIGATORY DEFAULT sy-uname.
TYPES: BEGIN OF zusertcode,
         operation type char30,
         type type char10,
         count  TYPE swncshcnt,
       END OF zusertcode.
TYPES: tt_zusertcode TYPE STANDARD TABLE OF zusertcode WITH KEY operation type.
DATA: lt_usertcode  TYPE swnc_t_aggusertcode,
      wa_usertcode TYPE swncaggusertcode,
      wa           TYPE zusertcode,
      t_ut         TYPE tt_zusertcode,
      ls_result    TYPE zusertcode,
      lt_result     TYPE tt_zusertcode.
CONSTANTS: cv_tcode TYPE char30 VALUE 'Tcode',
           cv_report TYPE char30 VALUE 'Report',
           cv_count TYPE char5 value 'Count'.
START-OF-SELECTION.
* Set date to the first day of the month
  "month+6(2) = '01'.
  CALL FUNCTION 'SWNC_COLLECTOR_GET_AGGREGATES'
    EXPORTING
      component     = 'TOTAL'
      periodtype    = 'M'
      periodstrt    = month
    TABLES
      usertcode     = lt_usertcode
    EXCEPTIONS
      no_data_found = 1
      OTHERS        = 2.
  DELETE lt_usertcode WHERE tasktype <> '01'.
  LOOP AT lt_usertcode ASSIGNING FIELD-SYMBOL(<user>) WHERE account = user.
     CLEAR: ls_result.
     ls_result-operation = <user>-entry_id.
     ls_result-type = <user>-entry_id+72.
     ls_result-count = <user>-count.
     COLLECT ls_result INTO lt_result.
  ENDLOOP.
  SORT lt_result BY count DESCENDING.
  WRITE:  10 cv_tcode, 20 cv_report, 60 cv_count COLOR COL_NEGATIVE.
  LOOP AT lt_result ASSIGNING FIELD-SYMBOL(<result>).
      IF <result>-type = 'T'.
        WRITE: / <result>-operation COLOR COL_TOTAL UNDER cv_tcode,
                 <result>-count COLOR COL_POSITIVE UNDER cv_count.
      ELSE.
        WRITE: / <result>-operation COLOR COL_GROUP UNDER cv_report,
                 <result>-count COLOR COL_POSITIVE UNDER cv_count.
      ENDIF.
  ENDLOOP.

按月统计tcode和report使用次数的工具的更多相关文章

  1. SqlServer mssql 按月统计所有部门

    以订单统计为例,前端展示柱状图(Jquery统计): 表及主要字段描述如下:表名:Orders1.日期CreateTime2.金额Amount3.用户UserID 情况一:根据部门统计某一年每月销量( ...

  2. sqlserver 按日、周、月统计方法

    摘自于网络网络:http://blog.csdn.net/wanmdb/article/details/8080636 create table T(日期时间 datetime, 数量 int) in ...

  3. Oracle-SQL-按月统计自助终端交易量

    SQL实现的目标: 基本情况 现金交易情况 转账情况 转账交易情况(明细) 其它业务情况 交易量汇总 日均交易量 交易金额 绩效情况(万元) 支行名 支行号 所属网点 网点号 管理员帐户 管理员 终端 ...

  4. 实现mysql按月统计的教程

    From: http://www.jbxue.com/db/758.html 实现mysql按月统计的教程   mysql有个字段是DATETIME类型,要实现可以按月统计,该怎么写sql语句? se ...

  5. tp5月统计的bug

    月统计求和时 本月第一天没有统计到

  6. sql按月统计数量和按月累加统计数量

    1.简单的,按月统计数量 SELECT CREATE_DATE, DATE_FORMAT(CREATE_DATE, '%Y-%m') AS month , COUNT(*) AS sum FROM p ...

  7. mysql按日/周/月统计

    一.mysql按日统计 ) count ' and start_time > '2017-06-28' group by days; 二.mysql按周统计 ) ' group by weeks ...

  8. mysql按月统计六个月内不同类型订单的成交金额

    mysql按月统计六个月内不同类型订单的成交金额 创建数据库 CREATE DATABASE test; 创建订单表 CREATE TABLE `t_order` ( `id` ) NOT NULL ...

  9. echart报表插件使用笔记(二)--按月统计

    按月统计注冊人数 java类: package com.spring.controller; import java.io.IOException; import java.sql.Connectio ...

随机推荐

  1. neo4j中文社区

    关于Neo4j中文社区 官网:http://neo4j.com.cn/ Neo4j 社区为国内具影响力的 Neo4j技术社区,致力于 Neo4j 的技术研究. Neo4j 社区由一批热爱 Neo4j ...

  2. Python anaconda links to GOMP_4.0 and throws error

    ImportError: /usr/progtools/anaconda2/bin/../lib/libgomp.so.1: version `GOMP_4.0' not found (require ...

  3. 基本类型和引用类型调用是的区别(Object.create)

    var person = { name : 'jim', address:{ province:'浙', city:'A' } } var newPerson = Object.create(pers ...

  4. Ajax_showHint() 函数

    showHint() 函数实现的功能是:当用户在输入框中键入字符时,网页如何与 web 服务器进行通信,完整的代码如下: <html><head><script type ...

  5. html/css 布局练习3

    效果图:

  6. Gerald is into Art

    Gerald is into Art Gerald bought two very rare paintings at the Sotheby's auction and he now wants t ...

  7. category - junit用例分组执行

    一.category 和 testSuite的比较 (1)testSuite是类级分组(xx.class) (2)category是用例级分组(@Test) (3)category是testSuite ...

  8. maven私服搭建(centOS6.5)

    maven的好处和私服的应用本文不赘述,私服搭建如下: MAVEN 私服搭建(centOS 6.5 环境) 1.  准备环境,搭建centOS6.5系统环境,略 2.  准备对应的软件包如下: A. ...

  9. mysql分表技术(学习心得)

    (最近在学习mysql优化的一些问题,以下为个人一些收获,如有不足,敬请提出!) 概述:当一个表的数据很大,比如200G,这时太大,我们只靠索引也不好使了,这时我们需要分表和分区处理.分表有两种形式( ...

  10. window.location.href无法跳转的解决办法

    -------------------接收别人做的SSO单点登录项目,无源码,只是点击登出按钮一直不跳转. 原因是: <a href="javascript:;" oncli ...