10-02-2008 9:06 PM
Hi All,
I have an issue with SELECT statement. In select statement though i am excluding some values which are in range table, those values are also getting selected.
I am using select statement like this.
select fielda fieldb fieldc... fieldn from table zzallt into corresponding fields of t_zzallt where saknr in s_saknr
and rcomp not in r_rcomp.
where s_saknr is select options and r_rcomp is range table. I should not select saknr values which are in r_rcomp, but are being selected. Please tell me where I am wrong.
Thanks
Suresh
10-02-2008 9:13 PM
Hi,
Dont do like this
select fielda fieldb fieldc... fieldn from table zzallt into corresponding fields of t_zzallt where saknr in s_saknr
and rcomp not in r_rcomp
when populating the r_rcomp, assign the sign as 'NE' ( Not equal to )
then write your query as
select fielda fieldb fieldc... fieldn from table zzallt into corresponding fields of t_zzallt where saknr in s_saknr
and rcomp in r_rcomp
regards,
Advait
10-02-2008 9:13 PM
Hi,
Dont do like this
select fielda fieldb fieldc... fieldn from table zzallt into corresponding fields of t_zzallt where saknr in s_saknr
and rcomp not in r_rcomp
when populating the r_rcomp, assign the sign as 'NE' ( Not equal to )
then write your query as
select fielda fieldb fieldc... fieldn from table zzallt into corresponding fields of t_zzallt where saknr in s_saknr
and rcomp in r_rcomp
regards,
Advait
10-02-2008 9:21 PM
>
> when populating the r_rcomp, assign the sign as 'NE' ( Not equal to )
I don't think that will work. The option should be 'EQ' and the sign 'E' (exclude).
Rob
10-02-2008 9:25 PM
Hello Rob,
Sorry about that and thanks for correcting me, I always get confused between the sign and the option
And I did the goof up this time too
regards,
Advait
10-02-2008 9:26 PM
The important part is that NE won't work. Everything will be selected.
Rob
10-02-2008 9:33 PM
Aha ! you mean r_comp-sign = 'I' and Option = 'NE' wont work ?
regards,
Advait
10-02-2008 9:39 PM
It'll work, but select everything. Remember that rows in select-options are strung together by ORs. So if you say SELECT something where field NE 1 OR field NE 2, all records will fulfil that.
Rob
10-02-2008 10:22 PM