‎2006 Sep 25 7:58 AM
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
‎2006 Sep 25 8:02 AM
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.
‎2006 Sep 25 7:59 AM
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'.
‎2006 Sep 25 8:01 AM
Hi Ravi RAJAN,
there is no VKORG field in knb1 table.
please help me.
thanks,
venkat
‎2006 Sep 25 8:04 AM
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
‎2006 Sep 25 8:01 AM
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'.
‎2006 Sep 25 8:07 AM
‎2006 Sep 25 8:02 AM
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.
‎2006 Sep 25 8:02 AM
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
‎2006 Sep 25 8:03 AM
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
‎2006 Sep 25 8:08 AM
the proble is
where vkorg = p_vkorg
u can change
vkorg = itab1-vkorg.