Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Text Repositories →  Messages →  System Interfaces for Messages 

System Interface IF_T100_MESSAGE for Messages

The interface IF_T100_MESSAGE associates classes with messages. To do this, IF_T100_MESSAGE contains a structured attribute T100KEY of the type SCX_T100KEY, which specifies a message in the table T100:

  • The components ATTR1 to ATTR4 contain the names of class attributes whose content is used as placeholder texts for any placeholders in the texts of the message.

The message text can be accessed as follows:

  • The interface IF_T100_MESSAGE includes the interface IF_MESSAGE (which should not be used as a standalone interface). This interface contains the methods GET_TEXT and GET_LONGTEXT, which can be implemented by a class with the interface IF_T100_MESSAGE in such a way that they return the short text and long text of the current message. This can be done using the corresponding methods of the class CL_MESSAGE_HELPER.

The statement MESSAGE or the class CL_MESSAGE_HELPER evaluate the content of the structure T100KEY here:

  • The components MSGID and MSGNO are scanned by message class and message class for a message. If a message is found, its texts are used. If not, a short text is generated that counts the message class and message number plus the placeholder texts from the assigned class attributes.
  • If they exist, the placeholders "&1" to "&4" and "&" of the short text or "&V1&" to "&V4&" of the long text of the message are replaced by the content of the class attributes specified in the components ATTR1 to ATTR4 in accordance with the rules of the addition WITH of the statement MESSAGE. If an attribute specified in the components ATTR1 to ATTR4 does not exist or if an attribute cannot be converted to a placeholder text, the character "&" is added to the start and the end of the attribute name and used as a placeholder text. If one of the components ATTR1 to ATTR4 is initial, the corresponding placeholder text is initialized‎.

Other versions: 7.31 | 7.40 | 7.54


Notes

  • The interface IF_T100_MESSAGE is mainly designed for use with exception texts in exception classes. If the interface is included in regular classes and in local exception classes, the filling of the interface structure T100KEY must be programmed here separately. The implementation of the interface methods GET_TEXT and GET_LONGTEXT, however, is already contained in the superclass CX_ROOT and alias names are declared for these methods here. When creating global exception classes, tool support is provided for filling the structure T100KEY and for mapping attributes to placeholders. This is done using structured constants that can be specified when an exception is raised.

  • The method GET_LATEST_T100_EXCEPTION in the class CL_MESSAGE_HELPER is used to return the last object in a chain of exception objects that has an exception text defined by a message. Here, the chain is created using the attribute PREVIOUS.

  • The interface IF_T100_MESSAGE does not have any attributes for the message type.

  • The interface IF_T100_DYN_MSG adds predefined attributes for the message type and the placeholders of the message to the interface IF_T100_MESSAGE. IF_T100_MESSAGE is designed for static exception texts of exception classes, but IF_T100_DYN_MSG can associate any messages with exception classes.

Example

Uses THROW to raise an exception of the class CX_DEMO_T100, which binds the interface IF_T100_MESSAGE.

DATA col TYPE c LENGTH 1. 

... 

DATA(color) = COND string( 
               WHEN col = 'R' THEN 'red' 
               WHEN col = 'B' THEN 'blue' 
                WHEN col = 'G' THEN 'green' 
                ELSE THROW cx_demo_t100( 
                     textid = cx_demo_t100=>demo 
                     text1  = 'Illegal value:' 
                     text2  = CONV #( col ) ) ).

Executable Examples


This translation does not reflect the current version of the documentation.

Continue

IF_T100_MESSAGE in Regular Class

IF_T100_MESSAGE in Local Exception Class

IF_T100_MESSAGE in Global Exception Class

IF_T100_MESSAGE for Exception with Message