Skip to content

Avoid Obsolete Arithmetic and Assignment Statements ​

WarningAnti-Patterns & Bad PracticesQuickFix Ready#EC NO_OBS_ARITHRemote Enabled

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 ​

abap
ADD 1 TO lv_count.
MOVE lv_source TO lv_target.
GET REFERENCE OF lv_val INTO lr_ref.

Compliant ​

abap
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):

  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.

Configuration & Thresholds ​

This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:

Parameter NameData TypeDefault ValueDescription & Guidance
CHECK_ADDBooleantrueDetect obsolete ADD ... TO and SUBTRACT ... FROM statements
CHECK_ADD_CORRBooleantrueDetect obsolete ADD-CORRESPONDING statements
CHECK_COMPUTEBooleantrueDetect obsolete COMPUTE keyword
CHECK_MOVEBooleantrueDetect obsolete MOVE ... TO statements (prefer =)
CHECK_GET_REFBooleantrueDetect obsolete GET REFERENCE OF statement (prefer REF #( ))

Suppression ​

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

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

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

Technical Details ​

Released under the MIT License.