SELECT A.REQ_ID , A.BUSINESS_UNIT , A.LINE_NBR , SUM(R.QTY_SH_ACCPT_VUOM) , SUM(R.QTY_SH_NETRCV_VUOM) , SUM(R.PRICE_PO) FROM PS_REQ_HDR H , PS_REQ_LINE A , PS_PO_HDR B , PS_PO_LINE_DISTRIB C , PS_RECV_LN_SHIP R WHERE A.REQ_ID = H.REQ_ID AND A.BUSINESS_UNIT = H.BUSINESS_UNIT AND H.REQ_STATUS = 'A' AND A.BUSINESS_UNIT = C.BUSINESS_UNIT_REQ AND A.LINE_NBR = C.REQ_LINE_NBR AND A.REQ_ID = C.REQ_ID AND B.PO_ID = C.PO_ID AND B.BUSINESS_UNIT = C.BUSINESS_UNIT AND R.BUSINESS_UNIT_PO = C.BUSINESS_UNIT AND R.PO_ID = C.PO_ID AND R.LINE_NBR = C.LINE_NBR AND R.SCHED_NBR = C.SCHED_NBR AND (B.PO_STATUS = 'D' OR (B.CHNG_ORD_BATCH > 0 AND B.PO_STATUS = 'A')) AND B.RECV_STATUS <> 'R' AND R.RECV_SHIP_STATUS <> 'X' GROUP BY A.REQ_ID , A.BUSINESS_UNIT, A.LINE_NBR
|