The MESSAGE
statement has more to it then meets the eye... A message is an important way to inform the en user in a uniform way that should be understood and carried by all developers.
From ABAP a message can easily be edited by entering the statement MESSAGE
in ABAP and double clicking the message number. The program editor will jump to the message or indicate that it has not yet been created.
If you would like to report on the message text without actually "throwing" it, use:
MESSAGE I123(XX) WITH 'Parameter 1' Param2 INTO full_message_text
This will make the message available as a variabele you can report on.
A message appears at runtime in a message window with two buttons "Proceed" and "?". The help text can be filled in with the message long text.
The actual sequence of parameters is preset, so if you need to set a message from the variables in SYST
, make sure you get the id / type / number sequence correct:
The message statement also has a controlling function. Of which the most common one is the Error message in a report.
So messages always relate to a message number ? No they don't. You may have come across the 000 or 999 messages under many message ID's that have a placeholder function only. The text for these messages is & & & &
and the developer can fill in any parameters he/she likes.
If you've assembled/gathered a list of messages, there are several ways to take messaging further. There is a class CL_ERROR_MSG
available which can be used to add messages to (method SET
, messages can be counted (method GET_COUNT
- use to determine whether display is needed) and a popup with the messages can be displayed (method DISPLAY
) with a suite of functions. You may also want to consider using the Business Application Log (BAL)