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

Errors in Call transaction and Session method.

Former Member
0 Likes
394

Hi all

Please explain me in detail with example how to handle errors in call transaction method and session method.

Thanks in advance

Manu.

2 REPLIES 2
Read only

Former Member
0 Likes
373

Hi,

In Session Method Datawill be stored in session.In that session u can find error recods.

In CALL Transation useing 'FORMAT_MESSAGE' Function Module u can catch the errors.

ex:

LOOP AT it_messtab.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = it_messtab-msgid

lang = it_messtab-msgspra

no = it_messtab-msgnr

v1 = it_messtab-msgv1

v2 = it_messtab-msgv2

IMPORTING

msg = g_msg

EXCEPTIONS

OTHERS = 0.

IF it_messtab-msgtyp = 'S'.

it_sucess-sucess_rec = g_msg.

it_sucess-lifnr = it_header-lifnr." Based on your field

it_sucess-tabix = v_lines.

APPEND it_sucess.

ELSEIF it_messtab-msgtyp = 'E'.

it_error-error_rec = g_msg.

it_error-lifnr = it_header-lifnr.

it_error-tabix = v_lines.

APPEND it_error.

ELSE.

it_info-info_rec = g_msg.

it_info-lifnr = it_header-lifnr.

it_info-tabix = v_lines.

APPEND it_info.

ENDIF.

ENDLOOP.

LOOP AT IT_BDC_MESSAGES.

IF IT_BDC_MESSAGES-msgtyp = 'E'.

SELECT single * FROM t100 WHERE

sprsl = it_BDC_MESSAGES-msgspra

AND arbgb = IT_BDC_MESSAGES-msgid

AND msgnr = IT_BDC_MESSAGES-msgnr.

IF sy-subrc = 0.

l_mstring = t100-text.

IF l_mstring CS '&1'.

REPLACE '&1' WITH IT_BDC_MESSAGES-msgv1 INTO l_mstring.

REPLACE '&2' WITH IT_BDC_MESSAGES-msgv2 INTO l_mstring.

REPLACE '&3' WITH IT_BDC_MESSAGES-msgv3 INTO l_mstring.

REPLACE '&4' WITH IT_BDC_MESSAGES-msgv4 INTO l_mstring.

ELSE.

REPLACE '&' WITH IT_BDC_MESSAGES-msgv1 INTO l_mstring.

REPLACE '&' WITH IT_BDC_MESSAGES-msgv2 INTO l_mstring.

REPLACE '&' WITH IT_BDC_MESSAGES-msgv3 INTO l_mstring.

REPLACE '&' WITH IT_BDC_MESSAGES-msgv4 INTO l_mstring.

ENDIF.

CONDENSE l_mstring.

it_mess-msgtyp = IT_BDC_MESSAGES-msgtyp.

it_mess-lms = l_mstring.

it_mess-msgv1 = IT_BDC_MESSAGES-msgv1.

APPEND it_mess.

ELSE.

it_mess-msgtyp = IT_BDC_MESSAGES-msgtyp.

it_mess-lms = l_mstring.

it_mess-msgv1 = IT_BDC_MESSAGES-msgv1.

APPEND it_mess.

ENDIF.

ENDIF.

ENDLOOP.

ENDFORM.

Reward if useful.

Regards,

Narasimha

Read only

Former Member
0 Likes
373

Hi,

For call Transaction:

We can use session method logfile in call transaction.

1. We have to send error records in to one internal table.

2. Next for that itab we can use session method.

3. With this we will get session method log file in call transaction.

we can use funtion module WRITE_MESSAGES and FORMAT_MESSAGES to read the messeges in stead of BDCMSGC

Refer:

For session method:

If there are any error records in session, all those error records will get poulated in log .and after the session is completed , u can see error records which can be corrected and reprocessed again.

Sessions can be viewed in SM35.