Académique Documents
Professionnel Documents
Culture Documents
BDC Reports are used to transfer data from legacy system into SAP system
during SAP Implementation.
Based on the functional requirements you have to now write a BDC report to
upload the legacy data into SAP system.
Before Data transfer, the non SAP data has to be analysed and extracted from
the non SAP system. It is then mapped into the SAP format. Then only it is
transferred to SAP system. Finally transferred data is checked in the SAP
database.
Tcode SHDB is used to record transaction code the user requires. This will create
a simulation using which the developer will create a program and modify it. This
is a easy method for developer.
Call Transaction
Asynchronous Processing
To use BDC, first upload data to an internal table. This data cannot be passed
directly to DB. These source fields are passed through corresponding screen
fields which are used in the recording. For this transfer we need a batch input
structure.
This batch input structure is used by all batch input methods regardless we
are using session method or call transaction method.
We need to create a structure called BDCDATA. The fields are as shown below.
1. PROGRAM - name of the module pool program associated with the screen. Set
other records.
4. FNAM Field name. Not case sensitive
5. FVAL BDC field value of the given field name. It contains data that is entered
into screen fields, Function codes that are entered into the command field. Such
function codes execute functions in a transaction, such as Save or Enter.
Using fields MSGV1, MSGV2, MSGV3, MSGV4 we can view the messages
generated by BDC program.
Example
If we are using Session Method we use the following functions 1) BDC_OPEN_GROUP for opening the Batch Input Session
2) BDC_INSERT for inserting the transactional data into SAP
3) BDC_CLOSE_GROUP for closing the Batch Input Session
General Information about a session is stored in table APQI.
Transaction data for a session is stored in table APQD.
These functions are generated automatically when we create new program after
recording is done using transaction SHDB.
Example Upload Material Master Data using BDC. Tcode MM01 using Call
Transaction
Step 1: Record the transaction
Tcode SHDB is used to record transaction.
Press New Recording, enter recording name, enter Tcode, press Start Recording
BDC_OKCODE: is used for storing commands during the recording for eg. '/00' is the
command for 'ENTER' Key.
BDC_CURSOR: contains the cursor position. it contains the field in which cursor will
be.
Go Back.
Now create a New Program.
ABAP editor screen is displayed with the code generated after recording the Tcode.
Now create a excel sheet as source file with all the fields required for upload.
Using Format Cells option for each cell, convert each cell as Text
Depending the field length for each field, change the column width for each cell.
For example for material number, make column width as 18 which is same as the field
length of matnr.
Accordingly make changes for all other fields depending on their length in DB tables.
Now, the progam create an internal table with same fields are required for upload. Keep
the sequence same as in the recording.
In the above example function Upload is use to read data from file into internal table.
To read files from Application Server use following functions OPEN DATASET ---> opens the file(dataset) either in read /write mode.
READ DATASET ---> Read the file
CLOSE DATASET ---> Close the dataset once the date has been read .
To read files from Presentation Server use following functions GUI_UPLOAD --> To read data from file into an internal table
GUI_DOWNLOAD --> To write data from internal table to a file on presentation server
After perform open_group, insert LOOP statement.
Replace all the values entered during recording with the sames of corresponding
internal table fields. Comment the recording values.
Generate Session
Call transaction
The name and path of the source file is to be given here. Make sure you enter the .prn
format of the file. Press transfer.
All the screen used in the recording will be displayed. Check if all the data mentioned in
the source file is as per given and placed in the correct field on screen. If correct press
Continue.
BDC OK-codes are the commands that we have entered during our recording.
For each step there is a separate OK-Code. For example: for Enter the Ok code is '/00'.
For Save the Ok Code is '/11'. For each recording the last Ok code is always Save.
With other things as usual, there is a special trick that you have to use while doing BDC
for table control.
You need to use the BDC OKCODE '=P+'.
Finally, after all screens are processed, the following screen is displayed which shows
the detailed report of the upload.
Errors if any can be seen here.