Application Development 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: 

Issue with SELECT statement

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

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

0 Kudos

>

> 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

0 Kudos

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

0 Kudos

The important part is that NE won't work. Everything will be selected.

Rob

0 Kudos

Aha ! you mean r_comp-sign = 'I' and Option = 'NE' wont work ?

regards,

Advait

0 Kudos

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

0 Kudos

Thanks Rob n Advait, thanks for your suggestions..

Suresh