cancel
Showing results for 
Search instead for 
Did you mean: 

FOR ALL ENTRIES not returning correct number of records

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Answers (1)

Answers (1)

naimesh_patel
Active Contributor
0 Kudos

FOR ALL Entries can fatch only the unique rows from the table. So, check in the VBFA for the your inputs and the output fields, you will have only 4 unique records. That's why it is picking up only 4 records.

Try to include one more fields which makes every row as a unique row.

Regards,

Naimesh Patel