REPORT ZTRANSPORT_LIST LINE-SIZE 255 MESSAGE-ID ZZ.
**********************************************************************
* TABLES
**********************************************************************
TABLES: E071K,
E071,
E070,
SKA1.
**********************************************************************
* INTERNAL TABLES
**********************************************************************
DATA: BEGIN OF IT_SAKNR OCCURS 0,
SAKNR LIKE SKA1-SAKNR,
END OF IT_SAKNR.
**********************************************************************
* DATA DEFINITION
**********************************************************************
DATA: V_E071K LIKE E071K-AS4POS,
V_E071 LIKE E071-AS4POS,
V_TABKEY1 LIKE E071K-TABKEY,
V_TABKEY2 LIKE E071K-TABKEY.
**********************************************************************
* SELECTION SCREEN
**********************************************************************
PARAMETER: P_TRKORR LIKE E071K-TRKORR.
SELECT-OPTIONS: P_SAKNR FOR SKA1-SAKNR.
PARAMETER: P_TEST AS CHECKBOX DEFAULT 'X'.
**********************************************************************
* AT SELECTION SCREEN
**********************************************************************
AT SELECTION-SCREEN.
* check if transport request exists
IF P_TRKORR IS INITIAL.
MESSAGE I006(ZZ) WITH 'Enter an Existing Transport Request'.
ELSE.
SELECT SINGLE * FROM E070 WHERE TRKORR EQ P_TRKORR.
IF SY-SUBRC EQ 0.
* to check if the transport is already released
IF E070-TRSTATUS EQ 'R'.
MESSAGE I006 WITH 'Transport Request' P_TRKORR 'already'
'released.'.
ENDIF.
SELECT * FROM E071 WHERE TRKORR EQ P_TRKORR.
ENDSELECT.
IF SY-SUBRC EQ 0.
MESSAGE I006 WITH 'Transport rquest' P_TRKORR 'is not' 'empty.'.
ENDIF.
ELSE.
MESSAGE I006 WITH 'transport' 'request' P_TRKORR 'does not exist.'.
ENDIF.
ENDIF.
* Validate GL Account
IF P_SAKNR IS INITIAL.
MESSAGE I006 WITH 'Please enter GL Account'.
ELSE.
SELECT * FROM SKA1 WHERE SAKNR IN P_SAKNR.
MOVE SKA1-SAKNR TO IT_SAKNR-SAKNR.
APPEND IT_SAKNR.
CLEAR IT_SAKNR.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE I006 WITH 'Account number does not exist'.
ENDIF.
ENDIF.
**********************************************************************
* START OF SELECTION
**********************************************************************
START-OF-SELECTION.
SORT IT_SAKNR BY SAKNR.
IF NOT P_TEST IS INITIAL.
WRITE: / 'Test Run',/,/.
ELSE.
WRITE: / 'Real Run',/,/.
ENDIF.
WRITE: / 'G/L account from ',P_SAKNR-LOW,' to ',P_SAKNR-HIGH,/.
CLEAR V_E071.
* Insert the values in table E071
WRITE: /,/ 'Entries in table E071:',/.
V_E071 = V_E071 + 1.
* for table SKA1
* transport task no.
E071-TRKORR = P_TRKORR.
E071-AS4POS = V_E071.
E071-PGMID = 'R3TR'.
E071-OBJECT = 'TABU'.
E071-OBJ_NAME = 'SKA1'.
* object function
E071-OBJFUNC = 'K'.
* Insert the data into table E071
IF P_TEST IS INITIAL.
INSERT INTO E071 VALUES E071.
ENDIF.
WRITE: / 'E071: ', E071-TRKORR, E071-PGMID, E071-OBJECT,
E071-OBJ_NAME(40), E071-OBJFUNC.
V_E071 = V_E071 + 1.
* for table SKAT
* transport task no.
E071-TRKORR = P_TRKORR.
E071-AS4POS = V_E071.
E071-PGMID = 'R3TR'.
E071-OBJECT = 'TABU'.
E071-OBJ_NAME = 'SKAT'.
E071-OBJFUNC = 'K'.
* Insert the data into table E071
IF P_TEST IS INITIAL.
INSERT INTO E071 VALUES E071.
ENDIF.
WRITE: / 'E071: ',E071-TRKORR, E071-PGMID, E071-OBJECT,
E071-OBJ_NAME(40), E071-OBJFUNC.
WRITE: /,/ 'Entries in table E071K:',/.
CLEAR V_E071K.
* Entries in SKA1,SKAT,
CLEAR IT_SAKNR.
LOOP AT IT_SAKNR.
V_E071K = V_E071K + 1.
* Creation of the table entries for SKA1.
MOVE '100ERC ' TO V_TABKEY1.
MOVE IT_SAKNR-SAKNR TO V_TABKEY1+7.
* Entry SKA1
E071K-TRKORR = P_TRKORR.
E071K-PGMID = 'R3TR'.
E071K-OBJECT = 'TABU'.
E071K-OBJNAME = 'SKA1'.
E071K-AS4POS = V_E071K.
E071K-MASTERTYPE = 'TABU'.
E071K-MASTERNAME = 'SKA1'.
E071K-TABKEY = V_TABKEY1.
IF P_TEST IS INITIAL.
INSERT INTO E071K VALUES E071K.
ENDIF.
*
WRITE: / 'E071K:', E071K-TRKORR, E071K-PGMID, E071K-OBJECT,
E071K-OBJNAME, E071K-TABKEY(40).
* Creation of table entries for SKAT
MOVE '100EERC ' TO V_TABKEY2.
MOVE IT_SAKNR-SAKNR TO V_TABKEY2+8.
* Entry SKAT
E071K-TRKORR = P_TRKORR.
E071K-PGMID = 'R3TR'.
E071K-OBJECT = 'TABU'.
E071K-OBJNAME = 'SKAT'.
E071K-AS4POS = V_E071K.
E071K-MASTERTYPE = 'TABU'.
E071K-MASTERNAME = 'SKAT'.
E071K-TABKEY = V_TABKEY2.
IF P_TEST IS INITIAL.
INSERT INTO E071K VALUES E071K.
ENDIF.
WRITE: / 'E071K:', E071K-TRKORR, E071K-PGMID, E071K-OBJECT,
E071K-OBJNAME, E071K-TABKEY(40).
CLEAR: V_TABKEY1,
V_TABKEY2.
ENDLOOP.
No comments:
Post a Comment