SELECT DISTINCT C.OPRID ,A.BUSINESS_UNIT ,B.DESCR FROM PS_BU_LED_GRP_TBL A ,PS_KK_BUDGET_TYPE B ,PS_OPR_DEF_TBL_FS C ,PS_KSEC_EVENTS D ,PS_SET_CNTRL_REC E ,PS_SEC_LEDGER_OPR L WHERE D.KSEC_EVENT = 'NOTIFY' AND B.LEDGER_GROUP = A.LEDGER_GROUP AND B.LEDGER_GROUP = L.LEDGER_GROUP AND C.OPRID = L.OPRID AND B.SETID1= E.SETID AND E.SETCNTRLVALUE = A.BUSINESS_UNIT AND E.RECNAME ='KK_BD_TYPE_VW' AND B.EFFDT = ( SELECT MAX(B1.EFFDT) FROM PS_KK_BUDGET_TYPE B1 WHERE B1.LEDGER_GROUP = B.LEDGER_GROUP AND B1.SETID1 = B.SETID1 AND B1.EFFDT <= %CurrentDateIn) AND (D.ACTIVE_STATUS = 'I' OR EXISTS ( SELECT 'X' FROM PS_KSEC_SUPER_USER K1 WHERE K1.OPRID = C.OPRID AND K1.KSEC_EVENT = D.KSEC_EVENT) OR EXISTS ( SELECT 'X' FROM PS_KSEC_FLAT_RULES K2 , PS_KSEC_FLAT K3 , PS_KSEC_RULES_EVEN K4 WHERE K2.CHARTFIELD = 'LEDGER_GROUP' AND K3.KSEC_ATTRIB = 'A' AND K2.OPRID=K3.OPRID AND K2.BUSINESS_UNIT=K3.BUSINESS_UNIT AND K2.KSEC_RULE=K3.KSEC_RULE AND K2.KSEC_RULE=K4.KSEC_RULE AND K2.OPRID = C.OPRID AND K2.KSEC_START = B.LEDGER_GROUP AND K2.BUSINESS_UNIT = A.BUSINESS_UNIT AND K4.KSEC_EVENT = D.KSEC_EVENT))
|