DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PROC_COMMON_ENRT_RSLT

Source


1 package body ben_proc_common_enrt_rslt as
2 /* $Header: benprcme.pkb 120.11.12010000.3 2008/10/28 21:27:23 sagnanas ship $ */
3 --------------------------------------------------------------------------------
4 /*
5 +==============================================================================+
6 |                       Copyright (c) 1998 Oracle Corporation                  |
7 |                          Redwood Shores, California, USA                     |
8 |                               All rights reserved.                           |
9 +==============================================================================+
10 --
11 Name
12     Common Enrollment Results Process
13 Purpose
14     This process closes all the post enrollment RCOs to calculate rates,
15         writes element entries, compute total flex credits, allocate excess
16         flex credits, compute imputed income and closes the enrollment.
17 History
18 
19 Version Date        Author         Comments
20 -------+-----------+--------------+----------------------------------------
21 110.0   02-JUN-1998 stee           Created
22 110.1   18-JUN-1998 maagrawa       Two new parameters added
23                                    p_pgm_id and p_pl_id
24 115.3   22-SEP-1998 GPERRY         Added logic for 'Automatic' enrollment.
25                                    Added close statements for cursors.
26                     STEE           Update Pil elctbl chc popl with elcn_made_dt
27                                    ,auto_asnd_dt and dflt_asnd_dt instead of
28                                    per_in_ler_f. Add call to generate
29                                    communications.
30 115.4   10-DEC-1998 bbulusu        added per_in_ler_id to the process_post_res
31                    ults procedure.
32 115.5   11-DEC-1998 stee           Fix to select per_in_ler from table instead
33                                    of view.
34 115.6   01-JAN-1999 stee           Added new parameters, pgm_id, pl_id and
35                                    ler_id to ben_generate_communications.
36 115.7   13-JAN-1999 stee           Added new parameter to call to
37                                    ben_det_imputed_income.
38 115.8   10-FEB-1999 yrathman       Added set_elcn_made_or_asnd_dt procedure,
39                                    moved coded from process_post_enrollment
40 115.9   22-FEB-1999 stee           Move generate communications to run
41                                    before close enrollment bug#1918.
42 115.10  09-APR-1999 mhoyes         Un-datetrack of per_in_ler_f changes.
43 115.11  21-jun-1999 jcarpent       Added uneai to close single enrollment.
44 115.12  02-JUL-1999 stee           Update COBRA information.
45 115.13  02-OCT-1999 stee           Changed update_cobra_info to a new
46                                    procedure ben_cobra_requirements.
47                                    update_prtt_cobra_info.
48 115.14  01-MAR-2000 stee           Remove update_prtt_cobra_info.  Cobra
49                                    qualified beneficiary are now written
50                                    during benmngle.  COBRA eligibility is
51                                    evaluated during close enrollment.
52 115.15  11-APR-2000 gperry         Added extra param for fido ctrl m call.
53 115.16  31-Jul-2000 pzclark        Added a wrapper to procedure
54                                    process_post_enrollment to allow self
55                                    service java code to call using varchar2
56                                    'TRUE' or 'FALSE' instead of booleans.
57 115.17  15-Aug-2000 maagrawa       Added procedure process_post_enrt_calls_w
58                                    (wrapper for self-service).
59 115.18  05-sep-2000 pbodla          Bug 5422 : Allow different enrollment periods
60                                     for programs for a scheduled  enrollment.
61                                     p_popl_enrt_typ_cycl_id is removed.
62 115.19  06-Sep-2000 maagrawa        Backported to 115.17. Added exception
63                                     handling for self-service wrapper.
64 115.20  06-Sep-2000 maagrawa        Leapfrog. 115.18  +115.19 changes.
65 115.21  14-Sep-2000 pzclark        Backported to 115.19. Added when others
66                                     exception to process_post_enrollment_w
67                                     procedure.
68 115.22  14-Sep-2000 pzclark        Leapfrog 115.21. Added when others
69                                     exception to process_post_enrollment_w
70                                     procedure to version 115.20
71 115.23  14-Sep-2000 pzclark        Backported to 115.21, added EXIT to end of
72                                     Package
73 115.24  14-Sep-2000 pzclark        Leapfrog 115.23. Back to version 115.22
74 115.25  12-Mar-2001 ikasire        bug 1644520 fixed the problem in election
75                                    made date
76 115.26  13-Mar-2001 ikasire        bug 1644520 fixed the problem in election
77                                    made date. taking max of pen.effective_start_date
78                                    for the pil,pgm and plan - added a cursor
79 115.28  13-Mar-2001 ikasire        to correct the version numbers read 25 as 26
80                                    26 as 27
81 115.29  17-May-2001 maagrawa       Added parameter self_service_flag to
82                                    process_post_results for performance.
83 115.30  18-dec-2001 tjesumic       cwb changes
84 115.31  19-dec-2001 tjesumic       cwb changes
85 115.32  20-dec-2001 ikasire        added dbdrv lines
86 115.33  02-jan-2002 tjesumic       2170324 paramter for proc_cd2 to proc_cd5 added
87 115.34  06-nov-2002 shdas          bug fix 2656718 -- added fnd_msg_pub.initialize
88                                    enrollment selection page was showing some cached
89                                    message from fnd table
90 115.35  13-aug-2003 kmahendr       Added codes for coverage calculation for ERL
91 115.36  22-aug-2003 kmahendr       Multi_row edit proc called after election_info.
92 115.37  02-sep-2003 kmahendr       Bug#3120675 - warnings handled
93 115.38  02-sep-2003 kmahendr       Message nos changed
94 115.39  23-jul-2004 kmahendr       Bug#3772143 - added parameter - p_include_erl to multi_rows_edit
95 115.40  28-jul-2004 kmahendr       Bug#3772143 - Multi_rows_edit called outside the loop
96 115.41  11-oct-2004 kmahendr       Bug#3944970 - added parameter to process_post_results
97                                    and imputed_income call is not made for ICD enrollments
98 115.42  03-Dec-2004 ikasire        Bug 3988565 Changed effective_date data type to Date
99 115.43  15-Mar-2005 ikasire        overloaded process_post_enrt_calls_w with a new
100                                    parameter p_self_service_flag to avoid conversion issues
101 115.44  17-may-05   ssarkar       Bug: 4362939 : modified process_post_results -- 'l_call_multi_rows' set outside the coverage amount chk.
102 115.45  26-May-05   vborkar        Bug 4387247 : In wrapper method exception
103                                    handlers changes made to avoid null errors
104                                    on SS pages
105 115.46  01-Jun-05   vborkar        Bug 4387247 : Modifications to take care of
106                                    application exceptions.
107 115.47  06-Jun-05   ikasire        Bug 4414127
108 115.48  17-Jun-05   vborkar        Bug 4436578 : In SS wrapper app exception handler
109                                    added generic(default) exception handler code.
110 115.49  02-Nov-05   ikasire        BUG 4709601 we don't need to multi_rows_edit for
111                                    CFW process
112 115.50  11-Nov-05   ikasire        BUG 4718599 fixed ERL cursor to return the correct
113                                    number of records.
114 115.51  26-Oct-06   bmanyam        5621577 When CVG is ERL and Rates are
115                                    Enter Value At Enrollment, fetch rates again
116                                    during re-enrollment in process_post_results
117 115.53  09-Nov-06   rtagarra       Added condition while calling close_single_enrollment so that fix 5529696 wont be
118 				   overriden by 5527233.
119 115.54  16-Nov-06   vvprabhu       Bug 5664300 - parameter p_called_from_ss added
120 115.55                             to process_post_results
121 
122 155.56  31-Aug-07   rtagarra       Bug 5997904 : Life Event will be closed when user makes election when
123 					     the code is 'ELCNSMADE'
124 115.57  19-Oct-08   sagnanas       7447088 - Added enrt_mthd_cd 'D' in cursor c_enrt_rslt
125 115.58  28-Oct-08   sagnanas       7510533 - Commented pen.per_in_ler_id in cursor c_enrt_rslt
126 */
127 ------------------------------------------------------------------------------
128   g_debug boolean := hr_utility.debug_enabled;
129   g_package varchar2(80):='ben_proc_common_enrt_rslt.';
130 --
131 -- ---------------------------------------------------------------------------
132 -- This procedure was later added to update elctn made dt or assigned dt on pil_popl  (yrathman)
133 -- ---------------------------------------------------------------------------
134 --
135 procedure set_elcn_made_or_asnd_dt
136     (p_per_in_ler_id     in number   default null
137     ,p_pgm_id            in number
138     ,p_pl_id             in number
139     ,p_enrt_mthd_cd      in varchar2
140     ,p_business_group_id in number
141     ,p_effective_date    in date
142     ,p_validate          in boolean  default false) is
143   --
144   -- Declare cursors and local variables
145   --
146   l_object_version_number    ben_pil_elctbl_chc_popl.object_version_number%TYPE;
147   l_pil_elctbl_chc_popl_id   ben_pil_elctbl_chc_popl.pil_elctbl_chc_popl_id%TYPE;
148   l_proc                     varchar2(72) := g_package||'set_elcn_made_or_asnd_dt';
149   --
150   cursor c_pgm_popl is
151     select pel.pil_elctbl_chc_popl_id
152           ,pel.object_version_number
153           ,pel.elcns_made_dt
154     from   ben_pil_elctbl_chc_popl pel
155     where  pel.per_in_ler_id = p_per_in_ler_id
156     and    pel.pgm_id = p_pgm_id;
157   --
158   cursor c_pl_popl is
159     select pel.pil_elctbl_chc_popl_id
160           ,pel.object_version_number
161           ,pel.elcns_made_dt
162     from   ben_pil_elctbl_chc_popl pel
163     where  pel.per_in_ler_id = p_per_in_ler_id
164     and    pel.pl_id  = p_pl_id;
165   --
166   --  Added the cursor to fix bug 1644520
167   --Bug 4414127
168   cursor c_pgm_elcns_made_dt is
169     select max(pen.EFFECTIVE_START_DATE) elcns_made_dt
170     from ben_prtt_enrt_rslt_f pen
171     where pen.per_in_ler_id = p_per_in_ler_id
172     and   pen.pgm_id = p_pgm_id
173     and pen.prtt_enrt_rslt_stat_cd is null
174     and pen.enrt_cvg_thru_dt = hr_api.g_eot ;
175   --Bug 4414127
176   cursor c_pl_elcns_made_dt is
177     select max(pen.EFFECTIVE_START_DATE) elcns_made_dt
178     from ben_prtt_enrt_rslt_f pen
179     where pen.per_in_ler_id = p_per_in_ler_id
180     and   pen.pl_id = p_pl_id
181     and pen.prtt_enrt_rslt_stat_cd is null
182     and pen.enrt_cvg_thru_dt = hr_api.g_eot ;
183   --
184   l_old_elcns_made_dt       date default null;
185   l_new_elcns_made_dt       date default null;
186   --
187   begin
188     --
189     hr_utility.set_location('Entering:'||l_proc, 5);
190     --
191     --  Get the pil_elctbl_chc_popl object_version_number
192     --
193     if p_pgm_id is not null then
194       open c_pgm_popl;
195       fetch c_pgm_popl into l_pil_elctbl_chc_popl_id
196                            ,l_object_version_number
197                            ,l_old_elcns_made_dt ;
198       --
199       if c_pgm_popl%notfound then
200         --
201         close c_pgm_popl;
202         fnd_message.set_name('BEN','BEN_91916_ENRT_TABLE_NOT_FOUND');
203         fnd_message.set_token('TABLE','PIL_ELCTBL_CHC_POPL');
204         fnd_message.raise_error;
205         --
206       end if;
207       --
208       close c_pgm_popl;
209     else
210       open c_pl_popl;
211       fetch c_pl_popl into l_pil_elctbl_chc_popl_id
212                           ,l_object_version_number
213                           ,l_old_elcns_made_dt ;
214       --
215       if c_pl_popl%notfound then
216         --
217         close c_pl_popl;
218         fnd_message.set_name('BEN','BEN_91916_ENRT_TABLE_NOT_FOUND');
219         fnd_message.set_token('TABLE','PIL_ELCTBL_CHC_POPL');
220         fnd_message.raise_error;
221         --
222       end if;
223       --
224       close c_pl_popl;
225     end if;
226     --
227     --  If enrollment method code is explicit, update the election made date.
228     --
229     hr_utility.set_location('enrt mthd cd'||p_enrt_mthd_cd||l_proc, 5);
230     if p_enrt_mthd_cd = 'E' then
231       --
232       hr_utility.set_location(l_proc, 10);
233       --
234       --  Update election made date on pil_elctbl_chc_popl.
235       -- Bug 1644520 added the if condition to take the only first election
236       -- made date
237       --
238       if p_pgm_id is not null then
239         open c_pgm_elcns_made_dt ;
240         fetch c_pgm_elcns_made_dt into l_new_elcns_made_dt ;
241         close c_pgm_elcns_made_dt ;
242       else
243         open c_pl_elcns_made_dt ;
244         fetch c_pl_elcns_made_dt into l_new_elcns_made_dt ;
245         close c_pl_elcns_made_dt ;
246       end if;
247       --
248       -- Update only if the old value is null or if the value needs to be
249       -- changed.
250       --
251       if l_old_elcns_made_dt is null or
252          l_old_elcns_made_dt <> l_new_elcns_made_dt then
253       --
254         ben_Pil_Elctbl_chc_Popl_api.update_Pil_Elctbl_chc_Popl
255           (p_validate               => p_validate
256            ,p_pil_elctbl_chc_popl_id => l_pil_elctbl_chc_popl_id
257            ,p_elcns_made_dt          => nvl(l_new_elcns_made_dt ,p_effective_date)
258            ,p_object_version_number  => l_object_version_number
259            ,p_effective_date         => p_effective_date
260            ,p_business_group_id      => p_business_group_id
261            );
262       --
263       end if;
264       --
265       -- If enrollment method code is default, update the default
266       -- enrollment date
267       --
268     elsif p_enrt_mthd_cd = 'D' then
269       --
270       hr_utility.set_location(l_proc, 20);
271       --
272       --
273       --  Update default assigned date on pil_elctbl_chc_popl.
274       --
275       ben_Pil_Elctbl_chc_Popl_api.update_Pil_Elctbl_chc_Popl
276         (p_validate               => p_validate
277         ,p_pil_elctbl_chc_popl_id => l_pil_elctbl_chc_popl_id
278         ,p_dflt_asnd_dt           => p_effective_date
279         ,p_object_version_number  => l_object_version_number
280         ,p_effective_date         => p_effective_date
281         ,p_business_group_id      => p_business_group_id
282         );
283           --
284       --
285     elsif p_enrt_mthd_cd = 'A' then
286       --
287       hr_utility.set_location(l_proc, 20);
288       --
289       --  Update automatic enrollment assigned date on pil_elctbl_chc_popl.
290       --
291       ben_Pil_Elctbl_chc_Popl_api.update_Pil_Elctbl_chc_Popl
292         (p_validate               => p_validate
293         ,p_pil_elctbl_chc_popl_id => l_pil_elctbl_chc_popl_id
294         ,p_auto_asnd_dt           => p_effective_date
295         ,p_object_version_number  => l_object_version_number
296         ,p_effective_date         => p_effective_date
297         ,p_business_group_id      => p_business_group_id
298         );
299       --
300     end if;
301     --
302     hr_utility.set_location(l_proc, 25);
303     --
304     hr_utility.set_location(' Leaving:'||l_proc, 30);
305     --
306   end set_elcn_made_or_asnd_dt;
307   --
308   -- ------------------------------------------------------------------------------
309   procedure process_post_results
310     (p_flx_cr_flag       in varchar2 default 'N'
311     ,p_person_id         in number
312     ,p_enrt_mthd_cd      in varchar2
313     ,p_effective_date    in date
314     ,p_business_group_id in number
315     ,p_validate          in boolean  default false
316     ,p_per_in_ler_id     in number
317     ,p_self_service_flag in boolean  default false
318     ,p_pgm_id            in number
319     ,p_pl_id             in number
320     ,p_called_frm_ss     in boolean  default false
321     )
322   is
323     --
324     l_proc    varchar2(72) := g_package||'process_post_results';
325     --
326     l_dummy_set ben_det_enrt_rates.PRVRtVal_tab;
327     --
328     cursor c_per_in_ler
329     is
330     select per_in_ler_id
331       from ben_per_in_ler
332       where person_id = p_person_id
333       and per_in_ler_stat_cd = 'STRTD'
334       and business_group_id  = p_business_group_id;
335   --
336   l_per_in_ler_id number;
337   --
338   cursor c_lf_evt_ocrd_dt is
339     select lf_evt_ocrd_dt
340     from   ben_per_in_ler pil
341     where  pil.per_in_ler_id = l_per_in_ler_id;
342   --
343   l_lf_evt_ocrd_dt  date;
344   /* cursor to pick results with coverage calculation method ERL */
345   --
346   --BUG 4718599 Modifed the cursor to join epe to enb and check for per in ler
347   --otherwise if there were multiple updates to the enrollment results in the
348   --previous life event, you will end up getting multiple records returned by the
349   --cursor and get into APP-BEN-91711 issue.
350   --
351    cursor c_enrt_rslt
352     (c_person_id      in     number
353     ,c_enrt_mthd_cd   in     varchar2
354     ,c_per_in_ler_id  in     number
355     ,c_effective_date in     date
356     )
357   is
358     select pen.*,
359            enb.elig_per_elctbl_chc_id,
360            enb.enrt_bnft_id
361     from ben_prtt_enrt_rslt_f pen,
362          ben_enrt_bnft enb,
363          ben_elig_per_elctbl_chc epe
364     where pen.person_id          = c_person_id
365     and ( pen.enrt_mthd_cd         = c_enrt_mthd_cd
366           or pen.enrt_mthd_cd         = 'O'
367 	   or pen.enrt_mthd_cd         = 'D') --7447088
368     and pen.prtt_enrt_rslt_stat_cd is null
369     --and pen.per_in_ler_id        = c_per_in_ler_id
370     and enrt_cvg_thru_dt = hr_api.g_eot
371     and pen.comp_lvl_cd <> 'PLANIMP'
372     and pen.prtt_enrt_rslt_id = enb.prtt_enrt_rslt_id
373     and enb.cvg_mlt_cd = 'ERL'
374     and c_effective_date
375       between pen.effective_start_date and pen.effective_end_date
376     and pen.effective_end_date = hr_api.g_eot
377     and enb.elig_per_elctbl_chc_id = epe.elig_per_elctbl_chc_id
378     and epe.per_in_ler_id = c_per_in_ler_id
379     ;
380     --
381     -- 5621577 Fetch the Rates for the current Enrollment
382     --         which are enter value at enrollment
383     --
384     CURSOR c_prv_rt(c_prtt_enrt_rslt_id number,
385                     c_per_in_ler_id number) is
386     select ecr.enrt_rt_id,
387            prv.rt_val,
388            prv.ann_rt_val,
389            prv.prtt_rt_val_id
390       from ben_prtt_rt_val prv,
391            ben_elig_per_elctbl_chc epe,
392            ben_enrt_bnft enb,
393            ben_enrt_rt ecr
394      where prv.prtt_enrt_rslt_id = c_prtt_enrt_rslt_id
395        and prv.prtt_rt_val_stat_cd is null
396        and ecr.entr_val_at_enrt_flag = 'Y'
397        and ecr.prtt_rt_val_id = prv.prtt_rt_val_id
398        and epe.per_in_ler_id = c_per_in_ler_id
399        and epe.prtt_enrt_rslt_id = c_prtt_enrt_rslt_id
400        and epe.elig_per_elctbl_chc_id = enb.elig_per_elctbl_chc_id(+)
401        and ecr.enrt_bnft_id(+) = enb.enrt_bnft_id
402        and NVL(ecr.elig_per_elctbl_chc_id, epe.elig_per_elctbl_chc_id) = epe.elig_per_elctbl_chc_id
403        ;
404        --
405     type g_rt_rec is record
406     (enrt_rt_id      ben_enrt_rt.enrt_rt_id%type,
407      rt_val          ben_enrt_rt.dflt_val%type,
408      ann_val         ben_enrt_rt.ann_val%type,
409      prtt_rt_val_id  ben_enrt_rt.prtt_rt_val_id%type
410      );
411     --
412     type g_rt_table is table of g_rt_rec index by binary_integer;
413     l_rt_table g_rt_table;
414     l_count number;
415     --
416   CURSOR c_interim (c_interim_pen     IN NUMBER
417                     ,c_person_id      in     number
418                    ,c_per_in_ler_id   in     number
419                    ,c_effective_date  in     date)
420    IS
421       SELECT 'Y' interim_flag,
422              prtt_enrt_rslt_id suspended_pen_id,
423              object_version_number suspended_ovn
424         FROM ben_prtt_enrt_rslt_f pen
425        WHERE pen.rplcs_sspndd_rslt_id = c_interim_pen
426          AND pen.person_id          = c_person_id
427          AND pen.prtt_enrt_rslt_stat_cd IS NULL
428          AND pen.per_in_ler_id = c_per_in_ler_id
429          AND pen.enrt_cvg_thru_dt = hr_api.g_eot
430          AND c_effective_date BETWEEN pen.effective_start_date
431                                   AND pen.effective_end_date
432          AND pen.effective_end_date = hr_api.g_eot;
433    --
434    l_interim varchar2(30) ;
435    l_suspended_pen_id number;
436    l_suspended_ovn number;
437    --
438     cursor c_pl (p_pl_id number) is
439       select name,
440              SUBJ_TO_IMPTD_INCM_TYP_CD
441       from ben_pl_f pln
442       where pln.pl_id = p_pl_id
443       and p_effective_date between pln.effective_start_date
444           and pln.effective_end_date;
445     --
446     l_pln_name      varchar2(300);
447     l_enb_valrow                 ben_determine_coverage.ENBValType;
448     l_enrt_rslt    c_enrt_rslt%rowtype;
449     l_dummy_char   varchar2(1);
450     l_dummy_number number;
451     l_dummy_date   date;
452     l_dummy_bool   boolean;
453     l_ctfn_actn_warning boolean;
454     l_DPNT_ACTN_WARNING boolean;
455     l_BNF_ACTN_WARNING  boolean;
456     l_call_multi_rows   boolean;
457     l_SUBJ_TO_IMPTD_INCM_TYP_CD varchar2(300);
458     l_call_imputed      boolean;
459     l_datetrack_mode         varchar2(30);
460     --
461   begin
462     --
463     g_debug := hr_utility.debug_enabled;
464     --
465     if (g_debug) then
466         hr_utility.set_location('Entering:'||l_proc, 5);
467     end if;
468     --
469     -- Check to see if the per in ler id is being passed in. If not then
470     -- fetch it.
471     --
472     if p_per_in_ler_id is null
473     then
474       open c_per_in_ler;
475       fetch c_per_in_ler into l_per_in_ler_id;
476       --
477       if c_per_in_ler%notfound
478       then
479         close c_per_in_ler;
480         fnd_message.set_name('BEN', 'BEN_91272_PER_IN_LER_MISSING');
481         fnd_message.raise_error;
482       end if;
483       --
484       close c_per_in_ler;
485       --
486     else
487       l_per_in_ler_id := p_per_in_ler_id;
488 
489     end if;
490     --
491     hr_utility.set_location(l_proc, 10);
492     --
493     -- process post enrollment rule for coverages
494     --
495     --
496     open c_enrt_rslt
497         (c_person_id       => p_person_id
498          ,c_enrt_mthd_cd   => p_enrt_mthd_cd
499          ,c_per_in_ler_id  => p_per_in_ler_id
500          ,c_effective_date => p_effective_date
501          )
502           ;
503     loop
504       fetch c_enrt_rslt into l_enrt_rslt;
505       if c_enrt_rslt%notfound then
506          exit;
507       end if;
508       --
509       open c_lf_evt_ocrd_dt;
510       fetch c_lf_evt_ocrd_dt into l_lf_evt_ocrd_dt;
511       close c_lf_evt_ocrd_dt;
512       --
513       ben_determine_coverage.main
514             (p_elig_per_elctbl_chc_id => l_enrt_rslt.elig_per_elctbl_chc_id
515             ,p_effective_date         => p_effective_date
516             ,p_lf_evt_ocrd_dt         => l_lf_evt_ocrd_dt
517             ,p_perform_rounding_flg   => true
518             --
519             ,p_enb_valrow             => l_enb_valrow
520             ,p_calculate_only_mode    => TRUE
521             );
522       --
523       -- call election information
524       if nvl(l_enb_valrow.val,0) <> nvl(l_enrt_rslt.bnft_amt,0) then
525         --
526         l_interim := NULL;
527         l_suspended_pen_id := NULL;
528         --
529         open c_interim
530            (c_interim_pen     => l_enrt_rslt.prtt_enrt_rslt_id
531            ,c_person_id       => p_person_id
532            ,c_per_in_ler_id   => p_per_in_ler_id
533            ,c_effective_date  => p_effective_date
534            );
535         --
536         fetch c_interim into l_interim,
537                              l_suspended_pen_id,
538                              l_suspended_ovn;
539         close c_interim;
540         --
541         hr_utility.set_location('l_interim '|| l_interim, 10);
542         --
543         IF l_interim = 'Y' THEN
544           --
545           ben_sspndd_enrollment.g_interim_flag := 'Y';
546           ben_sspndd_enrollment.g_use_new_result:=true;
547           hr_utility.set_location('Before ERL Interim call',20);
548           --
549         END IF;
550         --
551         --
552         if (g_debug) then
553              hr_utility.set_location('Fetch entr_val_at_enrt rates for ERL enrollments ', 15);
554         end if;
555         -- 5621577 Fetch and populate existing rate values.
556         for l_count in 1..10 loop
557             -- Initialise array to null
558             l_rt_table(l_count).enrt_rt_id := null;
559             l_rt_table(l_count).rt_val := null;
560             l_rt_table(l_count).ann_val := null;
561             l_rt_table(l_count).prtt_rt_val_id := null;
562             --
563         end loop;
564         --
565         l_count:= 0;
566         --
567         for l_rec in c_prv_rt(l_enrt_rslt.prtt_enrt_rslt_id, l_per_in_ler_id) loop
568             --
569             l_count := l_count+1;
570             l_rt_table(l_count).enrt_rt_id := l_rec.enrt_rt_id;
571             l_rt_table(l_count).rt_val := l_rec.rt_val;
572             l_rt_table(l_count).ann_val := l_rec.ann_rt_val;
573             l_rt_table(l_count).prtt_rt_val_id := l_rec.prtt_rt_val_id;
574             --
575             if (g_debug) then
576                 hr_utility.set_location('Rate l_count '|| l_count, 15);
577                 hr_utility.set_location('l_rec.enrt_rt_id '|| l_rec.enrt_rt_id, 15);
578                 hr_utility.set_location('l_rec.rt_val '|| l_rec.rt_val, 15);
579                 hr_utility.set_location('l_rec.ann_val '|| l_rec.ann_rt_val, 15);
580                 hr_utility.set_location('l_rec.prtt_rt_val_id '|| l_rec.prtt_rt_val_id, 15);
581             end if;
582             --
583         end loop;
584                 --
585         ben_election_information.election_information
586                (p_elig_per_elctbl_chc_id => l_enrt_rslt.elig_per_elctbl_chc_id,
587                 p_prtt_enrt_rslt_id      => l_enrt_rslt.prtt_enrt_rslt_id,
588                 p_effective_date         => p_effective_date,
589                 p_enrt_mthd_cd           => l_enrt_rslt.enrt_mthd_cd,
590                 p_enrt_bnft_id           => l_enrt_rslt.enrt_bnft_id,
591                 p_bnft_val               => l_enb_valrow.val,
592 /* 5621577 - Added the below parameters */
593                 p_enrt_rt_id1            => l_rt_table(1).enrt_rt_id,
594                 p_rt_val1                => l_rt_table(1).rt_val,
595                 p_ann_rt_val1            => l_rt_table(1).ann_val,
596                 p_prtt_rt_val_id1        => l_rt_table(1).prtt_rt_val_id,
597 
598                 p_enrt_rt_id2            => l_rt_table(2).enrt_rt_id,
599                 p_rt_val2                => l_rt_table(2).rt_val,
600                 p_ann_rt_val2            => l_rt_table(2).ann_val,
601                 p_prtt_rt_val_id2        => l_rt_table(2).prtt_rt_val_id,
602 
603                 p_enrt_rt_id3            => l_rt_table(3).enrt_rt_id,
604                 p_rt_val3                => l_rt_table(3).rt_val,
605                 p_ann_rt_val3            => l_rt_table(3).ann_val,
606                 p_prtt_rt_val_id3        => l_rt_table(3).prtt_rt_val_id,
607 
608                 p_enrt_rt_id4            => l_rt_table(4).enrt_rt_id,
609                 p_rt_val4                => l_rt_table(4).rt_val,
610                 p_ann_rt_val4            => l_rt_table(4).ann_val,
611                 p_prtt_rt_val_id4        => l_rt_table(4).prtt_rt_val_id,
612 
613                 p_enrt_rt_id5            => l_rt_table(5).enrt_rt_id,
614                 p_rt_val5                => l_rt_table(5).rt_val,
615                 p_ann_rt_val5            => l_rt_table(5).ann_val,
616                 p_prtt_rt_val_id5        => l_rt_table(5).prtt_rt_val_id,
617 
618                 p_enrt_rt_id6            => l_rt_table(6).enrt_rt_id,
619                 p_rt_val6                => l_rt_table(6).rt_val,
620                 p_ann_rt_val6            => l_rt_table(6).ann_val,
621                 p_prtt_rt_val_id6        => l_rt_table(6).prtt_rt_val_id,
622 
623                 p_enrt_rt_id7            => l_rt_table(7).enrt_rt_id,
624                 p_rt_val7                => l_rt_table(7).rt_val,
625                 p_ann_rt_val7            => l_rt_table(7).ann_val,
626                 p_prtt_rt_val_id7        => l_rt_table(7).prtt_rt_val_id,
627 
628                 p_enrt_rt_id8            => l_rt_table(8).enrt_rt_id,
629                 p_rt_val8                => l_rt_table(8).rt_val,
630                 p_ann_rt_val8            => l_rt_table(8).ann_val,
631                 p_prtt_rt_val_id8        => l_rt_table(8).prtt_rt_val_id,
632 
633                 p_enrt_rt_id9            => l_rt_table(9).enrt_rt_id,
634                 p_rt_val9                => l_rt_table(9).rt_val,
635                 p_ann_rt_val9            => l_rt_table(9).ann_val,
636                 p_prtt_rt_val_id9        => l_rt_table(9).prtt_rt_val_id,
637 
638                 p_enrt_rt_id10            => l_rt_table(10).enrt_rt_id,
639                 p_rt_val10                => l_rt_table(10).rt_val,
640                 p_ann_rt_val10            => l_rt_table(10).ann_val,
641                 p_prtt_rt_val_id10        => l_rt_table(10).prtt_rt_val_id,
642 
643 /*  5621577 Commented the below parameters
644                 p_prtt_rt_val_id2        => l_dummy_number,
645                 p_prtt_rt_val_id3        => l_dummy_number,
646                 p_prtt_rt_val_id4        => l_dummy_number,
647                 p_prtt_rt_val_id5        => l_dummy_number,
648                 p_prtt_rt_val_id6        => l_dummy_number,
649                 p_prtt_rt_val_id7        => l_dummy_number,
650                 p_prtt_rt_val_id8        => l_dummy_number,
651                 p_prtt_rt_val_id9        => l_dummy_number,
652                 p_prtt_rt_val_id10       => l_dummy_number,
653 */
654                 p_pen_attribute_category =>  l_enrt_rslt.pen_attribute_category,
655                 p_pen_attribute1         =>  l_enrt_rslt.pen_attribute1,
656                 p_pen_attribute2         =>  l_enrt_rslt.pen_attribute2,
657                 p_pen_attribute3         =>  l_enrt_rslt.pen_attribute3,
658                 p_pen_attribute4         =>  l_enrt_rslt.pen_attribute4,
659                 p_pen_attribute5         =>  l_enrt_rslt.pen_attribute5,
660                 p_pen_attribute6         =>  l_enrt_rslt.pen_attribute6,
661                 p_pen_attribute7         =>  l_enrt_rslt.pen_attribute7,
662                 p_pen_attribute8         =>  l_enrt_rslt.pen_attribute8,
663                 p_pen_attribute9         =>  l_enrt_rslt.pen_attribute9,
664                 p_pen_attribute10        =>  l_enrt_rslt.pen_attribute10,
665                 p_pen_attribute11        =>  l_enrt_rslt.pen_attribute11,
666                 p_pen_attribute12        =>  l_enrt_rslt.pen_attribute12,
667                 p_pen_attribute13        =>  l_enrt_rslt.pen_attribute13,
668                 p_pen_attribute14        =>  l_enrt_rslt.pen_attribute14,
669                 p_pen_attribute15        =>  l_enrt_rslt.pen_attribute15,
670                 p_pen_attribute16        =>  l_enrt_rslt.pen_attribute16,
671                 p_pen_attribute17        =>  l_enrt_rslt.pen_attribute17,
672                 p_pen_attribute18        =>  l_enrt_rslt.pen_attribute18,
673                 p_pen_attribute19        =>  l_enrt_rslt.pen_attribute19,
674                 p_pen_attribute20        =>  l_enrt_rslt.pen_attribute20,
675                 p_pen_attribute21        =>  l_enrt_rslt.pen_attribute21,
676                 p_pen_attribute22        =>  l_enrt_rslt.pen_attribute22,
677                 p_pen_attribute23        =>  l_enrt_rslt.pen_attribute23,
678                 p_pen_attribute24        =>  l_enrt_rslt.pen_attribute24,
679                 p_pen_attribute25        =>  l_enrt_rslt.pen_attribute25,
680                 p_pen_attribute26        =>  l_enrt_rslt.pen_attribute26,
681                 p_pen_attribute27        =>  l_enrt_rslt.pen_attribute27,
682                 p_pen_attribute28        =>  l_enrt_rslt.pen_attribute28,
683                 p_pen_attribute29        =>  l_enrt_rslt.pen_attribute29,
684                 p_pen_attribute30        =>  l_enrt_rslt.pen_attribute30,
685                 p_datetrack_mode         => hr_api.g_update,
686                 p_suspend_flag           => l_dummy_char,
687                 p_effective_start_date   => l_dummy_date,
688                 p_effective_end_date     => l_dummy_date,
689                 p_object_version_number  => l_enrt_rslt.object_version_number,
690                 p_prtt_enrt_interim_id   => l_dummy_number,
691                 p_business_group_id      => p_business_group_id,
692                 p_dpnt_actn_warning      => l_DPNT_ACTN_WARNING,
693                 p_bnf_actn_warning       => l_BNF_ACTN_WARNING,
694                 p_ctfn_actn_warning      => l_ctfn_actn_warning);
695          --
696         -- l_call_multi_rows  := true; --commented bug 4362939
697          if l_ctfn_actn_warning then
698             --
699             open c_pl (l_enrt_rslt.pl_id);
700             fetch c_pl into l_pln_name, l_SUBJ_TO_IMPTD_INCM_TYP_CD;
701             close c_pl;
702             --
703             ben_warnings.load_warning
704              (p_application_short_name  => 'BEN',
705               p_message_name            => 'BEN_93582_RQD_CTFN_MISSING',
706               p_parma     => l_pln_name);
707             --
708             l_ctfn_actn_warning := false;
709          end if;
710          --
711          if l_DPNT_ACTN_WARNING then
712             --
713             open c_pl (l_enrt_rslt.pl_id);
714             fetch c_pl into l_pln_name, l_SUBJ_TO_IMPTD_INCM_TYP_CD;
715             close c_pl;
716             --
717             ben_warnings.load_warning
718              (p_application_short_name  => 'BEN',
719               p_message_name            => 'BEN_93583_DPNT_ERR',
720               p_parma     => l_pln_name);
721             --
722             l_DPNT_ACTN_WARNING := false;
723          end if;
724          --
725          if l_BNF_ACTN_WARNING then
726             --
727             open c_pl (l_enrt_rslt.pl_id);
728             fetch c_pl into l_pln_name,l_SUBJ_TO_IMPTD_INCM_TYP_CD;
729             close c_pl;
730             --
731             ben_warnings.load_warning
732              (p_application_short_name  => 'BEN',
733               p_message_name            => 'BEN_93584_BNF_ERR',
734               p_parma     => l_pln_name);
735             --
736             l_BNF_ACTN_WARNING := false;
737          end if;
738          --
739          --ERL for Interim Handling
740          IF l_interim = 'Y' THEN
741            --
742            ben_sspndd_enrollment.g_interim_flag := 'N';
743            ben_sspndd_enrollment.g_use_new_result:=false;
744            --
745            -- Now update the suspended enrollment with newly cteated interim id.
746            --
747            hr_utility.set_location('After ERL Interim call ELINF',20);
748            --
749            ben_prtt_enrt_result_api.get_ben_pen_upd_dt_mode
750                      (p_effective_date         => p_effective_date
751                      ,p_base_key_value         => l_suspended_pen_id
752                      ,P_desired_datetrack_mode => hr_api.g_correction
753                      ,P_datetrack_allow        => l_datetrack_mode
754                      );
755            --
756            hr_utility.set_location('After ERL Interim call BEPENDT',20);
757            hr_utility.set_location('l_datetrack_mode '||l_datetrack_mode,10);
758            --
759            ben_prtt_enrt_result_api.update_prtt_enrt_result
760               (p_validate                 => FALSE,
761                p_prtt_enrt_rslt_id        => l_suspended_pen_id,
762                p_effective_start_date     => l_dummy_date,
763                p_effective_end_date       => l_dummy_date,
764                p_business_group_id        => p_business_group_id,
765                p_RPLCS_SSPNDD_RSLT_ID     => l_enrt_rslt.prtt_enrt_rslt_id,
766                p_object_version_number    => l_suspended_ovn,
767                p_effective_date           => p_effective_date,
768                p_datetrack_mode           => l_datetrack_mode,
769                p_multi_row_validate       => FALSE,
770                p_program_application_id   => fnd_global.prog_appl_id,
771                p_program_id               => fnd_global.conc_program_id,
772                p_request_id               => fnd_global.conc_request_id,
773                p_program_update_date      => sysdate);
774                --
775             hr_utility.set_location('After ERL Interim BEPENUPD call',30);
776          END IF;
777          --
778       end if; --call election information
779       --
780       l_call_multi_rows  := true; -- bug 4362939
781 
782     end loop;
783     close c_enrt_rslt;
784     --BUG 4709601 we don't need to call this in carry forward action items process
785     if l_call_multi_rows and nvl(ben_sspndd_enrollment.g_cfw_flag,'Y') = 'N' then
786 
787          ben_prtt_enrt_result_api.multi_rows_edit(
788                      p_person_id   => p_person_id
789                     ,p_effective_date =>p_effective_date
790                     ,p_business_group_id =>p_business_group_id
791                     ,p_pgm_id => l_enrt_rslt.pgm_id
792                     ,p_per_in_ler_id   =>p_per_in_ler_id
793                     ,p_include_erl     => 'Y'
794 		    ,p_called_frm_ss   => p_called_frm_ss
795                     );
796     end if;
797 
798     --
799     -- Determine enrollment rates and writes element entries.
800     --
801     ben_det_enrt_rates.p_det_enrt_rates
802       (p_person_id         => p_person_id
803       ,p_per_in_ler_id     => l_per_in_ler_id
804       ,p_enrt_mthd_cd      => p_enrt_mthd_cd
805       ,p_effective_date    => p_effective_date
806       ,p_business_group_id => p_business_group_id
807       ,p_validate          => p_validate
808       ,p_self_service_flag => p_self_service_flag
809       --
810       ,p_prv_rtval_set     => l_dummy_set
811       );
812      --
813      --  Determine imputed income
814      --
815      hr_utility.set_location(l_proc, 15);
816      --
817      l_call_imputed := true;
818      --
819      if p_pl_id is not null and p_pgm_id is null then
820        --
821         hr_utility.set_location('PL id '||p_pl_id,16);
822        open c_pl(p_pl_id);
823        fetch c_pl into l_pln_name, l_SUBJ_TO_IMPTD_INCM_TYP_CD;
824        if c_pl%found and l_SUBJ_TO_IMPTD_INCM_TYP_CD is null then
825           l_call_imputed := false;
826        end if;
827        close c_pl;
828        --
829      end if;
830      --
831      if l_call_imputed then
832        --
833        ben_det_imputed_income.p_comp_imputed_income
834          (p_person_id        => p_person_id
835          ,p_enrt_mthd_cd         => p_enrt_mthd_cd
836          ,p_per_in_ler_id        => l_per_in_ler_id
837          ,p_effective_date       => p_effective_date
838          ,p_business_group_id    => p_business_group_id
839          ,p_ctrlm_fido_call      => false
840          ,p_validate             => p_validate);
841        --
842      end if;
843      --
844      hr_utility.set_location(' Leaving:'||l_proc, 20);
845      --
846   end process_post_results;
847   --
848   -- ------------------------------------------------------------------------------
849   --    process_post_enrollment
850   -- -----------------------------------------------------------------------------
851   procedure process_post_enrollment
852     (p_per_in_ler_id     in number   default null
853     ,p_pgm_id            in number
854     ,p_pl_id             in number
855     ,p_enrt_mthd_cd      in varchar2
856     ,p_cls_enrt_flag     in boolean  default true
857     ,p_proc_cd           in varchar2 default null
858     ,p_proc_cd2          in varchar2 default  null
859     ,p_proc_cd3          in varchar2 default  null
860     ,p_proc_cd4          in varchar2 default  null
861     ,p_proc_cd5          in varchar2 default  null
862     ,p_person_id         in number
863     ,p_business_group_id in number
864     ,p_effective_date    in date
865     ,p_validate          in boolean  default false) is
866   --
867   -- Declare cursors and local variables
868   --
869   l_asnd_lf_evt_dt           ben_enrt_perd.asnd_lf_evt_dt%TYPE;
870 --  l_ler_id                   ben_per_in_ler.ler_id%TYPE;
871   l_exists                   varchar2(1);
872   l_proc                     varchar2(72) := g_package||'process_post_enrollment';
873   --
874   -- PB : 5422 :
875   -- Get the asnd_lf_evt_dt
876   --
877   cursor c_pil_elctbl_chc_popl is
878     select enp.asnd_lf_evt_dt
879     from   ben_pil_elctbl_chc_popl pel,
880            ben_enrt_perd enp
881     where  pel.per_in_ler_id = p_per_in_ler_id
882     and    nvl(pel.pgm_id,-1) = nvl(p_pgm_id,-1)
883     and    nvl(pel.pl_id,-1)  = nvl(p_pl_id,-1)
884     and    pel.enrt_perd_id = enp.enrt_perd_id;
885   --
886   l_global_pil_rec ben_global_enrt.g_global_pil_rec_type;
887   --
888   begin
889     --
890     hr_utility.set_location('Entering:'||l_proc, 5);
891     --
892     set_elcn_made_or_asnd_dt
893         (p_per_in_ler_id     => p_per_in_ler_id
894         ,p_pgm_id            => p_pgm_id
895         ,p_pl_id             => p_pl_id
896         ,p_enrt_mthd_cd      => p_enrt_mthd_cd
897         ,p_business_group_id => p_business_group_id
898         ,p_effective_date    => p_effective_date
899         ,p_validate          => p_validate
900        );
901     --
902     hr_utility.set_location(p_proc_cd, 25);
903     hr_utility.set_location(p_proc_cd2, 25);
904     --
905     --  Write communication.
906     --
907     hr_utility.set_location(l_proc, 26);
908     --
909     if p_proc_cd is not null then
910       --
911       open c_pil_elctbl_chc_popl;
912       fetch c_pil_elctbl_chc_popl into l_asnd_lf_evt_dt;
913       close c_pil_elctbl_chc_popl;
914       --
915       ben_global_enrt.get_pil
916        (p_per_in_ler_id          => p_per_in_ler_id
917        ,p_global_pil_rec         => l_global_pil_rec);
918       --
919       ben_generate_communications.main
920       (p_person_id             => p_person_id
921       ,p_ler_id                => l_global_pil_rec.ler_id
922       -- CWB Changes.
923       ,p_per_in_ler_id         => p_per_in_ler_id
924       ,p_pgm_id                => p_pgm_id
925       ,p_pl_id                 => p_pl_id
926       -- PB : 5422 :
927       ,p_asnd_lf_evt_dt        => l_asnd_lf_evt_dt
928       -- ,p_enrt_perd_id       => l_enrt_perd_id
929       ,p_enrt_mthd_cd          => p_enrt_mthd_cd
930       ,p_business_group_id     => p_business_group_id
931       ,p_proc_cd1              => p_proc_cd
932       ,p_proc_cd2              => p_proc_cd2
933       ,p_proc_cd3              => p_proc_cd3
934       ,p_proc_cd4              => p_proc_cd4
935       ,p_proc_cd5              => p_proc_cd5
936       ,p_effective_date        => p_effective_date);
937     end if;
938     --
939     hr_utility.set_location(l_proc, 27);
940     --
941     --  Close enrollment i.e. update the per_in_ler to processed.
942     --
943     if p_cls_enrt_flag then
944      --
945 --     if p_enrt_mthd_cd = 'A' then   --Bug 5529696
946      --
947       ben_close_enrollment.close_single_enrollment
948         (p_per_in_ler_id        => p_per_in_ler_id
949         ,p_effective_date       => p_effective_date
950         ,p_business_group_id    => p_business_group_id
951         ,p_validate             => p_validate
952         ,p_close_uneai_flag     => 'Y'
953         ,p_uneai_effective_date => p_effective_date
954 	,p_close_cd             => 'FORCE'
955       );
956  -- Bug 5997904
957 /*      else
958      ben_close_enrollment.close_single_enrollment
959         (p_per_in_ler_id        => p_per_in_ler_id
960         ,p_effective_date       => p_effective_date
961         ,p_business_group_id    => p_business_group_id
962         ,p_validate             => p_validate
963         ,p_close_uneai_flag     => 'Y'
964         ,p_uneai_effective_date => p_effective_date
965       );
966     end if;*/
967  -- Bug 5997904
968     --
969    end if;
970     hr_utility.set_location(' Leaving:'||l_proc, 30);
971     --
972   end process_post_enrollment;
973   --
974   --
975   -- ------------------------------------------------------------------------------
976   --    process_post_enrollment_w
977   -- -----------------------------------------------------------------------------
978   procedure process_post_enrollment_w
979     (p_per_in_ler_id     in number
980     ,p_pgm_id            in number
981     ,p_pl_id             in number
982     ,p_enrt_mthd_cd      in varchar2
983     ,p_cls_enrt_flag     in varchar2
984     ,p_proc_cd           in varchar2
985     ,p_person_id         in number
986     ,p_business_group_id in number
987     ,p_effective_date    in date
988     ,p_validate          in varchar2) is
989   --
990   -- Declare local variables
991   --
992   l_proc   varchar2(72) := g_package||'process_post_enrollment - wrapper';
993   l_validate       BOOLEAN;
994   l_cls_enrt_flag  BOOLEAN;
995   --
996   begin
997     --
998     hr_utility.set_location('Entering:'||l_proc, 10);
999     --
1000     if upper(p_validate) = 'TRUE'
1001     then
1002       l_validate := TRUE;
1003     else
1004       l_validate := FALSE;
1005     end if;
1006 
1007     if upper(p_cls_enrt_flag) = 'TRUE'
1008     then
1009       l_cls_enrt_flag := TRUE;
1010     else
1011       l_cls_enrt_flag := FALSE;
1012     end if;
1013     --
1014     hr_utility.set_location('Entering:'||l_proc, 20);
1015     --
1016     process_post_enrollment(
1017      p_per_in_ler_id     => p_per_in_ler_id
1018     ,p_pgm_id            => p_pgm_id
1019     ,p_pl_id             => p_pl_id
1020     ,p_enrt_mthd_cd      => p_enrt_mthd_cd
1021     ,p_cls_enrt_flag     => l_cls_enrt_flag
1022     ,p_proc_cd           => p_proc_cd
1023     ,p_person_id         => p_person_id
1024     ,p_business_group_id => p_business_group_id
1025     ,p_effective_date    => p_effective_date
1026     ,p_validate          => l_validate
1027     );
1028     --
1029     hr_utility.set_location(' Leaving:'||l_proc, 30);
1030     --
1031   exception
1032   --
1033   when others then
1034     fnd_msg_pub.add;
1035   --
1036   end process_post_enrollment_w;
1037 
1038 
1039 procedure process_post_enrt_calls_w
1040   (p_validate               in varchar2 default 'N'
1041   ,p_person_id              in number
1042   ,p_per_in_ler_id          in number
1043   ,p_pgm_id                 in number default null
1044   ,p_pl_id                  in number default null
1045   ,p_flx_cr_flag            in varchar2 default 'N'
1046   ,p_enrt_mthd_cd           in varchar2
1047   ,p_proc_cd                in varchar2 default null
1048   ,p_cls_enrt_flag          in varchar2 default 'N'
1049   ,p_business_group_id      in number
1050   ,p_effective_date         in date)
1051 is
1052   --
1053   l_validate              boolean := false;
1054   l_effective_date        date    := trunc(sysdate);
1055   l_cls_enrt_flag         boolean := false;
1056   --
1057 begin
1058   --
1059   fnd_msg_pub.initialize;
1060   if p_validate = 'Y' then
1061     l_validate := true;
1062   end if;
1063   --
1064   if p_cls_enrt_flag = 'Y' then
1065     l_cls_enrt_flag := true;
1066   end if;
1067   --
1068   if p_effective_date is not null then
1069     -- l_effective_date := to_date(p_effective_date, 'YYYY/MM/DD');
1070     l_effective_date := p_effective_date ;
1071   end if;
1072   --
1073   ben_proc_common_enrt_rslt.set_elcn_made_or_asnd_dt
1074       (p_validate              => l_validate
1075       ,p_per_in_ler_id         => p_per_in_ler_id
1076       ,p_pgm_id                => p_pgm_id
1077       ,p_pl_id                 => p_pl_id
1078       ,p_enrt_mthd_cd          => p_enrt_mthd_cd
1079       ,p_business_group_id     => p_business_group_id
1080       ,p_effective_date        => l_effective_date);
1081   --
1082   ben_prtt_enrt_result_api.multi_rows_edit
1083       (p_person_id            => p_person_id
1084       ,p_per_in_ler_id        => p_per_in_ler_id
1085       ,p_pgm_id               => p_pgm_id
1086       ,p_business_group_id    => p_business_group_id
1087       ,p_effective_date       => l_effective_date);
1088   --
1089   ben_proc_common_enrt_rslt.process_post_results
1090       (p_validate             => l_validate
1091       ,p_person_id            => p_person_id
1092       ,p_per_in_ler_id        => p_per_in_ler_id
1093       ,p_flx_cr_flag          => p_flx_cr_flag
1094       ,p_enrt_mthd_cd         => p_enrt_mthd_cd
1095       ,p_business_group_id    => p_business_group_id
1096       ,p_effective_date       => l_effective_date
1097       ,p_self_service_flag    => true
1098       ,p_pl_id                => p_pl_id);
1099   --
1100   ben_proc_common_enrt_rslt.process_post_enrollment
1101       (p_validate             => l_validate
1102       ,p_person_id            => p_person_id
1103       ,p_per_in_ler_id        => p_per_in_ler_id
1104       ,p_pgm_id               => p_pgm_id
1105       ,p_pl_id                => p_pl_id
1106       ,p_enrt_mthd_cd         => p_enrt_mthd_cd
1107       ,p_cls_enrt_flag        => l_cls_enrt_flag
1108       ,p_proc_cd              => p_proc_cd
1109       ,p_business_group_id    => p_business_group_id
1110       ,p_effective_date       => l_effective_date);
1111   --
1112 exception
1113   --
1114   when app_exception.application_exception then	--Bug 4387247
1115     fnd_msg_pub.add;
1116     ben_det_enrt_rates.clear_globals; --Bug 4436578
1117   when others then
1118     --Bug 4387247
1119     fnd_message.set_name('PER','FFU10_GENERAL_ORACLE_ERROR');
1120     fnd_message.set_token('2',substr(sqlerrm,1,200));
1121     fnd_msg_pub.add;
1122     ben_det_enrt_rates.clear_globals;
1123   --
1124 end process_post_enrt_calls_w;
1125 
1126 
1127 procedure process_post_enrt_calls_w
1128   (p_validate               in varchar2 default 'N'
1129   ,p_person_id              in number
1130   ,p_per_in_ler_id          in number
1131   ,p_pgm_id                 in number default null
1132   ,p_pl_id                  in number default null
1133   ,p_flx_cr_flag            in varchar2 default 'N'
1134   ,p_enrt_mthd_cd           in varchar2
1135   ,p_proc_cd                in varchar2 default null
1136   ,p_cls_enrt_flag          in varchar2 default 'N'
1137   ,p_business_group_id      in number
1138   ,p_effective_date         in date
1139   ,p_self_service_flag      in varchar2 )
1140 is
1141   --
1142   l_validate              boolean := false;
1143   l_effective_date        date    := trunc(sysdate);
1144   l_cls_enrt_flag         boolean := false;
1145   l_self_service_flag     boolean := false;
1146   --
1147 begin
1148   --
1149   fnd_msg_pub.initialize;
1150   if p_validate = 'Y' then
1151     l_validate := true;
1152   end if;
1153   --
1154   if p_cls_enrt_flag = 'Y' then
1155     l_cls_enrt_flag := true;
1156   end if;
1157   --
1158   if p_self_service_flag = 'Y' then
1159     l_self_service_flag := true;
1160   end if;
1161   --
1162   if p_effective_date is not null then
1163     -- l_effective_date := to_date(p_effective_date, 'YYYY/MM/DD');
1164     l_effective_date := p_effective_date ;
1165   end if;
1166   --
1167   ben_proc_common_enrt_rslt.set_elcn_made_or_asnd_dt
1168       (p_validate              => l_validate
1169       ,p_per_in_ler_id         => p_per_in_ler_id
1170       ,p_pgm_id                => p_pgm_id
1171       ,p_pl_id                 => p_pl_id
1172       ,p_enrt_mthd_cd          => p_enrt_mthd_cd
1173       ,p_business_group_id     => p_business_group_id
1174       ,p_effective_date        => l_effective_date);
1175   --
1176   ben_prtt_enrt_result_api.multi_rows_edit
1177       (p_person_id            => p_person_id
1178       ,p_per_in_ler_id        => p_per_in_ler_id
1179       ,p_pgm_id               => p_pgm_id
1180       ,p_business_group_id    => p_business_group_id
1181       ,p_effective_date       => l_effective_date);
1182   --
1183   ben_proc_common_enrt_rslt.process_post_results
1184       (p_validate             => l_validate
1185       ,p_person_id            => p_person_id
1186       ,p_per_in_ler_id        => p_per_in_ler_id
1187       ,p_flx_cr_flag          => p_flx_cr_flag
1188       ,p_enrt_mthd_cd         => p_enrt_mthd_cd
1189       ,p_business_group_id    => p_business_group_id
1190       ,p_effective_date       => l_effective_date
1191       ,p_self_service_flag    => l_self_service_flag
1192       ,p_pl_id                => p_pl_id);
1193   --
1194   ben_proc_common_enrt_rslt.process_post_enrollment
1195       (p_validate             => l_validate
1196       ,p_person_id            => p_person_id
1197       ,p_per_in_ler_id        => p_per_in_ler_id
1198       ,p_pgm_id               => p_pgm_id
1199       ,p_pl_id                => p_pl_id
1200       ,p_enrt_mthd_cd         => p_enrt_mthd_cd
1201       ,p_cls_enrt_flag        => l_cls_enrt_flag
1202       ,p_proc_cd              => p_proc_cd
1203       ,p_business_group_id    => p_business_group_id
1204       ,p_effective_date       => l_effective_date);
1205   --
1206 exception
1207   --
1208   when others then
1209     fnd_msg_pub.add;
1210     ben_det_enrt_rates.clear_globals;
1211   --
1212 end process_post_enrt_calls_w;
1213 
1214   end ben_proc_common_enrt_rslt;