Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Difference between session method & call transaction method (BDC)

Former Member
0 Kudos

Hi,

Can any one explain me with one example about, the Difference between Session Method & Call Transaction Method in BDC.

Can any one tell me in brief what for BDC's are used.

Plz help me regarding this , i need urgent.

Regards,

Pooja

8 REPLIES 8

Former Member
0 Kudos

Hi Pooja,

BDC:

Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.

Features :

BDC is an automatic procedure.

This method is used to transfer large amount of data that is available in electronic medium.

BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).

BDC uses normal transaction codes to transfer data.

Types of BDC :

CLASSICAL BATCH INPUT (Session Method)

CALL TRANSACTION

Session method.

1) synchronous processing.

2) can tranfer large amount of data.

3) processing is slower.

4) error log is created

5) data is not updated until session is processed.

Call transaction.

1) asynchronous processing

2) can transfer small amount of data

3) processing is faster.

4) errors need to be handled explicitly

5) data is updated automatically

Check these link:

http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm

http://www.sap-img.com/abap/question-about-bdc-program.htm

http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/

http://www.planetsap.com/bdc_main_page.htm

For BDC:

http://myweb.dal.ca/hchinni/sap/bdc_home.htm

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&;

http://www.sap-img.com/abap/learning-bdc-programming.htm

http://www.sapdevelopment.co.uk/bdc/bdchome.htm

http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm

http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm

http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html

Regards,

Priyanka.

0 Kudos

Thanks for ur reply.

It helped me a lot.

Regards,

Pooja

0 Kudos

Hi,

SESSION method:

Is a standard procedure for transferring large amount of data into the R/3 system.

Data consistency is ensured because batch input uses all thje checks conducted on the normal screen.

It is a two step procedure:

1. Progarm: creates batch input session. This session is the data file that includes everything to begin the transaction.

2. Process session: Which then actually transfers the data to database table.

In this method an ABAP/4 program reads the external data that is to be entered in the SAP system and stores the data in a session.

A session stores the actions that are required to enter your data using normal SAP transactions i.e. data is transferred to session which inturn transfers data to database table. Session is an intermediate step between internal table and database table.

Data along with it's actions are stored in session. i.e. data for screen fields, to which screen it is passed, the program name behind it and how next screen is processed.

When the program has finished generating the session, u can run the session to execute the SAP transactions in it.

BDC_OPEN_GROUP

You create the session through program by BDC_OPEN_GROUP function.

1) User Name: User Name.

2) Group : Name of the session

3) Lock Date : The date when you want to process the session.

4) Keep : This parameter is passed as 'X' when you want to retain session even after processing it.

BDC_INSERT

Data is transferred to session by BDC_INSERT.

BDC_CLOSE_GROUP.

With this function the session will be closed.

CALL TRANSACTION method.

Syntax: call transaction <tr code> using <bdctab>

mode <A/N/E>

update <S/A>

messages into <internal table>.

<tr code> : transaction code

<bdctab> : Name of the BDC table

mode: mode in which you execute the transaction.

A : all screen mode ( all the screens of the transaction are displayed )

N : no screen mode ( no screen will be displayed when you execute the transaction )

E : error screen ( only those screens are displayed where in you have error record )

Update type:

S: synchronous update in which if you change data of one table then all the related tables gets updated and SY_SUBRC is returned for once and all.

A: asynchronous update in which if you change data of one table, the sy-subrc is returned and then updation of other affected tables takes place. So if system fails to update other tables still sy-subrc returned is zero.(that is when first table gets updated ).

messages: if you update database table, operation is either successful or unsuccessful. These messages are stored in internal table. This internal table structure is like BDCMSGCOLL.

TCODE: transaction code.

DYNAME: batch input module name.

DYNNUMB: batch input dyn no.

MSGTYP: batch input message type.

MSGSPRA: batch input language id of message.

MSGID: message id.

MSGV1….MSGV5: message variables

For each entry which is updated in the database table message is available in BDCMSGCOLL.

Reward if useful

Regards

sanjay

Former Member
0 Kudos

