CRITICAL
Rule Definition
An empty IF-ENDIF block defeats the purpose of error management or, more generally, pollutes the code with a piece of code that does nothing. Regarding error handling, when a function or an Open SQL query reports a problem via the SY-SUBRC, nothing happens and the program may dysfunction. Moreover, these empty IF-ENDIF blocks may not be detected easily.
Remediation
Insert statements in all IF blocks to manage the situation properly.
Violation Code Sample
READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV
INTO LS_EVENT.
IF SY-SUBRC = 0
ENDIF.
...
MOVE TOP_OF_PAGE TO LS_EVENT-FORM.
Fixed Code Sample
READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE TOP_OF_PAGE TO LS_EVENT-FORM.
ENDIF.
Related Technologies
Technical Criterion
Programming Practices - Error and Exception Handling
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.