Classic EXCEPTIONS must not map two errors to the same number
WarningAnti-Patterns & Bad Practices#EC EXC_OVERLAPRemote Enabled
Overview
Classic EXCEPTIONS must not overlap.
ATC Finding Message:
Two classic exceptions share the same error number
Rationale
When two classic exceptions map to the same sy-subrc number, the caller cannot tell which failure occurred. This makes error handling guesswork and can hide the real cause. Assign distinct numbers and reserve OTHERS for unexpected failures.
Non-Compliant
abap
CALL FUNCTION 'Z_PROCESS_ORDER'
EXCEPTIONS
system_failure = 1 MESSAGE lv_message
communication_failure = 1 MESSAGE lv_message
OTHERS = 1.Compliant
abap
CALL FUNCTION 'Z_PROCESS_ORDER'
EXCEPTIONS
system_failure = 1 MESSAGE lv_message
communication_failure = 2 MESSAGE lv_message
OTHERS = 3.Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC EXC_OVERLAP
" SAP CI_ prefix format:
... "#EC CI_EXC_OVERLAPTechnical Details
- Native ATC Class:
ZCL_SKYLINT_NO_EXC_OVERLAP - Implementation File: zcl_skylint_no_exc_overlap.clas.abap