Application Development and Automation 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: 
Read only

Difference between call transaction & session method?

Former Member
0 Likes
1,943

HI all,

Wha tis the Difference between call transaction & session method?

regards

JK

8 REPLIES 8
Read only

Former Member
0 Likes
1,878

Hi,

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.

6)supports multiple transactions

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

6)supports single transaction

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.

rgds,

bharat.

Read only

Former Member
0 Likes
1,878

HI,,

Here the differences betrween session and call transaction

session method

1) asynchronous process

2)synchronous update

3)multiple transactions can be handled (Menas u can upload the data at a time formore than one t-code)

4)huge amount of data can be uploaded.

5)implicit error handling (Menas for errors SM35)

6)execute the session on a specific date. (by using hold date parameter)

7) Time requirement is more

Call transaction:

1)asynchronous process

2)asynchronous /synchronous update

3) single transaction only handled

4)small amount of data uplaoded

5)explicit error handling (Menas all the error records move to internal table and validate)

6) Time requirement is low.

and also look at this link

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

Read only

Former Member
0 Likes
1,878

Hi

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

Call transaction is faster then session method. But usually we use session method in real time...because we can transfer large amount of data from internal table to database and if any errors in a session. Process will not complete until session get correct.

Session method:

1. This method is used to upload huge data

2 it has error log so that v can trace the errors easily.

3. it slower than call transaction method.

Call transaction:

1. This very fast than session method.

2. This is used to upload small volume of data.

3.Error tracing is bit difficult and v use MSGBDCCALL to get the error message.

PLZ REWARD IF USEFUL

vivek

Read only

ak_upadhyay
Contributor
0 Likes
1,878

Hi,

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.

6)supports multiple transactions

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

6)supports single transaction

Reward points if useful.....

Regards

AK

Read only

Former Member
0 Likes
1,878

HI

Session Method works in Background and as well as in Foreground. Where as Call Transaction Method Works in Foreground. (Note: No Display Mode is equal to Background Processing in call transaction method).

Session Method can handle Multiple Applications at a time. Where as Call Transaction Method can handle only one Application.

Session Method holds Log File by Default. Where as in Call Transaction Method no Log File by Default. We have to design Log File by using BDCMSGCOLL.

Session Method Updates the Database Synchronously. Call Transaction Method Updates the Database Asynchronously. (Note: Asynchronous updation is Faster than Synchronous)

Session Method :

session method can work both foreground and background.

log file is created for this.

useful to transfer large amount of data.

in session method updation is synchronous and processing is asynchrounous.

it can be used for any no of applications at a time.

all the sessions, we have created are stored in a queue.

if we forget to set the processing then our session will be automatically deleted from the queue.

Call transaction Method :

call transaction method is faster because we can can change the updation mode from synchronous to asynchronous (and asynchronous method is faster than synchronous method)

mode : n (acts as background )

log file will not be created whereas the errors has to be handled explicitly using itab like bdcmsgcoll and we should use the function module 'FORMAT_MESSAGE' .

only one application will be considered.

lsmw does not support call transaction method because errors has to handled explicitly.

Read only

Former Member
0 Likes
1,878

Hi,

Session Call Transaction

Return Code No Yes

DB update Sychnronous asychnronous

Processing

Read only

Former Member
0 Likes
1,878

Hi,

Session :

Return code : no

DB Update : Synchronous

Processing: Time delayed

Transactions : More than one can be handled

Error Log: Will be created

Call Transaction

Return code :Yes

DB Update : ASynchronous

Processing: Immediately

Transactions :only one can be handled

Error Log: Will not be created.

Regards,

Sindhu

Read only

Former Member
0 Likes
1,878

Hello Janardhan,

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.

6) Supports multiple transactions by using BDC_INSERT

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

6)supports single transaction

To get a clear picture, youhave to work with these Programs...

I will provide you a BDC progarm..with call tarnscation and Session method. Go through it and work with it....So that, you will get a brief ides abt these two methods...

Let us start with Recording proces

Before getting started with the Recording process...we have to know the transcation code. We do recording to record the screen number, screen values, Button values(OK codes) ...etc

For example...while recording we create a record using some t-code (Say MM01) ...Now, we will create a materail master record using the Recording process.

Let us see the process of recoding a single record with MM01 using SHDB(A tool used to record the details of T-code)

Go through these steps for recording by using SHDB.

How to use recording :

