SELECT A.BUSINESS_UNIT , A.RECEIVER_ID , A.RECV_LN_NBR , A.RECV_SHIP_SEQ_NBR , A.DISTRIB_LINE_NUM , A.QTY_DS_ACCPT_SUOM + SUM(D.QTY_AM_RETRN_SUOM) , A.QTY_DS_ACCPT_VUOM + SUM(D.QTY_AM_RETRN_VUOM) FROM PS_RECV_LN_DISTRIB A , PS_BUS_UNIT_TBL_PM B , PS_RTV_LN C , PS_RTV_LN_DISTRIB D WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT AND B.RTV_ADJ_SOURCE = 'Y' AND A.BUSINESS_UNIT = D.BUSINESS_UNIT_RECV AND A.RECEIVER_ID = D.RECEIVER_ID AND A.RECV_LN_NBR = D.RECV_LN_NBR AND A.RECV_SHIP_SEQ_NBR = D.RECV_SHIP_SEQ_NBR AND A.DISTRIB_LINE_NUM = D.DISTRIB_LINE_NUM AND D.RTV_DIST_STATUS <> 'X' AND D.BUSINESS_UNIT = C.BUSINESS_UNIT AND D.RTV_ID = C.RTV_ID AND D.RTV_LN_NBR = C.RTV_LN_NBR AND C.RTV_LN_STATUS <> 'X' AND C.RETURN_ACTION = 'R' GROUP BY A.BUSINESS_UNIT, A.RECEIVER_ID, A.RECV_LN_NBR, A.RECV_SHIP_SEQ_NBR, A.DISTRIB_LINE_NUM, A.QTY_DS_ACCPT_SUOM, A.QTY_DS_ACCPT_VUOM
|