Message types in ABAP as in every programming language are used to give information to the user or programmer about the status of the programming code execution. In ABAP there are 6 types of messages, which are available:
Type A (abend – abnormal end of task)
Type A (abend – abnormal end of task) means termination of the program. The message appears in a dialog box and the program terminates. The user is not able to make any further entries. The task is terminated and the system returns to a high-level menu. Messages of type A should be issued only in extraordinary circumstances, such as serious system errors. A-messages should be avoided, if possible.
Type E (error)
Type E is for error messages. An error message appears and the program stops. These messages are wide used. They can prevent the user from creating inconsistent records. They can point to a prerequisite to be fulfilled.
Type I (information)
Messages from type I are information only. The program is executed and information is displayed. After the user confirms the message, the program continues.
Type S (success, status)
Type S (success, status) messages only give information about the execution of the program. The only display the status of the program.
Type W (warning)
Waring messages are with type W. They are used to display information for the user, which warns the user for possible problems, but they don’t stop the program. The user can than perform corrections.
Type X (exit)
Messages from type X (exit) are the popular ABAP short dumps. The program terminates and the detailed information can be found in transaction ST22, searching by the user and the time of the error.
The syntax for message is MESSAGE <message> TYPE <message type>.
For example if we want to display a warning message:
MESSAGE ‘This is a warning message.’ TYPE ‘W’.
The usage of messages can vary in the different programs and functional requirements. The programmer should carry for the proper and good professional usage of messaging.
Check also the meaning of SY-SUBRC here.