ABAP Core Part 8: Messages and User-Friendly Error Handling
Preview · a free account unlocks the full lesson
Use messages correctly: message classes and numbers, message types (S, I, W, E, A, X) and their behavior in different contexts, placeholders, MESSAGE … INTO for logging, and collecting messages instead of stopping at the first error.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 5 showed an error message appearing on the selection screen without really explaining how messages work. This part covers them properly.
Messages live in message classes, maintained in SE91 or in ADT, each with a number and up to four placeholders, &1 through &4. A message class such as ZFLIGHT might contain numbered texts like 001 Airline &1 does not exist, 002 No authorization for airline &1, and 003 Flight &1 &2 on &3 is fully booked. These texts are translatable, which is exactly why user-facing messages should never be hard-coded directly in the program.
Sending a message is simple: MESSAGE e001(zflight) WITH p_carr. or, in its more structured form, MESSAGE ID 'ZFLIGHT' TYPE 'E' NUMBER '001' WITH p_carr.
The message type decides its behavior: Type decides behavior: S (status), I (info popup), W (warning), E (error), A (abort), X (dump).
In classic reports, S produces a status-bar message and processing simply continues; I shows an information popup and continues once the user confirms it; W shows a warning that the user can confirm and continue past, on screens; E, on a selection screen or dynpro, forces the user to correct their input, while in START-OF-SELECTION it instead ends the processing and displays the message; A terminates the whole transaction; and X triggers a short dump, reserved for genuinely impossible situations.
The same type behaves differently by context (selection screen, list, dialog, background, RAP) — in background jobs, function modules and RFC calls specifically, E and A messages behave quite differently, for instance canceling the job outright or turning into exceptions, which is exactly why MESSAGE E should never be used deep inside reusable code.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Referenced SAP objects
Reviewed reference pages for the objects this page mentions.
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.