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.
- 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.