Bdc Using Session Method
When SAP is implemented, we need Data to be migrated from non-SAP system i.e. Legacy system to SAP system. One way of doing this is BDC (Batch Data Communication).Requirement: - For Developing BDC using Session Method we need Recording & flat file in which data is stored. Flat file can be Text file or Excel File.
In Session Method following function Modulesare used.
1. BDC_OPEN_GROUP.
2. BDC_INSERT.
3. BDC_CLOSE_GROUP.
In BDC we use structure BDCDATA for Batch Input, Which has following components.
PROGRAM - BDC module poolDYNPRO- BDC Screen number
DYNBEGIN- BDC screen start
FNAM- Field name
FVAL- BDC field value
A BDCDATA structure can contain the batch input data for only asingle run of a transaction
Lets for the sake of convenience our flat file looks like this.
(If you are using the same file for practice make sure you remove the above two heading rows.)
Fromabove flat file we came to know about the structure of the internal table in which data will be uploaded.
DATA:
BEGIN OF fs_field,
bsart TYPE eban-bsart, ” Document Type. matnr TYPE eban-matnr, " Material Number.
menge TYPE eban-menge, " Quantity Requested.
werks TYPE eban-werks, " Plant.
END OF fs_field.
Recoding is done inTransacton – SHDB .
Here we have done Recording for the transaction- ME51 .
The Recording which you get will be in following format.
Now go to Abap Editor (SE38).
Do the following coding.*Input Path
PARAMETERS:
p_file TYPE rlgrap-filename. " File Path
* Structure Decleration
DATA :
BEGIN OF fs_field, bsart TYPE eban-bsart, " Document Type.
matnr TYPE eban-matnr, " Material Number.
menge TYPE eban-menge, " Quantity Requested.
werks TYPE eban-werks, " Plant.
END OF fs_field....
Regístrate para leer el documento completo.