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

checking Not in operator

Former Member
0 Likes
21,946

Hi experts

1. is it possible to use NOT IN operator

for e.g if i check few condition using ( IN operator ) and at the

same time want to check that is not there in my ( IN operator)

else pls do let me know by saying how can this be done.....

My query

========

Select pernr begda massn from pa0000 into corresponding fields of table it_pa0000

WHERE

MASSN in ('S1', 'S2', 'S3', 'S4', 'S7')

  • and massn not in 'S5' " this is wat the condition i want to check and pernr in so_pernr.

Elseif pr_sep = 'X'.

Select pernr begda from pa0000 into corresponding fields of table it_pa0000

WHERE

BEGDA <= SY-DATUM AND

ENDDA >= SY-DATUM AND

MASSN in ('S5')

and pernr in so_pernr.

thanx & regards

Rachel

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
6,957

write as :

Select pernr begda massn from pa0000 into corresponding fields of table it_pa0000

WHERE

pernr in so_pernr

MASSN in ('S1', 'S2', 'S3', 'S4', 'S7')

and massn NE 'S5' .

or create a range for MASSN ..

populate all the values for MASSN ..

r_massn-sign = 'E'. <-- for all other values pass 'I' ...

r_massn-option = 'EQ'.

r_massn-low = 'S5'.

append r_massn.

in select just use

select ....

where ...

massn in r_massn.

47 REPLIES 47
Read only

0 Likes
1,015

thanx for the response but then i tried this way

Ranges : massn for pa0000-massn.

SELECT pernr begda massn from pa0000

INTO corresponding fields of table it_pa0000

WHERE MASSN in ('S1') OR MASSN in ('S2') OR MASSN in ('S3')

OR MASSN in ('S4') OR MASSN in ('S7')

AND MASSN NOT IN ('S5').

but still face the same problem...

Read only

0 Likes
1,015

Hey,

As I said, u need not declare Ranges.

just copy the below code and execute.

data: BEGIN OF it_pa0000 OCCURS 0.
        include structure pa0000.
data: end of it_pa0000.

SELECT pernr begda massn from pa0000
 INTO corresponding fields of table it_pa0000
WHERE MASSN in ('S1') OR MASSN in ('S2') OR MASSN in ('S3')
   OR MASSN in ('S4') OR MASSN in ('S7')
  AND MASSN NOT IN ('S5').

LOOP AT it_pa0000.
WRITE:/ it_pa0000-PERNR, it_pa0000-begda, it_pa0000-MASSN.
ENDLOOP.

thanks\

Mahesh

Read only

0 Likes
1,015

Ignore, I apologise

Read only

former_member182354
Contributor
0 Likes
1,015

Range is what you need for your requirement.

Raghav

Read only

Former Member
0 Likes
1,015

Hi,

Try like this....



Ranges : s_massn for pa0000-massn.

s_massn-sign = 'E'. OR 'I'
s_massn-option = 'EQ'.
s_massn-low = 'S5'.
append s_massn.

s_massn-sign = 'E'. OR 'I'
s_massn-option = 'EQ'.
s_massn-low = 'S2'.
append s_massn.

select pernr begda massn from pa0000 into corresponding fields of table it_pa0000
WHERE MASSN in ('S1', 'S2', 'S3', 'S4', 'S7')
and massn in s_massn and pernr in so_pernr.

Hope its helps

Read only

dev_parbutteea
Active Contributor
0 Likes
1,015

delete it_pa0001 where pernr = wa_pa0000-pernr

Read only

ThomasZloch
Active Contributor
0 Likes
1,015

Note: I did not read all above posts, it's too many.

> MASSN in ('S1', 'S2', 'S3', 'S4', 'S7')

> * and massn not in 'S5' *" this is wat the condition i want to check

Doesn't make sense to me, by specifying five values you are excluding anything else anyway, so skip the "NOT IN" altogether, maybe that solves the subsequent problems as well.

Thomas

Read only

0 Likes
1,015

thanx alot for your valuable reply...

i already dropped checking NOT IN condition ....

and trying for alternate solutions....

once again thanx