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

Issue with SELECT statement

Former Member
0 Likes
874

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
Read only

Former Member
0 Likes
845

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
Read only

Former Member
0 Likes
846

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

Read only

0 Likes
845

>

> 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

Read only

0 Likes
845

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

Read only

0 Likes
845

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

Rob

Read only

0 Likes
845

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

regards,

Advait

Read only

0 Likes
845

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

Read only

0 Likes
845

Thanks Rob n Advait, thanks for your suggestions..

Suresh