Avoid Chained Declarations (DATA:, CONSTANTS:, TYPES:)
WarningAnti-Patterns & Bad PracticesQuickFix Ready#EC NO_CHAINED_DECLRemote Enabled
Overview
Avoid Chained Declarations.
ATC Finding Message:
Avoid chained declarations; declare each entity individually
Rationale
Chained declarations combine multiple definitions behind a colon and commas, obscuring types and causing noisy version control diffs for single-variable modifications. In modern Clean ABAP, each variable, constant, or type definition should be an independent, fully qualified statement for maximum readability and clean diff tracking.
Non-Compliant
abap
DATA: lv_order_id TYPE string,
lv_status TYPE string.Compliant
abap
DATA lv_order_id TYPE string.
DATA lv_status TYPE string.Automated QuickFix
This rule provides an automated QuickFix directly in Eclipse ABAP Development Tools (ADT):
- Position the cursor on the flagged statement.
- Press Ctrl + 1 (Quick Assist).
- Select the automated refactoring to apply the clean syntax immediately.
Configuration & Thresholds
This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:
| Parameter Name | Data Type | Default Value | Description & Guidance |
|---|---|---|---|
ALLOW_STRUCTURE_CHAINS | Boolean | true | Allow chained declarations exclusively inside BEGIN OF ... END OF structure definitions |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC NO_CHAINED_DECL
" SAP CI_ prefix format:
... "#EC CI_NO_CHAINED_DECLRelated Rules
- Avoid Chained Assignments (a = b = c = 1) —
#EC NO_CHAINED_ASSIGN - Prefer Modern Inline Declarations in ABAP 7.40+ —
#EC PREF_INLINE - Prefer FINAL( ) over DATA( ) when the variable is never written again —
#EC PREF_FINAL_DATA
Technical Details
- Native ATC Class:
ZCL_SKYLINT_NO_CHAINED_DECL - Implementation File: zcl_skylint_no_chained_decl.clas.abap