Skip to content

Avoid Hardcoding System & Tenant Environment Checks ​

WarningSecurity & Robustness#EC HARDCODED_ENVRemote Enabled

Overview ​

Avoid reading environment system fields (sy-sysid, etc.).

ATC Finding Message: Avoid reading environment system fields (sy-sysid, sy-uname, etc.)

Rationale ​

Comparing sy-sysid, sy-mandt, or sy-host to literals bakes a specific system landscape into the code. The logic breaks after a client copy, system copy, or cloud tenant move. Use configuration, feature toggles, or authorization objects instead.

Non-Compliant ​

abap
IF sy-sysid = 'PRD' OR sy-mandt = '100'.
  enable_production_mode( ).
ENDIF.

Compliant ​

abap
IF is_feature_enabled( c_features-prod_mode ).
  enable_production_mode( ).
ENDIF.

Configuration & Thresholds ​

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

Parameter NameData TypeDefault Value
CHECK_SYSIDBooleantrue
CHECK_MANDTBooleantrue
CHECK_HOSTBooleantrue
CHECK_DBSYSBooleantrue
CHECK_OPSYSBooleantrue
CHECK_UNAMEBooleantrue
ONLY_CONDITIONALBooleanfalse

Suppression ​

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

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

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

Technical Details ​

Released under the MIT License.