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

Regarding Session Method

Former Member
0 Likes
472

Hi Friends ,

I have problem in BDC.

if the call transaction fails, at leasT it will create the session with the data and the users can go in SM35 and execute the session to trouble shoot.

FOR THIS PURPOSE I WRITE CODE AS FOLOOWOS

call transaction 'WSO1' using bdcdata mode 'A'

update 'A'

messages into itab_messages.

if sy-subrc eq 0.

get parameter id 'MAT' field e_new_sposi.

else.

  • loop at itab_messages.

  • write : itab_messages.

  • endloop.

  • if sy-subrc <> 0 .

  • Create session , if call transaction fails.

concatenate sy-uname sy-uzeit into p_session.

call function 'BDC_OPEN_GROUP'

exporting

client = sy-mandt

group = p_session

keep = 'X'

user = sy-uname

exceptions

client_invalid = 1

destination_invalid = 2

group_invalid = 3

group_is_locked = 4

holddate_invalid = 5

internal_error = 6

queue_error = 7

running = 8

system_lock_error = 9

user_invalid = 10

others = 11.

  • if sy-subrc ne 0.

  • message e000(ZV) with ' ERROR CREATING BDC SESSION '.

  • endif.

call function 'BDC_INSERT'

exporting

tcode = i_tcode

tables

dynprotab = bdcdata

exceptions

internal_error = 1

not_open = 2

queue_error = 3

tcode_invalid = 4

others = 5.

call function 'BDC_CLOSE_GROUP'

exceptions

not_open = 1

queue_error = 2

others = 3.

message i000(zi) with 'Transaction could not be'

'processed. Please process the session'

p_session

'in SM35 to find out the errors.'.

raise x_transaction_failure.

endif.

BUT IT IS NOT WORKING WHEN SY-SUBRC NOT EQUAL TO 0 IT IS RUNNING CALL TRANSACTION METHOD ..

ANY BODY CAN HELP ME

THANKS

maheedhar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
444

Hi,

if error occurs in call trans ,even it is error in session also.

Here u can save the error records in session ie,when

sy-subrc <> 0,then that is passed to session is created

and we can find incorresct sessions

3 REPLIES 3
Read only

Former Member
0 Likes
445

Hi,

if error occurs in call trans ,even it is error in session also.

Here u can save the error records in session ie,when

sy-subrc <> 0,then that is passed to session is created

and we can find incorresct sessions

Read only

Former Member
0 Likes
444

hi,

try this link for help

http://www.sap-img.com/ab001.htm

Read only

Former Member
0 Likes
444

hello,

this may look silly but try using

<b>it_bdcmsgcoll like bdcmsgcoll occurs 1 with header line.

if it_bdcmsgcoll-msgtyp = 'E'.</b><whatever u have written right now...>

<b>endif.</b>