Prefer Modern Inline Declarations in ABAP 7.40+
WarningClean ABAP & Modern Syntax#EC PREF_INLINERemote Enabled
Overview
Prefer Inline Declarations.
ATC Finding Message:
Prefer inline declaration over separate DATA and assignment
Rationale
Declaring a variable at the top and assigning it in the very next statement separates the declaration from its first use. Inline DATA( ) keeps the variable close to where it is needed and shortens its lifetime in the reader mind. Use inline declarations when the type is obvious from the initial value.
Non-Compliant
abap
DATA lv_name TYPE string.
lv_name = |Order { lv_id }|.Compliant
abap
DATA(lv_name) = |Order { lv_id }|.Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC PREF_INLINE
" SAP CI_ prefix format:
... "#EC CI_PREF_INLINERelated Rules
- Avoid Obsolete Inline Length Specifications (var(len)) —
#EC NO_INLINE_LEN - Avoid Chained Declarations (DATA:, CONSTANTS:, TYPES:) —
#EC NO_CHAINED_DECL - Routine Declaration Hygiene (Top Placement & Order) —
#EC DEF_TOP
Technical Details
- Native ATC Class:
ZCL_SKYLINT_PREF_INLINE - Implementation File: zcl_skylint_pref_inline.clas.abap