Skip to main content

SY-SUBRC Handling

IntermediateError Handling⏱ 15 min

Task

Handle return codes using SY-SUBRC after a READ or SELECT statement and take appropriate action.

Write Your ABAP Code

ABAP Editor
Loading...
📥 Sample Input & Output
READ TABLE result
SY-SUBRC = 0 → Record found
SY-SUBRC ≠ 0 → Handle error
💡 Hint

Always check SY-SUBRC immediately after the statement.

✅ View Reference Solution
READ TABLE it_data INTO DATA(ls_row) INDEX lv_index.
IF sy-subrc = 0.
  " Record found
ELSE.
  " Handle not found
ENDIF.