data : begin of RECORD occurs 10,
lifnr like RF02K-LIFNR, " VENDOR NUMBER 0000000000099889
bukrs like RF02K-BUKRS, " COM 0001
ekorg like RF02K-EKORG, " SALES ORG 0001
KTOKK LIKE RF02K-KTOKK, " ACC GRP 0001
ANRED LIKE LFA1-ANRED, " TITLE MR
NAME1 LIKE LFA1-NAME1, " NAME SUDHKARA
SORTL LIKE LFA1-SORTL, " SEARC P
PFACH LIKE LFA1-PFACH, " POSTAL CODE 502032
ORT01 LIKE LFA1-ORT01, " LAND1 HYDERBAD
PSTLZ LIKE LFA1-PSTLZ, " 502032
PSTL2 LIKE LFA1-PSTL2, " 502032
LAND1 LIKE LFA1-LAND1, " IN
AKONT LIKE LFB1-AKONT, " RECONCILAIATION
FDGRV LIKE LFB1-FDGRV, " GROUP
WAERS LIKE LFM1-WAERS, " INR
END OF RECORD.
lifnr like RF02K-LIFNR, " VENDOR NUMBER 0000000000099889
bukrs like RF02K-BUKRS, " COM 0001
ekorg like RF02K-EKORG, " SALES ORG 0001
KTOKK LIKE RF02K-KTOKK, " ACC GRP 0001
ANRED LIKE LFA1-ANRED, " TITLE MR
NAME1 LIKE LFA1-NAME1, " NAME SUDHKARA
SORTL LIKE LFA1-SORTL, " SEARC P
PFACH LIKE LFA1-PFACH, " POSTAL CODE 502032
ORT01 LIKE LFA1-ORT01, " LAND1 HYDERBAD
PSTLZ LIKE LFA1-PSTLZ, " 502032
PSTL2 LIKE LFA1-PSTL2, " 502032
LAND1 LIKE LFA1-LAND1, " IN
AKONT LIKE LFB1-AKONT, " RECONCILAIATION
FDGRV LIKE LFB1-FDGRV, " GROUP
WAERS LIKE LFM1-WAERS, " INR
END OF RECORD.
DATA : BEGIN OF ITAB1 OCCURS 10,
LIFNR LIKE RF02K-LIFNR,
BANKS LIKE lfbk-banks , " COUNTRY IN
BANKL LIKE LFBK-BANKL, " BANK KEY 00456
BANKN LIKE LFBK-BANKN, " ACC NO 004001502032
KOINH LIKE LFBK-KOINH, " CC HOLDER NAME SUDHAKAR
BKONT LIKE LFBK-BKONT, " C 01
BANKA LIKE BNKA-BANKA, " BANK NAME ICICI
BORT01 LIKE BNKA-ORT01, " CITY HYDERABAD
BRNCH LIKE BNKA-BRNCH, " BRANCH SR NAGAR
END OF ITAB1.
LIFNR LIKE RF02K-LIFNR,
BANKS LIKE lfbk-banks , " COUNTRY IN
BANKL LIKE LFBK-BANKL, " BANK KEY 00456
BANKN LIKE LFBK-BANKN, " ACC NO 004001502032
KOINH LIKE LFBK-KOINH, " CC HOLDER NAME SUDHAKAR
BKONT LIKE LFBK-BKONT, " C 01
BANKA LIKE BNKA-BANKA, " BANK NAME ICICI
BORT01 LIKE BNKA-ORT01, " CITY HYDERABAD
BRNCH LIKE BNKA-BRNCH, " BRANCH SR NAGAR
END OF ITAB1.
DATA : IBDC LIKE BDCDATA OCCURS 10 WITH HEADER LINE,
DAT LIKE SY-DATUM,
CNT TYPE I,
A(16),
B(16),
C(16),
D(16),
E(16),
F(16).
DAT LIKE SY-DATUM,
CNT TYPE I,
A(16),
B(16),
C(16),
D(16),
E(16),
F(16).
START-OF-SELECTION.
DAT = SY-DATUM - 1.
DAT = SY-DATUM - 1.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:/PAPPU3.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = RECORD
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
EXPORTING
FILENAME = 'C:/PAPPU3.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = RECORD
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:/PAPPU2.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = ITAB1
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
EXPORTING
FILENAME = 'C:/PAPPU2.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = ITAB1
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
* DEST = FILLER8
GROUP = 'ROSE_LILY'
HOLDDATE = DAT
KEEP = 'X'
USER = SY-UNAME
* RECORD = ' '
* IMPORTING
* QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
.
LOOP AT RECORD.
PERFORM MAPPING.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'XK01'
* POST_LOCAL = NOVBLOCAL
* PRINTING = NOPRINT
TABLES
DYNPROTAB = IBDC
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH IBDC.
ENDLOOP.
EXPORTING
CLIENT = SY-MANDT
* DEST = FILLER8
GROUP = 'ROSE_LILY'
HOLDDATE = DAT
KEEP = 'X'
USER = SY-UNAME
* RECORD = ' '
* IMPORTING
* QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
.
LOOP AT RECORD.
PERFORM MAPPING.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'XK01'
* POST_LOCAL = NOVBLOCAL
* PRINTING = NOPRINT
TABLES
DYNPROTAB = IBDC
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH IBDC.
ENDLOOP.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
*&---------------------------------------------------------------------*
*& Form MAPPING
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM MAPPING. perform bdc_dynpro using 'SAPMF02K' '0100'. perform bdc_field using 'BDC_CURSOR' 'RF02K-KTOKK'. perform bdc_field using 'BDC_OKCODE' '/00'. perform bdc_field using 'RF02K-LIFNR' record-lifnr. perform bdc_field using 'RF02K-BUKRS' record-bukrs. perform bdc_field using 'RF02K-EKORG' record-ekorg. perform bdc_field using 'RF02K-KTOKK' record-ktokk. perform bdc_dynpro using 'SAPMF02K' '0110'. perform bdc_field using 'BDC_CURSOR' 'LFA1-LAND1'. perform bdc_field using 'BDC_OKCODE' '/00'. perform bdc_field using 'LFA1-ANRED' record-anred. perform bdc_field using 'LFA1-NAME1' record-name1. perform bdc_field using 'LFA1-SORTL' record-sortl. perform bdc_field using 'LFA1-PFACH' record-pfach. perform bdc_field using 'LFA1-ORT01' record-ort01. perform bdc_field using 'LFA1-PSTLZ' record-pstlz. perform bdc_field using 'LFA1-PSTL2' record-pstl2. perform bdc_field using 'LFA1-LAND1' record-land1. perform bdc_dynpro using 'SAPMF02K' '0120'. perform bdc_field using 'BDC_CURSOR' 'LFA1-KUNNR'. perform bdc_field using 'BDC_OKCODE' '/00'. **************************************************** CNT = 01. **************************************************** A = 'LFBK-BANKS(01)'. B = 'LFBK-BANKL(01)'. C = 'LFBK-BANKN(01)'. D = 'LFBK-KOINH(01)'. E = 'LFBK-BKONT(01)'. F = 'LFBK-BKONT(01)'. LOOP AT ITAB1 WHERE LIFNR = RECORD-LIFNR. IF CNT > 5.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
CNT = 05.
ENDIF.
A+11(2) = CNT.
B+11(2) = CNT.
C+11(2) = CNT.
D+11(2) = CNT.
E+11(2) = CNT.
F+11(2) = CNT.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
F.
perform bdc_field using 'BDC_OKCODE'
'=BANK'.
perform bdc_field using A
ITAB1-BANKS .
perform bdc_field using B
ITAB1-BANKL.
perform bdc_field using C
ITAB1-BANKN.
perform bdc_field using D
ITAB1-KOINH.
perform bdc_field using E
ITAB1-BKONT.
*****************
perform bdc_dynpro using 'SAPLBANK' '0100'.
perform bdc_field using 'BDC_CURSOR'
'BNKA-BRNCH'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'BNKA-BANKA'
ITAB1-BANKA.
perform bdc_field using 'BNKA-ORT01'
ITAB1-BORT01.
perform bdc_field using 'BNKA-BRNCH'
ITAB1-BRNCH.
CNT = CNT + 1.
ENDLOOP.
****************************************************
******************
******************
****************************************************
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-FDGRV'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
record-akont.
perform bdc_field using 'LFB1-FDGRV'
record-fdgrv.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
record-waers.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'WYT3-PARVW(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
ENDFORM. " MAPPING
*&---------------------------------------------------------------------*
*& Form bdc_dynpro
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0264 text
* -->P_0265 text
*----------------------------------------------------------------------*
FORM bdc_dynpro USING PROGRAM TYPE STRING SCREEN TYPE STRING.
IBDC-PROGRAM = PROGRAM.
IBDC-DYNPRO = SCREEN.
IBDC-DYNBEGIN = 'X'.
APPEND IBDC.
CLEAR IBDC.
ENDFORM. " bdc_dynpro
*&---------------------------------------------------------------------*
*& Form bdc_field
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0549 text
* -->P_0550 text
*----------------------------------------------------------------------*
FORM bdc_field USING FNAM LIKE A FVAL.
IBDC-FNAM = FNAM.
IBDC-FVAL = FVAL.
APPEND IBDC.
CLEAR IBDC.
ENDFORM. " bdc_field
*&---------------------------------------------------------------------*
*& Form MAPPING
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM MAPPING. perform bdc_dynpro using 'SAPMF02K' '0100'. perform bdc_field using 'BDC_CURSOR' 'RF02K-KTOKK'. perform bdc_field using 'BDC_OKCODE' '/00'. perform bdc_field using 'RF02K-LIFNR' record-lifnr. perform bdc_field using 'RF02K-BUKRS' record-bukrs. perform bdc_field using 'RF02K-EKORG' record-ekorg. perform bdc_field using 'RF02K-KTOKK' record-ktokk. perform bdc_dynpro using 'SAPMF02K' '0110'. perform bdc_field using 'BDC_CURSOR' 'LFA1-LAND1'. perform bdc_field using 'BDC_OKCODE' '/00'. perform bdc_field using 'LFA1-ANRED' record-anred. perform bdc_field using 'LFA1-NAME1' record-name1. perform bdc_field using 'LFA1-SORTL' record-sortl. perform bdc_field using 'LFA1-PFACH' record-pfach. perform bdc_field using 'LFA1-ORT01' record-ort01. perform bdc_field using 'LFA1-PSTLZ' record-pstlz. perform bdc_field using 'LFA1-PSTL2' record-pstl2. perform bdc_field using 'LFA1-LAND1' record-land1. perform bdc_dynpro using 'SAPMF02K' '0120'. perform bdc_field using 'BDC_CURSOR' 'LFA1-KUNNR'. perform bdc_field using 'BDC_OKCODE' '/00'. **************************************************** CNT = 01. **************************************************** A = 'LFBK-BANKS(01)'. B = 'LFBK-BANKL(01)'. C = 'LFBK-BANKN(01)'. D = 'LFBK-KOINH(01)'. E = 'LFBK-BKONT(01)'. F = 'LFBK-BKONT(01)'. LOOP AT ITAB1 WHERE LIFNR = RECORD-LIFNR. IF CNT > 5.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
CNT = 05.
ENDIF.
A+11(2) = CNT.
B+11(2) = CNT.
C+11(2) = CNT.
D+11(2) = CNT.
E+11(2) = CNT.
F+11(2) = CNT.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
F.
perform bdc_field using 'BDC_OKCODE'
'=BANK'.
perform bdc_field using A
ITAB1-BANKS .
perform bdc_field using B
ITAB1-BANKL.
perform bdc_field using C
ITAB1-BANKN.
perform bdc_field using D
ITAB1-KOINH.
perform bdc_field using E
ITAB1-BKONT.
*****************
perform bdc_dynpro using 'SAPLBANK' '0100'.
perform bdc_field using 'BDC_CURSOR'
'BNKA-BRNCH'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'BNKA-BANKA'
ITAB1-BANKA.
perform bdc_field using 'BNKA-ORT01'
ITAB1-BORT01.
perform bdc_field using 'BNKA-BRNCH'
ITAB1-BRNCH.
CNT = CNT + 1.
ENDLOOP.
****************************************************
******************
******************
****************************************************
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-FDGRV'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
record-akont.
perform bdc_field using 'LFB1-FDGRV'
record-fdgrv.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
record-waers.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'WYT3-PARVW(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
ENDFORM. " MAPPING
*&---------------------------------------------------------------------*
*& Form bdc_dynpro
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0264 text
* -->P_0265 text
*----------------------------------------------------------------------*
FORM bdc_dynpro USING PROGRAM TYPE STRING SCREEN TYPE STRING.
IBDC-PROGRAM = PROGRAM.
IBDC-DYNPRO = SCREEN.
IBDC-DYNBEGIN = 'X'.
APPEND IBDC.
CLEAR IBDC.
ENDFORM. " bdc_dynpro
*&---------------------------------------------------------------------*
*& Form bdc_field
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0549 text
* -->P_0550 text
*----------------------------------------------------------------------*
FORM bdc_field USING FNAM LIKE A FVAL.
IBDC-FNAM = FNAM.
IBDC-FVAL = FVAL.
APPEND IBDC.
CLEAR IBDC.
ENDFORM. " bdc_field
ALSO READ:
- BDC Program To Send Mails And Trigger Jobs.
- BDC Program To Load The Material Assignment Of Routing (CA02) - PP.
- Sample Code To Handle Multiple Records In BDC Table Control (IB01).
- HR ABAP - BDC For Uploading Absence Data Into PA30 Transaction.
- HR ABAP - BDC To Upload The OM Relations Through T-code PO13.
- HR ABAP - BDC Upload For The Org Unit Relationship Through T-Code PO10.
- HR ABAP - BDC For The Action Transfer Of Location.
No comments:
Post a Comment