SAP ABAP Message Types

This is an easy which demonstrate the different types of messages that can be displayed in an ABAP program.

Types of ABAP messages:

  • Success message (S)
    • A success message appears along the SAP Logon footer (in green) and processing is not stop.

\"\"

  • Error message (E)
    • Error message appears along the SAP Logon footer (in red) and processing is stopped.

\"\"

  • Warning message (W)
    • Warning message is similar to error message, however depending on the context, error message may appear or program terminated.

\"\"

  • Information message (I)
    • An information message appears in a popup window, processing halt. When the user close the information message, processing resume.

\"\"

  • Abend /Termination Message message (A)
    • A termination message will stop processing and an exit button will appears which will exit the session.

\"\"

  • Exit message (X)
    • An exit message will normally terminated the program. Usually, a stack dump for the state of the system is raised (can be viewed in ST22).

\"\"

 

Please find below a sample program which demonstrate the different types of messages available for SAP ABAP programs.

REPORT zdemomessages.

*&--------------------------------------------------------------------&*
*& Program Description:                                               &*
*& -----------------------                                            &*
*& This demo program will demonstrate the different types of SAP ABAP &*
*& messages.                                                          &*
*&                                                                    &*
*& Author:  ABAPCOOKBOOK                                              &*
*& Website: www.abapcookbook.com                                      &*
************************************************************************


************************************************************************
* SELECTION SCREEN                                                     *
************************************************************************
PARAMETERS:
  rb_msg01 RADIOBUTTON GROUP msg DEFAULT \'X\',   \" Success Message
  rb_msg02 RADIOBUTTON GROUP msg,               \" Error Message
  rb_msg03 RADIOBUTTON GROUP msg,               \" Warning Message
  rb_msg04 RADIOBUTTON GROUP msg,               \" Information Message
  rb_msg05 RADIOBUTTON GROUP msg,               \" Abend/Termination Message
  rb_msg06 RADIOBUTTON GROUP msg.               \" Exit Message


************************************************************************
* SAMPLE CODE LOGIC FOR DEMONSTRACTION PURPOSES                        *
************************************************************************
START-OF-SELECTION.

  CASE \'X\'.

*   Success Message.
*   A success message appears along the SAP Logon footer (in green)
*   and processing is not stop.
    WHEN rb_msg01.

        MESSAGE \'This is an example of a SUCCESS message.\' TYPE \'S\'.

*   Error Message.
*   Error message appears along the SAP Logon footer (in red) and
*   processing is stopped.
    WHEN rb_msg02.

      MESSAGE \'This is an example of an ERROR message.\' TYPE \'E\'.

*   Warning Message.
*   Warning message is similar to error message, however depending
*   on the context, error message may appear or program terminated.
    WHEN rb_msg03.

      MESSAGE \'This is an example of a WARNING message.\' TYPE \'W\'.

*   Information Message.
*   An information message appears in a popup window, processing halt.
*   When the user close the information message, processing resume.
    WHEN rb_msg04.

      MESSAGE \'This is an example of an INFORMATION message.\' TYPE \'I\'.

*   Abend/Termination Message.
*   A termination message will stop processing and an exit button will
*   appears which will exit the session.
    WHEN rb_msg05.

      MESSAGE \'This is an example of a TERMINATION message.\' TYPE \'A\'.

*   Exit Message.
*   An exit message will normally terminated the program. Usually, a
*   stack dump for the state of the system is raised (can be viewed in ST22).
    WHEN rb_msg06.

      MESSAGE \'This is an example of an EXIT message.\' TYPE \'X\'.

  ENDCASE.

 

Please Note: The syntax for the implementation of ABAP messages can also be in the following format:

*Hardcoded success message.
 MESSAGE \'This is an example of a SUCCESS message.\' TYPE \'S\'.
        
*Success message with message number \'001\' defined in the message class \'V1\' (via SE91). 
 MESSAGE S001(V1).
        
*Success message with text symbols \'001\' defined in menu \'GoTO > Text Elements > Text Symbols\'.
 MESSAGE TEXT-001 TYPE \'S\'.