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

help needed

Former Member
0 Likes
1,150

Hi expert,

i have written this code to fetch data from knvp table

select kunnr parvw kunn2 vkorg

from knvp

into table i_knvp

for all entries in i_knb1

where vkorg = p_vkorg

and parvw = 'RG'.

but it shows syntax error table: The WHERE condition does not refer to For All entries

please guide me how to write select statement.

Thanks,

venkat

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,112

Here u r using for all entries in i_knb1 and not using any of the refrence from this table in where cndition due to this u r getting error..

U have to modify this as follows:

If i_knb1[] is not initial.

select kunnr parvw kunn2 vkorg

from knvp

into table i_knvp

for all entries in i_knb1

where vkorg = p_vkorg ====>Here use some key ==================fields from ur i_knb1 ..

and parvw = 'RG'.

ENdif.

9 REPLIES 9
Read only

Former Member
0 Likes
1,112

select kunnr parvw kunn2 vkorg

from knvp

into table i_knvp

for all entries in i_knb1

where vkorg = <b>i_knb1-vkorg</b>and parvw = 'RG'.

Read only

0 Likes
1,112

Hi Ravi RAJAN,

there is no VKORG field in knb1 table.

please help me.

thanks,

venkat

Read only

0 Likes
1,112

Hi Venkat,

If you are using FOR ALL ENTRIES then you need to specify some common field between the two tables(KNVP and I_KNB1)in your WHERE clause.

This would be the reason for the error.

Regards,

Saurabh

Read only

Former Member
0 Likes
1,112

in where cond u have to write cond in which data fetch from table knvp on the basis of i_knb1.

search the field which is common in both

for ex.

for all entries in i_knb1

<b>where field1 = i_knb1-field1</b>

vkorg = p_vkorg

and parvw = 'RG'.

Read only

0 Likes
1,112

Hi kishan negi,

Thanks a lot.

regards,

venkat

Read only

Former Member
0 Likes
1,113

Here u r using for all entries in i_knb1 and not using any of the refrence from this table in where cndition due to this u r getting error..

U have to modify this as follows:

If i_knb1[] is not initial.

select kunnr parvw kunn2 vkorg

from knvp

into table i_knvp

for all entries in i_knb1

where vkorg = p_vkorg ====>Here use some key ==================fields from ur i_knb1 ..

and parvw = 'RG'.

ENdif.

Read only

anversha_s
Active Contributor
0 Likes
1,112

hi venkat,

select kunnr parvw kunn2 vkorg

from knvp

into table i_knvp

for all entries in i_knb1

where vkorg = <b>i_knvp-p_vkorg</b>

and parvw = 'RG'.

rgds

anver

pls mark hlpful answers

Read only

Former Member
0 Likes
1,112

hi Venkat,

The syntax is

FOR ALL ENTRIES IN itab WHERE ... col operator itab-comp ...

it means that in where condition u should use field from the internal table which u r using in for all wntries in

i_knb1.

Otherwise it will give u error like this.

Try out this .

-Umesh

Read only

Former Member
0 Likes
1,112

the proble is

where vkorg = p_vkorg

u can change

vkorg = itab1-vkorg.