REPORT ZAPRCGINTF160 MESSAGE-ID ZG.

************************************************************************
* SYSTEM NAME : GROBAL INTERFACE/CONVERSION
* PROGRAM NAME : ZAPRCGINTF160
* PROGRAM TYPE : INTERFACE
* CREATE BY
: IBM(SATORU TANAKA)
* CREATE DATE : 2001/08/23
*----------------------------------------------------------------------*
* <DESCRIPTION>
* BANK MASTER EXTRACT
*
*----------------------------------------------------------------------*
* <UPDATE LOG>
* UPDATE BY
:
* UPDATE DATE :
* DESCRIPTION :
*
************************************************************************
*
*----------------------------------------------------------------------*
*
DEFINE TABLES
*----------------------------------------------------------------------*
TABLES: CDHDR , CDPOS , BNKA , TVARV.
*
*----------------------------------------------------------------------*
*
DEFINE INTERNAL TABLES
*----------------------------------------------------------------------*
DATA:BEGIN OF PROC_KEY_TAB OCCURS 0 ,
BANKS LIKE BNKA-BANKS,
"BANK COUNTRY
BANKL LIKE BNKA-BANKL,
"BANK KEY
PROCID LIKE CDHDR-CHANGE_IND, "CHANGE_IND(PROCESS-ID)
END OF PROC_KEY_TAB.
*----------------------------------------------------------------------*
*
DEFINE PARAMETERS
*----------------------------------------------------------------------*
PARAMETERS:
P_SYSID(5) TYPE C LOWER CASE DEFAULT ' ' obligatory,"SYSTEM ID
P_COMP(4)
TYPE C LOWER CASE DEFAULT ' ' obligatory,"COMPANY CODE
P_CTRY(3)
TYPE C LOWER CASE DEFAULT ' ' obligatory,"COUNTRY CODE
P_OUTPUT(40) TYPE C LOWER CASE DEFAULT ' ' obligatory."OUTPUT FILE NAME
*
*----------------------------------------------------------------------*
*
OUTPUT FILE
*----------------------------------------------------------------------*
*
*--- OUTPUT FILE ---------------*
DATA: T_I016 LIKE ZRCGC009 OCCURS 0 WITH HEADER LINE.
*
*----------------------------------------------------------------------*
*
CONSTANT DEFINITION
*----------------------------------------------------------------------*
*
*--- CONSTANT-------------------*
CONSTANTS: BEGIN OF CNS,
INSERT(1)
TYPE C VALUE 'I',
"CHANGE ID 'INSERT'
UPDATE(1)
TYPE C VALUE 'U',
"CHANGE ID 'UPDATE'
ITFID(5)
TYPE C VALUE 'I016' , "INTERFACE ID
BNKA(4)
TYPE C VALUE 'BNKA' , "TABLE ID OF BANK MASTER
BANK(4)
TYPE C VALUE 'BANK' , "BANK MASTER OBJECT CLASS
FI01(4)
TYPE C VALUE 'FI01' , "MASTER ENTRY TRANSACTION
FI02(4)
TYPE C VALUE 'FI02' , "MASTER UPDATE TRANSACTION

