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

SQL: combined SELECT-command possible???

Former Member
0 Likes
538

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

3 REPLIES 3
Read only

ThomasZloch
Active Contributor
0 Likes
447

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

Read only

0 Likes
447

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

Read only

Former Member
0 Likes
447

Solution found!