title: Nested subquery in FOR ALL ENTRIES
body: <p>Consultant sent me this code example, here is something he expects to get </p>
  
  <pre><code>SELECT m1~vbeln_im m1~vbelp_im m1~mblnr smbln      
      INTO CORRESPONDING FIELDS OF TABLE lt_mseg
      FROM mseg AS m1
      INNER JOIN mseg AS m2 ON m1~mblnr = m2~smbln
                           AND m1~mjahr = m2~sjahr
                           AND m1~zeile = m2~smblp
      FOR ALL ENTRIES IN lt_vbfa
      WHERE 
        AND m2~bwart = '102'
        AND 0 = ( select SUM( ( CASE
          when SHKZG = 'S' THEN 1
          when SHKZG = 'H' THEN -1
          else 0
          END ) *MENGE ) MENGE
          into lt_mseg-summ
          from mseg
          where
          VBELN_IM = m1~vbeln_im
          and VBELP_IM = m1~vbelp_im
          ).
  </code></pre>
  
  <p>The problem is I don't see how that should work in current syntax. I think about deriving internal select and using it as condition to main one, but is there a proper way to write this nested construction?</p>
  
  <p>As i get it, if nested statement = 0, then main query executes. The problem here is the case inside nested statement. Is it even possible in ABAP? And in my opinion this check could be used outside from main SQL query.</p>
  
  <p>Any suggestions are welcome.</p>