Skip to content

Eliminate Unused Local Variables and Symbols ​

WarningAnti-Patterns & Bad Practices#EC NEEDEDRemote Enabled

Overview ​

Detect unused local variables and field symbols.

ATC Finding Message: Local variable or field symbol is declared but never read

Rationale ​

An unused variable or field symbol adds noise and suggests incomplete refactoring or a missing assignment. It keeps dead objects alive longer than necessary and makes reviews harder. Remove the declaration, or mark it with ##NEEDED when an external contract requires it.

Non-Compliant ​

abap
DATA lv_message TYPE string.
process_order( ).

Compliant ​

abap
DATA lv_message TYPE string.
lv_message = |Order { lv_id }|.
log_message( lv_message ).

Suppression ​

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

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

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

Technical Details ​

Released under the MIT License.