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

QUERY REGARDING A STATEMENT

Former Member
0 Likes
692

SELECT vbeln

fkimg

INTO TABLE i_fkimg

FROM vbrp

FOR ALL ENTRIES IN invtab1

WHERE vbrp~vbeln = invtab1-vbeln

AND vbrp~pstyv = 'TAQ'.

I AM RUNNING THIS QUERY BUT WHAT IT IS DOING IS THAT IN CASE FOR AN ORDER IF FOR TWO CONSECUTIVE LINE ITEMS IF THE VALUE OF FKIMG IS SAME

ITS IS PICKING ONLY ONE VALUE OUT OF THE TWO

I JUST WANTED TO KNOW WHETHER ITS IS DUE TO THE PARTNER FUNCTION(~) THAT WE ARE USING OR SOME OTHER ISSUE.

BECAUSE I NEED ALL THE VALUES.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
662

Yes - FOR ALL ENTRIES eliminates duplicates.

You can avoid this by adding posnr to your internal table.

Rob

Message was edited by:

Rob Burbank

6 REPLIES 6
Read only

Former Member
0 Likes
663

Yes - FOR ALL ENTRIES eliminates duplicates.

You can avoid this by adding posnr to your internal table.

Rob

Message was edited by:

Rob Burbank

Read only

0 Likes
662

means its due to FOR ALL ENTRIES it is not taking duplicate values not due to the partner function.

am i getting you correctly.??

if thats the case then my problem is solved..:)

Read only

0 Likes
662

I don't see how partner function is relevant here at all.

Rob

Read only

Former Member
0 Likes
662

Hello,

This is due to the error in the select query.

Whenever u use the for all entries u need to select all the key fields table.

This is the prerequiste of the FOR ALL ENTRIES

Check this.


SELECT vbeln posnr " Check here
fkimg
INTO TABLE i_fkimg
FROM vbrp
FOR ALL ENTRIES IN invtab1
WHERE vbrp~vbeln = invtab1-vbeln
AND vbrp~pstyv = 'TAQ'.

Vasanth

Read only

Former Member
0 Likes
662

Hi,

3 major drawbacks of the "for all entries" clause:

1. duplicate rows are automatically removed

2. if the itab used in the clause is empty , all the rows in the source table will be selected .

3. performance degradation when using the clause on big tables.

So you need to use the Joins instead of the For all entries

Regards

Sudheer

Read only

Former Member
0 Likes
662

Hi

Change ur code like this

SELECT vbeln

fkimg

INTO TABLE i_fkimg

FROM vbrp

FOR ALL ENTRIES IN invtab1

WHERE vbeln = invtab1-vbeln

AND pstyv = 'TAQ'.

Reward me if its helpful

Regards

Ravi