SELECT KKVW.BUSINESS_UNIT , KKVW.PO_ID , SUM(KKVW.ENCUM_BALANCE) , KKVW.CURRENCY_CD , SUM(KKVW.FOREIGN_AMOUNT) FROM PS_PO_KK_VW KKVW , PS_PO_LINE_DISTRIB DIS , PS_PO_HDR POHDR , PS_BUL_CNTL_BUD LED WHERE KKVW.PO_ID = POHDR.PO_ID AND KKVW.BUSINESS_UNIT = POHDR.BUSINESS_UNIT AND POHDR.BUSINESS_UNIT = DIS.BUSINESS_UNIT AND POHDR.PO_ID = DIS.PO_ID AND KKVW.LINE_NBR = DIS.LINE_NBR AND KKVW.SCHED_NBR = DIS.SCHED_NBR AND KKVW.DISTRIB_LINE_NUM = DIS.DISTRIB_LINE_NUM AND DIS.DISTRIB_LN_STATUS NOT IN ('X', 'C') AND LED.BUSINESS_UNIT = DIS.BUSINESS_UNIT_GL AND LED.KK_DETAIL_LED = 'Y' AND LED.KK_LEDGER_GROUP = KKVW.LEDGER_GROUP GROUP BY KKVW.BUSINESS_UNIT , KKVW.PO_ID , KKVW.CURRENCY_CD
|