2007 May 15 11:51 AM
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
2007 May 15 12:24 PM
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
2007 May 15 11:57 AM
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.
2007 May 15 12:05 PM
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>
2007 May 15 12:10 PM
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^
2007 May 15 12:24 PM
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
2007 May 15 12:32 PM
<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>
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |