Vous êtes sur la page 1sur 9

ABAP/4 Training Batch Data Communication

Batch Data Communication (BDC) In the SAP R/3 SYSTEM

Company Confidential)

Page

1 of 9

ABAP/4 Training Batch Data Communication

TABLE OF CONTENTS
1. INTRODUCTION......................................................................................................................................3 2. USING CLASSICAL BATCH INPUT METHOD..................................................................................4 3. USING THE CALL TRANSACTION USING METHOD ....................................................................7

Company Confidential)

Page

2 of 9

ABAP/4 Training Batch Data Communication

! Int"o#uction The SAP system provides a method to transfer data from one SAP system to another and also from any legacy system to the SAP system. This method is called Batch Data Communication (BDC). A#$anta%e& Uses of atch input include the follo!ing" transferring data from legacy system to the SAP System regularly transferring data that is captured y a non#SAP system into the SAP System. Data can also e transferred from one SAP system to another SAP system. T'(e& o) Batch In(ut Metho#& Classical Batch $nput $n it% an ABAP&' program reads the e(ternal data that is to e entered in the SAP System and stores the data in a ) atch#input session.) A session stores the actions that are re*uired to enter data using normal SAP transactions. +hen the program has finished generating the session% run the session to e(ecute the SAP transactions in it. The user can either e(plicitly start and monitor a session !ith the atch# input management function (System Services Batch input) or have the session run in the ac,ground processing system. This method uses the function modules BDC-.P/0% BDC-$0S/1T% and BDC-C2.S/ to generate sessions. Call Transaction Using $n the second method% the program uses the ABAP&' CA22 T1A0SACT$.0 US$03 statement to run an SAP transaction. Batch#input data does not have to e deposited in a session for later processing. $nstead% the entire atch#input process ta,es place inline in the program. Call Dialog 4ethod There is a third atch#input method using the ABAP&' CA22 D$A2.3 statement. The CA22 D$A2.3 method is no! outdated and is more comple( and less comforta le to use than the other techni*ues. All three atch#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&' Dictionary.

Company Confidential)

Page

of 9

ABAP/4 Training Batch Data Communication

*! +&in% C,a&&ica, Batch In(ut Metho# $n order to generate a Batch $nput in ABAP&' the user has to determine !hich of the t!o 4ethods to use for su mitting the data to atch input processing. This section descri es the procedure for using the standard atch input method. This method offers management of sessions% support for playing ac, and correcting sessions that contain errors% and detailed logging. The program prepares the data and stores it in a atch input session. A session is a collection of transaction data for one or more transactions. Batch input sessions are maintained y the system in the atch input *ueue. The user can process atch input sessions in the ac,ground processing system. The program must open a session in the *ueue efore transferring data to it% and must close it again after!ards. All of these operations are performed y ma,ing function module calls from the ABAP&' program. The most important aspects of the session interface are" Asynchronous processing Transfers data for multiple transactions Synchronous data ase update During processing% no transaction is started until the previous transaction has een !ritten to the data ase. A atch input processing log is generated for each session Sessions cannot e generated in parallel The atch input program must not open a session until it has closed the preceding session. Ste(& )o" &u-mittin% #ata )o" Batch P"oce&&in% 5. Analyse the transactions for !hich a BDC program. The user has to determine the se*uence of screens in the transactions and the information a out all the fields in every screen. To do this the user must run the transaction . Then select System #6 Status .This !ill give the screen num er and the module pool associated !ith this screen of the transacation. These t!o are the most important fields that the user !ould need in order to !rite the BDC program. 2! Use transaction SE3. to !rite the BDC program. $n it% an ABAP&' program reads the e(ternal data that is to e entered in the SAP System and stores the data in a ) atch#input session.) A session stores the actions that are re*uired to enter data using normal SAP transactions. This is done y asically using three functions BDC-.P/0-31.UP BDC-$0S/1T BDC-C2.S/-31.UP.

7. To create a atch input session% use the function BDC-.P/0-31.UP. This function has the follo!ing 8 parameters " Company Confidential) Page 4 of 9

ABAP/4 Training Batch Data Communication

a! "! c! d! e!

CLIENT !hich is y default set to S9-4A0DT. $t is the client in !hich the session is to e processed. /RO+P !hich is the name of the dc session . This parameter is important ecause it is !ith this name that the user !ill recogni:e the dc session in the atch input *ueue.Using this name process the dc session. +SER !hich is usually set to S9-U0A4/ . $t is the user name for starting the session in ac,ground. 0EEP indicates !hether the session should e ,ept or deleted after processing. $f ; ; then the session is deleted . $f ;<= then the session is retained even after it is successfully processed !ithout any errors. 1OLDDATE 2oc, date. The session is loc,ed and may not e processed until after the date that is specified. Default" 0o loc, date% session can e processed immediately. A loc, date is optional.

'. Populate the dcdata ta le . The user may define the ta le as follo!s" DATA" B/3$0 .> BDCDATA .CCU1S ?. $0C2UD/ ST1UCTU1/ BDCDATA. DATA" /0D .> BDCDATA. This dcdata structure has the follo!ing fields " PRO/RAM 0ame of the program. 2ength (@) DYNPRO 0um er of the screen. 2ength ('). Set this field only in the first record for the screen. DYNBE/IN $ndicates the first record for the screen. 2ength (5). Set this field to < only in the first record for the screen. (1eset to A A ( lan,) for all other records.) FNAM 0ame of a field in the screen. 2ength (78). The >0A4 field is not case#sensitive. F2AL Balue for the field named in >0A4. 2ength (57C).

