CRITICAL
Rule Definition
Missing return code checks after an Open SQL statement can result in unpredictable behavior and untraceable execution errors. This is why it is extremely important to report and handle errors as soon as they occur.
Remediation
Check the system field SY-SUBRC after SQL commands, internal table commands and file-handling commands.
Violation Code Sample
select date_e into zdate_e
from zkopcor
where date_e lt p_run
and p_doc eq 'TT'.
<statements>
Fixed Code Sample
select date_e into zdate_e
from zkopcor
where date_e lt p_run and p_doc eq 'TT'.
if sy-subrc <> 0.
message e000 with text-007.
else.
<statements>
endif.
Reference
Enhancing the Quality of ABAP Development,
Meijs-Krouwels-Heulmans-Sommen, SAP Press
ISBN 1-59229-030-2
Related Technologies
Technical Criterion
CWE-391 - Unchecked Error Condition
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.