Avoid Obsolete Arithmetic and Assignment Statements
Overview
Obsolete Arithmetic and Assignment Statements.
ATC Finding Message:
Avoid obsolete arithmetic or assignment statements; use =, +, -, *, /
Rationale
Legacy calculation statements (ADD, SUBTRACT, MULTIPLY, DIVIDE, ADD-CORRESPONDING, and COMPUTE) and verbose assignments (MOVE ... TO, GET REFERENCE OF ... INTO) clutter code and hinder readability. Modern ABAP provides clean functional expressions, compound arithmetic, and standard assignment operators (=, +, -, *, /, REF #()) that are strictly required in Clean ABAP and ABAP Cloud.
Non-Compliant
ADD 1 TO lv_count.
MOVE lv_source TO lv_target.
GET REFERENCE OF lv_val INTO lr_ref.Compliant
lv_count = lv_count + 1.
lv_target = lv_source.
lr_ref = REF #( lv_val ).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 |
|---|---|---|---|
CHECK_ADD | Boolean | true | Detect obsolete ADD ... TO and SUBTRACT ... FROM statements |
CHECK_ADD_CORR | Boolean | true | Detect obsolete ADD-CORRESPONDING statements |
CHECK_COMPUTE | Boolean | true | Detect obsolete COMPUTE keyword |
CHECK_MOVE | Boolean | true | Detect obsolete MOVE ... TO statements (prefer =) |
CHECK_GET_REF | Boolean | true | Detect obsolete GET REFERENCE OF statement (prefer REF #( )) |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
" Standard pseudo-comment:
... "#EC NO_OBS_ARITH
" SAP CI_ prefix format:
... "#EC CI_NO_OBS_ARITHRelated Rules
- Avoid Obsolete Control Flow and Procedural Forms —
#EC NO_OBS_CONTROL - Avoid Obsolete Declarations and Table Headers —
#EC NO_OBS_DECL - Avoid Obsolete ABAP Memory and Context Statements —
#EC NO_OBS_MEMORY
Technical Details
- Native ATC Class:
ZCL_SKYLINT_NO_OBS_ARITH - Implementation File: zcl_skylint_no_obs_arith.clas.abap