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

Call Transaction,Errors

Former Member
0 Likes
371

Hi friends,

How can I trap errors in BDC using Call Transaction method?

Thanx in advance.

I promise to reward.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
347

using the following FM we can

CALL FUNCTION 'FORMAT_MESSAGE'

Use the following sample code

CALL TRANSACTION pv_tcode USING it_bdcdata

MODE ctumode "c_n

UPDATE ctupdate "c_s

MESSAGES INTO it_msgtab.

IF sy-subrc NE 0.

  • Format the error message and update the Error log table.

perform z_error_format.

endif.

&----


*& Form z_error_format

&----


  • Format the error message and update the error-log table

----


Form z_error_format.

READ TABLE it_msgtab INTO st_msgtab WITH KEY msgtyp = c_e.

IF sy-subrc <> 0.

READ TABLE it_msgtab INTO st_msgtab WITH KEY msgtyp = c_a.

ENDIF.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = st_msgtab-msgid

lang = SY-LANGU

no = st_msgtab-msgnr

v1 = st_msgtab-msgv1

v2 = st_msgtab-msgv2

v3 = st_msgtab-msgv3

v4 = st_msgtab-msgv4

IMPORTING

msg = w_errmsg

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

CLEAR w_errmsg.

ENDIF.

st_err_log-message = w_errmsg.

st_err_log-matnr = st_eord-matnr.

st_err_log-werks = st_eord-werks.

st_err_log-zeord = st_eord-zeord.

st_err_log-lifnr = st_eord-lifnr.

APPEND st_err_log TO it_err_log.

clear st_err_log.

endform. " z_error_format

Message was edited by:

Lakshmi Sekhar Reddy

Message was edited by:

Lakshmi Sekhar Reddy

2 REPLIES 2
Read only

Former Member
0 Likes
348

using the following FM we can

CALL FUNCTION 'FORMAT_MESSAGE'

Use the following sample code

CALL TRANSACTION pv_tcode USING it_bdcdata

MODE ctumode "c_n

UPDATE ctupdate "c_s

MESSAGES INTO it_msgtab.

IF sy-subrc NE 0.

  • Format the error message and update the Error log table.

perform z_error_format.

endif.

&----


*& Form z_error_format

&----


  • Format the error message and update the error-log table

----


Form z_error_format.

READ TABLE it_msgtab INTO st_msgtab WITH KEY msgtyp = c_e.

IF sy-subrc <> 0.

READ TABLE it_msgtab INTO st_msgtab WITH KEY msgtyp = c_a.

ENDIF.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = st_msgtab-msgid

lang = SY-LANGU

no = st_msgtab-msgnr

v1 = st_msgtab-msgv1

v2 = st_msgtab-msgv2

v3 = st_msgtab-msgv3

v4 = st_msgtab-msgv4

IMPORTING

msg = w_errmsg

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

CLEAR w_errmsg.

ENDIF.

st_err_log-message = w_errmsg.

st_err_log-matnr = st_eord-matnr.

st_err_log-werks = st_eord-werks.

st_err_log-zeord = st_eord-zeord.

st_err_log-lifnr = st_eord-lifnr.

APPEND st_err_log TO it_err_log.

clear st_err_log.

endform. " z_error_format

Message was edited by:

Lakshmi Sekhar Reddy

Message was edited by:

Lakshmi Sekhar Reddy

Read only

Former Member
0 Likes
347

Hi annapurna,

Run SHDB to execute ur program and at the end of the transactio u can see all the messages.

RGDS,

Durgaprasad.