SAP NetWeaver AS ABAP Release 750, ©Copyright 2016 SAP AG. All rights reserved.
ABAP - Keyword Documentation → ABAP - Reference → Text Repositories → Messages →
MESSAGE
Syntax
MESSAGE { msg | text }
| { [DISPLAY LIKE dtype] [WITH dobj1 ... dobj4] }
| { [DISPLAY LIKE dtype] [WITH dobj1 ... dobj4]
RAISING exception }
| {
[WITH dobj1 ... dobj4]
INTO text }.
Additions
1. ... DISPLAY LIKE dtype
2. ... WITH dobj1 ... dobj4
Effect
This statement MESSAGE either displays the short text of a message specified in msg from the table T100 in the logon language of the current user, or any text from text as a message. The following variants are available:
System Fields
Name | Meaning |
sy-msgid | Contains the message class after a message is sent, and the value "00" after any text is sent. |
sy-msgno | Contains the message number after a message is sent, and the value "001" after any text is sent. |
sy-msgty | Contains the identifier of the message type with which the message or the text was sent. |
sy-msgv1 to sy-msgv4 | Contain the content of the data objects specified after the addition WITH after sending a message (in order). After any text is sent, contain the first 200 characters of the data object text. |
Notes
... DISPLAY LIKE dtype
Effect
When this addition is used, the icon of the message type specified in dtype is displayed instead of the associated icon. dtype expects a character-like data objects containing one of the values "A", "E", "I", "S", or "W" in uppercase letters.
For messages displayed in a dialog box by default, the short text is still displayed as a dialog box.
Messages with the type "E" or "W" (except those for PBO and LOAD-OF-PROGRAM)
are displayed as a dialog window if dtype contains "A" or "I". Messages with
the type "S" are always displayed in the status bar, regardless of the dtype.
The latter also applies to messages of the type "I" for PBO and LOAD-OF-PROGRAM. Messages of the type "X" always cause a runtime error.
Notes
... WITH dobj1 ... dobj4
Effect
This addition replaces the placeholders "&1" to "&4" and "&" of the short text or "&V1&" to "&V4&" of the long text of the message with the formatted content of the operands dobj1, ..., dobj4. Up to four operands dobj1 through dobj4 can be specified. They can have the same data type as a source field of the statement WRITE TO and they are formatted in accordance with the associated predefined formats with an output length of 50. If the data type is character-like, dobj1 through dobj4 are character-like expression positions; if it is not character-like, they are functional operand positions.
The position of an operand determines which placeholder is replaced. The formatted content of the first operand replaces the placeholders "&1", the first placeholder "&" and "&V1&", the second replaces "&2", the second "&" and "&V2&" etc. Furthermore, the formatted content of the operands dobj1, ..., dobj4 is assigned in sequence to the system fields sy-msgv1 to sy-msgv4.
If fewer operands than placeholders are specified, surplus placeholders are not displayed in the short text and the associated system fields sy-msgv1 to sy-msgv4 are initialized. If a specified operand cannot be assigned to a placeholder, it is ignored.
If the system fields sy-msgid, sy-msgno, and sy-msgv1 through sy-msgv4 are specified directly after WITH, the values set by the current MESSAGE statement are used. If they are specified as operands of character-like expressions, the preceding values are used.
The addition WITH cannot be specified when a text txt is displayed and not when an object reference variable is specified in msg.
Notes
Example
If the short text of the specified message in the table T100 contains the value "& & & &" , the text "This is not America" is displayed as an information message. If the short text was defined as "&4 &1 &3 &2", the output is "America This not is".
Non-Handleable Exceptions