Tools for monthly statistics on Tcode and report usage times

Source: Internet
Author: User

Execute report, enter the date and user to query,

The tool will list all the Tcode and report lists that were used by the user in the month in which the input date was entered, according to the number of uses:

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, Cv_report, 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.

Tools for monthly statistics on Tcode and report usage times

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.