Select ... For All Entries in ABAP/4

You can specify condition of where clause using intenal table using option "FOR ALL ENTRIES IN ". When you apply this option please make sure that the internal table has at least one row. If internal table has no entry, system will ignore this option.

Example


DATA: itab TYPE TABLE OF vbak WITH HEADER LINE,
  itab2 TYPE TABLE OF vbap WITH HEADER LINE.
SELECT * INTO TABLE itab FROM vbak
WHERE vbeln BETWEEN ’1000000000’ AND ’4999999999’.
IF NOT itab[] is initial.
SELECT * INTO TABLE itab2 FROM vbap
FOR ALL ENTRIES IN itab
WHERE vbeln = itab-vbeln
AND matnr LIKE ’F%’.
ENDIF.

Post new comment