Class-based Exceptions
CX_STATIC_CHECK, CX_DYNAMIC_CHECK, CX_NO_CHECK and TRY/CATCH.
Explanation
Class-based exceptions replace SY-SUBRC. Static-check exceptions must be declared with RAISING and caught. Dynamic-check exceptions fail at runtime if uncaught. NO_CHECK exceptions (e.g. framework errors) do not require declaration. Wrap external errors in your own domain exception hierarchy to keep upper layers stable.
Code example
TRY. lo_order->confirm( is_header ). CATCH zcx_order INTO DATA(lx). MESSAGE lx TYPE 'E'.ENDTRY.Real project scenario
Wrapping RFC errors in ZCX_INTEGRATION let the UI show one consistent error text instead of RFC short dumps.
Common mistakes
Catching CX_ROOT to hide bugs; not preserving the cause via PREVIOUS; raising exceptions for expected empty results.
Best practices
Build a small domain exception tree; always chain via PREVIOUS; log or rethrow โ never swallow.
Interview angle
Difference between static-check and dynamic-check exceptions.