Sunteți pe pagina 1din 20

BDC (Batch Data Communication)

The SAP System offers three methods for transferring data into the System from other SAP Systems and non-SAP Systems.
These methods are collectively called "batch input" or "batch data communication."

Uses of Batch Input


Transferring data from another system when you install your SAP System Regularly transferring data that is captured by a non-SAP system in your company into the SAP System. You can also use batch input to transfer data between two R/3 Systems.

Basic Technique
All batch input methods work by carrying out normal SAP transactions, just as any user would. Batch-input executes the transactions automatically and is therefore suitable for entering large amounts of data that are already available .

The batch input technique offers these advantages for transferring data: No manual interaction is required during data transfer. Batch input ensures data integrity.

Batch input processing methods

Method 1 - CLASSICAL BATCH INPUT Method 2 - CALL TRANSACTION Method 3 - CALL DIALOG

Method 1 - Classical batch input.


In this method ABAP/4 program reads the external data that is to be entered in the SAP System and stores the data in a "batch-input session." When the program has finished generating the session, you can run the session to execute the SAP transactions in it.

This method uses the function modules BDC_OPEN, BDC_INSERT, and BDC_CLOSE to generate sessions.

Method 2 - CALL TRANSACTION USING


In this method, your program uses the ABAP/4 CALL TRANSACTION USING statement to run an SAP transaction. Batch-input data is not deposited in a session for later processing. Instead, the entire batch-input process takes place inline in your program.

Method 3 - CALL DIALOG


There is a third batch-input method using the ABAP/4 CALL DIALOG statement. SAP recommends against using this method unless necessary. The CALL DIALOG method is now outdated and is more complex and less comfortable to use than the other techniques.

BDCDATA
All three batch-input methods use a common data structure for holding the instructions and data for SAP transactions. This structure is defined as structure BDCDATA in the ABAP/4 Dictionary.

Filling the BDCDATA Structure


The first record for each screen must contain information that identifies the screen: program name, screen name and a start-of-screen indicator. You record this information in the PROGRAM, DYNPRO, and DYNBEGIN fields of the BDCDATA structure.

Example
BDCDATA-PROGRAM = 'sapms38m'. BDCDATA-DYNPRO = '0100'. BDCDATA-DYNBEGIN = 'x'. APPEND BDCDATA.

Entering a Value in a Field


After the dynpro-start record, you must add a record for each field that is to receive a value. You need fill only the FNAM and FVAL fields.

Example BDCDATA-FNAM = 'RS38M-FUNC_EDIT'. BDCDATA-FVAL = 'x'. APPEND BDCDATA.

Executing a function
You can execute a function in a transaction by entering the function code or function key number in the command field of an SAP session. You use the FNAM and FVAL fields to enter this information, just as you would for normal screen fields. The command field is identified by a special name in batch input, BDC_OKCODE. This name is constant and always identifies the command field. For function key: BDCDATA-FNAM = 'BDC_OKCODE'. BDCDATA-FVAL = '/11'. For function code: BDCDATA-FNAM = 'BDC_OKCODE'. BDCDATA-FVAL = '=UPDA'.

Entering Values in Loop Fields


Some screen fields need multiple values, one on each line. To provide input to one of these loop fields, you must use an explicit line index : BDCDATA-FNAM = 'fieldx(5)'. BDCDATA-FVAL = 'value'.

Positioning the cursor


To position the cursor on a particular field, you must use the special cursor field: BDCDATA-FNAM = 'BDC_CURSOR'.

BDCDATA-FVAL = 'fieldx'.
.

Creating a Session with BDC_OPEN_GROUP


BDC_OPEN_GROUP function module creates a new session. Once you have created a session, then you can insert batch input data into it with BDC_INSERT. You cannot re-open a session that already exists and has been closed. A batch input program may have only one session open at a time.

Using BDC_INSERT
This function module adds a transaction to a batch input session. You specify the transaction that is to be started in the call to BDC_INSERT.

You must provide a BDCDATA structure that contains all of the data required to process the transaction completely.

BDC_CLOSE_GROUP
Use the BDC_CLOSE_GROUP function module to close a session after you have inserted all of your batch input data into it. Once a session is closed, it can be processed. You must close a session before you can open another session from the same program.

CALL TRANSACTION USING for Batch Input


Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended batch input methods. In this method, batch input data is processed inline in your batch input program. Syntax:

CALL TRANSACTION 'SE38' USING BDCDATA MODE 'A' UPDATE 'S'.

S-ar putea să vă placă și