‎2009 Feb 18 6:36 AM
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
‎2009 Feb 18 6:41 AM
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.
‎2009 Feb 18 7:32 AM
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...
‎2009 Feb 18 8:38 AM
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
‎2009 Feb 18 7:18 PM
‎2009 Feb 18 7:16 AM
‎2009 Feb 18 9:14 AM
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
‎2009 Feb 18 11:44 AM
‎2009 Feb 18 11:44 AM
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
‎2009 Feb 18 11:46 AM
thanx alot for your valuable reply...
i already dropped checking NOT IN condition ....
and trying for alternate solutions....
once again thanx