ABAP Keyword Documentation → ABAP - Reference → User Dialogs → Messages → MESSAGE
MESSAGE - text
Other versions: 7.31 | 7.40 | 7.54
Syntax
... text TYPE mtype ... .
Effect
This variant sends a character string in text
as a
message of the
message type specified in mtype
.
You can enter a character-like data object text
to be used as a short text
for the message. Only the first 300 characters in text
are respected. No long text can be defined for a message of this type.
mtype
expects a character-like data object containing the message type in uppercase letters. Invalid message types raise a non-handleable exception.
Notes
-
In this variant, the additions
WITH
andINTO
inmessage_options
are not allowed. -
If field symbols or formal parameters of the type
any
ordata
are specified fortext
, these must be character-like when the statement is executed. The syntactically identical variantMESSAGE oref
cannot be executed using generically typed field symbols or formal parameters. -
The system fields
sy-msgid
andsy-msgno
are filled in a non-specific way when a character string is specified. This means that this variant should only be used on rare occasions if the content of the system fields is not required for identifying the message. Otherwise, in all cases in which messages are passed using these system fields (for example, from function modules) or logged (for example, in batch input), language-independent access to the message text would be lost.
Example
Produces an exception text as an information message.
DATA: oref TYPE REF TO cx_sy_arithmetic_error,
text TYPE string.
TRY.
...
CATCH cx_sy_arithmetic_error INTO oref.
text = oref->get_text( ).
MESSAGE text TYPE 'I'.
ENDTRY.