Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

select less data using FOR ALL ENTRIES

Former Member
0 Likes
365

Hi experts,

I have met an odd problem during my coding.

if i use

select machtype ra rmodel from zgreit
      into table lt_zgreit
      where ra = '866B0020999'
        and receipt_stat = 'R'.

I could select 8 data from table zgreit.

but if I use

if not gt_zgrrnnh[] is initial.
* get machine receiving for selected RNN
    select machtype ra rmodel from zgreit
      into table lt_zgreit
      for all entries in gt_zgrrnnh
      where ra = gt_zgrrnnh-rnn
        and receipt_stat = 'R'.
endif.

I just selected 5 data from table zgreit.

and in these codes, both field RA and field RNN are typed c length 11. and '866B0020999' is one of the data of gt_zgrrnnh-rnn

Is there any reason that made the mistake?

Thanks a lot.

sincerely,

Julie

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
341

FOR ALL ENTRIES eliminates duplicates from the selection set. Just make sure you are selecting all the key fields and you should be OK.

Rob

2 REPLIES 2
Read only

Former Member
0 Likes
342

FOR ALL ENTRIES eliminates duplicates from the selection set. Just make sure you are selecting all the key fields and you should be OK.

Rob

Read only

Former Member
0 Likes
341

Hi Julie

FOR ALL ENTRIES

deletes the duplicate entries from the itab. That's why only 5 entries are selected. Check in your 1st select query, some of the entries must have been duplicate. Make sure you are using all the Key fields while fetching from your Ztable.

For your reference, Search by

FOR ALL ENTRIES

and there you'll find lots of BLOGS on the same.

Hope this helps.

Harsh