When catching errors using the CATCH…ENDCATCH statement, where does the runtime error return code get placed?
Reveal answer
Fill a bubble to check yourself
When catching errors using the CATCH…ENDCATCH statement, where does the runtime error return code get placed?
sy-subrc
sy-fdpos
error class
system-exceptions
When using the CATCH...ENDCATCH statement (the obsolete ABAP error handling mechanism before TRY...CATCH), the runtime error return code is placed in the system field sy-subrc. This allows the program to check what error occurred.
When a CATCH SYSTEM-EXCEPTIONS ... ENDCATCH block catches a runtime error, ABAP stores the corresponding numeric code in the system field sy-subrc, which the program then checks (e.g. IF sy-subrc <> 0) to handle the error. 'system-exceptions' is only the name of the clause used to declare which errors to catch, not the place the return code is stored.