Go to SHDB

--> Click on New Recording

--> Provide any name in Recording , For ex: Z_CHAITU

--> Provide the Transaction name as “MM01”

--> Select the update mode as Synchrounous or Asynchrounus method

--> Click on Start Recording button.

--> It will display MM01 screen….type the appropriate

information in it.

--> Type the Material no as : 4567E (Any no, But there should b 1 Character in it)

--> Type Checmical Industry in INDUSTRY SECTOR

--> Type COUPONS in MATERIAL TYPE

--> Now click on Select Views button.

--> Select BASIC DATA 1

--> Click on Ok button

--> Under Basic data tab under Material, it will display the Material number.

--> Type the short description and “Provide EA as Base Unit Of Measure”

--> CLICK ON BACK AND IT WILL ASK U TO SAVE THE DATA, CLICK ON YES

--> Again click on Back, it will ask if u wish to save the changes to record entries.

-> Click on Yes

--> Now, u will be in Initial screen

--> Select the record and Click on Program button

--> Now, provide any program name

--> Now, select ‘Transfer from recording’

--> Click on Tick mark

--> Give some short description

--> Type as Executable

--> Click on Source Code button

--> Automatically the code will appear in SE 38 program.

U can try these steps with any T-code by knowing the Mandatory fields in it.

---> Now by following all the above steps ur done with the recording process to create a single record in MAterail master (MM01). Now, we use the same recording process and put this recording under Loop in report program.

So that, it will follow the same steps automatically to create materail master records from the flat file. If you have 10 records in flat file(Note pad) then it will do the same process for 10 times to upload 10 records from the flat file using the recoding process that we have done by using the SHDB

If you want then i will provide you with the sample program to upload the data for MK01 using Call transcation and Session method.

Call transcation method for MK01:

U can try these steps with any T-code by knowing the Mandatory fields in it.

& TITLE : BDC FOR MK01

*& DESCR : UPLOAD THE DATA THROUGH FLAT FILE

*& TRANSPORT : DOLK901203

*& VERSION : V1

*& DATE : 17th , JAN , 2008

&----


&

report Z24_BDC_MK01

no standard page heading line-size 255.

&----


&

*& DECLARATIONS OF STRUCTURE FOR MK01

&----


&

TYPES : BEGIN OF TY_MK01 ,

KTOKK TYPE RF02K-KTOKK ,

NAME1 TYPE LFA1-NAME1 ,

SORTL TYPE LFA1-SORTL ,

PSTLZ TYPE LFA1-PSTLZ ,

LAND1 TYPE LFA1-LAND1 ,

END OF TY_MK01 .

&----


&

*& DECLARATION OF INTERNAL TABLE

&----


&

DATA : T_MK01 TYPE STANDARD TABLE OF TY_MK01 INITIAL SIZE 0 ,

T_BDCDATA TYPE STANDARD TABLE OF BDCDATA INITIAL SIZE 0 ,

T_BDCMSGCOLL TYPE STANDARD TABLE OF BDCMSGCOLL INITIAL SIZE 0 ,

T_ERROR TYPE STANDARD TABLE OF TY_MK01 INITIAL SIZE 0 ,

&----


&

*& DECLARATION OF WORK AREA

&----


&

W_MK01 TYPE TY_MK01 ,

W_BDCDATA TYPE BDCDATA ,

W_BDCMSGCOLL TYPE BDCMSGCOLL .

&----


&

*& DECLARATION OF SELECTION SCREEN

&----


&

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME .

PARAMETERS : P_FILE TYPE FILENAME .

SELECTION-SCREEN END OF BLOCK B1 .

&----


&

*& DECLARATION OF START-OF-SELECTION

&----


&

START-OF-SELECTION .

PERFORM SUB_UPLOAD_DATA .

PERFORM SUB_POPULATE_BDC .

PERFORM SUB_ERROR_REC .

*include bdcrecx1.

&----


*& Form SUB_UPLOAD_DATA

&----


text

-


form SUB_UPLOAD_DATA .

DATA : L_FILE TYPE STRING .

L_FILE = P_FILE .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = L_FILE

HAS_FIELD_SEPARATOR = 'X'

tables

data_tab = T_MK01 .

endform. " SUB_UPLOAD_DATA

&----


*& Form SUB_POPULATE_BDC

&----


text

-


form SUB_POPULATE_BDC .

LOOP AT T_MK01 INTO W_MK01 .