"SELECT RECORD COUNT CREATE(8) TYPE P. SELECT(8) TYPE P. * * *--. * *----------------------------------------------------------------------* . * *--. "OMIT RECORD COUNT REPL(8) TYPE P. "DELETE RECORD COUNT OMIT(8) TYPE P. "OBJECT ID EDIT WORK SUBRC LIKE SY-SUBRC. "CHANGE RECORD COUNT DELETE(8) TYPE P. "RETURN CODE MSGTXT(100) TYPE C. * *----------------------------------------------------------------------* * OTHER WORK FIELDS *----------------------------------------------------------------------* * *--. "LAST EXECUTE TIME END OF WRK. * *--.INITIAL PROCESS -----------* PERFORM INIT_RTN.FI06(4) TYPE C VALUE 'FI06' . * END-OF-SELECTION. "BANK CONTRY KEY BANKL(15) TYPE C.END PROCESS ---------------* PERFORM END_RTN.COUNTERS ------------------* DATA: BEGIN OF CTR. BANKS(3) TYPE C. "LAST EXECUTE DATE LASTTIME LIKE SY-UZEIT. "LAST EXECUTE TIME KEY LASTDATE LIKE SY-DATUM. * *----------------------------------------------------------------------* * INCLUDE *----------------------------------------------------------------------* INCLUDE ZCMRCGINCL001. "LOGICAL DELETE TRANSACTION DELETE(8) TYPE C VALUE 'LOEVM'. "FIELD NAME OF DELETE FLAG SELECT(1) TYPE C VALUE 'X'. "BANK KEY PROC(1) TYPE C. "REPLACE RECORD COUNT OUTPUT(8) TYPE P. "LAST EXECUTE DATE KEY VARIABLE_T(50) TYPE C. "MESSAGE AREA TCODE LIKE SY-TCODE. "CREATE RECORD COUNT CHANGE(8) TYPE P. "EXECUTE TRANSACTION CODE VARIABLE_D(50) TYPE C. "SELECT MARK END OF CNS. "PROCESS ID OBJECTID(30) TYPE C. INCLUDE ZCMRCGINCL002. * *----------------------------------------------------------------------* * COUNTER DEFINITION *----------------------------------------------------------------------* * *--.MAIN PROCESS --------------* PERFORM MAIN_RTN. * ************************************************************************ * PROCESS CONTROL ************************************************************************ * START-OF-SELECTION. "OUTPUT RECORD COUNT END OF CTR.WORK FIELDS ---------------* DATA: BEGIN OF WRK.

