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

catching error message from standard function module to internal table.

Former Member
0 Likes
1,180

Hi,

i am calling a FM in my custom prog.

After execution of the FM some auto generated errors is getting displayed.

I want to pass this error to an internal table.

Please tell me how to do this?

CALL FUNCTION 'FORMAT_CHECK'

EXPORTING

i_checkrule = t005-prbkn

i_checkfield = it_ven-bankn

i_checklength = t005-lnbkn

i_checkmask = space

i_fname = fname

EXCEPTIONS

not_valid = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

I want to catch this particular error message in the itab.

Thanks,

SAM.

3 REPLIES 3
Read only

Sm1tje
Active Contributor
0 Likes
731

use message xxxx into gv_message.

gv_message type char200 (or alike).

example:

data: msgtext type char200.

MESSAGE E004 WITH 'bla bla bla' INTO msgtext.

Edited by: Micky Oestreich on Apr 2, 2008 5:44 PM

Read only

Former Member
0 Likes
732

Thanks.

We can call FM 'FORMAT_MESSAGE' to get it in itab.

Read only

Former Member
0 Likes
732

Even we can create an internal table nad move the messages to it.

DATA : BEGIN OF L_ERR OCCURS 0,

SNO LIKE SY-tabix, "serial no

MSGTY LIKE SY-MSGTY, "message type

MSGNO LIKE SY-MSGNO, "message no

ERR_TEXT LIKE T100-TEXT, "message text

END OF L_ERR.

IF SY-SUBRC <> 0.

L_ERR-SNO = SY-TABIX.

L_ERR-MSGTY = SY-MSGTY.

L_ERR-MSGNO = SY-MSGNO.

L_ERR-ERR_TEXT = TEXT-015. "Problem encounterd in uploading data.

APPEND L_ERR.

clear L_ERR.

ENDIF.