Posted: Mon Sep 08, 2008 3:51 pm Post subject: Shows ABNORMAL Activity in a System Instance
Code:
* Source Name is ZSHOWACT
* Source Name is ZSHOWACT
REPORT ZSHOWACT LINE-SIZE 255
message-id xx
* line-count 65
NO STANDARD PAGE HEADING.
********************************************************************
* Purpose - to look at Program Dumps *
********************************************************************
TABLES: SNAP, VBHDR,TBTCO, USR02, T000, APQI, ARFCSSTATE,
usr21, adrp.
SELECT-OPTIONS: UNAME FOR USR02-BNAME.
*SELTEXT*E* "User(s) to be Selected
SELECT-OPTIONS: MANDT FOR T000-MANDT.
*SELTEXT*E* "Client(s) to be Searched
SELECT-OPTIONS: DATUM FOR SNAP-DATUM DEFAULT SY-DATUM.
*SELTEXT*E* "Client(s) to be Searched
PARAMETERS: TEXT(40).
*SELTEXT*E* "Scan on Literal for Searching
DATA: BEGIN OF TAB OCCURS 500.
INCLUDE STRUCTURE SNAP.
DATA: END OF TAB.
DATA: BEGIN OF TAB1 OCCURS 500.
INCLUDE STRUCTURE VBHDR.
DATA: END OF TAB1.
DATA: BEGIN OF TAB3 OCCURS 500.
INCLUDE STRUCTURE SEQG3.
DATA: END OF TAB3.
DATA: BEGIN OF TAB4 OCCURS 50.
INCLUDE STRUCTURE TBTCO.
DATA: MANDT LIKE T000-MANDT,
END OF TAB4.
DATA: BEGIN OF TAB5 OCCURS 50.
INCLUDE STRUCTURE TBTC5.
DATA: END OF TAB5.
DATA: FOUND-IN-TAB5.
DATA: BEGIN OF TAB6 OCCURS 50.
INCLUDE STRUCTURE UINFO.
DATA: END OF TAB6.
DATA: BEGIN OF TAB7 OCCURS 50.
INCLUDE STRUCTURE APQI.
DATA: END OF TAB7.
DATA: BEGIN OF TAB8 OCCURS 50.
INCLUDE STRUCTURE WPINFOS.
DATA: END OF TAB8.
DATA: BEGIN OF TAB9 OCCURS 50.
INCLUDE STRUCTURE ARFCSSTATE.
DATA: MANDT LIKE SY-MANDT.
DATA: END OF TAB9.
DATA: BEGIN OF %_RESERV,
CPROG LIKE SY-CPROG, "8
RETURN_FB LIKE TFDIR-PNAME, "30
MANDT LIKE SY-MANDT. "3
...... " hier kцnnnen bis Lдnge 255 insges.
DATA: END OF %_RESERV. " weitere Eintrдge abgesp. werden
DATA: LIT-BDC(30).
DATA: APSERVER LIKE MSXXLIST-NAME.
DATA: REC-COUNT TYPE P.
DATA: REP-TYPE VALUE '1'.
DATA: T-DATUM LIKE SY-DATUM.
DATA: T-UZEIT LIKE SY-UZEIT.
DATA: T-TEXT(128).
DATA: GCLIENT LIKE SY-MANDT.
DATA: GUNAME LIKE SY-UNAME.
DATA: GNAME LIKE SEQG3-GNAME.
DATA: GARG LIKE SEQG3-GARG.
DATA: LOCAL LIKE SY-SUBTY.
data: services like MSXXLIST-MSGTYPES.
data: begin of list occurs 500.
include structure MSXXLIST.
data: end of list.
data: begin of tab6a occurs 50.
include structure tab6.
data: server like list-name,
end of tab6a.
********** Begin of Program DUMPS*************
SELECT * FROM SNAP WHERE DATUM IN DATUM
AND UNAME IN UNAME
AND MANDT IN MANDT
AND SEQNO EQ '000'.
IF TEXT IS INITIAL
OR SNAP CS TEXT.
MOVE-CORRESPONDING SNAP TO TAB.
APPEND TAB.
ENDIF.
ENDSELECT.
COMMIT WORK.
SORT TAB BY DATUM UZEIT UNAME MANDT.
COMMIT WORK.
LOOP AT TAB.
ADD 1 TO REC-COUNT.
WRITE: / TAB-MANDT,
TAB-DATUM, TAB-UZEIT,
TAB-UNAME,
TAB-FLIST+5(80).
ENDLOOP.
WRITE: / REC-COUNT, '= Count of Dumps'.
WRITE: / 'For Details - use Transaction ST22'.
COMMIT WORK.
********** End of Program DUMPS*************
********** Begin of ABORTING Jobs*************
MOVE '4' TO REP-TYPE.
CLEAR REC-COUNT.
NEW-PAGE.
REFRESH TAB4.
SELECT * FROM TBTCO WHERE STATUS EQ 'A'
AND ENDDATE IN DATUM.
CLEAR TAB4.
MOVE-CORRESPONDING TBTCO TO TAB4.
MOVE TAB4-AUTHCKMAN TO TAB4-MANDT.
IF TAB4-MANDT IN MANDT
AND TAB4-LASTCHNAME IN UNAME.
IF TEXT IS INITIAL
OR TAB4 CS TEXT.
APPEND TAB4.
ENDIF.
ENDIF.
ENDSELECT.
COMMIT WORK.
SORT TAB4 BY ENDDATE ENDTIME MANDT.
COMMIT WORK.
LOOP AT TAB4.
CLEAR FOUND-IN-TAB5.
REFRESH TAB5.
CALL FUNCTION 'BP_JOBLOG_READ'
EXPORTING
CLIENT = TAB4-MANDT
JOBCOUNT = TAB4-JOBCOUNT
* JOBLOG = ' '
JOBNAME = TAB4-JOBNAME
TABLES
JOBLOGTBL = TAB5
EXCEPTIONS
CANT_READ_JOBLOG = 1
JOBCOUNT_MISSING = 2
JOBLOG_DOES_NOT_EXIST = 3
JOBLOG_IS_EMPTY = 4
JOBLOG_NAME_MISSING = 5
JOBNAME_MISSING = 6
JOB_DOES_NOT_EXIST = 7
OTHERS = 8.
IF SY-SUBRC EQ 0.
IF NOT TEXT IS INITIAL.
LOOP AT TAB5.
IF TAB5 CS TEXT.
MOVE 'Y' TO FOUND-IN-TAB5.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
IF TEXT IS INITIAL
OR TAB4 CS TEXT
OR FOUND-IN-TAB5 EQ 'Y'.
ADD 1 TO REC-COUNT.
WRITE: / TAB4-MANDT,
05 TAB4-ENDDATE,
16 TAB4-ENDTIME,
25 TAB4-LASTCHNAME,
38 TAB4-JOBNAME.
LOOP AT TAB5.
WRITE: /38 TAB5-TEXT(128).
ENDLOOP.
ENDIF.
ENDIF.
ENDLOOP.
WRITE: / REC-COUNT, '= Count of ABORTED Jobs'.
WRITE: / 'For Details - use Transaction SM37 (Job Status=TERMINATED)'.
COMMIT WORK.
********** End of ABORTING Jobs*************
********** Begin of Hung Programs*************
MOVE '2' TO REP-TYPE.
CLEAR REC-COUNT.
NEW-PAGE.
SELECT * FROM VBHDR
WHERE VBMANDT IN MANDT.
IF VBHDR-VBDATE(8) IN DATUM
AND VBHDR-VBUSR IN UNAME.
IF TEXT IS INITIAL
OR VBHDR CS TEXT.
MOVE-CORRESPONDING VBHDR TO TAB1.
APPEND TAB1.
ENDIF.
ENDIF.
ENDSELECT.
COMMIT WORK.
SORT TAB1 BY VBDATE VBUSR VBMANDT.
COMMIT WORK.
LOOP AT TAB1.
ADD 1 TO REC-COUNT.
MOVE TAB1-VBDATE(8) TO T-DATUM.
MOVE TAB1-VBDATE+8(6) TO T-UZEIT.
CLEAR T-TEXT.
MOVE TAB1-VBTCODE TO T-TEXT.
MOVE TAB1-VBREPORT TO T-TEXT+32.
CONDENSE T-TEXT.
WRITE: / TAB1-VBMANDT,
T-DATUM, T-UZEIT,
TAB1-VBUSR,
T-TEXT.
ENDLOOP.
WRITE: / REC-COUNT, '= Count of HUNG Transactions'.
WRITE: / 'For Details - use Transaction SM13'.
COMMIT WORK.
********** End of Hung Programs*************
********** Begin of BATCH INPUT Records*******
MOVE '6' TO REP-TYPE.
CLEAR REC-COUNT.
NEW-PAGE.
SELECT * FROM APQI
WHERE MANDANT IN MANDT
AND DATATYP EQ 'BDC'
* and qerase eq ' '
AND ( QSTATE EQ ' '
OR QSTATE EQ 'E'
OR QSTATE EQ 'R'
OR QSTATE EQ 'C' ).
IF APQI-CREDATE IN DATUM
AND APQI-USERID IN UNAME.
IF TEXT IS INITIAL
OR APQI CS TEXT.
MOVE-CORRESPONDING APQI TO TAB7.
APPEND TAB7.
ENDIF.
ENDIF.
ENDSELECT.
COMMIT WORK.
SORT TAB7 BY CREDATE CRETIME USERID MANDANT.
COMMIT WORK.
LOOP AT TAB7.
ADD 1 TO REC-COUNT.
CLEAR LIT-BDC.
IF TAB7-QSTATE EQ ' '.
MOVE 'Still to be Processed' TO LIT-BDC.
ENDIF.
IF TAB7-QSTATE EQ 'C'.
MOVE 'Session being Created' TO LIT-BDC.
ENDIF.
IF TAB7-QSTATE EQ 'E'.
MOVE 'Errors in Session' TO LIT-BDC.
ENDIF.
IF TAB7-QSTATE EQ 'R'.
MOVE 'Being Processed' TO LIT-BDC.
ENDIF.
WRITE: / TAB7-MANDANT,
TAB7-CREDATE, TAB7-CRETIME,
TAB7-USERID,
TAB7-GROUPID,
LIT-BDC.
ENDLOOP.
WRITE: / REC-COUNT, '= Count of BATCH INPUT SESSIONS'.
WRITE: / 'For Details - use Transaction SM35(Overview)'.
COMMIT WORK.
********** End of BATCH INPUT Records*******
********** Begin of RFC PROCESSING*******
MOVE '8' TO REP-TYPE.
CLEAR REC-COUNT.
NEW-PAGE.
SELECT * FROM ARFCSSTATE
WHERE ARFCDATUM IN DATUM
AND ARFCUSER IN UNAME.
%_RESERV = ARFCSSTATE-ARFCRESERV.
MOVE %_RESERV-MANDT TO TAB9-MANDT.
IF TAB9-MANDT IN MANDT.
IF TEXT IS INITIAL
OR ARFCSSTATE CS TEXT.
MOVE-CORRESPONDING ARFCSSTATE TO TAB9.
MOVE %_RESERV-MANDT TO TAB9-MANDT.
APPEND TAB9.
ENDIF.
ENDIF.
ENDSELECT.
COMMIT WORK.
SORT TAB9 BY ARFCDATUM ARFCUZEIT MANDT.
COMMIT WORK.
LOOP AT TAB9.
ADD 1 TO REC-COUNT.
WRITE: / TAB9-MANDT,
TAB9-ARFCDATUM, TAB9-ARFCUZEIT,
TAB9-ARFCUSER,
TAB9-ARFCSTATE,
TAB9-ARFCDEST,
TAB9-ARFCFNAM,
TAB9-ARFCRHOST,
TAB9-ARFCMSG.
ENDLOOP.
WRITE: / REC-COUNT, '= Count of RFC PROCESSING'.
WRITE: / 'For Details - use Transaction SM58'.
COMMIT WORK.
********** End of RFC PROCESSING************
********** Begin of Locked Records************
MOVE '3' TO REP-TYPE.
CLEAR REC-COUNT.
NEW-PAGE.
COMMIT WORK.
CALL FUNCTION 'ENQUEUE_READ'
EXPORTING
GCLIENT = GCLIENT
GNAME = GNAME
GARG = GARG
GUNAME = GUNAME
LOCAL = LOCAL
TABLES
ENQ = TAB3
EXCEPTIONS
COMMUNICATION_FAILURE = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
SORT TAB3 BY GTDATE GTTIME GUNAME GCLIENT.
COMMIT WORK.
LOOP AT TAB3.
CHECK TAB3-GCLIENT IN MANDT.
CHECK TAB3-GUNAME IN UNAME.
CHECK TEXT IS INITIAL OR TAB3 CS TEXT.
ADD 1 TO REC-COUNT.
CLEAR T-TEXT.
MOVE TAB3-GTCODE TO T-TEXT.
MOVE TAB3-GNAME TO T-TEXT+32.
MOVE TAB3-GARG TO T-TEXT+64.
CONDENSE T-TEXT.
clear usr21.
clear adrp.
select single * from usr21 client specified
where mandt eq tab3-gclient
and bname eq tab3-guname.
select * from adrp client specified
where client eq tab3-gclient
and persnumber eq usr21-persnumber.
exit.
endselect.
WRITE: / TAB3-GCLIENT,
TAB3-GTDATE, TAB3-GTTIME,
TAB3-GUNAME,
adrp-name_text(30),
T-TEXT.
ENDLOOP.
WRITE: / REC-COUNT, '= Count of LOCKED Records'.
WRITE: / 'For Details - use Transaction SM12'.
COMMIT WORK.
********** End of Locked Records************
********** Begin of ACTIVE Users**************
clear services.
refresh list.
call function 'TH_SERVER_LIST'
* EXPORTING
* services = services
TABLES
list = list.
refresh tab6a.
loop at list.
MOVE '5' TO REP-TYPE.
CLEAR REC-COUNT.
NEW-PAGE.
COMMIT WORK.
refresh tab6.
move list-name to apserver.
CALL FUNCTION 'TH_REMOTE_USER_LIST'
EXPORTING
SRVNAME = APSERVER
TABLES
LIST = TAB6
EXCEPTIONS
OTHERS = 1.
loop at tab6.
move-corresponding tab6 to tab6a.
move list-name to tab6a-server.
append tab6a.
endloop.
endloop.
SORT TAB6a BY BNAME MANDT.
COMMIT WORK.
LOOP AT TAB6a.
CHECK TAB6a-MANDT IN MANDT.
CHECK TAB6a-BNAME IN UNAME.
CHECK TEXT IS INITIAL OR TAB6a CS TEXT.
ADD 1 TO REC-COUNT.
clear usr21.
clear adrp.
select single * from usr21 client specified
where mandt eq tab6a-mandt
and bname eq tab6a-bname.
select * from adrp client specified
where client eq tab6a-mandt
and persnumber eq usr21-persnumber.
exit.
endselect.
WRITE: / TAB6a-MANDT,
SY-DATUM, SY-UZEIT,
TAB6a-BNAME,
TAB6a-TCODE, TAB6a-ZEIT, TAB6a-TERM,
tab6a-server,
adrp-name_text.
ENDLOOP.
WRITE: / REC-COUNT, '= Count of ACTIVE USERS'.
WRITE: / 'For Details - use Transaction SM04'.
COMMIT WORK.
********** End of ACTIVE Users**************
********** Begin of WORK PROCESSES************
MOVE '7' TO REP-TYPE.
CLEAR REC-COUNT.
NEW-PAGE.
COMMIT WORK.
CALL FUNCTION 'TH_SYSTEMWIDE_WPINFO'
TABLES
WPLIST = TAB8
EXCEPTIONS
OTHERS = 1.
COMMIT WORK.
LOOP AT TAB8.
IF TEXT IS INITIAL
OR TAB8 CS TEXT.
ADD 1 TO REC-COUNT.
WRITE: / TAB8(130).
ENDIF.
ENDLOOP.
WRITE: / REC-COUNT, '= Count of WORK PROCESSES'.
WRITE: / 'For Details - use Transaction SM50'.
COMMIT WORK.
********** End of WORK PROCESSES************
INCLUDE ZCONINC3.
FORMAT INTENSIFIED OFF.
IF REP-TYPE EQ '1'.
WRITE: / 'Program DUMPS'.
ENDIF.
IF REP-TYPE EQ '2'.
WRITE: / 'Data HUNG IN UPDATE TASKS'.
ENDIF.
IF REP-TYPE EQ '3'.
WRITE: / 'Records LOCKED'.
ENDIF.
IF REP-TYPE EQ '4'.
WRITE: / 'Jobs ABORTING'.
ENDIF.
IF REP-TYPE EQ '5'.
WRITE: / 'ACTIVE USERS'.
ENDIF.
IF REP-TYPE EQ '6'.
WRITE: / 'BATCH INPUT SESSIONS'.
ENDIF.
IF REP-TYPE EQ '7'.
WRITE: / 'WORK PROCESSES'.
ENDIF.
IF REP-TYPE EQ '8'.
WRITE: / 'RFC PROCESSING'.
ENDIF.
IF REP-TYPE NE '7'.
WRITE: / 'Clt',
05 'Date',
16 'Time',
25 'User',
38 'Additional Info'.
ENDIF.
FORMAT INTENSIFIED ON.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.