SELECT A.PROCESS_INSTANCE , A.BUSINESS_UNIT , A.INV_ITEM_ID , A.START_DT , A.LOCATION , A.BUSINESS_UNIT_GL , A.DEPTID , B.DESCR , SUM(A.SHIP_QTY) , A.END_DT , A.LAST_UPDATE_DTTM FROM PS_IN_ITM_SHIP_DTL A , PS_LOCATION_TBL B , PS_SET_CNTRL_REC C WHERE ((A.CUST_ID = ' ') OR (A.CUST_ID <> ' ' AND EXISTS ( SELECT 'X' FROM PS_TRANSACTION_INV D WHERE A.BUSINESS_UNIT = D.BUSINESS_UNIT AND A.INV_ITEM_ID = D.INV_ITEM_ID AND A.SOURCE_BUS_UNIT = D.SOURCE_BUS_UNIT AND A.ORDER_NO = D.ORDER_NO AND A.ORDER_INT_LINE_NO = D.ORDER_INT_LINE_NO AND A.SCHED_LINE_NBR = D.SCHED_LINE_NBR AND D.DESTIN_BU <> ' ' AND D.TRANSACTION_GROUP = '035'))) AND A.LOCATION = B.LOCATION AND C.SETCNTRLVALUE = A.BUSINESS_UNIT AND C.REC_GROUP_ID = 'FS_26' AND C.RECNAME = 'LOCATION_TBL' AND B.SETID = C.SETID AND B.EFFDT = ( SELECT MAX(B1.EFFDT) FROM PS_LOCATION_TBL B1 WHERE B1.SETID = B.SETID AND B1.LOCATION = B.LOCATION AND B1.EFFDT <= %CurrentDateIn) AND B.EFF_STATUS = 'A' GROUP BY A.PROCESS_INSTANCE , A.BUSINESS_UNIT , A.INV_ITEM_ID , A.START_DT , A.LOCATION , A.BUSINESS_UNIT_GL , A.DEPTID , B.DESCR , A.END_DT , A.LAST_UPDATE_DTTM
|