DATA : L_MSG TYPE STRING .

REFRESH T_BDCDATA .

perform bdc_dynpro using 'SAPMF02K' '0107'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-KTOKK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-KTOKK'

W_MK01-KTOKK.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-LAND1'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFA1-NAME1'

W_MK01-NAME1.

perform bdc_field using 'LFA1-SORTL'

W_MK01-SORTL.

perform bdc_field using 'LFA1-PSTLZ'

W_MK01-PSTLZ.

perform bdc_field using 'LFA1-LAND1'

W_MK01-LAND1.

perform bdc_dynpro using 'SAPMF02K' '0120'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-KUNNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-LIFNR'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

CALL TRANSACTION 'MK01' USING T_BDCDATA MODE 'N' MESSAGES INTO T_BDCMSGCOLL .

IF SY-SUBRC 0 .

APPEND W_MK01 TO T_ERROR .

ENDIF .

CLEAR W_BDCMSGCOLL .

READ TABLE T_BDCMSGCOLL INTO W_BDCMSGCOLL INDEX 1 .

CLEAR L_MSG .

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = W_BDCMSGCOLL-MSGID

LANG = SY-LANGU

NO = W_BDCMSGCOLL-MSGNR

V1 = W_BDCMSGCOLL-MSGV1

V2 = W_BDCMSGCOLL-MSGV2

V3 = W_BDCMSGCOLL-MSGV3

V4 = W_BDCMSGCOLL-MSGV4

IMPORTING

MSG = L_MSG

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2

.

IF sy-subrc = 0.

WRITE : / 'MESSAGE FOR ' , W_MK01-KTOKK ,'-------' , L_MSG .

ENDIF.

ENDLOOP .

endform. " SUB_POPULATE_BDC

-


Start new screen *

-


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR W_BDCDATA.

W_BDCDATA-PROGRAM = PROGRAM.

W_BDCDATA-DYNPRO = DYNPRO.

W_BDCDATA-DYNBEGIN = 'X'.

APPEND W_BDCDATA TO T_BDCDATA .

ENDFORM.

-


Insert field *

-


FORM BDC_FIELD USING FNAM FVAL.

CLEAR W_BDCDATA.

W_BDCDATA-FNAM = FNAM.

W_BDCDATA-FVAL = FVAL.

APPEND W_BDCDATA TO T_BDCDATA .

ENDFORM.

&----


*& Form SUB_ERROR_REC

&----


text

-


--> p1 text

<-- p2 text

-


form SUB_ERROR_REC .

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:/ERRORS OF MK01.TXT'

WRITE_FIELD_SEPARATOR = 'X'

tables

data_tab = T_ERROR .

endform. " SUB_ERROR_REC

Session Method for MK01:

**&----


**

*& PURPOSE : This BDC report is used to upload all the vendor master

*& data in to SAP using SESSION METHOD with handling the errors

**&----


**report Y035_SESSION_METHOD

no standard page heading line-size 255.

&----


*& Structure declaration

&----


*Structure Declaration for source internal table

TYPES : BEGIN OF TY_UPLOAD,

LIFNR TYPE RF02K-LIFNR,

EKORG TYPE RF02K-EKORG,

KTOKK TYPE RF02K-KTOKK,

NAME1 TYPE LFA1-NAME1,

SORTL TYPE LFA1-SORTL,

LAND1 TYPE LFA1-LAND1,

SPRAS TYPE LFA1-SPRAS,

WAERS TYPE LFM1-WAERS,

END OF TY_UPLOAD.

&----


*& Internal Table declaration

&----


*Internal Table Declaration for source table

DATA : T_UPLOAD TYPE STANDARD TABLE OF TY_UPLOAD INITIAL SIZE 0,

*Internal Table Declaration for bdcdata

T_BDCDATA TYPE STANDARD TABLE OF BDCDATA INITIAL SIZE 0,

*Internal table declaration for BDCMSGCOLL (To handle the errors)

T_BDCMSG TYPE STANDARD TABLE OF BDCMSGCOLL,

*Internal table declaration for reprocess the errors

T_ERRORS TYPE STANDARD TABLE OF TY_UPLOAD INITIAL SIZE 0,

&----


*& Workarea declaration

&----


*Work area delaration for source table

W_UPLOAD TYPE TY_UPLOAD,

*Work area delaration for bdcdata

W_BDCDATA TYPE BDCDATA,

