Last Updated on August 11, 2022 by admin
SAP BDC
SAP BDC stands for batch data communication and it is a technique using with legacy data or data loading in to SAP system which is not updated in the SAP systems. For example, company decides to adapt its systems and procedures to SAP, and installs SAP, it will have to upload a huge volume of data that are a part of its legacy systems or old systems into the SAP system. This technique is done through SAP BDC (Batch Data Communication).
BDC sessions, which are also known as Batch Input Sessions, are used to load legacy data into the SAP system and perform highly repetitive tasks that involve in data entry. BDC session simulates the online entry of all data, transactions, validations that are included in each transaction.
To perform SAP BDC transaction, a programmer has to manually examine the entire transaction for the first time . He must note every single field – including details such as the field’s name, type and length. Programmer has to write a batch input program to format the entire incoming data into a BDC table. SAP simplifies the entire process by using BDC Recording. BDC Recording is a feature that is included in SAP R/3 systems. In BDC Recording, a user records a sample transaction and Importer Wizard formats the recording into a structure of type tree. The tree is then used in a Map Designer, which maps the entire data directly into the BDC table format. This is then processed entirely by the SAP BDC session program.
To perform SAP BDC, we do the following steps
- Load SAP systems with data using a BDC session
- Identify the transaction which is used to create the SAP data. (For example, take MM01)
- Run SHDB transaction (Use SM35 recording)
By using the above SAP transactions, you have loaded the initial data into the SAP system means have done a “recording”. So, next, you must use this format for the rest of the program. You will do well to note down each of the fields here.
The data can only be read in form of a text file or a flat file, and fed by the ABAP program into an internal table called the BDCDATA. Now, this internal table, BDCDATA is taken as the format for the input and executed in the background. The SAP BDC Data table should have the following structure.
How to write SAP BDC Program
——————–
report ZMAT_MAST_UPLOAD
no standard page heading line-size 255.
TABLES : RLGRAP.
include bdcrecx1.
DATA : BEGIN OF IT_MM01 OCCURS 0,
MATNR(18),
MBRSH,
MTART(4),
KZSEL,
MAKTX(40),
MEINS(3),
END OF IT_MM01.
DATA : STR_FPATH TYPE STRING.
PARAMETERS : P_FPATH LIKE RLGRAP-FILENAME.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FPATH.
CALL FUNCTION ‘F4_FILENAME’
* EXPORTING
* PROGRAM_NAME = SYST-CPROG
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ‘ ‘
IMPORTING
FILE_NAME = P_FPATH.
start-of-selection.
IF P_FPATH IS NOT INITIAL.
STR_FPATH = P_FPATH.
ENDIF.
CALL FUNCTION ‘GUI_UPLOAD’
EXPORTING
filename = STR_FPATH
FILETYPE = ‘ASC’
tables
data_tab = IT_MM01.
LOOP AT IT_MM01.
WRITE :/10 IT_MM01.
ENDLOOP.
perform open_group.
LOOP AT IT_MM01.
perform bdc_dynpro using ‘SAPLMGMM’ ‘0060’.
perform bdc_field using ‘BDC_CURSOR’
‘RMMG1-MTART’.
perform bdc_field using ‘BDC_OKCODE’
‘=AUSW’.
perform bdc_field using ‘RMMG1-MATNR’
IT_MM01-MATNR.
perform bdc_field using ‘RMMG1-MBRSH’
IT_MM01-MBRSH.
perform bdc_field using ‘RMMG1-MTART’
IT_MM01-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)’
IT_MM01-KZSEL.
perform bdc_dynpro using ‘SAPLMGMM’ ‘4004’.
perform bdc_field using ‘BDC_OKCODE’
‘/00’.
perform bdc_field using ‘MAKT-MAKTX’
IT_MM01-MAKTX.
perform bdc_field using ‘BDC_CURSOR’
‘MARA-MEINS’.
perform bdc_field using ‘MARA-MEINS’
IT_MM01-MEINS.
perform bdc_dynpro using ‘SAPLSPO1’ ‘0300’.
perform bdc_field using ‘BDC_OKCODE’
‘=YES’.
perform bdc_transaction using ‘MM01’.
REFRESH BDCDATA.
ENDLOOP.
perform close_group.
———————–
# Now run the program, so that the initial data contained in it is loaded into the SAP system
# The last step to is run SM35 to process the batch session, where the entire legacy system data is uploaded into the SAP system.
SAP BDC can be performed by the Call Transaction method or by the Session method. The above example makes use of the Session method.