Copyright 2024 - BV TallVision IT

The message statement also has a controlling function. Of which the most common one is the Error message in a report.

  • Direct from a report (effectively stopping execution)
  • As a tool for use with DYNPRO's, it can be used in the interaction between the DYNPRO (screen) and the MODULE (ABAP source). From the MODULE an error message could freeze the screen and leave one or more (or no) fields available for input. This way a field check only has to be programmed once.
  • The EXCEPTIONS in function modules can be initiated from within the function module with the MESSAGE ... RAISING ... statement.
  • The message that was last initiated by a program or transaction that just stopped can be retreived from the system. The system variable overview shows which variables can be used.

Influence message screen control

The S (skip/success) message will show on the next screen without impacting screen flow, repeating a series of 'S' messages will effectively only show the last one. The 'I' (Information) message does show on the screen that is being processed, and requires the end user to press enter. Repeating 'I' messages are thus all "seen" by the end user. The 'W' (Warning) message also needs to be confirmed with an "Enter" action (much like 'I' Information). The 'E' (Error) message will freeze the screen (when thrown from PAI Process After Input processing of a dynpro) or even the whole report. Then there is the 'A' (Abort/Abnormal program determination) and the 'X' (eXit) which will both cause the system to dump. 

If you set up a test report with the coding below, it will run until the E message is shown, which will stop the report.

MESSAGE S999(B1) WITH '(S) Success/skip'.
MESSAGE I999(B1) WITH '(I) Information'.
MESSAGE W999(B1) WITH '(W) Warning'.
MESSAGE E999(B1) WITH '(E) Error'. "Last statement executed
MESSAGE A999(B1) WITH '(A) Abort'.
MESSAGE X999(B1) WITH '(X) eXit)'.

The actual response that is controlled by a message, can be altered with the DISPLAY LIKE 'W'. addition to the message statement. So if you want to warn the end user about something, but you don't need the extra "Enter" you can state MESSAGE S999(B1) WITH 'Watch out!' DISPLAY LIKE 'W'.

A small amendment to the above report:

MESSAGE S999(B1) WITH '(S) Success/skip' DISPLAY LIKE 'X'.
                     "Last statement executed
MESSAGE I999(B1) WITH '(I) Information'.
MESSAGE W999(B1) WITH '(W) Warning'.
MESSAGE E999(B1) WITH '(E) Error'. 
MESSAGE A999(B1) WITH '(A) Abort'. 
MESSAGE X999(B1) WITH '(X) eXit)'.

(This will produce dump MESSAGE_TYPE_X...)