Ansicht
Dokumentation

ABENIF_T100_MESSAGE - IF T100 MESSAGE

ABENIF_T100_MESSAGE - IF T100 MESSAGE

BAL_S_LOG - Application Log: Log header data   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

- System Interface IF_T100_MESSAGE

The interface IF_T100_MESSAGE associates classes with messages. Classes that implement this interface can be used to access and send messages. To do this, IF_T100_MESSAGE contains a structured attribute T100KEY of the type SCX_T100KEY. In a class that implements the interface, the content of this structure specifies a message in the database table T100:

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

Using an implementing class, 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 so that they return the short text and long text of the current message. To do this, the corresponding methods of the class CL_MESSAGE_HELPER can be used.

To do this, the statement MESSAGE or the class CL_MESSAGE_HELPER evaluates the content of the structure T100KEY as follows:

  • In database table T100, a message is searched for whose message class and message number correspond to the components MSGID and MSGNO of the structure T100KEY. If a message is found, its texts are used. If not, a short text is generated that lists the message class and message number as well as the placeholder texts from the class attributes that are specified in the structure.
  • The possible 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 of structure T100KEY 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 the content of an attribute cannot be converted to a placeholder text, the character "&" is added to the start and the end of the attribute name and the resulting string is used as the placeholder text. If one of the components ATTR1 to ATTR4 is initial, the corresponding placeholder text is initialized.

Notes

  • The interface IF_T100_MESSAGE is mainly intended for use with exception texts in exception classes. If the interface is implemented in regular classes and in local exception classes, the filling of the interface structure T100KEY must be programmed here explicitly. For global exception classes, however, the implementation of the interface methods GET_TEXT and GET_LONGTEXT 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.
  • It should be noted that with interface IF_T100_MESSAGE there is a double indirection for the possible placeholders of a message. The text for a placeholder is taken from an attribute of the implementing class whose name is itself contained in a component of structure T100KEY.
  • The method GET_LATEST_T100_EXCEPTION in the class CL_MESSAGE_HELPER can be used to return the last object in a chain of exception objects that are chained by the attribute PREVIOUS that has an exception text defined by a message.
  • 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. While IF_T100_MESSAGE is intended for static exception texts of exception classes, IF_T100_DYN_MSG can associate any messages with exception classes.

Example

Raising of an exception of the class CX_DEMO_T100, which implements the interface IF_T100_MESSAGE by using THROW.






General Material Data   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 7450 Date: 20240328 Time: 144255     sap01-206 ( 133 ms )