SAP MESSAGE INTERFACE REUSE ABEXA



Get Example source ABAP code based on a different SAP table
  


VX_EXA_ONLY

ABAP_MSG - IF_T100_MESSAGE for Exception with Message
This example demonstrates the MESSAGE addition when an exception is raised using IF_T100_MESSAGE.

ABAP_SOURCE_CODE
DEMO CL_DEMO_RAISE_MSG_REUSE_ATTR

ABAP_DESCRIPTION
This example demonstrates the transformation of a non-class-based exception raised in a method using MESSAGE RAISING and handled during a method call using the addition EXCEPTIONS to a class-based exception. It uses the exception class CX_DEMO_T100 from the executable example for the system interface IF_T100_MESSAGE in a global exception class, which includes only the interface IF_T100_MESSAGE and not IF_T100_DYN_MSG.
The properties of the message sent using MESSAGE RAISING are available in the system fields sy-msgty, sy-msgid, sy-msgno, and sy-msgv1 to sy-msgv4 after the exception has been caught.
sy-msgid and sy-msgno are used after the addition MESSAGE of the statement RAISE EXCEPTION to associate the exception object with the message.
sy-msgv1 to sy-msgv4 are assigned to the input parameters of the instance constructor and these are automatically assigned to the identically named attributes.
sy-msgty cannot be passed in this case.
The executable example for the system interface IF_T100_DYN_MSG in a global exception demonstrates how all properties of the message can be specified after the addition MESSAGE.