Skip to content

Prefer Enumerations over Constants ​

WarningClean ABAP & Modern Syntax#EC PREF_ENUMRemote Enabled

Overview ​

Prefer ENUM over CONSTANTS for set of related values.

ATC Finding Message: Prefer ENUM over CONSTANTS for set of related values

Rationale ​

Use TYPES: BEGIN OF ENUM ... END OF ENUM for related discrete value sets instead of structured CONSTANTS for type safety and modern syntax.

Non-Compliant ​

abap
CONSTANTS:
  BEGIN OF c_status,
    open TYPE string VALUE 'O',
  END OF c_status.

Compliant ​

abap
TYPES:
  BEGIN OF ENUM ty_status,
    open,
  END OF ENUM ty_status.

Suppression ​

To suppress findings for this rule, append the pseudo-comment to the statement:

abap
" Standard pseudo-comment:
... "#EC PREF_ENUM

" SAP CI_ prefix format:
... "#EC CI_PREF_ENUM

Technical Details ​

Released under the MIT License.