Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

FOR ALL ENTRIES not returning correct number of records

Hi,

I have the following code: -

SELECT vbelv "Delivery

posnv "Delivery Item

rfmng "GR Qty

plmin "Sign

INTO TABLE t_gr

FROM vbfa

FOR ALL ENTRIES IN t_deliveries

WHERE vbelv EQ t_deliveries-vbeln

AND posnv EQ t_deliveries-posnr

AND vbtyp_n EQ c_goods_receipt.

The internal table t_deliveries has a single entry. The table VBFA has 5 records for the delivery/item.

When the SQL is executed it returns 4 records. If I amend the code to use the following it returns the 5 records. Has anybody had a similar issue.

LOOP AT t_deliveries INTO st_deliveries.

SELECT vbelv "Delivery

posnv "Delivery Item

rfmng "GR Qty

plmin "Sign

APPENDING TABLE t_gr

FROM vbfa

WHERE vbelv EQ st_deliveries-vbeln

AND posnv EQ st_deliveries-posnr

AND vbtyp_n EQ c_goods_receipt.

ENDLOOP.

Tags:
Former Member
Former Member replied

you probably have 2 records in VBFA matching your criteriasthe for all entries statement eliminates double records matching those criterias. try use a more qualified key then it will work.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question