Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Program Flow Logic →  Exception Handling →  Class-Based Exceptions →  Exception Classes 

Exception Texts

Each exception is assigned a text that can be given parameters using attributes and that describes the exception situation. This text is displayed in the short dump of the runtime error if the exception is not handled. If the exception is handled in the program, the text can be read using the method GET_TEXT of the interface IF_MESSAGE, implemented by every exception class. If applicable, the long text can be read using the method GET_LONG_TEXT. A global exception class has a predefined exception text that has the same name as the exception class. This predefined text can be edited and further exception texts can be defined.

From a technical perspective, each exception text is defined using an identically named constant in the public visibility section of the exception class and this constant defines its properties. The instance constructor of an exception class has an input parameter TEXTID to which a constant like this can be passed when the exception is raised. This then determines the exception text. If the parameter is not passed, the predefined exception text with the same name as the exception class is used.

The exception texts of an exception class are usually defined by referencing messages in the table T100. In predefined system classes, OTR (Online Text Repository) texts can also be used.

Other versions: 7.31 | 7.40 | 7.54

Programming Guideline

Using Messages as Exception Texts


Notes

  • The names of the exception texts or the associated constants should be seen as keys of the texts available for an exception class. This means that when an exception is raised, only the exception class constants of the same name should be passed to the parameter TEXTID to identify the exception text.

  • The way in which the exception texts (namely the associated constants and the instance constructor) are edited depends to a large extent on whether Class Builder in ABAP Workbench or the source code editor in the ABAP Development Tools (ADT) is used.

Continue

Messages as Exception Texts

Exception Texts for System Classes