按月统计tcode和report使用次数的工具
2015-10-13 11:24
441 查看
执行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.
工具会按照使用次数从高到低列出输入日期所在的月份内所有该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.
相关文章推荐
- phpcms使用细节
- Nmap教程之nmap命令使用示例(nmap使用方法)
- CodeForces 527C(set大法好)
- 想要上市,SaaS 企业应该重点关注什么?(下)
- Android屏幕适配全攻略(最权威的官方适配指导)
- android studio 数据库相关操作
- 某研究所“大数据分析及处理技术”内训圆满结束!
- HDU 1385 Minimum Transport Cost(最短路Floyd+标记路径)
- Volley网络框架完全解析(使用篇)
- ImageView setImageBitmap 不显示图片
- WEB编码规范
- mysql之InnoDB内存管理
- web流程图JS插件:dagre-d3
- 安装Cocoapods, 更新gem,出现 Operation not permitted
- 前端js解决fastjson $ref引用问题
- ava.math.Math类常用的常量和方法:
- HashMap实现原理分析(转自 Alpha's 学习笔记 )
- vnc配合oracle sqldeveloper 本地基本连接操作 centos
- iOS 清理缓存功能实现第一种方法
- Eclipse中解决git冲突