Skip to content

Avoid CHECK Statements ​

WarningAnti-Patterns & Bad PracticesQuickFix Ready#EC CHECK_STMTRemote Enabled

Overview ​

Avoid CHECK statements; prefer IF with RETURN or CONTINUE.

ATC Finding Messages:

  • Avoid CHECK inside loop; use IF ... CONTINUE instead
  • Avoid CHECK outside loop; use IF ... RETURN instead

Rationale ​

CHECK behaves like CONTINUE inside a loop but like RETURN outside a loop, so moving the statement between contexts silently changes control flow. That dual meaning makes refactoring and reviews hazardous. Replace it with an explicit IF ... CONTINUE or IF ... RETURN that states the intended behavior.

Non-Compliant ​

abap
LOOP AT lt_orders INTO ls_order.
  CHECK ls_order-status = 'OPEN'.
  process_order( ls_order ).
ENDLOOP.

Compliant ​

abap
LOOP AT lt_orders INTO ls_order.
  IF ls_order-status <> 'OPEN'.
    CONTINUE.
  ENDIF.
  process_order( ls_order ).
ENDLOOP.

Automated QuickFix ​

This rule provides an automated QuickFix directly in Eclipse ABAP Development Tools (ADT):

  1. Position the cursor on the flagged statement.
  2. Press Ctrl + 1 (Quick Assist).
  3. 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 NameData TypeDefault Value
CHECK_IN_LOOPBooleantrue
CHECK_OUTSIDE_LOOPBooleantrue

Suppression ​

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

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

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

Technical Details ​

Released under the MIT License.