Prefer Calculation Assignment Operators (+=, -=, *=)
WarningClean ABAP & Modern SyntaxQuickFix Ready#EC CALC_ASSIGNRemote Enabled
Overview
Prefer calculation assignment operators (+=, -=, *=, /=).
ATC Finding Message:
Use calculation assignment operator (+=, -=) or ADD statement replacement
Rationale
Assignments such as lv_total = lv_total + 1 repeat the target variable and make the update harder to scan. Compound operators +=, -=, and *= express the change directly and avoid duplicating the left-hand side. Use them for simple arithmetic updates where the target is both source and result.
Non-Compliant
abap
lv_stock = lv_stock - 1.
lv_price = lv_price * 1.19.Compliant
abap
lv_stock -= 1.
lv_price *= 1.19.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.
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC CALC_ASSIGN
" SAP CI_ prefix format:
... "#EC CI_CALC_ASSIGNTechnical Details
- Native ATC Class:
ZCL_SKYLINT_PREF_CALC_OP - Implementation File: zcl_skylint_pref_calc_op.clas.abap