2007 Jun 12 10:40 AM
Hi,
i try to select all POs wich MATKL are not declared.
I use this code:
TABLES: T023.
TABLES: ekpo.
*
data: itab type table of t023.
*
select * from t023 into table itab.
*
SELECT * FROM ekpo where matkl not in TABLE T023.
or
SELECT * FROM ekpo where matkl not in TABLE ITAB.
but i get an systax error.
Wich Select-statement can i use?
Any idea?
Thanks.
Regards, Dieter
2007 Jun 12 11:12 AM
Hi Dieter ,
You will have to create a range to acheive the desired result.
Here is a sample code which does some thing similar.
Data : Begin of it_1 occurs 0 ,
MATKL type MATKL ,
End of it_1.
data : begin of it_2 occurs 0 ,
EBELN type EBELN ,
EBELP type EBELP,
End of it_2.
select MATKL
into table it_1
from T023.
data : r_MATKL type range of MATKL,
w_MATKL like line of r_MATKL.
loop at it_1.
<b>w_MATKL-sign = 'E'.
w_MATKL-option = 'EQ'.
w_MATKL-low = it_1-MATKL.
append w_MATKL to r_MATKL.</b>
endloop.
select EBELN EBELP
into table it_2
from EKPO
where MATKL in r_MATKL.
Hope this helps.
Reward point if reply is helpful.
Regards
Arun
Message was edited by:
Arun R
2007 Jun 12 10:44 AM
Hi
data: itab type table of t023 occurs 0 with header line,
itab1 like ekko occurs 0 with header line.
select * from t023 into table itab.
if not itab[] is initial.
SELECT * FROM ekko into table itab1
for all entries in itab
where matkl = itab-matkl.
endif.
Itab1 will have all PO no's with all Material groups of t023 table
<b>Reward points for useful Answers</b>
Regards
Anji
2007 Jun 12 10:55 AM
Hi Anji,
the problem is, that i will see all POs wich have an MATKL
who is NOT in T023.
Any idea?
Regards, Dieter
2007 Jun 12 10:59 AM
The resultant table will have all the entries matching with T023-MAKTl, r u getting the same result or u want some other way.
2007 Jun 12 10:49 AM
hi,
try this code,
select * from t023 into table itab.
SELECT * FROM ekpo where matkl ne itab-matkl.
reward points if helpful,
ragards,
seshu.
2007 Jun 12 10:53 AM
Change the code like below.
Select * from t023 into table itab.
if not itab[] is initial.
SELECT * FROM ekko into table itab1
for all entries in itab
where matkl = itab-matkl.
endif.
2007 Jun 12 10:58 AM
Hello,
Change the code like this.
SELECT * FROM ekpo into it_ekpo for all entries in itab
where matkl ne itab-matkl.
Vasanth
2007 Jun 12 11:03 AM
Hi,
try this
TABLES: T023.
TABLES: ekpo.
*
data: itab type table of t023,
it_ekpo type table of ekpo .
*
select * from t023 into table itab.
*
SELECT * into table it_ekpo FROM ekpo where matkl not in ITAB-maktl.
regards,
sudha
2007 Jun 12 11:13 AM
Hi sudha,
i get an syntax-error with yout code.
regards, Dieter
2007 Jun 12 11:06 AM
hi,
try this:
select * from t023 into table itab.
SELECT * FROM ekpo into table it_ekpo.
sort itab by matkl.
sort it_ekpo by matkl.
delete adjacent dupilcates from itab comparing matkl.
select * from it_ekpo
into it_ekpo2
for all entries in itab
where matkl = itab-matkl.
delete it_ekpo2 from it_ekpo.
Regards,
Sooness
d
2007 Jun 12 11:12 AM
Hi Dieter ,
You will have to create a range to acheive the desired result.
Here is a sample code which does some thing similar.
Data : Begin of it_1 occurs 0 ,
MATKL type MATKL ,
End of it_1.
data : begin of it_2 occurs 0 ,
EBELN type EBELN ,
EBELP type EBELP,
End of it_2.
select MATKL
into table it_1
from T023.
data : r_MATKL type range of MATKL,
w_MATKL like line of r_MATKL.
loop at it_1.
<b>w_MATKL-sign = 'E'.
w_MATKL-option = 'EQ'.
w_MATKL-low = it_1-MATKL.
append w_MATKL to r_MATKL.</b>
endloop.
select EBELN EBELP
into table it_2
from EKPO
where MATKL in r_MATKL.
Hope this helps.
Reward point if reply is helpful.
Regards
Arun
Message was edited by:
Arun R
2007 Jun 12 11:42 AM
Hi,
i make it in this way and works very good:
TABLES: T023.
TABLES: EKPO.
*
DATA: R_MATKL TYPE RANGE OF MATKL.
DATA: W_MATKL LIKE LINE OF R_MATKL.
*
W_MATKL-SIGN = 'E'.
W_MATKL-OPTION = 'EQ'.
*
SELECT * FROM T023.
W_MATKL-LOW = T023-MATKL.
APPEND W_MATKL TO R_MATKL.
ENDSELECT.
*
SELECT * FROM EKPO WHERE MATKL IN R_MATKL.
*
WRITE: / '##', EKPO-EBELN, EKPO-EBELP, EKPO-MATKL.
*
ENDSELECT.
thanks for your help.
surbjeet your answer works also very good.
thanks for your help.
Regards, Dieter
2007 Jun 12 11:25 AM
Hi,
The following will give you all entries from EKPO where MATKL does not exist in T023:
DATA: t_ekpo TYPE STANDARD TABLE OF ekpo.
SELECT *
INTO TABLE t_ekpo
FROM ekpo
WHERE NOT EXISTS ( SELECT *
FROM t023
WHERE matkl EQ ekpo~matkl ).
Hope it helps.