03-14-2007 10:34 AM
Hi,
I'm getting strange compiler error by a simple SQL-Statement:
select * from KNVP into table CST_KNVP
where KUNNR <> KUNN2.
Compiler complains that the Field KUNN2 is unknown.
If I write
where KUNN2 <> KUNNR.
it complains about KUNNR.
Strange, because both fields ARE in the KNVP table.
Do You have some advice how to deal with it?
Thanks in Advance
Daniel
03-14-2007 10:36 AM
Hello Daniel,
U can't give the selection condition like this.
Change the code like this.
select * from KNVP into table CST_KNVP
where KUNNR IN SO_KUNNR. " From selection screen
loop at cst_KNVP.
if cst_KNVP-kunnr = cst_KNVP-kunn2.
delete cst_KNVP.
endif.
endloop.
Hope it helps you.
Regards,
Vasanth
03-14-2007 10:36 AM
03-14-2007 10:36 AM
Hello Daniel,
U can't give the selection condition like this.
Change the code like this.
select * from KNVP into table CST_KNVP
where KUNNR IN SO_KUNNR. " From selection screen
loop at cst_KNVP.
if cst_KNVP-kunnr = cst_KNVP-kunn2.
delete cst_KNVP.
endif.
endloop.
Hope it helps you.
Regards,
Vasanth
03-14-2007 10:37 AM
Hi,
In the select statements, all the fields mentioned on teh left handside of the where condition are known to the select statement, but the fields mentioned on the right hand side are unknown to the select statement.
That is why you are getting error.
You have use some selection screen field or some field which is already defined in the right hand side of the where condition.
Regards,
Anji
03-14-2007 10:37 AM
use FM conversion_exit_alpha_input
cause 0001230133 = 1230133 ( wrong )
0001230133 = 0001230133 ( correct )
This check has to be carried out .
before the select convert the rhs value of Kunnr to compatible of lhs of where clause .
regards,
vijay
03-14-2007 10:37 AM
Try this...
Report ytest.
parameters : p_kunnr for knvp-kunnr default '1000000'.
data : begin of CST_KNVP occurs 0.
include structure knvp.
data : end of CST_KNVP.
select * from KNVP into table CST_KNVP
where KUNNR <> p_kunnr..
03-14-2007 10:39 AM
but it is not giving me error
data kunn2 like knvp-kunn2 value '123'.
select * from KNVP into table CST_KNVP
where KUNNR <> KUNN2.
regards
shiba dutta
03-14-2007 10:41 AM
Daniel,
your query is wrong.Syntaxt problem
select * from KNVP into table CST_KNVP
where KUNNR <> KUNN2.
How KUNN2 will availble to select statement?
You have to pass this value.
ex : you can use various ways
1.
loop at itab.
select * from KNVP into table CST_KNVP
where KUNNR <> itab-KUNN2.
endloop.
2. select * from KNVP into table CST_KNVP
for all entries in itab
where KUNNR <> itab-KUNN2.
pls. reward if useful