Powered By

Free XML Skins for Blogger

Powered by Blogger

Tuesday, October 7, 2008

SAP ABAP BDC 1

(1) BATCH INPUT CONCEPTS:

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

basic technique for data transfer with batch input.

Both batch input methods work by carrying out normal SAP transactions, just as a user would. However, batch-input can execute the transactions automatically and is therefore suitable for entering large amounts of data that are already available in electronic form.
The batch input technique offers these advantages for transferring data:


No manual interaction is required during data transfer. If the data to be transferred is already available in electronic form (on a tape, for example), then you can enter the data automatically into the SAP System using batch input.

Batch input ensures data integrity. Batch input enters data into the SAP System using the same transactions that interactive users do. Batch input data is therefore submitted to all of the checks and controls that apply to data entered by normal interactive means.

The batch input methods.

There are several ways to process batch input data in the SAP System.


Batch input processing methods.

The first processing method could be called "classical batch input." In it, an 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." A session stores the actions that are required to enter your data using normal SAP transactions.

When the program has finished generating the session, you can run the session to execute the SAP transactions in it. You can either explicitly start and monitor a session with the batch-input management function (System --> Services --> Batch input) or have the session run in the background processing system.
This method uses the function modules BDC_OPEN, BDC_INSERT, and BDC_CLOSE to generate sessions.

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

There is a third batch-input method using the ABAP/4 CALL DIALOG statement. However, 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.
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.

For help in selecting the method to use, please see SELECTING A BATCH-INPUT METHOS (11).

Typical uses of batch input.

Uses of batch input include the following:

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. Assume, for example, that data collection in some areas of your company is still performed by a non-SAP system. You can still consolidate all of your data in the SAP System by exporting the data from the other system and reading it into the SAP System with batch input.

You can also use batch input to transfer data between two R/3 Systems. However, there are more direct methods for doing this, such as RFC (remote function calls).

application support for batch-input.

The SAP applications provide pre-programmed support for batch input transfers for many of SAP's business objects.
To implement one of the supported data transfers, you must often write the program that exports the data from your non-SAP System. This program, known as a "data transfer" program must map the data from the external system into the data structure required by the SAP batch input program.
Should you wish to write a transfer program that executes outside the SAP System, then the SAP applications provide definitions of the required data formats for the exports. From these definitions, you can generate code for the data structures to include in your export program. You can also write such programs in ABAP/4, which lets you take advantage of the comfort and conveniences of the SAP Development Workbench.
Once you have exported the data, you can then use a standard, pre-programmed SAP report to import the data. This program uses one of the batch input methods to process the data and add it to the SAP System.

You can find information on pre-defined batch-input programs in the SAP Customizing System. Choose Tools --> Customizing. Then display either your Enterprise IMG (Implementation Guide) projects or the SAP standard IMG. In the project display, use the Expand function to display all nodes in the project. You can then search for relevant topics with the keywords batch input and transfer.

(2) TRANSFERING DATA : BATCH INPUT PROCEDURE IN OVERVIEW.

Transferring data with batch input requires the steps shown in the illustration and list below.
Note that SAP standard batch-input programs take care of several of these steps for you. For more information, please see BATCH INPUT CONCEPTS (1).



The procedure:

1. Analyze the data that is to be transferred to the SAP System.

Goal: Determine how your existing data should be mapped to the SAP data structure.
Method: You'll need to determine the structure of the data that is to be transferred into the system. Using the SAP data structure that you generate in step 2, you'll need to determine how the data to be transferred must be mapped to the SAP structure. You'll also need to determine whether any data type or data length conversions are required.

For more information, please see DATA CONVERSIONS(6).

2. Generate SAP data structures for incorporation into your data export program.

Method: Use the data structure generation function of the ABAP/4 dictionary to generate data structures for SAP tables in any of several programming languages.
If you are using one of SAP's standard batch input programs, then use of this function is required. The standard batch input programs generally require that you use a special pre-defined data structure.

For more information, please see GENERATING AN SAP DATA STRUCTURE(5).

If you're writing your own batch input procedure, then you will need to determine the data structure on your own. You'll need to analyze the SAP transactions to find the names of the fields that the transaction requires. For more information, please see ANALYSING SAP TRANSACTIONS(4).

3. Code your data transfer program. You can write the program in ABAP/4 or as an external program. You'll find more information in WRITING A DATA TRANSFER PROGRAM(3).

4. Export the data that is to be transferred to a sequential file.

Requirements:

The file must use the logical format required by the batch-input program that will import the file (step 6).

Reading and interpreting the file is much easier if you write it in ASCII or EBCDIC
(character) format rather than, for example, writing numeric data in hexadecimal format.

Character format is required by the pre-defined SAP batch input programs.

5. If necessary, code the ABAP/4 batch input program that will read in the data to be transferred from your file.

SAP supplies ready-to-run batch-input programs for most of the SAP applications.

For more information on writing your own program, see WRITING A BATCH INPUT PROGRAM : PROCEDURE IN OVERVIEW(10).

6. Process the data and add it to the SAP System. You can do this either by:

GENERATING A BATCH-INPUT SESSION(A) ; or
by processing data directly in your batch-input program with the ABAP/4 statement
CALL TRANSACTION USING (19).

7. Check that all data has been successfully processed.

Method: Analyze the batch input processing log. If you are using CALL TRANSACTION USING, then you will need to analyze the processing messages collected by your program.
You'll find more information on running and analyzing sessions and logs in MANAGING BATCH-INPUT SESSIONS(B).

8. Correct and re-process erroneous data.

Method: You can use the batch-input management function to process erroneous transactions interactively. You can correct data during this interactive processing.



A.GENERATING A BATCH-INPUT SESSION.


One of the two recommended ways to process batch input data is to store the data in a batch input session. This session can then be run in the SAP System to enter the batch input data into the system.

In general, preparing a session is the best and most comfortable way to process batch input data. However, you may wish to use the alternate method, CALL TRANSACTION USING, if your batch input sessions cannot be run quickly enough. For more information on choosing the best batch input method, see SELECTING A BATCH-INPUT METHOD(11).

Creating, Filling, and Closing a Batch Input Session

To create a session, program the following procedure using the following BDC_ function modules:

1. Open the batch input session using function module BDC_OPEN_GROUP (15) .
2. For each transaction in the session:

a. Fill the BDCDATA structure with values for all screens and fields that must be
processed in the transaction. For more information, please see USING THE
BATCH-INPUT DATA STRUCTURE (12).

b. Transfer the transaction to the session with BDC_INSERT (16) .

3. Close the batch input session with BDC_CLOSE_GROUP (17).

The following topics describe these function modules. See SAMPLE BATCH INPUT PROGRAM(22) for an example of how the function modules are used.

No comments:

Archives