ABAP Keyword Documentation → ABAP − Reference → Program Flow Logic → Exception Handling → Class-Based Exceptions → Exception Classes
Exception Classes for Messages
The exception texts described in the previous section are assigned to an exception class statically and express a predefined semantic meaning. This applies to both categories of exception texts, namely messages as exception texts and internal exception texts from OTR.
Another frequent situation is when a message from the table T100 is passed to the exception object when
an exception is raised. This is the case, for example, when a non-class-based exception raised using
MESSAGE RAISING
is handled
or a message of a function module is caught using error_message
and then passed as a class-based exception.
The predefined exception texts selected using the input parameter TEXTID of the instance constructor are unsuitable in these cases. Instead, the following are available:
- The system interface IF_T100_DYN_MSG.
- The addition
MESSAGE
of the statementRAISE EXCEPTION
and of the additionTHROW
in a conditional expression.
Exception objects of exception classes that include the system interface IF_T100_DYN_MSG can be associated
with any message from the table T100 using the addition MESSAGE
.
Exception objects of exception classes that include only the system interface IF_T100_MESSAGE can also
be associated with messages using the addition MESSAGE
(but with restrictions).
The latter option is intended only for exception classes that were designed for generic use with exception
texts before IF_T100_DYN_MSG was implemented. In other cases, the concept of exception texts is strictly
divided from the association of a messages with special exception classes. More specifically, the addition MESSAGE
cannot be combined with the input parameter TEXTID.
Other versions:
7.31 | 7.40 | 7.54