Hi,

BDC allows you to perform database updates in the background using standard SAP transactions.

The resultant entries will be as if the user had manually entered the data via SAP. This means

that you do not bypass any of the standard SAP consistency checks, authorisations etc.

There are two main methods of ABAP BDC, these are Call Transaction and Batch Input.

<b>Difference between batch input and call transaction in BDC</b>

Session method.

1) synchronous processing.

2) can tranfer large amount of data.

3) processing is slower.

4) error log is created

5) data is not updated until session is processed.

Call transaction.

1) asynchronous processing

2) can transfer small amount of data

3) processing is faster.

4) errors need to be handled explicitly

5) data is updated automatically

Hope this helps.

Reward if helpful.

Regards,

Sipra

Former Member
0 Kudos

Batch Input and CALL TRANSACTION are both data transfer methods. Batch Input usually are used to transfer large amount of data. For example you are implementing a new SAP project, and of course you will need some data transfer from legacy system to SAP system. If there is no standard batch input program, direct input program, you would need to write your own data transfer program and it is going to be batch input program. CALL TRANSACTION methods is real-time method, whenever you run the program CALL TRANSACTION can be triggered. CALL TRANSACTION is used especially for integration actions between two SAP systems or between different modules. Users sometimes wish to do something like that click a button or an item then SAP would inserts or changes data automatically. Here CALL TRANSACTION should be considered. You use CALL TRANSACTION and you do everything automatically, collect necessary data, call transaction and so do database update. If any error occurs, show the user them.

Batch Input

With the Batch Input method, an ABAP program reads the external data that is to be entered in the R/3 System and stores the data in a “batch input session”. The session records the actions that are required to transfer data into the system using normal SAP transactions.

When the program has generated the session, you can run the session to execute the SAP transactions in it. You can explicitly start and monitor a session with the batch input management function (by choosing System - Services - Batch Input), or have the session run in the background processing session.

It offers management of sessions, support for playing back and correcting sessions that contain errors, and detailed logging. Your program prepares the data and stores it in a batch input session. A session is a collection of transaction data for one or more transactions. Batch input sessions are maintained by the system in the batch input queue. You can process batch input sessions in the background processing system.

Your program must open a session in the queue before transferring data to it, and must close it again afterwards. All of these operations are performed by making function modules calls from the ABAP program.

The most important aspects of the session interface are:

Asynchronous processing

Transfer data for multiple transactions

Synchronous database update. During processing, no transaction is started until the previous transaction has been written to the database.

A batch input processing log is generated for each session

Sessions cannot be generated in parallel. The batch input program must not open a session until it has closed the preceding session.

CALL TRANSACTION

In the second method, your program uses the ABAP statement CALL TRANSACTION USING to run an SAP transaction. External data doesn’t have to be deposited in a session for later processing. Instead, the entire batch input process takes place inline in your program. With CALL TRANSACTION USING, the system process the data more quickly than with batch input sessions. Unlike batch input sessions, CALL TRANSACTION USING does not automatically support interactive correction or logging functions.

Your program prepares the data and then calls the corresponding transaction that is then processed immediately.

The most important features of CALL TRANSACTION USING are:

Synchronous processing

Transfer of data from an individual transaction each time the statement CALL TRANSACTION USING is called

You can update the database both synchronously and asynchronously. The program specifies the update type.

Separate LUW (Logical Units of Work) for the transaction. The system executes a database commit immediately before and after the CALL TRANSACTION USING statement.

No batch input processing log

Former Member
0 Kudos

Hi Pooja,

Both these methods are used to update data into transactions.While Call Transaction method enables u to update data records one by one and enables u to catch errors,if any at each end, Session method will allow u to update all the records at once .

Check these link:

http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm

http://www.sap-img.com/abap/question-about-bdc-program.htm

http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/

http://www.planetsap.com/bdc_main_page.htm

Hope this helps u...

Cheers...

Former Member
0 Kudos

Hi,