* * *--.GET LAST RUN DATE/TIME ----* PERFORM GET_RUNDATE USING P_COMP P_SYSID. *----------------------------------------------------------------------* * (3. PERFORM EDIT_OUT_RTN. * * *--.COUNT REPORT --------------* PERFORM CNT_REPORT USING 'SELECT RECORD COUNT : ' CTR-SELECT. PERFORM CNT_REPORT USING 'OMIT RECORD COUNT : ' CTR-OMIT . ENDIF. IF P_COMP IS INITIAL. ENDIF. * *--. * *--. * *--.PROGRAM START MESSAGE -----* PERFORM PROGRAM_START. MESSAGE A997(ZG) WITH 'P_OUTPUT'. CLEAR WRK.0) FORM:MAIN_RTN *----------------------------------------------------------------------* * READ FILE AND BATCH INPUT PROCESS *----------------------------------------------------------------------* FORM MAIN_RTN. MESSAGE A997(ZG) WITH 'P_SYSID'. ENDIF.0) FORM:INIT_RTN *----------------------------------------------------------------------* * COUNTER CLEAR AND PARAMETER CHECK AND FILE OPEN *----------------------------------------------------------------------* FORM INIT_RTN. PERFORM CNT_REPORT USING ' CREATE COUNT : ' CTR-CREATE.OUTPUT FILE OPEN-----------* PERFORM OPEN_OUTDATA USING P_OUTPUT 'OUTFILE'. ENDFORM.FILE CLOSE ----------------* PERFORM CLOSE_DATASET USING P_OUTPUT 'OUTFILE'. IF P_CTRY IS INITIAL. .PROGRAM END MESSAGE -------* PERFORM PROGRAM_END. IF P_OUTPUT IS INITIAL. * *--. * * *--. ENDLOOP. * *--. ENDIF.PARAMETER CHECK -----------* IF P_SYSID IS INITIAL. PERFORM CNT_REPORT USING ' CHANGE COUNT : ' CTR-CHANGE. PERFORM CNT_REPORT USING ' DELETE COUNT : ' CTR-DELETE. * * *--. *----------------------------------------------------------------------* * (2. PERFORM CNT_REPORT USING 'OUTPUT RECORD COUNT : ' CTR-OUTPUT.0) FORM:END_RTN *----------------------------------------------------------------------* * PROGRAM END PROCESS *----------------------------------------------------------------------* FORM END_RTN. * LOOP AT PROC_KEY_TAB. * * *--. MESSAGE A997(ZG) WITH 'P_CTRY' .STORE KEY & PROC-ID PERFORM PROC_KEY_TAB_RTN.* (1.UPDATE RUNDATE ------------* PERFORM UPDATE_RUNDATE.CLEAR ---------------------* CLEAR CTR. MESSAGE A997(ZG) WITH 'P_COMP' . PERFORM CNT_REPORT USING 'REPLACE RECORD COUNT : ' CTR-OMIT . * ENDFORM.

* *--. IF SY-SUBRC <> 0.UPDATE THIS JOB RUN TIME UPDATE TVARV SET LOW = SY-UZEIT WHERE NAME = WRK-VARIABLE_T AND TYPE = 'P' AND NUMB = '0000'.EDIT TIME KEY--------------* CONCATENATE 'Z' 'I016_' P_COMP '_ ' P_SYSID '_TIME' INTO WRK-VARIABLE_T. * ENDFORM. " GET_RUNDATE *&---------------------------------------------------------------------* *& Form UPDATE_RUNDATE *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-. * ENDFORM. ENDIF.* ENDFORM. MESSAGE A999 WITH 'TVARV' 'UPDATE' SY-SUBRC WRK-VARIABLE_D.SELECT LAST RUN TIME ------* SELECT SINGLE * FROM TVARV WHERE NAME = WRK-VARIABLE_T AND TYPE = 'P' AND NUMB = '0000'. * *--.SELECT LAST RUN DATE ------* SELECT SINGLE * FROM TVARV WHERE NAME = WRK-VARIABLE_D AND TYPE = 'P' AND NUMB = '0000'. WRK-LASTTIME = TVARV-LOW. * *--.UPDATE THIS JOB RUN DATE UPDATE TVARV SET LOW = SY-DATUM WHERE NAME = WRK-VARIABLE_D AND TYPE = 'P' AND NUMB = '0000'. * * *--. * *--. " UPDATE_RUNDATE . WRK-LASTDATE = TVARV-LOW. * *--.p2 text *----------------------------------------------------------------------* FORM UPDATE_RUNDATE. MESSAGE A999 WITH 'TVARV' 'UPDATE' SY-SUBRC WRK-VARIABLE_T. *&---------------------------------------------------------------------* *& Form GET_RUNDATE *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_COMP text * -->P_SYSID text *----------------------------------------------------------------------* FORM GET_RUNDATE USING P_COMP P_SYSID.EDIT DATE KEY--------------* CONCATENATE 'Z' 'I016_' P_COMP '_ ' P_SYSID '_DATE' INTO WRK-VARIABLE_D. * *--. ENDIF.GET DATE & TIME GET TIME. IF SY-SUBRC <> 0.

* * * * I/O COMMAND ERROR ! OBJECT=&1 COMMAND=&2 SY-SUBRC=&3 KEY=&4.IF SAME KEY IS NOT EXIST-PROC_KEY_TAB-BANKS = WRK-BANKS. "--. *--.UP OMIT COUNT -----------ENDIF. " EXTRACT_KEY_RTN *&---------------------------------------------------------------------* *& Form DECIDE_PROC_RTN *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-. ENDIF. WHEN 0.EDIT BANK COUNTRY KEY----PROC_KEY_TAB-BANKL = WRK-BANKL."--. "--.EDIT OBJECTID CONCATENATE SY-MANDT P_CTRY '%' INTO WRK-OBJECTID.p2 text *----------------------------------------------------------------------* FORM PROC_KEY_TAB_RTN.DECIDE PROCESS-ID---------* PERFORM DECIDE_PROC_RTN USING WRK-BANKS WRK-BANKL WRK-PROC. *--."--CHANGE PROC ID MODIFY PROC_KEY_TAB INDEX SY-TABIX.p2 text . ENDSELECT. "---IF SAME KEY EXIST---------IF PROC_KEY_TAB-PROCID <> 'A'. I/O COMMAND ERROR ! OBJECT=&1 COMMAND=&2 SY-SUBRC=&3 KEY=&4. * * WHEN 4. IF SY-SUBRC > 4. CTR-REPL = CTR-REPL + 1.SELECT CDHDR --------------* SELECT * FROM CDHDR WHERE OBJECTCLAS = CNS-BANK AND OBJECTID LIKE WRK-OBJECTID AND ( ( UDATE > WRK-LASTDATE ) OR ( UDATE = WRK-LASTDATE AND UTIME > WRK-LASTTIME ) ) ORDER BY OBJECTID UDATE UTIME. * *--. ENDFORM."--. * *--. "---AND BEFORE ACTION IS NOT 'A' PROC_KEY_TAB-PROCID = WRK-PROC.*&---------------------------------------------------------------------* *& Form EXTRACT_KEY_RTN *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-. MESSAGE A999 WITH 'CDHDR' 'SELECT' SY-SUBRC WRK-OBJECTID. *--.EDIT BANK KEY -----------PROC_KEY_TAB-PROCID = WRK-PROC."--.APPEND KEY & PROCID TO TAB WHEN OTHERS. CTR-OMIT = CTR-OMIT + 1. ENDCASE.UP SELECT COUNT-----------* CTR-SELECT = CTR-SELECT + 1. "--.CHACK SAME KEY -----------* READ TABLE PROC_KEY_TAB WITH KEY BANKS = WRK-BANKS BANKL = WRK-BANKL. CASE SY-SUBRC. MESSAGE A999 WITH 'PROC_KEY_TAB' 'READ' SY-SUBRC CDHDR-OBJECTID.EDIT PROCESS ID ---------APPEND PROC_KEY_TAB.|UP REPLACE COUNT---------ELSE. "-.

ENDIF. SELECT SINGLE * FROM BNKA WHERE BANKS = PROC_KEY_TAB-BANKS AND BANKL = PROC_KEY_TAB-BANKL. P_PROC = 'C'. ENDIF. . ENDFORM. * I/O COMMAND ERROR ! OBJECT=&1 COMMAND=&2 SY-SUBRC=&3 KEY=&4.*----------------------------------------------------------------------* FORM DECIDE_PROC_RTN USING P_BANKS P_BANKL P_PROC. IF SY-SUBRC <> 0. * I/O COMMAND ERROR ! OBJECT=&1 COMMAND=&2 SY-SUBRC=&3 KEY=&4. IF CDPOS-VALUE_NEW = 'X'. P_PROC = 'A'. * MOVE-CORRESPONDING BNKA TO T_I016. P_COMP. MESSAGE A999 WITH 'CDPOS' 'SELECT' SY-SUBRC CDHDR-OBJECTID. ELSE. CASE CDHDR-CHANGE_IND. ENDIF. ' '. ENDCASE. IF SY-SUBRC <> 0 . * CLEAR:T_I016. SELECT SINGLE * FROM CDPOS WHERE OBJECTCLAS = CDHDR-OBJECTCLAS AND OBJECTID = CDHDR-OBJECTID AND CHANGENR = CDHDR-CHANGENR AND TABNAME = CNS-BNKA AND FNAME = CNS-DELETE. " DECIDE_PROC_RTN *&---------------------------------------------------------------------* *& Form EDIT_OUT_RTN *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-. CTR-CHANGE = CTR-CHANGE + 1. PROC_KEY_TAB-BANKL.p2 text *----------------------------------------------------------------------* FORM EDIT_OUT_RTN. TRANSFER T_I016 TO P_OUTPUT. CTR-CREATE = CTR-CREATE + 1. WHEN CNS-INSERT. PROC_KEY_TAB-PROCID. P_PROC = 'D'. ENDIF. ELSE. MESSAGE A999 WITH 'BNKA' 'SELECT' SY-SUBRC BNKA-BANKL. T_I016-ZRCG_ITFID T_I016-ZRCG_CMPCD T_I016-ZRCG_SYSID T_I016-ZRCG_PRCID T_I016-ZRCG_TMKEY T_I016-ZRCG_RECTP = = = = = = CNS-ITFID. P_PROC = 'C'. WHEN CNS-UPDATE. IF CDHDR-TCODE = CNS-FI06. CTR-CHANGE = CTR-CHANGE + 1. P_BANKL = CDHDR-OBJECTID+6(15). P_BANKS = CDHDR-OBJECTID+3(3). CTR-DELETE = CTR-DELETE + 1. P_SYSID.

" EDIT_OUT_RTN . * ENDFORM.CTR-OUTPUT = CTR-OUTPUT + 1.