‎2008 Jul 21 3:36 PM
Hello Experts!
in the enclosed SQL-command I'm actually selecting from table EKPO only the open POs with no reference in order-history (EKBE). Now I want to enlarge/combine this command in that way that additionally records from order history (EKBE) with a special movement type in EKBE are selected on top.
Is it possible or do need a second select-command in the Z-application???
THANKS for a response.
Regards,
Bernd
select ebeln ebelp menge meins txz01 bukrs matkl
werks matnr mtart labnr elikz pstyp from ekpo as b
into (itab-bestnr, itab-pos, itab-best_mng,itab-meins, itab-text,
itab-bukrs, itab-matkl, itab-werks, itab-matnr, itab-mtart,
itab-labnr, itab-elikz, itab-pstyp)
where ( mtart = 'ETMW' or mtart = 'ETVB' ) and
menge > 0 and
loekz <> 'L' and
loekz <> 'S' and
elikz <> 'X' and " Endliefer-KZ
ebelp not in ( select ebelp from ekbe where
ebeln = b~ebeln ).
Edited by: Bernd Thielemann on Jul 21, 2008 4:37 PM
‎2008 Jul 21 3:42 PM
hmm, you want records with no EKBE and some special values in EKBE at the same time?
I'm hitting a logical brick wall here.
Thomas
P.S. please enlose the code in "" brackets (one before, one after), looks much better
‎2008 Jul 21 3:49 PM
The result should be all open orders!
1.) no EKBE
2.) EKBE but quantity of goods receipt (WE) is less than quantity of the PO
3.) intercompany-POs (stock transport order) have other movement types (like LFS and WA) which do not effect the status of the open PO until good-receipt movement is posted in the receiving plant .
First/Second condition is realized. Third condition is the gap until now.
Regards,
Bernd
‎2008 Jul 24 10:38 AM