BDC- Batch Data Communictions.
This is basically used to transfer data in bulk from notepad/excel into
SAP.
For ex
We need to create say 10 Materials in SAP, instead of going and creating
each and every Material separately we
follow this method.
To create Material u need to go to MM01. Where u will be entering around
6 fields.
So instead u go to SHDB go to the transaction recorder screen.
When u press start recording, u need togo to MM01 screen which u have
already kept it open. Touch and every field that u want to enter and enter
data. Then press Finished recording.
After recording Press Program. It will transfer us from recording to
prog. You can enter the Prog Name.
After that press enter the prog that was recorded will be displayed.
In that u need to comment 4items
1)
Include
2)
Perform open group
3)
Perform bdc_transactiion using MM01
4)
Perform Close_group
We entered values in 6 fields at the
time of recording.
There are 3 modes for running BDC
A-
Show all screens
N- Show No screens
E- Show Error screens.
report ZBDC_CALL_TRANSACTION_NEW
no standard page heading line-size 255.
*include bdcrecx1.
types : BEGIN OF stu,
matnr type mara-matnr,
mbrsh type mara-mbrsh,
mtart type mara-mtart,
maktx type makt-maktx,
meins type mara-meins,
matkl type mara-matkl,
end of stu.
data : wa type stu,
itab TYPE TABLE OF stu.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\BDC_TEST.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = ITAB
.
TYPES : BEGIN OF STU1,
PROGRAM TYPE BDCDATA-PROGRAM,
DYNPRO TYPE BDCDATA-DYNPRO,
DYNBEGIN TYPE BDCDATA-DYNBEGIN,
FNAM TYPE BDCDATA-FNAM,
FVAL TYPE BDCDATA-FVAL,
END OF STU1.
DATA : WA_BDCDATA TYPE STU1,
BDCDATA TYPE TABLE OF STU1.
start-of-selection.
*perform open_group.
LOOP AT ITAB INTO WA.
REFRESH BDCDATA.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MTART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
WA-MATNR.
perform bdc_field using 'RMMG1-MBRSH'
WA-MBRSH.
perform bdc_field using 'RMMG1-MTART'
WA-MTART.
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'
WA-MAKTX.
perform bdc_field using 'BDC_CURSOR'
'MARA-MATKL'.
perform bdc_field using 'MARA-MEINS'
WA-MEINS.
perform bdc_field using 'MARA-MATKL'
WA-MATKL.
perform bdc_field using 'MARA-MTPOS_MARA'
'NORM'.
CALL TRANSACTION 'MM01' USING BDCDATA MODE 'A'.
ENDLOOP.
*perform bdc_transaction using 'MM01'.
*perform close_group.
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
WA_BDCDATA-PROGRAM = PROGRAM.
WA_BDCDATA-DYNPRO = DYNPRO.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
WA_BDCDATA-FNAM = FNAM.
WA_BDCDATA-FVAL = FVAL.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
ENDFORM.