DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CWB_CHANGE_ACCESS

Source


1 package body ben_cwb_change_access as
2 /* $Header: bencwbca.pkb 120.2 2006/12/01 06:10:50 ddeb noship $ */
3 --
4 -- Global cursor and variables declaration
5 --
6 g_package  VARCHAR2(80) := 'ben_cwb_change_access.';
7 g_debug    boolean      := hr_utility.debug_enabled;
8 --
9 -- ----------------------------------------------------------------------------
10 -- |---------------------------< update_group_budget >------------------------|
11 -- ----------------------------------------------------------------------------
12 --
13 PROCEDURE update_group_budget
14     (
15       p_validate                      in     boolean  default false
16      ,p_group_per_in_ler_id           in     number
17      ,p_group_pl_id                   in     number
18      ,p_group_oipl_id                 in     number
19      ,p_access_cd                     in     varchar2 default hr_api.g_varchar2
20      ,p_comments                      in     varchar2 default null
21      ,p_rcvr_person_id                in     number
22      ,p_from_person_id                in     number
23      ,p_grp_pl_name                   in     varchar2
24      ,p_grp_pl_for_strt_dt            in     varchar2
25      ,p_grp_pl_for_end_dt             in     varchar2
26      ,p_object_version_number         in out nocopy   number
27      ,p_requestor_name                 in     varchar2
28     ) IS
29 
30 --
31 -- Declare cursors and local variables
32 --
33   l_proc  varchar2(72) := g_package||'update_group_budget';
34   l_object_version_number number;
35   l_transaction_id number;
36 -- Notification changes for 11510
37   l_old_access_cd varchar2(10);
38   l_requestor_first_name varchar2(240);
39   l_requestor_last_name varchar2(240);
40 --
41 BEGIN
42   if g_debug then
43     hr_utility.set_location('Entering:'|| l_proc, 5);
44   end if;
45   --
46   -- Store initial values for IN OUT parameters
47   --
48   l_object_version_number := p_object_version_number;
49 
50   -- Fetch old access code, which needs to be displayed in notification
51 
52       select access_cd into l_old_access_cd
53       from  ben_cwb_person_groups
54       where group_per_in_ler_id = p_group_per_in_ler_id
55           and group_pl_id = p_group_pl_id
56           and group_oipl_id = p_group_oipl_id;
57 
58     l_requestor_first_name := substr(p_requestor_name,0, instr(p_requestor_name,' ')-1);
59     l_requestor_last_name := substr(p_requestor_name, instr(p_requestor_name,' ')+1);
60 
61   /* Update the person group information with new access code */
62   BEN_CWB_PERSON_GROUPS_API.update_group_budget
63      (p_group_per_in_ler_id   => p_group_per_in_ler_id
64      ,p_group_pl_id           => p_group_pl_id
65      ,p_group_oipl_id         => p_group_oipl_id
66      ,p_access_cd             => p_access_cd
67      ,p_object_version_number => l_object_version_number
68      );
69 
70  /* If comments is <> null update the transaction and send the notification */
71  if( p_comments is not null) then
72 
73  /* Update the transaction table with the contents of notification */
74  insert into ben_transaction ( transaction_id,
75                               transaction_type,
76                               attribute1, -- from_person_id,
77                               attribute2, -- to_person_id,
78                               attribute3, -- to_per_in_ler_id,
79                               attribute4, -- plan_name
80                               attribute5, -- for_strt_dt
81                               attribute6, -- for_end_dt
82                               attribute7, -- new_access_cd
83                               attribute40,-- comments
84                               attribute9,  -- last updated date/time
85                               attribute10,  -- old_access_cd
86                               attribute11,  -- requestor first name
87                               attribute12  -- requestor last name
88                               )
89              values         ( ben_transaction_s.nextval,
90                               'CWBNTF',
91                               p_from_person_id,
92                               p_rcvr_person_id,
93                               p_group_per_in_ler_id,
94                               p_grp_pl_name,
95                               p_grp_pl_for_strt_dt,
96                               p_grp_pl_for_end_dt,
97                               hr_general.decode_lookup('BEN_WS_ACC', p_access_cd ),
98                               p_comments,
99                               fnd_date.date_to_canonical(sysdate),
100                               hr_general.decode_lookup('BEN_WS_ACC', l_old_access_cd ),
101                               l_requestor_first_name,
102                               l_requestor_last_name
103                               )
104              returning transaction_id into l_transaction_id ;
105 
106  /* Call the notification API */
107   ben_cwb_wf_ntf.cwb_fyi_ntf_api (l_transaction_id,
108                                    'ACCESS',
109                                    p_rcvr_person_id,
110                                    p_from_person_id,
111                                    p_group_per_in_ler_id );
112   end if;
113 
114   --
115   if g_debug then
116     hr_utility.set_location(l_proc, 8);
117   end if;
118   --
119 /* NEED TO SAVE DATA IN BEN_TRANSACTIONS AND CALL NTF api */
120   -- Populating the OUT parameters.
121   --
122   p_object_version_number := l_object_version_number;
123   --
124   if g_debug then
125     hr_utility.set_location(' Leaving:'||l_proc, 10);
126   end if;
127   --
128 END  update_group_budget;
129 --
130 -- ----------------------------------------------------------------------------
131 -- |---------------------------< update_access >------------------------------|
132 -- ----------------------------------------------------------------------------
133 --
134 PROCEDURE update_access (
135       p_validate                      in     boolean        default false
136      ,p_popl_cd                       in     varchar2
137      ,p_group_per_in_ler_id           in     BEN_CWB_ACCESS_STRING_ARRAY default null
138      ,p_group_pl_id                   in     number
139      ,p_group_oipl_id                 in     number
140      ,p_access_cd_from                in     varchar2       default 'ANY'
141      ,p_access_cd_to                  in     varchar2
142      ,p_cascade                       in     varchar2       default 'N'
143      ,p_comments                      in     varchar2       default null
144      ,p_acting_person_id              in     number
145      ,p_grp_pl_name                   in     varchar2
146      ,p_grp_pl_for_strt_dt            in     varchar2
147      ,p_grp_pl_for_end_dt             in     varchar2
148      ,p_return_status                 out nocopy number
149      ,p_requestor_name                 in  varchar2
150      ,p_throw_exp                     out nocopy varchar2
151     ) IS
152 --
153 TYPE REF_CURSOR IS REF CURSOR;
154 fetch_all_managers REF_CURSOR;
155 fetch_direct_managers REF_CURSOR;
156 fetch_search_managers REF_CURSOR;
157 --
158 --
159 -- Declare cursors and local variables
160 --
161   l_proc  varchar2(72) := g_package||'update_access';
162   --
163   l_dynamic_sql varchar2(32000);
164   l_per_in_ler_id number;
165   l_emp_person_id number;
166   l_ovn number;
167   l_access_cd varchar2(5);
168   l_appr_cd varchar2(5);
169   l_submit_cd varchar2(5);
170   l_throw_exp varchar2(2);
171   l_concat_str varchar2(32000) default null;
172   l_num number default 0;
173 --
174 BEGIN
175   if g_debug then
176     hr_utility.set_location('Entering:'|| l_proc, 10);
177   end if;
178     --
179   FOR l_num in p_group_per_in_ler_id.First..p_group_per_in_ler_id.LAST
180    LOOP
181     IF l_num = p_group_per_in_ler_id.First THEN
182        l_concat_str := l_concat_str || p_group_per_in_ler_id(l_num);
183        ELSE
184         l_concat_str := l_concat_str ||',' || p_group_per_in_ler_id(l_num);
185        END IF;
186    END LOOP;
187    --
188   if g_debug then
189     hr_utility.set_location(l_proc, 20);
190   end if;
191   --
192 
193 if (p_popl_cd = 'D') then
194   --
195    if g_debug then
196     hr_utility.set_location(l_proc, 30);
197    end if;
198       --
199   l_dynamic_sql :=
200    'select max(emp_per.person_id)              emp_person_id,
201        max(mgr_hrchy.emp_per_in_ler_id)    emp_per_in_ler_id,
202        max(per_grp.object_version_number)  obj_ver_no,
203        max(per_grp.access_cd) access_cd,
204        max(per_grp.approval_cd) appr_cd,
205        max(per_grp.submit_cd) submit_cd
206 from
207          ben_cwb_person_info    emp_per,
208          ben_cwb_group_hrchy    mgr_hrchy,
209          ben_cwb_person_groups  per_grp,
210          ben_cwb_summary        smry
211 where
212              mgr_hrchy.mgr_per_in_ler_id        in (' || l_concat_str || ')
213          and mgr_hrchy.lvl_num                  = 1
214          and smry.group_per_in_ler_id           = mgr_hrchy.emp_per_in_ler_id
215          and smry.elig_count_all                > 0
216          and emp_per.group_per_in_ler_id        = mgr_hrchy.emp_per_in_ler_id
217          and per_grp.group_per_in_ler_id        = mgr_hrchy.emp_per_in_ler_id
218          and per_grp.group_pl_id                = ' || p_group_pl_id || '
219          and per_grp.group_oipl_id              = -1
220          and upper(per_grp.access_cd)           = decode(upper(''' || upper(p_access_cd_from) || '''), ''ANY'', upper(per_grp.access_cd), '''|| upper(p_access_cd_from) || ''')
221          -- Additional check to avoid records which have worksheet status Approved
222 	     -- or approval status null and submit status as sumitted
223 	 --    and nvl(per_grp.approval_cd, ''XX'') <> ''AP''
224          -- and NOT ( nvl(per_grp.submit_cd, ''XX'') = ''SU'' and per_grp.approval_cd is null )
225 group by smry.group_per_in_ler_id'; --
226    if g_debug then
227     hr_utility.set_location(l_proc, 40);
228    end if;
229    --
230    /* Open Main Cursor to fetch the desired population */
231    open fetch_direct_managers for l_dynamic_sql;
232     /* Loop through the cursor */
233     loop
234      fetch fetch_direct_managers into
235                      l_emp_person_id,
236                      l_per_in_ler_id,
237                      l_ovn,
238 		     l_access_cd,
239 		     l_appr_cd,
240 		     l_submit_cd;
241      EXIT WHEN fetch_direct_managers%NOTFOUND;
242 
243      -- CODE TO UPDATE , CALL TO MAIN API
244      p_return_status := l_per_in_ler_id;
245 
246      --
247      --Access to be changed for the following cases when the PerInLer has Submitted or has been Approved
248      --
249      if ((l_appr_cd = 'AP' OR l_appr_cd = 'PR') OR (l_submit_cd = 'SU' AND l_appr_cd is null)) AND (l_access_cd <> p_access_cd_to) then
250        --
251        if g_debug then
252          hr_utility.set_location('Entering outer IF'|| l_proc, 50);
253        end if;
254        --
255        if l_access_cd = 'NA' AND p_access_cd_to = 'RO' then
256         --
257 	if g_debug then
258           hr_utility.set_location('Entering: '|| l_proc, 55);
259         end if;
260         --
261 	update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
262                            p_group_oipl_id, p_access_cd_to, p_comments,
263                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
264                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);--process;
265        elsif l_access_cd = 'UP' AND p_access_cd_to = 'RO' then
266         --
267 	if g_debug then
268           hr_utility.set_location('Entering: '|| l_proc, 56);
269         end if;
270         --
271 	update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
272                            p_group_oipl_id, p_access_cd_to, p_comments,
273                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
274                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);--process;
275        elsif l_access_cd = 'RO' AND p_access_cd_to = 'NA' then
276         --
277 	if g_debug then
278           hr_utility.set_location('Entering: '|| l_proc, 57);
279         end if;
280         --
281 	update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
282                            p_group_oipl_id, p_access_cd_to, p_comments,
283                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
284                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);--process;
285        elsif l_access_cd = 'UP' AND p_access_cd_to = 'RO' then
286         --
287 	if g_debug then
288           hr_utility.set_location('Entering: '|| l_proc, 58);
289         end if;
290         --
291 	update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
292                            p_group_oipl_id, p_access_cd_to, p_comments,
293                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
294                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);--process;
295        else
296          --
297 	 if g_debug then
298            hr_utility.set_location('Condition not found:'|| l_proc, 60);
299          end if;
300          --
301 	 -- Will set to 'Y' , to throw warning message
302 	 --
303 	 l_throw_exp := 'Y';
304 	 p_throw_exp := l_throw_exp;
305        end if;
306      else
307        --
308        if g_debug then
309          hr_utility.set_location('Entering: '|| l_proc, 70);
310        end if;
311        --
312        --
313        --Update as usual if not Submitted/Approved
314        --
315        update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
316                            p_group_oipl_id, p_access_cd_to, p_comments,
317                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
318                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);
319      end if;
320     end loop;
321     --
322     if g_debug then
323      hr_utility.set_location(l_proc, 80);
324     end if;
325     --
326     close fetch_direct_managers ;
327     --
328     if g_debug then
329      hr_utility.set_location(l_proc, 90);
330     end if;
331 --
332 elsif (p_popl_cd = 'A') then
333 --
334    if g_debug then
335     hr_utility.set_location(l_proc, 100);
336    end if;
337 --
341        max(per_grp.object_version_number)  obj_ver_no,
338    l_dynamic_sql := '
339     select max(emp_per.person_id)              emp_person_id,
340        max(mgr_hrchy.emp_per_in_ler_id)    emp_per_in_ler_id,
342        max(per_grp.access_cd) access_cd,
343        max(per_grp.approval_cd) appr_cd,
344        max(per_grp.submit_cd) submit_cd
345 from
346          ben_cwb_person_info    emp_per,
347          ben_cwb_group_hrchy    mgr_hrchy,
348          ben_cwb_person_groups  per_grp,
349          ben_cwb_summary        smry
350 where
351              mgr_hrchy.mgr_per_in_ler_id        in (' || l_concat_str || ')
352          and mgr_hrchy.lvl_num                  > 0
353          and smry.group_per_in_ler_id           = mgr_hrchy.emp_per_in_ler_id
354          and smry.elig_count_all                > 0
355          and emp_per.group_per_in_ler_id        = mgr_hrchy.emp_per_in_ler_id
356          and per_grp.group_per_in_ler_id        = mgr_hrchy.emp_per_in_ler_id
357          and per_grp.group_pl_id                = ' || p_group_pl_id || '
358          and per_grp.group_oipl_id              = -1
359          and upper(per_grp.access_cd)           = decode(upper(''' || upper(p_access_cd_from) || '''), ''ANY'', upper(per_grp.access_cd), '''|| upper(p_access_cd_from) || ''')
360          -- Additional check to avoid records which have worksheet status Approved
361 	     -- or approval status null and submit status as sumitted
362 	 --    and nvl(per_grp.approval_cd, ''XX'') <> ''AP''
363          -- and NOT ( nvl(per_grp.submit_cd, ''XX'') = ''SU'' and per_grp.approval_cd is null )
364 group by smry.group_per_in_ler_id';
365 
366     /* Open Main Cursor to fetch the desired population */
367    --
368    if g_debug then
369     hr_utility.set_location(l_proc, 110);
370    end if;
371    --
372    open fetch_all_managers for l_dynamic_sql;
373    /* Loop through the cursor */
374    loop
375     fetch fetch_all_managers into
376                  l_emp_person_id,
377                  l_per_in_ler_id ,
378                            l_ovn ,
379 		              l_access_cd,
380 		                l_appr_cd,
381 		              l_submit_cd;
382     EXIT WHEN fetch_all_managers%NOTFOUND;
383 
384      --
385      --Access to be changed for the following cases when the PerInLer has Submitted or has been Approved
386      --
387      if ((l_appr_cd = 'AP' OR l_appr_cd = 'PR') OR (l_submit_cd = 'SU' AND l_appr_cd is null)) AND (l_access_cd <> p_access_cd_to) then
388        --
389        if g_debug then
390          hr_utility.set_location('Entering outer IF'|| l_proc, 120);
391        end if;
392        --
393        if l_access_cd = 'NA' AND p_access_cd_to = 'RO' then
394         --
395 	if g_debug then
396           hr_utility.set_location('Entering: '|| l_proc, 125);
397         end if;
398         --
399 	update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
400                            p_group_oipl_id, p_access_cd_to, p_comments,
401                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
402                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);--process;
403        elsif l_access_cd = 'UP' AND p_access_cd_to = 'RO' then
404         --
405 	if g_debug then
406           hr_utility.set_location('Entering: '|| l_proc, 126);
407         end if;
408         --
409 	update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
410                            p_group_oipl_id, p_access_cd_to, p_comments,
411                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
412                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);--process;
413        elsif l_access_cd = 'RO' AND p_access_cd_to = 'NA' then
414         --
415 	if g_debug then
416           hr_utility.set_location('Entering: '|| l_proc, 127);
417         end if;
418         --
419 	update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
420                            p_group_oipl_id, p_access_cd_to, p_comments,
421                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
422                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);--process;
423        elsif l_access_cd = 'UP' AND p_access_cd_to = 'RO' then
424         --
425 	if g_debug then
426           hr_utility.set_location('Entering: '|| l_proc, 128);
427         end if;
428         --
429 	update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
430                            p_group_oipl_id, p_access_cd_to, p_comments,
431                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
432                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);--process;
433        else
434          --
435 	 if g_debug then
436            hr_utility.set_location('Condition not found:'|| l_proc, 130);
437          end if;
438          --
439 	 -- Will set to 'Y' , to throw warning message
440 	 --
441 	 l_throw_exp := 'Y';
442 	 p_throw_exp := l_throw_exp;
443        end if;
444      else
445        --
446        if g_debug then
447          hr_utility.set_location('Entering: '|| l_proc, 140);
448        end if;
449        --
450        --
451        --Update as usual if not Submitted/Approved
452        --
453        update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
457      end if;
454                            p_group_oipl_id, p_access_cd_to, p_comments,
455                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
456                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);
458    end loop;
459    close fetch_all_managers ;
460    --
461    if g_debug then
462     hr_utility.set_location(l_proc, 150);
463    end if;
464 --
465 else
466 --
467   if g_debug then
468    hr_utility.set_location(l_proc, 160);
469   end if;
470   --
471   if(p_group_per_in_ler_id is not null ) then
472    l_dynamic_sql := '
473      select   distinct
474          max(emp_per.person_id)              emp_person_id,
475          max(mgr_hrchy.emp_per_in_ler_id)    emp_per_in_ler_id,
476          max(per_grp.object_version_number)  obj_ver_no,
477 	 max(per_grp.access_cd) access_cd,
478          max(per_grp.approval_cd) appr_cd,
479          max(per_grp.submit_cd) submit_cd
480 from
481          ben_cwb_person_info    emp_per,
482          ben_cwb_group_hrchy    mgr_hrchy,
483          ben_cwb_person_groups  per_grp,
484          ben_cwb_summary        smry
485 where
486          /* Looking for Direct Reports */
487              mgr_hrchy.mgr_per_in_ler_id        in (' || l_concat_str || ')
488          and ((''' || p_cascade || '''= ''Y'' and mgr_hrchy.lvl_num >=0) or
489                (''' || p_cascade || '''= ''N'' and mgr_hrchy.lvl_num =0))
490          and smry.group_per_in_ler_id           = mgr_hrchy.emp_per_in_ler_id
491          and smry.elig_count_all                > 0
492          and emp_per.group_per_in_ler_id        = mgr_hrchy.emp_per_in_ler_id
493          and per_grp.group_per_in_ler_id        = mgr_hrchy.emp_per_in_ler_id
494          and per_grp.group_pl_id                = ' || p_group_pl_id || '
495          and per_grp.group_oipl_id              = -1
496          and upper(per_grp.access_cd)           = decode(upper(''' || upper(p_access_cd_from) || '''), ''ANY'', upper(per_grp.access_cd), '''|| upper(p_access_cd_from) || ''')
497          -- Additional check to avoid records which have worksheet status Approved
498 	     -- or approval status null and submit status as sumitted
499          -- and nvl(per_grp.approval_cd, ''XX'') <> ''AP''
500          -- and NOT ( nvl(per_grp.submit_cd, ''XX'') = ''SU'' and per_grp.approval_cd is null )
501 group by smry.group_per_in_ler_id'; --
502     if g_debug then
503      hr_utility.set_location(l_proc, 170);
504     end if;
505     --
506     open fetch_search_managers for l_dynamic_sql;
507     /* Loop through the cursor */
508     loop
509       fetch fetch_search_managers into
510                       l_emp_person_id,
511                       l_per_in_ler_id ,
512                                l_ovn,
513 		          l_access_cd,
514 		            l_appr_cd,
515 		          l_submit_cd ;
516       EXIT WHEN fetch_search_managers%NOTFOUND;
517       if g_debug then
518        hr_utility.set_location(l_proc, 180);
519       end if;
520       -- CODE TO UPDATE , CALL TO MAIN API
521      --
522      --Access to be changed for the following cases when the PerInLer has Submitted or has been Approved
523      --
524      if ((l_appr_cd = 'AP' OR l_appr_cd = 'PR') OR (l_submit_cd = 'SU' AND l_appr_cd is null)) AND (l_access_cd <> p_access_cd_to) then
525        --
526        if g_debug then
527          hr_utility.set_location('Entering outer IF'|| l_proc, 190);
528        end if;
529        --
530        if l_access_cd = 'NA' AND p_access_cd_to = 'RO' then
531         --
532 	if g_debug then
533           hr_utility.set_location('Entering: '|| l_proc, 195);
534         end if;
535         --
536 	update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
537                            p_group_oipl_id, p_access_cd_to, p_comments,
538                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
539                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);--process;
540        elsif l_access_cd = 'UP' AND p_access_cd_to = 'RO' then
541         --
542 	if g_debug then
543           hr_utility.set_location('Entering: '|| l_proc, 196);
544         end if;
545         --
546 	update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
547                            p_group_oipl_id, p_access_cd_to, p_comments,
548                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
549                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);--process;
550        elsif l_access_cd = 'RO' AND p_access_cd_to = 'NA' then
551         --
552 	if g_debug then
553           hr_utility.set_location('Entering: '|| l_proc, 197);
554         end if;
555         --
556 	update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
557                            p_group_oipl_id, p_access_cd_to, p_comments,
558                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
559                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);--process;
560        elsif l_access_cd = 'UP' AND p_access_cd_to = 'RO' then
561         --
562 	if g_debug then
563           hr_utility.set_location('Entering: '|| l_proc, 198);
564         end if;
565         --
566 	update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
567                            p_group_oipl_id, p_access_cd_to, p_comments,
568                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
569                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);--process;
570        else
571          --
572 	 if g_debug then
573            hr_utility.set_location('Condition not found:'|| l_proc, 200);
574          end if;
575          --
576 	 -- Will set to 'Y' , to throw warning message
577 	 --
578 	 l_throw_exp := 'Y';
579 	 p_throw_exp := l_throw_exp;
580        end if;
581      else
582        --
583        --Update as usual if not Submitted/Approved
584        --
585        --
586        if g_debug then
587          hr_utility.set_location('Entering: '|| l_proc, 210);
588        end if;
589        --
590        update_group_budget ( p_validate, l_per_in_ler_id, p_group_pl_id,
591                            p_group_oipl_id, p_access_cd_to, p_comments,
592                            l_emp_person_id, p_acting_person_id, p_grp_pl_name, p_grp_pl_for_strt_dt,
593                            p_grp_pl_for_end_dt, l_ovn , p_requestor_name);
594      end if;
595       --
596     end loop;
597     close fetch_search_managers ;
598   end if;
599 end if;
600 --
601   --
602 if g_debug then
603   hr_utility.set_location(' Leaving:'||l_proc, 220);
604 end if;
605 --
606 END update_access;
607 --
608 END ben_cwb_change_access;  -- End of Package.