Avoid Deeply Nested TRY ... CATCH Blocks
WarningAnti-Patterns & Bad Practices#EC NESTED_TRYRemote Enabled
Overview
Avoid nested TRY blocks; extract to helper methods.
ATC Finding Message:
Avoid nested TRY blocks; extract to dedicated method
Rationale
A TRY block inside another TRY block makes it unclear which handler owns which failure and often duplicates cleanup logic. The inner operation should have its own exception contract behind a method boundary. Extract it into a focused helper and keep one TRY per responsibility.
Non-Compliant
abap
TRY.
step1( ).
TRY.
step2( ).
CATCH cx_step2_error.
handle_step2( ).
ENDTRY.
CATCH cx_step1_error.
handle_step1( ).
ENDTRY.Compliant
abap
TRY.
step1( ).
execute_step2( ).
CATCH cx_step1_error.
handle_step1( ).
ENDTRY.Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC NESTED_TRY
" SAP CI_ prefix format:
... "#EC CI_NESTED_TRYTechnical Details
- Native ATC Class:
ZCL_SKYLINT_NO_NESTED_TRY - Implementation File: zcl_skylint_no_nested_try.clas.abap