Skip to content

Avoid Redundant Self-Assignments ​

WarningAnti-Patterns & Bad PracticesQuickFix Ready#EC SELF_ASSIGNRemote Enabled

Overview ​

Detect Identical Self Assignments.

ATC Finding Message: Identical assignment has no effect; remove redundant statement

Rationale ​

Assigning a variable or component to itself does nothing and is usually left over from refactoring or a typo in the source field. It adds noise and can hide a missing assignment. Assign the intended source value or delete the statement.

Non-Compliant ​

abap
ls_order-customer_id = ls_order-customer_id.

Compliant ​

abap
ls_order-customer_id = iv_customer_id.

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 SELF_ASSIGN

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

Technical Details ​

Released under the MIT License.