SELECT DISTINCT F.FUND_SOURCE , B.CONTROL_CHARTFIELD , L.SHORTNAME FROM %Table(KK_FUND_SOURCE) F , %Table(KK_BUDGET_TYPE) B , %Table(KK_FS_VALUE) V , %Table(KK_REV_XREF) R ,PS_SET_CNTRL_REC S ,PSDBFLDLABL_VW L WHERE B.SETID1 = S.SETID AND S.SETCNTRLVALUE = V.BUSINESS_UNIT AND S.RECNAME = 'KK_BUDGET_TYPE' AND B.LEDGER_GROUP = V.LEDGER_GROUP AND B.EFFDT = ( SELECT MAX(B1.EFFDT) FROM %Table(KK_BUDGET_TYPE) B1 WHERE B.SETID1 = B1.SETID1 AND B.LEDGER_GROUP = B1.LEDGER_GROUP) AND B.CONTROL_CHARTFIELD = L.FIELDNAME AND R.BUSINESS_UNIT = V.BUSINESS_UNIT AND ((R.LEDGER_GROUP = V.LEDGER_GROUP AND R.REV_METHOD = '0') OR (R.LEDGER_GROUP = B.KK_REV_TRACK_LG AND R.REV_METHOD IN ('1','4'))) AND R.FUND_SOURCE = F.FUND_SOURCE
|