RAISE_EXCEPTION¶
A classic (non-class-based) exception was raised and no caller handled it.
An older-style RAISE statement or an unhandled CALL FUNCTION ... EXCEPTIONS exception propagated all the way to the top of the call stack without being caught.
Symptom¶
ST22 shows:
Runtime Errors RAISE_EXCEPTION
Exception (classic exception, not class-based)
Short text Exception condition "EXCEPTION_NAME" triggered.
The dump names the exception and the function module or form routine that raised it. There is no catchable CX_* class — classic exceptions are not objects.
Cause¶
Classic ABAP exceptions predate class-based exceptions. They work through the EXCEPTIONS addition on CALL FUNCTION and PERFORM:
- The FM or form maps exception names to
SY-SUBRCvalues when the caller lists them. - If the caller omits the
EXCEPTIONSblock entirely, or lists some exceptions but omitsOTHERS, any unlisted exception propagates up the stack as a dump. - A bare
RAISE my_exceptioninside a subroutine with noEXCEPTIONSdeclaration in its signature immediately causes the dump.
Missing OTHERS is the most common culprit
Adding EXCEPTIONS but omitting OTHERS = N is worse than omitting EXCEPTIONS altogether in some respects — it silently drops listed exceptions into SY-SUBRC but lets any unknown exception dump the program.
Reproduce¶
Function module Z_MY_FM raises exception MY_ERROR internally:
Caller provides no EXCEPTIONS addition:
" Caller — dumps with RAISE_EXCEPTION when FM raises MY_ERROR
CALL FUNCTION 'Z_MY_FM'
EXPORTING
iv_input = lv_value.
Caller lists exceptions but omits OTHERS — unknown exception still dumps:
CALL FUNCTION 'Z_MY_FM'
EXPORTING
iv_input = lv_value
EXCEPTIONS
known_error = 1. " OTHERS missing — any other exception dumps
Fix¶
SY-SUBRC after every CALL FUNCTION
Make it a habit: every CALL FUNCTION must be followed by a SY-SUBRC check, even when you expect success. Silent SY-SUBRC <> 0 values that go unchecked accumulate into hard-to-trace bugs.
Prevention¶
- Add
EXCEPTIONS ... OTHERS = Nto everyCALL FUNCTION— no exceptions (pun intended). - In new code, use class-based exceptions (
RAISE EXCEPTION TYPE,TRY ... CATCH) — they are catchable at any level and carry a text automatically. - Run the Extended Program Check (
SLIN) — it flagsCALL FUNCTIONcalls that are missingEXCEPTIONSorOTHERS. - Audit legacy code with transaction
SCOVor code inspector to find unguarded FM calls.
See also¶
MESSAGE_TYPE_X— related dump when an error escalates to an X message- Transaction ST22 — ABAP runtime error analysis
- Transaction SLIN — extended program check