*Work area delaration for BDCMSGCOLL

W_BDCMSG TYPE BDCMSGCOLL.

&----


*& Selection screen declaration

&----


*Selection Screen declaration

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

PARAMETERS : P_FLNAME TYPE FILENAME.

SELECTION-SCREEN END OF BLOCK B1.

&----


*& Start of selection declaration

&----


*Start of selection declaration

START-OF-SELECTION.

*Upload the data

PERFORM SUB_UPLOAD_DATA.

*Populate the BDC data

PERFORM SUB_POPULATE_BDC.

*Process the error records

PERFORM SUB_ERROR_RECORD.

*include bdcrecx1.

&----


*& Form SUB_UPLOAD_DATA

&----


This subroutine is used to upload the data

-


FORM SUB_UPLOAD_DATA .

DATA : L_FLNAME TYPE STRING.

L_FLNAME = P_FLNAME.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = L_FLNAME

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = T_UPLOAD.

ENDFORM. " SUB_UPLOAD_DATA

&----


*& Form SUB_POPULATE_BDC

&----


This subroutine is used to populate the BDC data

-


FORM SUB_POPULATE_BDC .

DATA : L_MSG TYPE STRING.

*To oper a sesion in SE35

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = 'MAMA_SESSION'

USER = SY-UNAME

KEEP = 'X'

HOLDDATE = '20080129'

PROG = SY-CPROG.

LOOP AT T_UPLOAD INTO W_UPLOAD.

REFRESH T_BDCDATA.

perform bdc_dynpro using 'SAPMF02K' '0107'.

perform bdc_field using 'BDC_CURSOR' 'RF02K-KTOKK'.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_field using 'RF02K-LIFNR' W_UPLOAD-LIFNR.

perform bdc_field using 'RF02K-EKORG' W_UPLOAD-EKORG.

perform bdc_field using 'RF02K-KTOKK' W_UPLOAD-KTOKK.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR' 'LFA1-SPRAS'.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_field using 'LFA1-NAME1' W_UPLOAD-NAME1.

perform bdc_field using 'LFA1-SORTL' W_UPLOAD-SORTL.

perform bdc_field using 'LFA1-LAND1' W_UPLOAD-LAND1.

perform bdc_field using 'LFA1-SPRAS' W_UPLOAD-SPRAS.

perform bdc_dynpro using 'SAPMF02K' '0120'.

perform bdc_field using 'BDC_CURSOR' 'LFA1-KUNNR'.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_dynpro using 'SAPMF02K' '0310'.

perform bdc_field using 'BDC_CURSOR' 'LFM1-WAERS'.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_field using 'LFM1-WAERS' W_UPLOAD-WAERS.

perform bdc_dynpro using 'SAPMF02K' '0320'.

perform bdc_field using 'BDC_CURSOR' 'RF02K-LIFNR'.

perform bdc_field using 'BDC_OKCODE' '=ENTR'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE' '=YES'.

*Transfer data to the session

  • For multiple transcations u have to call this FM again and *provide diff T code...For Ex : MM01

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'MK01'

TABLES

dynprotab = T_BDCDATA.

ENDLOOP.

*To close the session

CALL FUNCTION 'BDC_CLOSE_GROUP'.

ENDFORM. " SUB_POPULATE_BDC

-


Start new screen *

-


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR W_BDCDATA.

W_BDCDATA-PROGRAM = PROGRAM.

W_BDCDATA-DYNPRO = DYNPRO.

W_BDCDATA-DYNBEGIN = 'X'.

APPEND W_BDCDATA TO T_BDCDATA.

ENDFORM.

-


Insert field *

-


FORM BDC_FIELD USING FNAM FVAL.

CLEAR W_BDCDATA.

W_BDCDATA-FNAM = FNAM.

W_BDCDATA-FVAL = FVAL.

APPEND W_BDCDATA TO T_BDCDATA.

ENDFORM.

&----


*& Form SUB_ERROR_RECORD

&----


This subroutine is used to process the error records

in to a file T_ERRORS

-


FORM SUB_ERROR_RECORD .

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = 'C:\MAMA_ERRORS.TXT'

WRITE_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = T_ERRORS.

ENDFORM. " SUB_ERROR_RECORD

Hope the Explonation and information I had provided will resolve your issue.

Reward points if information is very Helpful.

Have a great day!

Regards,

Krishna Chaitanya