Skip to content

Avoid Concatenating Adjacent String Literals ​

NoteAnti-Patterns & Bad PracticesQuickFix Ready#EC NO_USELESS_CONCATRemote Enabled

Overview ​

Avoid concatenating string literals.

ATC Finding Message: Fold literal string concatenation into one literal

Rationale ​

Joining two or more literals with && produces one constant value at runtime, so the operator adds no information and only fragments the text. Folding the literals makes the final string visible and removes a pointless expression. Keep && only when at least one operand is dynamic.

Non-Compliant ​

abap
lv_path = 'orders' && '/' && 'open'.

Compliant ​

abap
lv_path = 'orders/open'.

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 NO_USELESS_CONCAT

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

Technical Details ​

Released under the MIT License.