BDC Call Transaction For Material Master MM01 - Batch Data Communication - SAPNuts
BDC Call Transaction For Material Master MM01 - Batch Data Communication - SAPNuts
BDC Call Transaction For Material Master MM01 - Batch Data Communication - SAPNuts
html
1 of 11 9/7/2017, 11:43 AM
BDC Call transaction for Material Master MM01 - Batch Data Communication | SAPNuts.com https://www.sapnuts.com/courses/core-abap/bdc/bdc-call-transaction-mm01.html
2 of 11 9/7/2017, 11:43 AM
BDC Call transaction for Material Master MM01 - Batch Data Communication | SAPNuts.com https://www.sapnuts.com/courses/core-abap/bdc/bdc-call-transaction-mm01.html
3 of 11 9/7/2017, 11:43 AM
BDC Call transaction for Material Master MM01 - Batch Data Communication | SAPNuts.com https://www.sapnuts.com/courses/core-abap/bdc/bdc-call-transaction-mm01.html
FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD' "upload flat file
EXPORTING
FILENAME = FILE "file name
FILETYPE = 'ASC' "file type
HAS_FIELD_SEPARATOR = 'X' "is tab delimited
TABLES
DATA_TAB = IT_MARA.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
4 of 11 9/7/2017, 11:43 AM
BDC Call transaction for Material Master MM01 - Batch Data Communication | SAPNuts.com https://www.sapnuts.com/courses/core-abap/bdc/bdc-call-transaction-mm01.html
5 of 11 9/7/2017, 11:43 AM
BDC Call transaction for Material Master MM01 - Batch Data Communication | SAPNuts.com https://www.sapnuts.com/courses/core-abap/bdc/bdc-call-transaction-mm01.html
LOOP AT IT_MARA INTO WA_MARA. "loop all records and pass one by one to BDC
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0060'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RMMG1-MTART'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'ENTR'.
PERFORM BDC_FIELD USING 'RMMG1-MATNR'
WA_MARA-MATNR. "pass material no
PERFORM BDC_FIELD USING 'RMMG1-MBRSH'
WA_MARA-MBRSH. "pass indistry sector
PERFORM BDC_FIELD USING 'RMMG1-MTART'
WA_MARA-MTART. "pass material type
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(01)' "select basic view1
'X'.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4004'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BU'.
PERFORM BDC_FIELD USING 'MAKT-MAKTX'
WA_MARA-MAKTX. "pass material description
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MARA-MEINS'.
PERFORM BDC_FIELD USING 'MARA-MEINS'
WA_MARA-MEINS. "pass base unit oe meassure
6 of 11 9/7/2017, 11:43 AM
BDC Call transaction for Material Master MM01 - Batch Data Communication | SAPNuts.com https://www.sapnuts.com/courses/core-abap/bdc/bdc-call-transaction-mm01.html
ENDLOOP.
7 of 11 9/7/2017, 11:43 AM
BDC Call transaction for Material Master MM01 - Batch Data Communication | SAPNuts.com https://www.sapnuts.com/courses/core-abap/bdc/bdc-call-transaction-mm01.html
REPORT ZSAPN_BDC
NO STANDARD PAGE HEADING LINE-SIZE 255.
START-OF-SELECTION.
IF P_FILE IS NOT INITIAL.
FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD' "upload flat file
EXPORTING
FILENAME = FILE "file name
FILETYPE = 'ASC' "file type
HAS_FIELD_SEPARATOR = 'X' "is tab delimited
TABLES
DATA_TAB = IT_MARA.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
LOOP AT IT_MARA INTO WA_MARA. "loop all records and pass one by one to BDC
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0060'.
8 of 11 9/7/2017, 11:43 AM
BDC Call transaction for Material Master MM01 - Batch Data Communication | SAPNuts.com https://www.sapnuts.com/courses/core-abap/bdc/bdc-call-transaction-mm01.html
9 of 11 9/7/2017, 11:43 AM
BDC Call transaction for Material Master MM01 - Batch Data Communication | SAPNuts.com https://www.sapnuts.com/courses/core-abap/bdc/bdc-call-transaction-mm01.html
ENDLOOP.
10 of 11 9/7/2017, 11:43 AM
BDC Call transaction for Material Master MM01 - Batch Data Communication | SAPNuts.com https://www.sapnuts.com/courses/core-abap/bdc/bdc-call-transaction-mm01.html
11 of 11 9/7/2017, 11:43 AM