The most important aspects of the batch session interface are: - Asynchronous processing - Transfers data for multiple transactions - Synchronous database update During processing, no transaction is started until the previous transaction has been written to the database. - A batch input processing log is generated for each session - Sessions cannot be generated in parallel

The most important aspects of the CALL TRANSACTION USING interface are: - Synchronous processing - Transfers data for a single transaction - Synchronous and asynchronous database updating both possible The program specifies which kind of updating is desired. - Separate LUW for the transaction The system performs a database commit immediately before and after the CALL TRANSACTION USING statement. - No batch input processing log is generated.

Batch Data Communication (BDC) is the oldest batch interfacing technique that SAP provided since the early versions of R/3. BDC is not a typical integration tool, in the sense that, it can be only be used for uploading data into R/3 and so it is

not bi-directional.

BDC works on the principle of simulating user input for transactional screen, via an ABAP program.

Typically the input comes in the form of a flat file. The ABAP program reads this file and formats the input data screen by screen into an internal table (BDCDATA). The transaction is then started using this internal table as the input and executed in the background.

In ‘Call Transaction’, the transactions are triggered at the time of processing itself and so the ABAP program must do the error handling. It can also be used for real-time interfaces and custom error handling & logging features. Whereas in

Batch Input Sessions, the ABAP program creates a session with all the transactional data, and this session can be viewed, scheduled and processed (using Transaction SM35) at a later time. The latter technique has a built-in error processing mechanism too.

Batch Input (BI) programs still use the classical BDC approach but doesn’t require an ABAP program to be written to format the BDCDATA. The user has to format the data using predefined structures and store it in a flat file. The BI program then reads this and invokes the transaction mentioned in the header record of the file.

Direct Input (DI) programs work exactly similar to BI programs. But the only difference is, instead of processing screens they validate fields and directly load the data into tables using standard function modules. For this reason, DI programs are much faster (RMDATIND - Material Master DI program works at least 5 times faster) than the BDC counterpart and so ideally suited for loading large volume data. DI programs are not available for all application areas.

Rgds,

Prakash

Former Member
0 Kudos

Pooja,

EX : Call Session

REPORT YHUS40 .

---Declaration of internal table Fields-

data: begin of itab occurs 0,

LIFNR like RF02K-LIFNR,

KTOKK like RF02K-KTOKK,

NAME1 like LFA1-NAME1,

SORTL like LFA1-SORTL,

LAND1 LIKE LFA1-LAND1,

SPRAS(2) type c ,

END OF ITAB.

*----Declaration of Itab

DATA: I_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

----Uploading**...(Pattern).

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = 'C:\WINDOWS\DESKTOP\NIRMALA.TXT'

FILETYPE = 'ASC'

TABLES

data_tab = ITAB.

*---Call function pattren(opening).

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

GROUP = 'YHUS40'

  • HOLDDATE = SY-DATUM

KEEP = ' '

USER = SY-UNAME.

LOOP AT ITAB.

  • Filling the BDC -DATA.

perform fill_bdc_Data.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'XK01'

TABLES

dynprotab = I_BDCDATA.

REFRESH I_BDCDATA.

ENDLOOP.

CALL FUNCTION 'BDC_CLOSE_GROUP'.

&----


*& Form fill_bdc_Data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form fill_bdc_Data.

*---SCREEN 1

i_bdcdata-program = 'SAPMF02K'.

I_BDCDATA-DYNPRO = '0100'.

I_BDCDATA-DYNBEGIN = 'X'.

APPEND I_BDCDATA.

CLEAR I_BDCDATA.

i_bdcdata-FNAM = 'RF02K-LIFNR'.

I_BDCDATA-FVAL = itab-lifnr.

APPEND I_BDCDATA.

CLEAR I_BDCDATA.

i_bdcdata-FNAM = 'RF02K-KTOKK'.

I_BDCDATA-FVAL = itab-KTOKK.

APPEND I_BDCDATA.

CLEAR I_BDCDATA.

i_bdcdata-fnam = 'BDC_OKCODE' .

i_bdcdata-fval = '/00'.

append i_bdcdata.

clear i_bdcdata.

