SELECT DISTINCT %Substring(D.SETCNTRLVALUE,1,5) , A.RMA_ID FROM PS_RMA_HEADER A , PS_RMA_LINE_PROMO B , PS_INV_RECV_LN C , PS_SET_CNTRL_REC D , PS_PPRC_PROMO_TBL E , PS_INV_RECV_HDR F , PS_RMA_LINE G WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT AND A.RMA_ID = B.RMA_ID AND C.RMA_ID <> ' ' AND C.SOURCE_BUS_UNIT = B.BUSINESS_UNIT AND A.RMA_ID = C.RMA_ID AND B.RMA_LINE_NBR = C.RMA_LINE_NBR AND D.RECNAME = 'PPRC_PROMO_TBL' AND D.SETCNTRLVALUE = E.SETID AND B.PPRC_PROMO_CD = E.PPRC_PROMO_CD AND F.INV_RECV_STATUS <> 'P' AND F.BUSINESS_UNIT = C.BUSINESS_UNIT AND F.RECEIVER_ID = C.RECEIVER_ID AND G.BUSINESS_UNIT = B.BUSINESS_UNIT AND G.RMA_ID = B.RMA_ID AND G.RMA_LINE_NBR = B.RMA_LINE_NBR
|