Avoid String Templates Without Embedded Expressions
WarningClean ABAP & Modern Syntax#EC NO_RAW_STR_TMPLRemote Enabled
Overview
Avoid string templates without embedded expressions.
ATC Finding Message:
String template has no embedded expressions { }; use string literal or backticks
Rationale
Using string templates (|...|) without any embedded expressions { ... } creates unnecessary string template runtime evaluation overhead and clutters code readability. If a string has no dynamic variables or formatting expressions, a standard single-quote literal ('...') or backtick literal (`...`) should be used instead.
Best Practice: Only use |...| when interpolating expressions or formatting parameters.
Non-Compliant
abap
" Anti-pattern: String template with no dynamic expressions
DATA(lv_text) = |Hello World|.
DATA(lv_empty) = ||.Compliant
abap
" Clean ABAP: Standard text literal or string backtick
DATA(lv_text) = 'Hello World'.
DATA(lv_str) = `Hello World`.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_EMPTY_TEMPLATE | Boolean | true | Flag empty string templates (||) |
CHECK_STATIC_TEMPLATE | Boolean | true | Flag static string templates without expressions (|text|) |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC NO_RAW_STR_TMPL
" SAP CI_ prefix format:
... "#EC CI_NO_RAW_STR_TMPLRelated Rules
- Prefer String Templates over CONCATENATE —
#EC PREF_STR_TMPL - Avoid Concatenating Adjacent String Literals —
#EC NO_USELESS_CONCAT
Technical Details
- Native ATC Class:
ZCL_SKYLINT_NO_RAW_STR_TMPL - Implementation File: zcl_skylint_no_raw_str_tmpl.clas.abap