SELECT DISTINCT H.BUSINESS_UNIT , H.PO_ID , B.LINE_NBR , B.SCHED_NBR , B.DISTRIB_LINE_NUM , C.FOREIGN_CURRENCY , C.BASE_CURRENCY , D.KK_LEDGER_GROUP , C.FOREIGN_AMOUNT , C.MONETARY_AMOUNT FROM PS_PO_HDR H , PS_KK_SHDR_POENC A , PS_KK_SOURCE_LN B , PS_KK_LIQUIDATION C , PS_BUL_CNTL_BUD D WHERE H.BUSINESS_UNIT = A.BUSINESS_UNIT AND H.PO_ID = A.PO_ID AND H.PO_STATUS NOT IN ('C','X') AND H.BUDGET_HDR_STATUS = 'V' AND H.BUDGET_HDR_STS_NP = 'V' AND D.KK_DETAIL_LED = 'Y' AND A.KK_SOURCE_TRAN = 'PO_POENC' AND A.KK_ROLLED_SEQ = 0 AND A.KK_TRAN_ID = B.KK_TRAN_ID AND A.KK_TRAN_DT = B.KK_TRAN_DT AND B.KK_TRAN_ID = C.KK_TRAN_ID AND B.KK_TRAN_DT = C.KK_TRAN_DT AND B.KK_TRAN_LN = C.KK_TRAN_LN AND D.KK_LEDGER_GROUP = C.LEDGER_GROUP AND C.FOREIGN_AMOUNT <> 0 AND C.MONETARY_AMOUNT <> 0 AND EXISTS ( SELECT 'X' FROM PS_PO_LINE_DISTRIB I WHERE H.BUSINESS_UNIT = I.BUSINESS_UNIT AND H.PO_ID = I.PO_ID AND I.BUSINESS_UNIT_GL = D.BUSINESS_UNIT)
|