SELECT A.BUSINESS_UNIT , C.DESCR FROM PS_BUS_UNIT_TBL_AP A , PS_BUS_UNIT_OPT_AP B , PS_BUS_UNIT_TBL_FS C , PS_SET_CNTRL_REC D , PS_BUS_UNIT_TBL_GL E WHERE A.BUSINESS_UNIT = C.BUSINESS_UNIT AND A.BUSINESS_UNIT_GL = E.BUSINESS_UNIT AND D.SETCNTRLVALUE = A.BUSINESS_UNIT AND D.RECNAME = 'BUS_UNIT_OPT_AP' AND D.REC_GROUP_ID='AP_01' AND B.SETID = D.SETID AND B.EFFDT = ( SELECT MAX(EFFDT) FROM PS_BUS_UNIT_OPT_AP G WHERE G.SETID=B.SETID AND G.EFFDT <= %CurrentDateIn) AND B.EFF_STATUS = 'A' AND NOT EXISTS ( SELECT 'X' FROM PS_EM_BUY_REG_TBL H WHERE H.BUSINESS_UNIT = A.BUSINESS_UNIT)
|