MESSAGE - text
Syntax
... text TYPE mtype ... .
Effect
This variant sends a character string contained in text as a
message of the
message type specified in mtype.
You can enter a character-type data object text, which
will be used as a short text for the message. Only the first 300 characters in text are taken into account. No long text can be defined for a message of this type.
For mtype, a character-type data object is expected, which must contain the message type in capital letters. Invalid message types generate an untreatable exception.
Notes
-
: In this variant, the additions WITH and
INTO are not allowed in message_options.
-
If field symbols or formal parameters of the type any
or data are specified for
text, these must be of character type when the statement is executed. The syntactically identical
variant MESSAGE oref cannot be executed with generically typed field symbols or formal parameters.
-
Because the system fields sy-msgid and
sy-msgno are filled unspecifically when a character string is entered, this variant should
only be used on rare occasions if the content of the system fields is not required for identification of the message. Otherwise, in all cases in which messages are transferred (for example, from
function modules) or logged (for example, in
batch input) using these system fields, language-independent access to the message text would be lost.
Example
: Output of 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.