Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to capture error message?

How to capture error message like below in to the string?

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

Regards

Ronny

Tags:
Former Member
Former Member replied

Hello Ronny,

try

Data:

wa_error(150) type C.

          • Call Function/BAPI

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = sy-msgid

no = sy-msgno

v1 = sy-msgv1

v2 = sy-msgv2

v3 = sy-msgv3

v4 = sy-msgv4

IMPORTING

msg = wa_err

EXCEPTIONS

not_found.

If wa_err is not initial.

Write:/ 'This error occurred: ', wa_err.

endif.

Regards,

C

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question