8. The ne(t step is to su mit the BDC session. Use the BDC-$0S/1T function module to add a transaction to a atch input session. Specify the transaction that is to e started in the call to BDC-$0S/1T. BDC-$0S/1T ta,es the follo!ing parameters" TCODE The code of the transaction that is to e run. TC.D/ is an /<P.1T$03 parameter in the function module. DYNPROTAB The BDCDATA structure that contains the data that is to e processed y the transaction. D90P1.TAB is a ta les parameter in the function module.

Company Confidential)

Page

# of 9

ABAP/4 Training Batch Data Communication

D. The final step is to close the dc session. Use the BDC-C2.S/-31.UP function module to close a session..nce a session is closed% it can e processed. E. 1unning this program !ill create a atch input session y the name that is specified in the 31.UP parameter in the BDC-C1/AT/-31.UP function call. $! Transaction SM33 can e used to process the su mitted session. This transaction can e used to chec, the status of all BDC sessions.

Summa"' 4 C"eatin% Batch In(ut Se&&ion& " .pen Batch $nput group CA22 >U0CT$.0 ABDC-.P/0-31.UPA /<P.1T$03 C2$/0T F S9#4A0DT 31.UP F 31.UP US/1 F US/1 G//P F G//P. >ill in the Data for Transaction in an internal ta le ABDCDATAA >.14 $0S/1T-SC1//0 US$03 P1.31A4 D90P1.. C2/A1 BDCDATA. BDCDATA#P1.31A4 F P1.31A4. BDCDATA#D90P1. F D90P1.. BDCDATA#D90B/3$0 F A<A. APP/0D BDCDATA. /0D>.14. >.14 $0S/1T->$/2D US$03 >0A4 >BA2. C2/A1 BDCDATA. BDCDATA#>0A4 F >0A4. BDCDATA#>BA2 F >BA2. APP/0D BDCDATA. /0D>.14. $nsert Transacton CA22 >U0CT$.0 ABDC-$0S/1TA /<P.1T$03 TC.D/ F A4/C5A TAB2/S D90P1.TAB F BDCDATA. Close Batch $nput group CA22 >U0CT$.0 ABDC-C2.S/-31.UPA. >inally to process Batch $nput Sesion% first e(ecute the BDC ABAP. This !ill create a BDC session. 1un tran. AS478A H processes the BDC session. Company Confidential) Page % of 9

ABAP/4 Training Batch Data Communication

3! +&in% the CALL TRANSACTION +SIN/ metho# This method offers faster processing of data than atch input sessions. The program prepares the data and calls the desired transaction for immediate processing. The most important aspects of the CA22 T1A0SACT$.0 US$03 interface are" Synchronous processing Transfers data for a single transaction Synchronous and asynchronous data ase updating oth possi le The procedure for using this method is as elo!" # >ill in the Data for Transaction in an internal ta le ABDCDATAA # Use ACA22 T1A0SACT$.0 ....A CA22 T1A0SACT$.0 A4/C5A US$03 BDCDATA 4.D/ D4.D/ 4/SSA3/S $0T. 4/SSTAB.

Company Confidential)

Page

& of 9

ABAP/4 Training Batch Data Communication

The Mo#e Pa"amete" The 4.D/ parameter lets the user specify !hether the atch input processing should e displayed as it happens. A F Display everything. All screens and the data that goes in them appear !hen Program is run.This is the default setting for 4.D/ in CA22 T1A0SACT$.0 US$03. 0 F Display nothing. All screens are processed invisi ly% regardless of !hether there are errors or not. Control returns to the program as soon as transaction processing is finished. (Data ase updates ho!ever% may have ta,en place or may have not have ta,en place% depending on the value of the UPDAT/ parameter.) / F Display errors only. The transaction goes into display mode as soon as an error in one of the screens is detected. The +(#ate Pa"amete" The UPDAT/ parameter lets the user specify ho! updates produced y a transaction should e processed. A Asynchronous updating. $n this mode% the called transaction does not !ait for any updates it produces to e completed. $t simply passes the updates to the SAP update service. Asynchronous processing therefore usually results in faster e(ecution of the atch input program. S Synchronous updating. $n this mode% the called transaction !aits for any updates that it produces to e completed. /(ecution is slo!er than !ith asynchronous updating ecause called transactions !ait for updating to e completed. Io!ever% the called transaction is a le to return any update error message that occurs to the program. The Me&&a%e& Pa"amete" The 4/SSA3/S specification indicates that all system messages issued during a CA22 T1A0SACT$.0 US$03 are !ritten into the internal ta le J4/SSTAB6. The internal ta le must have the structure BDC4S3C.22. BDC4S3C.22 is a structure used for collecting messages in the SAP system. Im(o"tant Point& Certain points should e ta,en into consideration for preparing atch input !hile using create sessions or call transactions. The user must provide data to fill every re*uired field in a screen. The user can only give the initial input for a screen. $nput entered as a response to !arnings or error messages is not accepted. $f a transaction or dialog can ta,e more than one path% the program specifies the screen order for the path the transaction should ta,e. Some common errors in atch input are" The BDCDATA structure contains screens in the !rong order. The BDCDATA structure assigns a value to a field that doesnAt e(ist in the current screen. Company Confidential) Page $ of 9

ABAP/4 Training Batch Data Communication

The BDCDATA structure contains a field that is longer than its declared length.

Company Confidential)

Page

9 of 9

Vous aimerez peut-être aussi