The system field SY-SUBRC
must be tested immediately after any statement setting this variable. Reading this variable informs on
previous operation success or errors. Such errors should be handled properly so that the program continues in a consistent state.
This rule raises an issue when the field SY-SUBRC
is not checked just after performing one of the following operations:
- Calling a function or method which can throw exceptions.
- Calling one of the file access operation
OPEN DATASET
, READ DATASET
or DELETE DATASET
.
SY-SUBRC
check must be done either with the CASE
, IF
or CHECK
statement.