Empty driver tables should not be used in a "SELECT/FOR ALL ENTRIES" clause

Template for a good false-positive report, formatted with Markdown:

  • versions used (SonarQube, Scanner, language analyzer)
    SonarQube
    languange:abap
    rule:abap:S2237 Empty driver tables should not be used in a “SELECT/FOR ALL ENTRIES” clause
  • minimal code sample to reproduce (with analysis parameter, and potential instructions to compile).
select objek into table @data(*lt_ausp2*) from ausp
   where klart = '015'
       and atinn = @gs_aufnr_300-ps0001_atinn
       and atwrt = @gs_aufnr_300-ps0001. "色号
       *if sy-subrc = 0.*
       select b~cuobj,b~objek into table @data(lt_inob)
       from ausp as a inner join inob as b
           on a~objek = b~cuobj
       for all entries in @*lt_ausp2*
       where a~objek = @lt_ausp2-objek.
       endif.

Because the previous “if sy subrc = 0.” is equivalent to Lt_ Ausp2 cannot be null.

Wrap code around triple quote ``` for proper formatting