SELECT H.BUSINESS_UNIT , H.REQ_ID , H.REQUESTOR_ID FROM PS_REQ_HDR H WHERE H.IN_PROCESS_FLG = 'N' AND (H.REQ_STATUS = 'A' OR H.REQ_STATUS = 'LA') AND H.HOLD_STATUS = 'N' AND H.BUDGET_HDR_STATUS = 'V' AND EXISTS ( SELECT 'X' FROM PS_REQ_LINE L , PS_REQ_LINE_SHIP S , PS_REQ_LN_DISTRIB D WHERE %Join(COMMON_KEYS, REQ_HDR H, REQ_LINE L) AND %Join(COMMON_KEYS, REQ_LINE L, REQ_LINE_SHIP S) AND %Join(COMMON_KEYS, REQ_LINE_SHIP S, REQ_LN_DISTRIB D) AND L.RFQ_IND = 'N' AND L.SOURCE_DATE <= %CurrentDateIn AND L.IN_PROCESS_FLG = 'N' AND L.SOURCE_STATUS = 'A' AND L.CURR_STATUS = 'A' AND S.BAL_STATUS = 'I' AND (D.QTY_OPEN > 0 OR D.AMT_OPEN <> 0) AND D.KK_CLOSE_FLAG <> 'Y')
|