BDC- Batch data Commnication MM01(material data)
BDC - Batch data comminication
* BDC is used to upload the data from flat file to SAP system.
Task - Create material data using BDC concept.
1. Goto T-code SHDB.
2. Click on new recording.
3. Give recording name and T-code and click on start recording.
4. Give material number, industry sector and material type and click on select view as basic data and click Enter.
5. Give material description and unit of measure and click on save and save the recording.
6. Go back and select the recording and click on program and give program name and select transfer from recording and select the package.
7. Goto se38 and give program name and click on change.
write a code like this.
report ZAB_RP_MATERIAL
no standard page heading line-size 255.include bdcrecx1_s.
data: begin of itab occurs 0,
matnr(10),
mbrsh(2),
mtart(4),
maktx(20),
meins(3),
END OF itab.
start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\Users\JFR2KOR\Documents\material.txt'
FILETYPE = 'ASC'
tables
data_tab = itab.
LOOP AT itab.
perform open_group.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'AUSW'.
perform bdc_field using 'RMMG1-MATNR'
'mm0101'.
perform bdc_field using 'RMMG1-MBRSH'
'P'.
perform bdc_field using 'RMMG1-MTART'
'ROH'.
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)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'=AUSW'.
perform bdc_field using 'RMMG1-MATNR'
itab-matnr. "'MM010111'.
perform bdc_field using 'RMMG1-MBRSH'
itab-mbrsh. "'P'.
perform bdc_field using 'RMMG1-MTART'
itab-mtart. "'ROH'.
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)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MAKT-MAKTX'
itab-maktx. "'material data'.
perform bdc_field using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field using 'MARA-MEINS'
itab-meins. "'kg'.
perform bdc_transaction using 'MM01'.
perform close_group.
ENDLOOP.
txt file
8. click on execute. It will reflect in mara table.
Comments
Post a Comment