Prefer Built-in String Functions over SEARCH/SHIFT
WarningClean ABAP & Modern SyntaxQuickFix Ready#EC STR_FUNCRemote Enabled
Overview
Detect obsolete string statements; prefer built-in functions.
ATC Finding Messages:
Use modern built-in string function condense( ... ) insteadUse modern string functions to_upper() or to_lower() insteadUse modern string function shift_left( ) or shift_right( ) insteadSEARCH statement is obsolete; prefer find( ) or contains( )OVERLAY statement is obsolete; prefer string functions or templatesObsolete REPLACE statement; prefer replace( ) functionUse strlen( ... ) instead of DESCRIBE FIELD ... LENGTH
Rationale
Statements such as CONDENSE, TRANSLATE, SHIFT, and SEARCH mutate a variable and cannot be used inside expressions. Built-in functions return values, compose cleanly, and make the intended transformation explicit. Use functions such as to_upper, to_lower, find, substring, and shift_left instead.
Non-Compliant
abap
SHIFT lv_code LEFT BY 2 PLACES.
TRANSLATE lv_country TO UPPER CASE.Compliant
abap
lv_code = shift_left( val = lv_code places = 2 ).
lv_country = to_upper( lv_country ).Automated QuickFix
This rule provides an automated QuickFix directly in Eclipse ABAP Development Tools (ADT):
- Position the cursor on the flagged statement.
- Press Ctrl + 1 (Quick Assist).
- 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 Name | Data Type | Default Value |
|---|---|---|
CHECK_CONDENSE | Boolean | true |
CHECK_TRANSLATE | Boolean | true |
CHECK_SHIFT | Boolean | true |
CHECK_SEARCH | Boolean | true |
CHECK_OVERLAY | Boolean | true |
CHECK_REPLACE | Boolean | true |
CHECK_DESCRIBE | Boolean | true |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC STR_FUNC
" SAP CI_ prefix format:
... "#EC CI_STR_FUNCTechnical Details
- Native ATC Class:
ZCL_SKYLINT_PREF_STR_FUNC - Implementation File: zcl_skylint_pref_str_func.clas.abap