Posted: Wed Aug 20, 2008 10:06 am Post subject: Show History of Imports
Code:
* Source Name is ZIMPORTS
REPORT ZIMPORTS
LINE-COUNT 65
LINE-SIZE 255 NO STANDARD PAGE HEADING.
********************************************************************
* Purpose - what has been imported into another System *
********************************************************************
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,
STRKORR LIKE E070-STRKORR,
AS4USER LIKE E070-AS4USER,
END OF TAB.
DATA: BEGIN OF TAB2 OCCURS 500,
STRKORR LIKE E070-STRKORR,
AS4USER LIKE E070-AS4USER,
TARSYSTEM LIKE TT_COFI_LINES-TARSYSTEM,
TRTIME LIKE TT_COFI_LINES-TRTIME,
TRDATE LIKE TT_COFI_LINES-TRDATE,
STATUS LIKE TT_COFI_LIT,
LIT2 LIKE TT_COFI_LIT2,
END OF TAB2.
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).
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
PARAMETERS:
SORT1 RADIOBUTTON GROUP TMOD DEFAULT 'X',
* Selection Text "Sort by Person/System/Date
SORT2 RADIOBUTTON GROUP TMOD.
* Selection Text "Sort by Person/Request/Date
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-STRKORR TO TAB-STRKORR.
MOVE E070-AS4USER TO TAB-AS4USER.
COLLECT 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.
LOOP AT TT_COFI_LINES WHERE TARSYSTEM IN TARSYS.
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_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.
APPEND TAB2.
ENDLOOP.
ENDIF.
ENDLOOP.
IF NOT SORT1 IS INITIAL.
SORT TAB2 BY AS4USER TARSYSTEM TRDATE TRTIME.
ENDIF.
IF NOT SORT2 IS INITIAL.
SORT TAB2 BY AS4USER STRKORR TRDATE TRTIME.
ENDIF.
LOOP AT TAB2 WHERE TRDATE GE FROMDATE
AND TRDATE LE TODATE.
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.
WRITE: /02
'Task Owner', TAB2-AS4USER,
'Import to', TAB2-TARSYSTEM,
'on', TAB2-TRDATE,
'at', TAB2-TRTIME,
TAB2-STATUS,
TAB2-STRKORR,
TEMP-LINE(75).
ENDLOOP.
INCLUDE ZCONINC3.
FORMAT INTENSIFIED OFF.
IF NOT SORT1 IS INITIAL.
WRITE: / 'Sort by User TargetSystem Time'.
ENDIF.
IF NOT SORT2 IS INITIAL.
WRITE: / 'Sort by User Task Time'.
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.