SAP MESSAGE INTERFACE ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_MSG - IF_T100_MESSAGE in a Local Exception Class
This example demonstrates how a local exception class is linked with a message

ABAP_SOURCE_CODE
DEMO CL_DEMO_MESSAGE_OREF

ABAP_DESCRIPTION
The functional method meth raises an exception from the local exception class cx_t100 that implements the interface IF_T100_MESSAGE. When the exception is raised, the constructor is given a message class, a message number, and values for the placeholders of the message.
The constructor of the local exception class cx_t100 fills the attribute T100KEY of the interface IF_T100_MESSAGE with the values passed. In this way, the exception class represents the passed message from the table T100 in which the placeholders are replaced with the content of the attributes text1 to text4.
The method main catches the exception in the reference variable oref and indicates the following:
The exception text can be obtained using the method GET_TEXT of the component interface IF_MESSAGE in the interface IF_T100_MESSAGE. The implementation of the method GET_TEXT is in the superclass CX_ROOT, which already includes the interface IF_MESSAGE .
The reference variable can be used directly as an operand of the statement MESSAGE in ABAP language versions where that syntax is allowed.
See also the executable examples listed below.
System Interface IF_T100_MESSAGE in Global Exception Class
System Interface IF_T100_DYN_MSG in Local Exception Class