Avoid Obsolete ABAP Memory and Context Statements
WarningAnti-Patterns & Bad Practices#EC NO_OBS_MEMORYRemote Enabled
Overview
Obsolete Memory and Context Statements.
ATC Finding Message:
Avoid obsolete memory, context, and legacy data-sharing constructs
Rationale
ABAP memory and database cluster statements (EXPORT ... TO MEMORY / DATABASE, FREE MEMORY) and Context commands (CONTEXTS, DEMAND, SUPPLY, PROVIDE) rely on hidden shared memory regions that break statelessness, multi-tenancy, and testability. In cloud systems, communicate explicitly via method parameters, database repositories, or session services.
Non-Compliant
abap
EXPORT user_id = lv_user TO MEMORY ID 'USR_CTX'.
FREE MEMORY ID 'USR_CTX'.Compliant
abap
" Pass user context explicitly via method arguments or a dedicated context provider service.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_EXPORT_MEMORY | Boolean | true | Detect obsolete EXPORT TO MEMORY statements |
CHECK_FREE_MEMORY | Boolean | true | Detect obsolete FREE MEMORY statements |
CHECK_PROVIDE | Boolean | true | Detect obsolete PROVIDE statements |
CHECK_CONTEXTS | Boolean | true | Detect obsolete CONTEXTS statements |
CHECK_INFOTYPES | Boolean | true | Detect obsolete INFOTYPES statements |
CHECK_COMMUNICATION | Boolean | true | Detect obsolete COMMUNICATION statements |
CHECK_CALL_TRANSF | Boolean | true | Detect obsolete CALL TRANSFORMATION XML statements |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC NO_OBS_MEMORY
" SAP CI_ prefix format:
... "#EC CI_NO_OBS_MEMORYRelated Rules
- Avoid Obsolete Arithmetic and Assignment Statements —
#EC NO_OBS_ARITH - Avoid Obsolete Control Flow and Procedural Forms —
#EC NO_OBS_CONTROL - Avoid Obsolete Declarations and Table Headers —
#EC NO_OBS_DECL
Technical Details
- Native ATC Class:
ZCL_SKYLINT_NO_OBS_MEMORY - Implementation File: zcl_skylint_no_obs_memory.clas.abap