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

BDC using both call transaction and session

Former Member
0 Likes
916

Hi Experts ,

I had one doubt regarding bdc...

what is the use of using both call transaction and session at a time in one program?

please give clear view..

thanks in advance

1 ACCEPTED SOLUTION
Read only

former_member223446
Active Participant
0 Likes
853

where as in call transaction we can do error handling explictly.those errors are stored in one file .this file will send to the error log(session method),i.e session log.

in the above case we use both call transaction n session method at time in one program.sample code is below ,go through it .

data : begin of itxk01 occurs 0,

end of itxk01.

data : bdcdata like itbdcdata occurs 0 with header line.

data : itbdcmsgcoll like itbdcmsgcoll occurs 0 with header line,

itxk01 like itxk01-dup occurs 0 with header line.

call gui-upload.

-


-


loop at itxk01.

refresh itxk01.

perform bdc-dynpr0 using 'prg' 'scr'

perform bdc-dynfld using fnam fval

-


-


call transaction 'xk01' using bdcdata mode 'a' update 's' messages into itbdcmsgcoll.

if sy-subrc ne 0.

append itxk01 into itxk01-dup.

endif.

endloop.

if not itxk01-dup[] is initial.

refresh itck01.

call bdc_open_group

-


-


itxk01 = itxk01-dup.

loop at itxk01.

refresh itxk01.

perform bdc-dynpr0 using 'prg' 'scr'

perform bdc-dynfld using fnam fval

-


-


call bdc-insert.

-


endloop.

call bdc-close-group.

form bdc-dynpr0 using pr sc

-


endform .

form bdc-field using fnam faval

-


endform.

this will help u.

reward points for me

kiran

where as in call transaction we can do error handling explictly.those errors are stored in one file .this file will send to the error log(session method),i.e session log.

in the above case we use both call transaction n session method at time in one program.sample code is below ,go through it .

data : begin of itxk01 occurs 0,

end of itxk01.

data : bdcdata like itbdcdata occurs 0 with header line.

data : itbdcmsgcoll like itbdcmsgcoll occurs 0 with header line,

itxk01 like itxk01-dup occurs 0 with header line.

call gui-upload.

-


-


loop at itxk01.

refresh itxk01.

perform bdc-dynpr0 using 'prg' 'scr'

perform bdc-dynfld using fnam fval

-


-


call transaction 'xk01' using bdcdata mode 'a' update 's' messages into itbdcmsgcoll.

if sy-subrc ne 0.

append itxk01 into itxk01-dup.

endif.

endloop.

if not itxk01-dup[] is initial.

refresh itck01.

call bdc_open_group

-


-


itxk01 = itxk01-dup.

loop at itxk01.

refresh itxk01.

perform bdc-dynpr0 using 'prg' 'scr'

perform bdc-dynfld using fnam fval

-


-


call bdc-insert.

-


endloop.

call bdc-close-group.

form bdc-dynpr0 using pr sc

-


endform .

form bdc-field using fnam faval

-


endform.

this will help u.

reward points for me

kiran

5 REPLIES 5
Read only

Former Member
0 Likes
853

hi,

First, we go by call transaction method., and we process session for those records that have failed in call transation method.

Errors need to be handled explicitly in case of call transaction method.

Regards

Sailaja.

Read only

Former Member
0 Likes
853

Hi Bhiragani,

First call transaction is used to upload the data and if any errors occur then those error records are processed using session because call transaction doesn't provide error logging facility. Session methods error log can be used for error handling.

Regds,

Younus

<b>Reward Helpful Answers!!!</b>

Read only

Former Member
0 Likes
853

HI

GOOD

there is some kind of requirement where you need to use both the call transaction and the session method,suppose you have some data in the flat file and y ou want to upload that data using both the methods,in that case you can use the both methods for the upload of data.

In different case suppose you want to give the option for the user to upload or download the data using the call transaction or session method,in that case you can use both the opetion and in the selection screen y ou can give the option for both,

thanks

mrutyun^

Read only

former_member223446
Active Participant
0 Likes
854

where as in call transaction we can do error handling explictly.those errors are stored in one file .this file will send to the error log(session method),i.e session log.

in the above case we use both call transaction n session method at time in one program.sample code is below ,go through it .

data : begin of itxk01 occurs 0,

end of itxk01.

data : bdcdata like itbdcdata occurs 0 with header line.

data : itbdcmsgcoll like itbdcmsgcoll occurs 0 with header line,

itxk01 like itxk01-dup occurs 0 with header line.

call gui-upload.

-


-


loop at itxk01.

refresh itxk01.

perform bdc-dynpr0 using 'prg' 'scr'

perform bdc-dynfld using fnam fval

-


-


call transaction 'xk01' using bdcdata mode 'a' update 's' messages into itbdcmsgcoll.

if sy-subrc ne 0.

append itxk01 into itxk01-dup.

endif.

endloop.

if not itxk01-dup[] is initial.

refresh itck01.

call bdc_open_group

-


-


itxk01 = itxk01-dup.

loop at itxk01.

refresh itxk01.

perform bdc-dynpr0 using 'prg' 'scr'

perform bdc-dynfld using fnam fval

-


-


call bdc-insert.

-


endloop.

call bdc-close-group.

form bdc-dynpr0 using pr sc

-


endform .

form bdc-field using fnam faval

-


endform.

this will help u.

reward points for me

kiran

Read only

Former Member
0 Likes
853

<b>Hi,

I will let you know the real time example.

I have an requrement to post the invoice through idoc.

The invoice will be posted through bdc call transaction. if this is successful, then invoice will be created orelse, if it is failure, then the errors should be captured in an internal table .

At this moment we need to see, what are the errors occured while posting invoice. at this time, we can use the session method, to create an session and process that, by that we can understand the errors.

Thanks

Manju.</b>