REPORT zbasis_roles.
TABLES: usr01.
TYPES: BEGIN OF ty_usr01,
bname TYPE usr01-bname,
END OF ty_usr01.
TYPES: BEGIN OF ty_roles,
agr_name TYPE agr_users-agr_name,
uname TYPE agr_users-uname,
END OF ty_roles.
TYPES: BEGIN OF ty_tcodes,
agr_name TYPE agr_tcodes-agr_name,
tcode TYPE agr_tcodes-tcode,
END OF ty_tcodes.
DATA: v_count TYPE i.
DATA : it_tcodes TYPE TABLE OF ty_tcodes WITH HEADER LINE,
it_roles TYPE TABLE OF ty_roles WITH HEADER LINE,
it_usr01 TYPE TABLE OF ty_usr01 WITH HEADER LINE,
tasktype TYPE TABLE OF swncaggtasktype WITH HEADER LINE,
tasktimes TYPE TABLE OF swncaggtasktimes WITH HEADER LINE,
times TYPE TABLE OF swncaggtimes WITH HEADER LINE,
dbprocs TYPE TABLE OF swncaggdbprocs WITH HEADER LINE,
extsystem TYPE TABLE OF swncaggextsystem WITH HEADER LINE,
tcdet TYPE TABLE OF swncaggtcdet WITH HEADER LINE,
frontend TYPE TABLE OF swncaggfrontend WITH HEADER LINE,
memory TYPE TABLE OF swncaggmemory WITH HEADER LINE,
spoolact TYPE TABLE OF swncaggspoolact WITH HEADER LINE,
tablerec TYPE TABLE OF swncaggtablerec WITH HEADER LINE,
usertcode TYPE TABLE OF swncaggusertcode WITH HEADER LINE,
userworkload TYPE TABLE OF swncagguserworkload WITH HEADER LINE,
rfcclnt TYPE TABLE OF swncaggrfcclnt WITH HEADER LINE,
rfcclntdest TYPE TABLE OF swncaggrfcclntdest WITH HEADER LINE,
rfcsrvr TYPE TABLE OF swncaggrfcsrvr WITH HEADER LINE,
rfcsrvrdest TYPE TABLE OF swncaggrfcsrvrdest WITH HEADER LINE,
spool TYPE TABLE OF swncaggspool WITH HEADER LINE,
hitlist_database TYPE TABLE OF swnchitlist WITH HEADER LINE,
hitlist_resptime TYPE TABLE OF swnchitlist WITH HEADER LINE,
astat TYPE TABLE OF swncaggappstat WITH HEADER LINE,
ashitl_database TYPE TABLE OF swnchitlistappl WITH HEADER LINE,
ashitl_resptime TYPE TABLE OF swnchitlistappl WITH HEADER LINE,
comp_hierarchy TYPE TABLE OF swncaggcomphier WITH HEADER LINE,
org_units TYPE TABLE OF swncaggorgunit WITH HEADER LINE,
dbcon TYPE TABLE OF swncaggdbc WITH HEADER LINE,
vmc TYPE TABLE OF swncaggvmc WITH HEADER LINE,
websd TYPE TABLE OF swncaggwebdest WITH HEADER LINE,
webcd TYPE TABLE OF swncaggwebdest WITH HEADER LINE,
webs TYPE TABLE OF swncaggwebclnt WITH HEADER LINE,
webc TYPE TABLE OF swncaggwebclnt WITH HEADER LINE.
SELECT-OPTIONS: s_user FOR usr01-bname.
PARAMETERS: p_date TYPE swncdatum OBLIGATORY.
START-OF-SELECTION.
SELECT bname
FROM usr01
INTO TABLE it_usr01
WHERE bname IN s_user.
IF sy-subrc = 0.
SELECT agr_name
uname
FROM agr_users
INTO TABLE it_roles
FOR ALL ENTRIES IN it_usr01
WHERE uname = it_usr01-bname.
IF sy-subrc = 0.
SELECT agr_name
tcode
FROM agr_tcodes
INTO TABLE it_tcodes
FOR ALL ENTRIES IN it_roles
WHERE agr_name = it_roles-agr_name.
ENDIF.
ENDIF.
END-OF-SELECTION.
DATA: v_date TYPE swncdatum.
v_date+4(4) = p_date+0(4).
v_date+2(2) = p_date+4(2).
v_date+0(2) = p_date+6(2).
CALL FUNCTION 'SWNC_COLLECTOR_GET_AGGREGATES'
EXPORTING
component = 'hoerp02dev_NED_02'
* ASSIGNDSYS = SY-SYSID
periodtype = 'M'
periodstrt = p_date
* SUMMARY_ONLY = ' '
factor = 1000
TABLES
tasktype = tasktype
tasktimes = tasktimes
times = times
dbprocs = dbprocs
extsystem = extsystem
tcdet = tcdet
frontend = frontend
memory = memory
spoolact = spoolact
tablerec = tablerec
usertcode = usertcode
userworkload = userworkload
rfcclnt = rfcclnt
rfcclntdest = rfcclntdest
rfcsrvr = rfcsrvr
rfcsrvrdest = rfcsrvrdest
spool = spool
hitlist_database = hitlist_database
hitlist_resptime = hitlist_resptime
astat = astat
ashitl_database = ashitl_database
ashitl_resptime = ashitl_resptime
comp_hierarchy = comp_hierarchy
org_units = org_units
dbcon = dbcon
vmc = vmc
websd = websd
webcd = webcd
webs = webs
webc = webc
EXCEPTIONS
no_data_found = 1
OTHERS = 2.
DELETE usertcode[] WHERE entry_id = 'Logoff'.
DELETE usertcode[] WHERE entry_id = 'MainMenu'.
LOOP AT it_usr01.
WRITE:/ 'User Name: ', it_usr01-bname.
WRITE:/ 'Role Name:' .
LOOP AT it_roles WHERE uname = it_usr01-bname
AND agr_name+(1) = 'Z'.
WRITE:/ it_roles-agr_name.
ENDLOOP .
WRITE:/ 'Used Transactions for the entered date' , p_date ,'is:'.
LOOP AT usertcode WHERE account = it_usr01-bname.
v_count = v_count + 1.
WRITE:/ v_count,
usertcode-entry_id.
ENDLOOP.
CLEAR : v_count.
ENDLOOP.
No comments:
Post a Comment