*--Second Screen

i_bdcdata-program = 'SAPMF02K'.

I_BDCDATA-DYNPRO = '0110'.

I_BDCDATA-DYNBEGIN = 'X'.

APPEND I_BDCDATA.

CLEAR I_BDCDATA.

i_bdcdata-FNAM = 'LFA1-NAME1'.

I_BDCDATA-FVAL = itab-name1.

APPEND I_BDCDATA.

CLEAR I_BDCDATA.

i_bdcdata-FNAM = 'LFA1-SORTL'.

I_BDCDATA-FVAL = itab-SORTL.

APPEND I_BDCDATA.

CLEAR I_BDCDATA.

i_bdcdata-FNAM = 'LFA1-LAND1'.

I_BDCDATA-FVAL = itab-LAND1.

APPEND I_BDCDATA.

CLEAR I_BDCDATA.

i_bdcdata-FNAM = 'LFA1-SPRAS'.

I_BDCDATA-FVAL = itab-SPRAS.

APPEND I_BDCDATA.

CLEAR I_BDCDATA.

i_bdcdata-fnam = 'BDC_OKCODE' .

i_bdcdata-fval = '/00'.

append i_bdcdata.

clear i_bdcdata.

endform. " fill_bdc_Data

Ex : Call Transaction

REPORT yhus39 .

DATA : BEGIN OF itab OCCURS 0 ,

lifnr LIKE rf02k-lifnr, "16

ktokk LIKE rf02k-ktokk , "4

name1 LIKE lfa1-name1 , "35

SORTL LIKE LFA1-SORTL , "10

land1 LIKE lfa1-land1 , "3

spras LIKE lfa1-spras, "2

END OF itab.

DATA : i_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'UPLOAD'

EXPORTING

filename = 'C:\WINDOWS\DESKTOP\BDC.TXT'

filetype = 'ASC'

TABLES

data_tab = itab.

LOOP AT itab.

PERFORM fill_bdc_data.

CALL TRANSACTION 'XK01' USING i_bdcdata

MODE 'A'

UPDATE 'S'.

REFRESH i_bdcdata.

ENDLOOP.

&----


*& Form fill_bdc_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form fill_bdc_data.

i_bdcdata-PROGRAM = 'SAPMF02K'.

i_bdcdata-DYNPRO = '0100' .

i_bdcdata-DYNBEGIN = 'X'.

append i_bdcdata.

clear i_bdcdata.

i_bdcdata-fnam = 'RF02K-LIFNR'.

i_bdcdata-fval = itab-lifnr.

append i_bdcdata.

clear i_bdcdata.

i_bdcdata-fnam = 'RF02K-KTOKK'.

i_bdcdata-fval = itab-KTOKK.

append i_bdcdata.

clear i_bdcdata.

i_bdcdata-fnam = 'BDC_OKCODE' .

i_bdcdata-fval = '/00'.

append i_bdcdata.

clear i_bdcdata.

*--- 110

i_bdcdata-program = 'SAPMF02K'.

i_bdcdata-dynpro = '0110'.

i_bdcdata-dynbegin = 'X'.

append i_bdcdata.

clear i_bdcdata.

i_bdcdata-fnam = 'LFA1-NAME1' .

i_bdcdata-fval = ITAB-NAME1.

append i_bdcdata.

clear i_bdcdata .

i_bdcdata-fnam = 'LFA1-SORTL' .

i_bdcdata-fval = ITAB-SORTL.

append i_bdcdata.

clear i_bdcdata .

i_bdcdata-fnam = 'LFA1-LAND1' .

i_bdcdata-fval = ITAB-LAND1.

append i_bdcdata.

clear i_bdcdata .

i_bdcdata-fnam = 'LFA1-SPRAS' .

i_bdcdata-fval = ITAB-SPRAS.

append i_bdcdata.

clear i_bdcdata .

i_bdcdata-fnam = 'BDC_OKCODE' .

i_bdcdata-fval = '=UPDA'.

append i_bdcdata.

clear i_bdcdata.

endform. " fill_bdc_data