Skip to content

Avoid Chained Assignments (a = b = c = 1) ​

WarningAnti-Patterns & Bad PracticesQuickFix Ready#EC NO_CHAINED_ASSIGNRemote Enabled

Overview ​

Avoid Chained Assignments.

ATC Finding Message: Avoid chained assignments; write separate assignment statements

Rationale ​

Chained assignments evaluate right-to-left and bind multiple targets in a single statement, making code execution order difficult to follow and debug. Split chained assignments into distinct, explicit assignment statements.

Non-Compliant ​

abap
lv_a = lv_b = lv_c = 0.

Compliant ​

abap
lv_c = 0.
lv_b = lv_c.
lv_a = lv_b.

Automated QuickFix ​

This rule provides an automated QuickFix directly in Eclipse ABAP Development Tools (ADT):

  1. Position the cursor on the flagged statement.
  2. Press Ctrl + 1 (Quick Assist).
  3. Select the automated refactoring to apply the clean syntax immediately.

Suppression ​

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

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

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

Technical Details ​

Released under the MIT License.