Posted: Wed Aug 20, 2008 10:07 am Post subject: Show History of Import Release Times
Code:
* Source Name is ZIMPORTT
REPORT ZIMPORTT
LINE-COUNT 65
LINE-SIZE 255 NO STANDARD PAGE HEADING.
********************************************************************
* Purpose - show History of Import Release Times *
********************************************************************
TABLES: E070,E07T,DD07T, USR21, TSYST.
DATA: BEGIN OF TT_COFI_LINES OCCURS 500.
INCLUDE STRUCTURE TSTRFCOFIL.
DATA: END OF TT_COFI_LINES.
DATA: TT_COFI_LINES-COUNT(8) TYPE P.
DATA: TT_COFI_LIT(10).
DATA: TT_COFI_LIT2 LIKE DD07T-DDTEXT.
DATA: BEGIN OF TAB OCCURS 500,
TRKORR LIKE E070-TRKORR,
STRKORR LIKE E070-STRKORR,
AS4USER LIKE E070-AS4USER,
END OF TAB.
DATA: BEGIN OF TAB2 OCCURS 500,
TRKORR LIKE E070-TRKORR,
TARSYSTEM LIKE TT_COFI_LINES-TARSYSTEM,
STRKORR LIKE E070-STRKORR,
AS4USER LIKE E070-AS4USER,
RETCODE LIKE TT_COFI_LINES-RETCODE,
TRTIME LIKE TT_COFI_LINES-TRTIME,
TRDATE LIKE TT_COFI_LINES-TRDATE,
STATUS LIKE TT_COFI_LIT,
LIT2 LIKE TT_COFI_LIT2,
TARSORTIND,
END OF TAB2.
DATA: BEGIN OF PREV,
AS4USER LIKE E070-AS4USER,
STRKORR LIKE E070-TRKORR,
TARSYSTEM LIKE TT_COFI_LINES-TARSYSTEM,
END OF PREV.
DATA: BEGIN OF TAB-DD07T OCCURS 100,
DOMVALUE_L LIKE DD07T-DOMVALUE_L,
DDTEXT LIKE DD07T-DDTEXT,
END OF TAB-DD07T.
DATA: TEMP-LINE(150).
DATA: TASK-DATE LIKE E070-AS4DATE.
DATA: TASK-TIME LIKE E070-AS4TIME.
DATA: REQ-DATE LIKE E070-AS4DATE.
DATA: REQ-TIME LIKE E070-AS4TIME.
SELECT-OPTIONS:
USER FOR USR21-BNAME DEFAULT SY-UNAME,
* Selection Text "User(s) Releasing a Task
TARSYS FOR TSYST-SYSNAME DEFAULT 'RQ1'.
* Selection Text "Target System(s)
PARAMETERS:
FROMDATE LIKE SY-DATUM DEFAULT '20000101' OBLIGATORY,
* Selection Text "From Date
TODATE LIKE SY-DATUM DEFAULT SY-DATUM OBLIGATORY.
* Selection Text "To Date
SET BLANK LINES ON.
SELECT * FROM DD07T WHERE DDLANGUAGE EQ SY-LANGU
AND DOMNAME EQ 'TRBATFUNC'.
MOVE-CORRESPONDING DD07T TO TAB-DD07T.
APPEND TAB-DD07T.
ENDSELECT.
CLEAR TAB-DD07T.
MOVE 'I' TO TAB-DD07T-DOMVALUE_L.
MOVE 'Import' TO TAB-DD07T-DDTEXT.
APPEND TAB-DD07T.
CLEAR TAB-DD07T.
MOVE 'P' TO TAB-DD07T-DOMVALUE_L.
MOVE 'Problem' TO TAB-DD07T-DDTEXT.
APPEND TAB-DD07T.
SORT TAB-DD07T BY DOMVALUE_L.
SELECT * FROM E070 WHERE AS4USER IN USER
* Find Released Tasks for an Owner
AND TRSTATUS EQ 'R'
AND STRKORR GT ' '.
CLEAR TAB.
MOVE E070-TRKORR TO TAB-TRKORR.
MOVE E070-STRKORR TO TAB-STRKORR.
MOVE E070-AS4USER TO TAB-AS4USER.
APPEND TAB.
ENDSELECT.
COMMIT WORK.
LOOP AT TAB.
REFRESH TT_COFI_LINES.
CALL FUNCTION 'STRF_READ_COFILE'
EXPORTING
IV_DIRTYPE = 'T'
IV_TRKORR = TAB-STRKORR
* IMPORTING
* EV_COFI_HEADER =
TABLES
TT_COFI_LINES = TT_COFI_LINES
EXCEPTIONS
WRONG_CALL = 1
NO_INFO_FOUND = 2
OTHERS = 3.
DESCRIBE TABLE TT_COFI_LINES LINES TT_COFI_LINES-COUNT.
IF TT_COFI_LINES-COUNT > 0.
SORT TT_COFI_LINES BY TRDATE TRTIME descending.
LOOP AT TT_COFI_LINES WHERE TARSYSTEM IN TARSYS
AND FUNCTION NE 'P'.
CLEAR TAB2.
IF TT_COFI_LINES-RETCODE EQ 0.
MOVE 'Successful' TO TT_COFI_LIT.
ELSE.
MOVE 'FAILED' TO TT_COFI_LIT.
ENDIF.
MOVE TAB-STRKORR TO TAB2-STRKORR.
MOVE TAB-AS4USER TO TAB2-AS4USER.
MOVE TT_COFI_LINES-TARSYSTEM TO TAB2-TARSYSTEM.
MOVE TT_COFI_LINES-TRDATE TO TAB2-TRDATE.
MOVE TT_COFI_LINES-TRTIME TO TAB2-TRTIME.
MOVE TT_COFI_LINES-RETCODE TO TAB2-RETCODE.
MOVE TT_COFI_LIT TO TAB2-STATUS.
CLEAR TT_COFI_LIT2.
IF TT_COFI_LINES-RETCODE NE 0.
READ TABLE TAB-DD07T WITH KEY DOMVALUE_L =
TT_COFI_LINES-FUNCTION
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE TAB-DD07T-DDTEXT TO TT_COFI_LIT2.
ENDIF.
ENDIF.
MOVE TT_COFI_LIT2 TO TAB2-LIT2.
MOVE TAB-TRKORR TO TAB2-TRKORR.
IF TAB2-TARSYSTEM(1) EQ 'D'.
MOVE '1' TO TAB2-TARSORTIND.
ENDIF.
IF TAB2-TARSYSTEM(2) EQ 'TS'.
MOVE '2' TO TAB2-TARSORTIND.
ENDIF.
IF TAB2-TARSYSTEM(2) EQ 'SU'.
MOVE '3' TO TAB2-TARSORTIND.
ENDIF.
IF TAB2-TARSYSTEM(2) EQ 'TR'.
MOVE '4' TO TAB2-TARSORTIND.
ENDIF.
IF TAB2-TARSYSTEM(1) EQ 'P'.
MOVE '5' TO TAB2-TARSORTIND.
ENDIF.
APPEND TAB2.
ENDLOOP.
ENDIF.
ENDLOOP.
SORT TAB2 BY AS4USER STRKORR TRKORR TARSORTIND TRDATE
RETCODE DESCENDING
TRTIME.
LOOP AT TAB2 WHERE TRDATE GE FROMDATE
AND TRDATE LE TODATE.
IF PREV-AS4USER EQ TAB2-AS4USER
AND PREV-STRKORR EQ TAB2-STRKORR
AND PREV-TARSYSTEM EQ TAB2-TARSYSTEM.
CONTINUE.
ENDIF.
IF TAB2-STRKORR NE PREV-STRKORR.
WRITE : / ' '.
ENDIF.
MOVE-CORRESPONDING TAB2 TO PREV.
CLEAR E07T.
SELECT SINGLE * FROM E07T WHERE TRKORR EQ TAB2-STRKORR
AND LANGU EQ SY-LANGU.
CLEAR TEMP-LINE.
MOVE TAB2-LIT2 TO TEMP-LINE.
MOVE '*' TO TEMP-LINE+60.
MOVE E07T-AS4TEXT TO TEMP-LINE+61.
CONDENSE TEMP-LINE.
CLEAR: TASK-DATE, TASK-TIME, REQ-DATE, REQ-TIME.
SELECT SINGLE * FROM E070 WHERE TRKORR EQ TAB2-TRKORR.
IF SY-SUBRC EQ 0.
MOVE E070-AS4DATE TO TASK-DATE.
MOVE E070-AS4TIME TO TASK-TIME.
ENDIF.
SELECT SINGLE * FROM E070 WHERE TRKORR EQ TAB2-STRKORR.
IF SY-SUBRC EQ 0.
MOVE E070-AS4DATE TO REQ-DATE.
MOVE E070-AS4TIME TO REQ-TIME.
ENDIF.
WRITE: /02
'Task Owner', TAB2-AS4USER(6),
TAB2-STRKORR,
* tab2-trkorr,
'ImportTo', TAB2-TARSYSTEM(3),
'on', TAB2-TRDATE,
'at', TAB2-TRTIME,
'SubTaskReleased', TASK-DATE, TASK-TIME,
'MainTaskReleased', REQ-DATE, REQ-TIME,
TAB2-STATUS,
TEMP-LINE(64).
ENDLOOP.
INCLUDE ZCONINC3.
FORMAT INTENSIFIED OFF.
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.