Skip to content

Avoid Obsolete String and POSIX Regex Statements ​

WarningAnti-Patterns & Bad Practices#EC NO_OBS_STRINGSRemote Enabled

Overview ​

Obsolete String and Regex Statements.

ATC Finding Message: Avoid obsolete string statements (PACK, UNPACK, POSIX REGEX, etc.)

Rationale ​

Statements such as PACK, UNPACK, REPLACE ... INTO, and FIND/REPLACE with REGEX / OCCURENCES (along with POSIX regular expression classes like CL_ABAP_REGEX=>CREATE_POSIX) are legacy constructs superseded by modern PCRE (Perl-Compatible Regular Expressions via PCRE keywords / XCO regex) and standard string expressions / built-ins.

Non-Compliant ​

abap
PACK lv_source TO lv_packed.
FIND REGEX 'pattern' IN lv_text.

Compliant ​

abap
FIND PCRE 'pattern' IN lv_text.

Configuration & Thresholds ​

This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:

Parameter NameData TypeDefault ValueDescription & Guidance
CHECK_PACKBooleantrueDetect obsolete PACK statement (prefer numeric assignment)
CHECK_UNPACKBooleantrueDetect obsolete UNPACK statement
CHECK_REGEXBooleantrueDetect obsolete POSIX regex statements in favour of PCRE
CHECK_OCCURENCESBooleantrueDetect obsolete OCCURRENCES addition syntax
CHECK_REPLACE_INTOBooleantrueDetect obsolete REPLACE ... WITH ... INTO syntax

Suppression ​

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

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

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

Technical Details ​

Released under the MIT License.