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.17 2011/11/22 23:20:02 pvelvano ship $ */
3 --------------------------------------------------------------------------------
4 /*
5 +==============================================================================+
6 |                       Copyright (c) 1998 Oracle Corporation                  |
7 |                          Redwood Shores, California, USA                     |
8 |                               All rights reserved.                           |
12     Common Enrollment Results Process
9 +==============================================================================+
10 --
11 Name
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
100                                    parameter p_self_service_flag to avoid conversion issues
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
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 115.59  29-Sep-09   stee           8930024 - Fix c_enrt_rslt to exclude enrt_mthd_cd = 'D'
127                                              if called from automatic enrollment.
128 115.60  27-Oct-09   stee           9026755 - Change fix for bug 7510533.  Check the
129                                              electable flag instead.
130 115.61  02-Sep-11   velvanop       Bug 12938378  - Do not call multi_rows_edit from 'process_post_results' when Automatic enrollments are applied.
131                                    multi-row edit is called and the enrollment results are terminated since the per_in_ler_id
132 				   has not been updated with the current per_in_ler_id.
133 115.62  23-Nov-11   velvanop       Bug 13367099: Do not consider Imputed Income enrollment to determine Elections Made date
134 */
135 ------------------------------------------------------------------------------
136   g_debug boolean := hr_utility.debug_enabled;
137   g_package varchar2(80):='ben_proc_common_enrt_rslt.';
138 --
139 -- ---------------------------------------------------------------------------
140 -- This procedure was later added to update elctn made dt or assigned dt on pil_popl  (yrathman)
141 -- ---------------------------------------------------------------------------
142 --
143 procedure set_elcn_made_or_asnd_dt
144     (p_per_in_ler_id     in number   default null
145     ,p_pgm_id            in number
146     ,p_pl_id             in number
147     ,p_enrt_mthd_cd      in varchar2
148     ,p_business_group_id in number
149     ,p_effective_date    in date
150     ,p_validate          in boolean  default false) is
151   --
152   -- Declare cursors and local variables
153   --
154   l_object_version_number    ben_pil_elctbl_chc_popl.object_version_number%TYPE;
155   l_pil_elctbl_chc_popl_id   ben_pil_elctbl_chc_popl.pil_elctbl_chc_popl_id%TYPE;
156   l_proc                     varchar2(72) := g_package||'set_elcn_made_or_asnd_dt';
157   --
158   cursor c_pgm_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.pgm_id = p_pgm_id;
165   --
166   cursor c_pl_popl is
167     select pel.pil_elctbl_chc_popl_id
168           ,pel.object_version_number
169           ,pel.elcns_made_dt
170     from   ben_pil_elctbl_chc_popl pel
171     where  pel.per_in_ler_id = p_per_in_ler_id
172     and    pel.pl_id  = p_pl_id;
173   --
174   --  Added the cursor to fix bug 1644520
175   --Bug 4414127
176   cursor c_pgm_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.pgm_id = p_pgm_id
181     and pen.prtt_enrt_rslt_stat_cd is null
182     and pen.enrt_cvg_thru_dt = hr_api.g_eot
183     and pen.comp_lvl_cd <> 'PLANIMP'; -- Bug 13367099
184   --Bug 4414127
185   cursor c_pl_elcns_made_dt is
186     select max(pen.EFFECTIVE_START_DATE) elcns_made_dt
187     from ben_prtt_enrt_rslt_f pen
188     where pen.per_in_ler_id = p_per_in_ler_id
189     and   pen.pl_id = p_pl_id
190     and pen.prtt_enrt_rslt_stat_cd is null
191     and pen.enrt_cvg_thru_dt = hr_api.g_eot ;
192   --
193   l_old_elcns_made_dt       date default null;
194   l_new_elcns_made_dt       date default null;
195   --
196   begin
197     --
198     hr_utility.set_location('Entering:'||l_proc, 5);
199     --
200     --  Get the pil_elctbl_chc_popl object_version_number
201     --
202     if p_pgm_id is not null then
203       open c_pgm_popl;
204       fetch c_pgm_popl into l_pil_elctbl_chc_popl_id
205                            ,l_object_version_number
209         --
206                            ,l_old_elcns_made_dt ;
207       --
208       if c_pgm_popl%notfound then
210         close c_pgm_popl;
211         fnd_message.set_name('BEN','BEN_91916_ENRT_TABLE_NOT_FOUND');
212         fnd_message.set_token('TABLE','PIL_ELCTBL_CHC_POPL');
213         fnd_message.raise_error;
214         --
215       end if;
216       --
217       close c_pgm_popl;
218     else
219       open c_pl_popl;
220       fetch c_pl_popl into l_pil_elctbl_chc_popl_id
221                           ,l_object_version_number
222                           ,l_old_elcns_made_dt ;
223       --
224       if c_pl_popl%notfound then
225         --
226         close c_pl_popl;
227         fnd_message.set_name('BEN','BEN_91916_ENRT_TABLE_NOT_FOUND');
228         fnd_message.set_token('TABLE','PIL_ELCTBL_CHC_POPL');
229         fnd_message.raise_error;
230         --
231       end if;
232       --
233       close c_pl_popl;
234     end if;
235     --
236     --  If enrollment method code is explicit, update the election made date.
237     --
238     hr_utility.set_location('enrt mthd cd'||p_enrt_mthd_cd||l_proc, 5);
239     if p_enrt_mthd_cd = 'E' then
240       --
241       hr_utility.set_location(l_proc, 10);
242       --
243       --  Update election made date on pil_elctbl_chc_popl.
244       -- Bug 1644520 added the if condition to take the only first election
245       -- made date
246       --
247       if p_pgm_id is not null then
248         open c_pgm_elcns_made_dt ;
249         fetch c_pgm_elcns_made_dt into l_new_elcns_made_dt ;
250         close c_pgm_elcns_made_dt ;
251       else
252         open c_pl_elcns_made_dt ;
253         fetch c_pl_elcns_made_dt into l_new_elcns_made_dt ;
254         close c_pl_elcns_made_dt ;
255       end if;
256       --
257       -- Update only if the old value is null or if the value needs to be
258       -- changed.
259       --
260       if l_old_elcns_made_dt is null or
261          l_old_elcns_made_dt <> l_new_elcns_made_dt then
262       --
263         ben_Pil_Elctbl_chc_Popl_api.update_Pil_Elctbl_chc_Popl
264           (p_validate               => p_validate
265            ,p_pil_elctbl_chc_popl_id => l_pil_elctbl_chc_popl_id
266            ,p_elcns_made_dt          => nvl(l_new_elcns_made_dt ,p_effective_date)
267            ,p_object_version_number  => l_object_version_number
268            ,p_effective_date         => p_effective_date
269            ,p_business_group_id      => p_business_group_id
270            );
271       --
272       end if;
273       --
274       -- If enrollment method code is default, update the default
275       -- enrollment date
276       --
277     elsif p_enrt_mthd_cd = 'D' then
278       --
279       hr_utility.set_location(l_proc, 20);
280       --
281       --
282       --  Update default assigned date on pil_elctbl_chc_popl.
283       --
284       ben_Pil_Elctbl_chc_Popl_api.update_Pil_Elctbl_chc_Popl
285         (p_validate               => p_validate
286         ,p_pil_elctbl_chc_popl_id => l_pil_elctbl_chc_popl_id
287         ,p_dflt_asnd_dt           => p_effective_date
288         ,p_object_version_number  => l_object_version_number
289         ,p_effective_date         => p_effective_date
290         ,p_business_group_id      => p_business_group_id
291         );
292           --
293       --
294     elsif p_enrt_mthd_cd = 'A' then
295       --
296       hr_utility.set_location(l_proc, 20);
297       --
298       --  Update automatic enrollment assigned date on pil_elctbl_chc_popl.
299       --
300       ben_Pil_Elctbl_chc_Popl_api.update_Pil_Elctbl_chc_Popl
301         (p_validate               => p_validate
302         ,p_pil_elctbl_chc_popl_id => l_pil_elctbl_chc_popl_id
303         ,p_auto_asnd_dt           => p_effective_date
304         ,p_object_version_number  => l_object_version_number
305         ,p_effective_date         => p_effective_date
306         ,p_business_group_id      => p_business_group_id
307         );
308       --
309     end if;
310     --
311     hr_utility.set_location(l_proc, 25);
312     --
313     hr_utility.set_location(' Leaving:'||l_proc, 30);
314     --
315   end set_elcn_made_or_asnd_dt;
316   --
317   -- ------------------------------------------------------------------------------
318   procedure process_post_results
319     (p_flx_cr_flag       in varchar2 default 'N'
320     ,p_person_id         in number
321     ,p_enrt_mthd_cd      in varchar2
322     ,p_effective_date    in date
323     ,p_business_group_id in number
324     ,p_validate          in boolean  default false
325     ,p_per_in_ler_id     in number
326     ,p_self_service_flag in boolean  default false
327     ,p_pgm_id            in number
328     ,p_pl_id             in number
329     ,p_called_frm_ss     in boolean  default false
330     )
331   is
332     --
333     l_proc    varchar2(72) := g_package||'process_post_results';
334     --
335     l_dummy_set ben_det_enrt_rates.PRVRtVal_tab;
336     --
337     cursor c_per_in_ler
338     is
339     select per_in_ler_id
340       from ben_per_in_ler
341       where person_id = p_person_id
342       and per_in_ler_stat_cd = 'STRTD'
343       and business_group_id  = p_business_group_id;
344   --
345   l_per_in_ler_id number;
346   --
347   cursor c_lf_evt_ocrd_dt is
348     select lf_evt_ocrd_dt
349     from   ben_per_in_ler pil
350     where  pil.per_in_ler_id = l_per_in_ler_id;
351   --
352   l_lf_evt_ocrd_dt  date;
353   /* cursor to pick results with coverage calculation method ERL */
354   --
358   --cursor and get into APP-BEN-91711 issue.
355   --BUG 4718599 Modifed the cursor to join epe to enb and check for per in ler
356   --otherwise if there were multiple updates to the enrollment results in the
357   --previous life event, you will end up getting multiple records returned by the
359   --
360    cursor c_enrt_rslt
361     (c_person_id      in     number
362     ,c_enrt_mthd_cd   in     varchar2
363     ,c_per_in_ler_id  in     number
364     ,c_effective_date in     date
365     )
366   is
367     select pen.*,
368            enb.elig_per_elctbl_chc_id,
369            enb.enrt_bnft_id
370     from ben_prtt_enrt_rslt_f pen,
371          ben_enrt_bnft enb,
372          ben_elig_per_elctbl_chc epe
373     where pen.person_id          = c_person_id
374     and ( pen.enrt_mthd_cd         = c_enrt_mthd_cd
375           or pen.enrt_mthd_cd         = 'O'
376 	   or ( (pen.enrt_mthd_cd = 'D' or pen.enrt_mthd_cd = 'E') --7447088 --Bug 12938378: Check for Explicit enrollments
377                and c_enrt_mthd_cd <> 'A')) -- 8930024
378     and pen.prtt_enrt_rslt_stat_cd is null
379     /* 9026755 */
380     and ((pen.per_in_ler_id        = c_per_in_ler_id
381          and epe.elctbl_flag = 'Y')
382          or (pen.per_in_ler_id <> c_per_in_ler_id
383              and epe.elctbl_flag = 'N'))
384    /* end 9026755 */
385     and enrt_cvg_thru_dt = hr_api.g_eot
386     and pen.comp_lvl_cd <> 'PLANIMP'
387     and pen.prtt_enrt_rslt_id = enb.prtt_enrt_rslt_id
388     and enb.cvg_mlt_cd = 'ERL'
389     and c_effective_date
390       between pen.effective_start_date and pen.effective_end_date
391     and pen.effective_end_date = hr_api.g_eot
392     and enb.elig_per_elctbl_chc_id = epe.elig_per_elctbl_chc_id
393     and epe.per_in_ler_id = c_per_in_ler_id
394     ;
395     --
396     -- 5621577 Fetch the Rates for the current Enrollment
397     --         which are enter value at enrollment
398     --
399     CURSOR c_prv_rt(c_prtt_enrt_rslt_id number,
400                     c_per_in_ler_id number) is
401     select ecr.enrt_rt_id,
402            prv.rt_val,
403            prv.ann_rt_val,
404            prv.prtt_rt_val_id
405       from ben_prtt_rt_val prv,
406            ben_elig_per_elctbl_chc epe,
407            ben_enrt_bnft enb,
408            ben_enrt_rt ecr
409      where prv.prtt_enrt_rslt_id = c_prtt_enrt_rslt_id
410        and prv.prtt_rt_val_stat_cd is null
411        and ecr.entr_val_at_enrt_flag = 'Y'
412        and ecr.prtt_rt_val_id = prv.prtt_rt_val_id
413        and epe.per_in_ler_id = c_per_in_ler_id
414        and epe.prtt_enrt_rslt_id = c_prtt_enrt_rslt_id
415        and epe.elig_per_elctbl_chc_id = enb.elig_per_elctbl_chc_id(+)
416        and ecr.enrt_bnft_id(+) = enb.enrt_bnft_id
417        and NVL(ecr.elig_per_elctbl_chc_id, epe.elig_per_elctbl_chc_id) = epe.elig_per_elctbl_chc_id
418        ;
419        --
420     type g_rt_rec is record
421     (enrt_rt_id      ben_enrt_rt.enrt_rt_id%type,
422      rt_val          ben_enrt_rt.dflt_val%type,
423      ann_val         ben_enrt_rt.ann_val%type,
424      prtt_rt_val_id  ben_enrt_rt.prtt_rt_val_id%type
425      );
426     --
427     type g_rt_table is table of g_rt_rec index by binary_integer;
428     l_rt_table g_rt_table;
429     l_count number;
430     --
431   CURSOR c_interim (c_interim_pen     IN NUMBER
432                     ,c_person_id      in     number
433                    ,c_per_in_ler_id   in     number
434                    ,c_effective_date  in     date)
435    IS
436       SELECT 'Y' interim_flag,
437              prtt_enrt_rslt_id suspended_pen_id,
438              object_version_number suspended_ovn
439         FROM ben_prtt_enrt_rslt_f pen
440        WHERE pen.rplcs_sspndd_rslt_id = c_interim_pen
441          AND pen.person_id          = c_person_id
442          AND pen.prtt_enrt_rslt_stat_cd IS NULL
443          AND pen.per_in_ler_id = c_per_in_ler_id
444          AND pen.enrt_cvg_thru_dt = hr_api.g_eot
445          AND c_effective_date BETWEEN pen.effective_start_date
446                                   AND pen.effective_end_date
447          AND pen.effective_end_date = hr_api.g_eot;
448    --
449    l_interim varchar2(30) ;
450    l_suspended_pen_id number;
451    l_suspended_ovn number;
452    --
453     cursor c_pl (p_pl_id number) is
454       select name,
455              SUBJ_TO_IMPTD_INCM_TYP_CD
456       from ben_pl_f pln
457       where pln.pl_id = p_pl_id
458       and p_effective_date between pln.effective_start_date
459           and pln.effective_end_date;
460     --
461     l_pln_name      varchar2(300);
462     l_enb_valrow                 ben_determine_coverage.ENBValType;
463     l_enrt_rslt    c_enrt_rslt%rowtype;
464     l_dummy_char   varchar2(1);
465     l_dummy_number number;
466     l_dummy_date   date;
467     l_dummy_bool   boolean;
468     l_ctfn_actn_warning boolean;
469     l_DPNT_ACTN_WARNING boolean;
470     l_BNF_ACTN_WARNING  boolean;
471     l_call_multi_rows   boolean;
472     l_SUBJ_TO_IMPTD_INCM_TYP_CD varchar2(300);
473     l_call_imputed      boolean;
474     l_datetrack_mode         varchar2(30);
475     --
476   begin
477     --
478     g_debug := hr_utility.debug_enabled;
479     --
480     if (g_debug) then
481         hr_utility.set_location('Entering:'||l_proc, 5);
482     end if;
483     --
484     -- Check to see if the per in ler id is being passed in. If not then
485     -- fetch it.
486     --
487     if p_per_in_ler_id is null
488     then
489       open c_per_in_ler;
490       fetch c_per_in_ler into l_per_in_ler_id;
491       --
492       if c_per_in_ler%notfound
493       then
494         close c_per_in_ler;
498       --
495         fnd_message.set_name('BEN', 'BEN_91272_PER_IN_LER_MISSING');
496         fnd_message.raise_error;
497       end if;
499       close c_per_in_ler;
500       --
501     else
502       l_per_in_ler_id := p_per_in_ler_id;
503 
504     end if;
505     --
506     hr_utility.set_location(l_proc, 10);
507     --
508     -- process post enrollment rule for coverages
509     --
510     --
511     open c_enrt_rslt
512         (c_person_id       => p_person_id
513          ,c_enrt_mthd_cd   => p_enrt_mthd_cd
514          ,c_per_in_ler_id  => p_per_in_ler_id
515          ,c_effective_date => p_effective_date
516          )
517           ;
518     loop
519       fetch c_enrt_rslt into l_enrt_rslt;
520       if c_enrt_rslt%notfound then
521          exit;
522       end if;
523       --
524       open c_lf_evt_ocrd_dt;
525       fetch c_lf_evt_ocrd_dt into l_lf_evt_ocrd_dt;
526       close c_lf_evt_ocrd_dt;
527       --
528       ben_determine_coverage.main
529             (p_elig_per_elctbl_chc_id => l_enrt_rslt.elig_per_elctbl_chc_id
530             ,p_effective_date         => p_effective_date
531             ,p_lf_evt_ocrd_dt         => l_lf_evt_ocrd_dt
532             ,p_perform_rounding_flg   => true
533             --
534             ,p_enb_valrow             => l_enb_valrow
535             ,p_calculate_only_mode    => TRUE
536             );
537       --
538       -- call election information
539       if nvl(l_enb_valrow.val,0) <> nvl(l_enrt_rslt.bnft_amt,0) then
540         --
541         l_interim := NULL;
542         l_suspended_pen_id := NULL;
543         --
544         open c_interim
545            (c_interim_pen     => l_enrt_rslt.prtt_enrt_rslt_id
546            ,c_person_id       => p_person_id
547            ,c_per_in_ler_id   => p_per_in_ler_id
548            ,c_effective_date  => p_effective_date
549            );
550         --
551         fetch c_interim into l_interim,
552                              l_suspended_pen_id,
553                              l_suspended_ovn;
554         close c_interim;
555         --
556         hr_utility.set_location('l_interim '|| l_interim, 10);
557         --
558         IF l_interim = 'Y' THEN
559           --
560           ben_sspndd_enrollment.g_interim_flag := 'Y';
561           ben_sspndd_enrollment.g_use_new_result:=true;
562           hr_utility.set_location('Before ERL Interim call',20);
563           --
564         END IF;
565         --
566         --
567         if (g_debug) then
568              hr_utility.set_location('Fetch entr_val_at_enrt rates for ERL enrollments ', 15);
569         end if;
570         -- 5621577 Fetch and populate existing rate values.
571         for l_count in 1..10 loop
572             -- Initialise array to null
573             l_rt_table(l_count).enrt_rt_id := null;
574             l_rt_table(l_count).rt_val := null;
575             l_rt_table(l_count).ann_val := null;
576             l_rt_table(l_count).prtt_rt_val_id := null;
577             --
578         end loop;
579         --
580         l_count:= 0;
581         --
582         for l_rec in c_prv_rt(l_enrt_rslt.prtt_enrt_rslt_id, l_per_in_ler_id) loop
583             --
584             l_count := l_count+1;
585             l_rt_table(l_count).enrt_rt_id := l_rec.enrt_rt_id;
586             l_rt_table(l_count).rt_val := l_rec.rt_val;
587             l_rt_table(l_count).ann_val := l_rec.ann_rt_val;
588             l_rt_table(l_count).prtt_rt_val_id := l_rec.prtt_rt_val_id;
589             --
590             if (g_debug) then
591                 hr_utility.set_location('Rate l_count '|| l_count, 15);
592                 hr_utility.set_location('l_rec.enrt_rt_id '|| l_rec.enrt_rt_id, 15);
593                 hr_utility.set_location('l_rec.rt_val '|| l_rec.rt_val, 15);
594                 hr_utility.set_location('l_rec.ann_val '|| l_rec.ann_rt_val, 15);
595                 hr_utility.set_location('l_rec.prtt_rt_val_id '|| l_rec.prtt_rt_val_id, 15);
596             end if;
597             --
598         end loop;
599                 --
600         ben_election_information.election_information
601                (p_elig_per_elctbl_chc_id => l_enrt_rslt.elig_per_elctbl_chc_id,
602                 p_prtt_enrt_rslt_id      => l_enrt_rslt.prtt_enrt_rslt_id,
603                 p_effective_date         => p_effective_date,
604                 p_enrt_mthd_cd           => l_enrt_rslt.enrt_mthd_cd,
605                 p_enrt_bnft_id           => l_enrt_rslt.enrt_bnft_id,
606                 p_bnft_val               => l_enb_valrow.val,
607 /* 5621577 - Added the below parameters */
608                 p_enrt_rt_id1            => l_rt_table(1).enrt_rt_id,
609                 p_rt_val1                => l_rt_table(1).rt_val,
610                 p_ann_rt_val1            => l_rt_table(1).ann_val,
611                 p_prtt_rt_val_id1        => l_rt_table(1).prtt_rt_val_id,
612 
613                 p_enrt_rt_id2            => l_rt_table(2).enrt_rt_id,
614                 p_rt_val2                => l_rt_table(2).rt_val,
615                 p_ann_rt_val2            => l_rt_table(2).ann_val,
616                 p_prtt_rt_val_id2        => l_rt_table(2).prtt_rt_val_id,
617 
618                 p_enrt_rt_id3            => l_rt_table(3).enrt_rt_id,
619                 p_rt_val3                => l_rt_table(3).rt_val,
620                 p_ann_rt_val3            => l_rt_table(3).ann_val,
621                 p_prtt_rt_val_id3        => l_rt_table(3).prtt_rt_val_id,
622 
623                 p_enrt_rt_id4            => l_rt_table(4).enrt_rt_id,
624                 p_rt_val4                => l_rt_table(4).rt_val,
628                 p_enrt_rt_id5            => l_rt_table(5).enrt_rt_id,
625                 p_ann_rt_val4            => l_rt_table(4).ann_val,
626                 p_prtt_rt_val_id4        => l_rt_table(4).prtt_rt_val_id,
627 
629                 p_rt_val5                => l_rt_table(5).rt_val,
630                 p_ann_rt_val5            => l_rt_table(5).ann_val,
631                 p_prtt_rt_val_id5        => l_rt_table(5).prtt_rt_val_id,
632 
633                 p_enrt_rt_id6            => l_rt_table(6).enrt_rt_id,
634                 p_rt_val6                => l_rt_table(6).rt_val,
635                 p_ann_rt_val6            => l_rt_table(6).ann_val,
636                 p_prtt_rt_val_id6        => l_rt_table(6).prtt_rt_val_id,
637 
638                 p_enrt_rt_id7            => l_rt_table(7).enrt_rt_id,
639                 p_rt_val7                => l_rt_table(7).rt_val,
640                 p_ann_rt_val7            => l_rt_table(7).ann_val,
641                 p_prtt_rt_val_id7        => l_rt_table(7).prtt_rt_val_id,
642 
643                 p_enrt_rt_id8            => l_rt_table(8).enrt_rt_id,
644                 p_rt_val8                => l_rt_table(8).rt_val,
645                 p_ann_rt_val8            => l_rt_table(8).ann_val,
646                 p_prtt_rt_val_id8        => l_rt_table(8).prtt_rt_val_id,
647 
648                 p_enrt_rt_id9            => l_rt_table(9).enrt_rt_id,
649                 p_rt_val9                => l_rt_table(9).rt_val,
650                 p_ann_rt_val9            => l_rt_table(9).ann_val,
651                 p_prtt_rt_val_id9        => l_rt_table(9).prtt_rt_val_id,
652 
653                 p_enrt_rt_id10            => l_rt_table(10).enrt_rt_id,
654                 p_rt_val10                => l_rt_table(10).rt_val,
655                 p_ann_rt_val10            => l_rt_table(10).ann_val,
656                 p_prtt_rt_val_id10        => l_rt_table(10).prtt_rt_val_id,
657 
658 /*  5621577 Commented the below parameters
659                 p_prtt_rt_val_id2        => l_dummy_number,
660                 p_prtt_rt_val_id3        => l_dummy_number,
661                 p_prtt_rt_val_id4        => l_dummy_number,
662                 p_prtt_rt_val_id5        => l_dummy_number,
663                 p_prtt_rt_val_id6        => l_dummy_number,
664                 p_prtt_rt_val_id7        => l_dummy_number,
665                 p_prtt_rt_val_id8        => l_dummy_number,
666                 p_prtt_rt_val_id9        => l_dummy_number,
667                 p_prtt_rt_val_id10       => l_dummy_number,
668 */
669                 p_pen_attribute_category =>  l_enrt_rslt.pen_attribute_category,
670                 p_pen_attribute1         =>  l_enrt_rslt.pen_attribute1,
671                 p_pen_attribute2         =>  l_enrt_rslt.pen_attribute2,
672                 p_pen_attribute3         =>  l_enrt_rslt.pen_attribute3,
673                 p_pen_attribute4         =>  l_enrt_rslt.pen_attribute4,
674                 p_pen_attribute5         =>  l_enrt_rslt.pen_attribute5,
675                 p_pen_attribute6         =>  l_enrt_rslt.pen_attribute6,
676                 p_pen_attribute7         =>  l_enrt_rslt.pen_attribute7,
677                 p_pen_attribute8         =>  l_enrt_rslt.pen_attribute8,
678                 p_pen_attribute9         =>  l_enrt_rslt.pen_attribute9,
679                 p_pen_attribute10        =>  l_enrt_rslt.pen_attribute10,
680                 p_pen_attribute11        =>  l_enrt_rslt.pen_attribute11,
681                 p_pen_attribute12        =>  l_enrt_rslt.pen_attribute12,
682                 p_pen_attribute13        =>  l_enrt_rslt.pen_attribute13,
683                 p_pen_attribute14        =>  l_enrt_rslt.pen_attribute14,
684                 p_pen_attribute15        =>  l_enrt_rslt.pen_attribute15,
685                 p_pen_attribute16        =>  l_enrt_rslt.pen_attribute16,
686                 p_pen_attribute17        =>  l_enrt_rslt.pen_attribute17,
687                 p_pen_attribute18        =>  l_enrt_rslt.pen_attribute18,
688                 p_pen_attribute19        =>  l_enrt_rslt.pen_attribute19,
689                 p_pen_attribute20        =>  l_enrt_rslt.pen_attribute20,
690                 p_pen_attribute21        =>  l_enrt_rslt.pen_attribute21,
691                 p_pen_attribute22        =>  l_enrt_rslt.pen_attribute22,
692                 p_pen_attribute23        =>  l_enrt_rslt.pen_attribute23,
693                 p_pen_attribute24        =>  l_enrt_rslt.pen_attribute24,
694                 p_pen_attribute25        =>  l_enrt_rslt.pen_attribute25,
695                 p_pen_attribute26        =>  l_enrt_rslt.pen_attribute26,
696                 p_pen_attribute27        =>  l_enrt_rslt.pen_attribute27,
697                 p_pen_attribute28        =>  l_enrt_rslt.pen_attribute28,
698                 p_pen_attribute29        =>  l_enrt_rslt.pen_attribute29,
699                 p_pen_attribute30        =>  l_enrt_rslt.pen_attribute30,
700                 p_datetrack_mode         => hr_api.g_update,
701                 p_suspend_flag           => l_dummy_char,
702                 p_effective_start_date   => l_dummy_date,
703                 p_effective_end_date     => l_dummy_date,
704                 p_object_version_number  => l_enrt_rslt.object_version_number,
705                 p_prtt_enrt_interim_id   => l_dummy_number,
706                 p_business_group_id      => p_business_group_id,
707                 p_dpnt_actn_warning      => l_DPNT_ACTN_WARNING,
708                 p_bnf_actn_warning       => l_BNF_ACTN_WARNING,
709                 p_ctfn_actn_warning      => l_ctfn_actn_warning);
710          --
711         -- l_call_multi_rows  := true; --commented bug 4362939
712          if l_ctfn_actn_warning then
713             --
714             open c_pl (l_enrt_rslt.pl_id);
715             fetch c_pl into l_pln_name, l_SUBJ_TO_IMPTD_INCM_TYP_CD;
716             close c_pl;
717             --
718             ben_warnings.load_warning
719              (p_application_short_name  => 'BEN',
723             l_ctfn_actn_warning := false;
720               p_message_name            => 'BEN_93582_RQD_CTFN_MISSING',
721               p_parma     => l_pln_name);
722             --
724          end if;
725          --
726          if l_DPNT_ACTN_WARNING then
727             --
728             open c_pl (l_enrt_rslt.pl_id);
729             fetch c_pl into l_pln_name, l_SUBJ_TO_IMPTD_INCM_TYP_CD;
730             close c_pl;
731             --
732             ben_warnings.load_warning
733              (p_application_short_name  => 'BEN',
734               p_message_name            => 'BEN_93583_DPNT_ERR',
735               p_parma     => l_pln_name);
736             --
737             l_DPNT_ACTN_WARNING := false;
738          end if;
739          --
740          if l_BNF_ACTN_WARNING then
741             --
742             open c_pl (l_enrt_rslt.pl_id);
743             fetch c_pl into l_pln_name,l_SUBJ_TO_IMPTD_INCM_TYP_CD;
744             close c_pl;
745             --
746             ben_warnings.load_warning
747              (p_application_short_name  => 'BEN',
748               p_message_name            => 'BEN_93584_BNF_ERR',
749               p_parma     => l_pln_name);
750             --
751             l_BNF_ACTN_WARNING := false;
752          end if;
753          --
754          --ERL for Interim Handling
755          IF l_interim = 'Y' THEN
756            --
757            ben_sspndd_enrollment.g_interim_flag := 'N';
758            ben_sspndd_enrollment.g_use_new_result:=false;
759            --
760            -- Now update the suspended enrollment with newly cteated interim id.
761            --
762            hr_utility.set_location('After ERL Interim call ELINF',20);
763            --
764            ben_prtt_enrt_result_api.get_ben_pen_upd_dt_mode
765                      (p_effective_date         => p_effective_date
766                      ,p_base_key_value         => l_suspended_pen_id
767                      ,P_desired_datetrack_mode => hr_api.g_correction
768                      ,P_datetrack_allow        => l_datetrack_mode
769                      );
770            --
771            hr_utility.set_location('After ERL Interim call BEPENDT',20);
772            hr_utility.set_location('l_datetrack_mode '||l_datetrack_mode,10);
773            --
774            ben_prtt_enrt_result_api.update_prtt_enrt_result
775               (p_validate                 => FALSE,
776                p_prtt_enrt_rslt_id        => l_suspended_pen_id,
777                p_effective_start_date     => l_dummy_date,
778                p_effective_end_date       => l_dummy_date,
779                p_business_group_id        => p_business_group_id,
780                p_RPLCS_SSPNDD_RSLT_ID     => l_enrt_rslt.prtt_enrt_rslt_id,
781                p_object_version_number    => l_suspended_ovn,
782                p_effective_date           => p_effective_date,
783                p_datetrack_mode           => l_datetrack_mode,
784                p_multi_row_validate       => FALSE,
785                p_program_application_id   => fnd_global.prog_appl_id,
786                p_program_id               => fnd_global.conc_program_id,
787                p_request_id               => fnd_global.conc_request_id,
788                p_program_update_date      => sysdate);
789                --
790             hr_utility.set_location('After ERL Interim BEPENUPD call',30);
791          END IF;
792          --
793       end if; --call election information
794       --
795       l_call_multi_rows  := true; -- bug 4362939
796 
797     end loop;
798     close c_enrt_rslt;
799     --BUG 4709601 we don't need to call this in carry forward action items process
800     /* Bug 12938378: Do not call multi_rows_edit from 'process_post_results' when Automatic enrollments are applied.multi-row edit is called and the enrollment results are terminated since the per_in_ler_id
801      has not been updated with the current per_in_ler_id. Call multi_rows_edit when p_enrt_mthd_cd <> 'A' */
802     if p_enrt_mthd_cd <> 'A' and l_call_multi_rows and nvl(ben_sspndd_enrollment.g_cfw_flag,'Y') = 'N' then
803 
804          ben_prtt_enrt_result_api.multi_rows_edit(
805                      p_person_id   => p_person_id
806                     ,p_effective_date =>p_effective_date
807                     ,p_business_group_id =>p_business_group_id
808                     ,p_pgm_id => l_enrt_rslt.pgm_id
809                     ,p_per_in_ler_id   =>p_per_in_ler_id
810                     ,p_include_erl     => 'Y'
811 		    ,p_called_frm_ss   => p_called_frm_ss
812                     );
813     end if;
814 
815     --
816     -- Determine enrollment rates and writes element entries.
817     --
818     ben_det_enrt_rates.p_det_enrt_rates
819       (p_person_id         => p_person_id
820       ,p_per_in_ler_id     => l_per_in_ler_id
821       ,p_enrt_mthd_cd      => p_enrt_mthd_cd
822       ,p_effective_date    => p_effective_date
823       ,p_business_group_id => p_business_group_id
824       ,p_validate          => p_validate
825       ,p_self_service_flag => p_self_service_flag
826       --
827       ,p_prv_rtval_set     => l_dummy_set
828       );
829      --
830      --  Determine imputed income
831      --
832      hr_utility.set_location(l_proc, 15);
833      --
834      l_call_imputed := true;
835      --
836      if p_pl_id is not null and p_pgm_id is null then
837        --
838         hr_utility.set_location('PL id '||p_pl_id,16);
839        open c_pl(p_pl_id);
840        fetch c_pl into l_pln_name, l_SUBJ_TO_IMPTD_INCM_TYP_CD;
841        if c_pl%found and l_SUBJ_TO_IMPTD_INCM_TYP_CD is null then
842           l_call_imputed := false;
846      end if;
843        end if;
844        close c_pl;
845        --
847      --
848      if l_call_imputed then
849        --
850        ben_det_imputed_income.p_comp_imputed_income
851          (p_person_id        => p_person_id
852          ,p_enrt_mthd_cd         => p_enrt_mthd_cd
853          ,p_per_in_ler_id        => l_per_in_ler_id
854          ,p_effective_date       => p_effective_date
855          ,p_business_group_id    => p_business_group_id
856          ,p_ctrlm_fido_call      => false
857          ,p_validate             => p_validate);
858        --
859      end if;
860      --
861      hr_utility.set_location(' Leaving:'||l_proc, 20);
862      --
863   end process_post_results;
864   --
865   -- ------------------------------------------------------------------------------
866   --    process_post_enrollment
867   -- -----------------------------------------------------------------------------
868   procedure process_post_enrollment
869     (p_per_in_ler_id     in number   default null
870     ,p_pgm_id            in number
871     ,p_pl_id             in number
872     ,p_enrt_mthd_cd      in varchar2
873     ,p_cls_enrt_flag     in boolean  default true
874     ,p_proc_cd           in varchar2 default null
875     ,p_proc_cd2          in varchar2 default  null
876     ,p_proc_cd3          in varchar2 default  null
877     ,p_proc_cd4          in varchar2 default  null
878     ,p_proc_cd5          in varchar2 default  null
879     ,p_person_id         in number
880     ,p_business_group_id in number
881     ,p_effective_date    in date
882     ,p_validate          in boolean  default false) is
883   --
884   -- Declare cursors and local variables
885   --
886   l_asnd_lf_evt_dt           ben_enrt_perd.asnd_lf_evt_dt%TYPE;
887 --  l_ler_id                   ben_per_in_ler.ler_id%TYPE;
888   l_exists                   varchar2(1);
889   l_proc                     varchar2(72) := g_package||'process_post_enrollment';
890   --
891   -- PB : 5422 :
892   -- Get the asnd_lf_evt_dt
893   --
894   cursor c_pil_elctbl_chc_popl is
895     select enp.asnd_lf_evt_dt
896     from   ben_pil_elctbl_chc_popl pel,
897            ben_enrt_perd enp
898     where  pel.per_in_ler_id = p_per_in_ler_id
899     and    nvl(pel.pgm_id,-1) = nvl(p_pgm_id,-1)
900     and    nvl(pel.pl_id,-1)  = nvl(p_pl_id,-1)
901     and    pel.enrt_perd_id = enp.enrt_perd_id;
902   --
903   l_global_pil_rec ben_global_enrt.g_global_pil_rec_type;
904   --
905   begin
906     --
907     hr_utility.set_location('Entering:'||l_proc, 5);
908     --
909     set_elcn_made_or_asnd_dt
910         (p_per_in_ler_id     => p_per_in_ler_id
911         ,p_pgm_id            => p_pgm_id
912         ,p_pl_id             => p_pl_id
913         ,p_enrt_mthd_cd      => p_enrt_mthd_cd
914         ,p_business_group_id => p_business_group_id
915         ,p_effective_date    => p_effective_date
916         ,p_validate          => p_validate
917        );
918     --
919     hr_utility.set_location(p_proc_cd, 25);
920     hr_utility.set_location(p_proc_cd2, 25);
921     --
922     --  Write communication.
923     --
924     hr_utility.set_location(l_proc, 26);
925     --
926     if p_proc_cd is not null then
927       --
928       open c_pil_elctbl_chc_popl;
929       fetch c_pil_elctbl_chc_popl into l_asnd_lf_evt_dt;
930       close c_pil_elctbl_chc_popl;
931       --
932       ben_global_enrt.get_pil
933        (p_per_in_ler_id          => p_per_in_ler_id
934        ,p_global_pil_rec         => l_global_pil_rec);
935       --
936       ben_generate_communications.main
937       (p_person_id             => p_person_id
938       ,p_ler_id                => l_global_pil_rec.ler_id
939       -- CWB Changes.
940       ,p_per_in_ler_id         => p_per_in_ler_id
941       ,p_pgm_id                => p_pgm_id
942       ,p_pl_id                 => p_pl_id
943       -- PB : 5422 :
944       ,p_asnd_lf_evt_dt        => l_asnd_lf_evt_dt
945       -- ,p_enrt_perd_id       => l_enrt_perd_id
946       ,p_enrt_mthd_cd          => p_enrt_mthd_cd
947       ,p_business_group_id     => p_business_group_id
948       ,p_proc_cd1              => p_proc_cd
949       ,p_proc_cd2              => p_proc_cd2
950       ,p_proc_cd3              => p_proc_cd3
951       ,p_proc_cd4              => p_proc_cd4
952       ,p_proc_cd5              => p_proc_cd5
953       ,p_effective_date        => p_effective_date);
954     end if;
955     --
956     hr_utility.set_location(l_proc, 27);
957     --
958     --  Close enrollment i.e. update the per_in_ler to processed.
959     --
960     if p_cls_enrt_flag then
961      --
962 --     if p_enrt_mthd_cd = 'A' then   --Bug 5529696
963      --
964       ben_close_enrollment.close_single_enrollment
965         (p_per_in_ler_id        => p_per_in_ler_id
966         ,p_effective_date       => p_effective_date
967         ,p_business_group_id    => p_business_group_id
968         ,p_validate             => p_validate
969         ,p_close_uneai_flag     => 'Y'
970         ,p_uneai_effective_date => p_effective_date
971 	,p_close_cd             => 'FORCE'
972       );
973  -- Bug 5997904
974 /*      else
975      ben_close_enrollment.close_single_enrollment
976         (p_per_in_ler_id        => p_per_in_ler_id
977         ,p_effective_date       => p_effective_date
978         ,p_business_group_id    => p_business_group_id
979         ,p_validate             => p_validate
980         ,p_close_uneai_flag     => 'Y'
981         ,p_uneai_effective_date => p_effective_date
982       );
983     end if;*/
987     hr_utility.set_location(' Leaving:'||l_proc, 30);
984  -- Bug 5997904
985     --
986    end if;
988     --
989   end process_post_enrollment;
990   --
991   --
992   -- ------------------------------------------------------------------------------
993   --    process_post_enrollment_w
994   -- -----------------------------------------------------------------------------
995   procedure process_post_enrollment_w
996     (p_per_in_ler_id     in number
997     ,p_pgm_id            in number
998     ,p_pl_id             in number
999     ,p_enrt_mthd_cd      in varchar2
1000     ,p_cls_enrt_flag     in varchar2
1001     ,p_proc_cd           in varchar2
1002     ,p_person_id         in number
1003     ,p_business_group_id in number
1004     ,p_effective_date    in date
1005     ,p_validate          in varchar2) is
1006   --
1007   -- Declare local variables
1008   --
1009   l_proc   varchar2(72) := g_package||'process_post_enrollment - wrapper';
1010   l_validate       BOOLEAN;
1011   l_cls_enrt_flag  BOOLEAN;
1012   --
1013   begin
1014     --
1015     hr_utility.set_location('Entering:'||l_proc, 10);
1016     --
1017     if upper(p_validate) = 'TRUE'
1018     then
1019       l_validate := TRUE;
1020     else
1021       l_validate := FALSE;
1022     end if;
1023 
1024     if upper(p_cls_enrt_flag) = 'TRUE'
1025     then
1026       l_cls_enrt_flag := TRUE;
1027     else
1028       l_cls_enrt_flag := FALSE;
1029     end if;
1030     --
1031     hr_utility.set_location('Entering:'||l_proc, 20);
1032     --
1033     process_post_enrollment(
1034      p_per_in_ler_id     => p_per_in_ler_id
1035     ,p_pgm_id            => p_pgm_id
1036     ,p_pl_id             => p_pl_id
1037     ,p_enrt_mthd_cd      => p_enrt_mthd_cd
1038     ,p_cls_enrt_flag     => l_cls_enrt_flag
1039     ,p_proc_cd           => p_proc_cd
1040     ,p_person_id         => p_person_id
1041     ,p_business_group_id => p_business_group_id
1042     ,p_effective_date    => p_effective_date
1043     ,p_validate          => l_validate
1044     );
1045     --
1046     hr_utility.set_location(' Leaving:'||l_proc, 30);
1047     --
1048   exception
1049   --
1050   when others then
1051     fnd_msg_pub.add;
1052   --
1053   end process_post_enrollment_w;
1054 
1055 
1056 procedure process_post_enrt_calls_w
1057   (p_validate               in varchar2 default 'N'
1058   ,p_person_id              in number
1059   ,p_per_in_ler_id          in number
1060   ,p_pgm_id                 in number default null
1061   ,p_pl_id                  in number default null
1062   ,p_flx_cr_flag            in varchar2 default 'N'
1063   ,p_enrt_mthd_cd           in varchar2
1064   ,p_proc_cd                in varchar2 default null
1065   ,p_cls_enrt_flag          in varchar2 default 'N'
1066   ,p_business_group_id      in number
1067   ,p_effective_date         in date)
1068 is
1069   --
1070   l_validate              boolean := false;
1071   l_effective_date        date    := trunc(sysdate);
1072   l_cls_enrt_flag         boolean := false;
1073   --
1074 begin
1075   --
1076   fnd_msg_pub.initialize;
1077   if p_validate = 'Y' then
1078     l_validate := true;
1079   end if;
1080   --
1081   if p_cls_enrt_flag = 'Y' then
1082     l_cls_enrt_flag := true;
1083   end if;
1084   --
1085   if p_effective_date is not null then
1086     -- l_effective_date := to_date(p_effective_date, 'YYYY/MM/DD');
1087     l_effective_date := p_effective_date ;
1088   end if;
1089   --
1090   ben_proc_common_enrt_rslt.set_elcn_made_or_asnd_dt
1091       (p_validate              => l_validate
1092       ,p_per_in_ler_id         => p_per_in_ler_id
1093       ,p_pgm_id                => p_pgm_id
1094       ,p_pl_id                 => p_pl_id
1095       ,p_enrt_mthd_cd          => p_enrt_mthd_cd
1096       ,p_business_group_id     => p_business_group_id
1097       ,p_effective_date        => l_effective_date);
1098   --
1099   ben_prtt_enrt_result_api.multi_rows_edit
1100       (p_person_id            => p_person_id
1101       ,p_per_in_ler_id        => p_per_in_ler_id
1102       ,p_pgm_id               => p_pgm_id
1103       ,p_business_group_id    => p_business_group_id
1104       ,p_effective_date       => l_effective_date);
1105   --
1106   ben_proc_common_enrt_rslt.process_post_results
1107       (p_validate             => l_validate
1108       ,p_person_id            => p_person_id
1109       ,p_per_in_ler_id        => p_per_in_ler_id
1110       ,p_flx_cr_flag          => p_flx_cr_flag
1111       ,p_enrt_mthd_cd         => p_enrt_mthd_cd
1112       ,p_business_group_id    => p_business_group_id
1113       ,p_effective_date       => l_effective_date
1114       ,p_self_service_flag    => true
1115       ,p_pl_id                => p_pl_id);
1116   --
1117   ben_proc_common_enrt_rslt.process_post_enrollment
1118       (p_validate             => l_validate
1119       ,p_person_id            => p_person_id
1120       ,p_per_in_ler_id        => p_per_in_ler_id
1121       ,p_pgm_id               => p_pgm_id
1122       ,p_pl_id                => p_pl_id
1123       ,p_enrt_mthd_cd         => p_enrt_mthd_cd
1124       ,p_cls_enrt_flag        => l_cls_enrt_flag
1125       ,p_proc_cd              => p_proc_cd
1126       ,p_business_group_id    => p_business_group_id
1127       ,p_effective_date       => l_effective_date);
1128   --
1129 exception
1130   --
1131   when app_exception.application_exception then	--Bug 4387247
1132     fnd_msg_pub.add;
1133     ben_det_enrt_rates.clear_globals; --Bug 4436578
1134   when others then
1135     --Bug 4387247
1136     fnd_message.set_name('PER','FFU10_GENERAL_ORACLE_ERROR');
1137     fnd_message.set_token('2',substr(sqlerrm,1,200));
1138     fnd_msg_pub.add;
1139     ben_det_enrt_rates.clear_globals;
1140   --
1141 end process_post_enrt_calls_w;
1142 
1143 
1144 procedure process_post_enrt_calls_w
1145   (p_validate               in varchar2 default 'N'
1146   ,p_person_id              in number
1147   ,p_per_in_ler_id          in number
1148   ,p_pgm_id                 in number default null
1149   ,p_pl_id                  in number default null
1150   ,p_flx_cr_flag            in varchar2 default 'N'
1151   ,p_enrt_mthd_cd           in varchar2
1152   ,p_proc_cd                in varchar2 default null
1153   ,p_cls_enrt_flag          in varchar2 default 'N'
1154   ,p_business_group_id      in number
1155   ,p_effective_date         in date
1156   ,p_self_service_flag      in varchar2 )
1157 is
1158   --
1159   l_validate              boolean := false;
1160   l_effective_date        date    := trunc(sysdate);
1161   l_cls_enrt_flag         boolean := false;
1162   l_self_service_flag     boolean := false;
1163   --
1164 begin
1165   --
1166   fnd_msg_pub.initialize;
1167   if p_validate = 'Y' then
1168     l_validate := true;
1169   end if;
1170   --
1171   if p_cls_enrt_flag = 'Y' then
1172     l_cls_enrt_flag := true;
1173   end if;
1174   --
1175   if p_self_service_flag = 'Y' then
1176     l_self_service_flag := true;
1177   end if;
1178   --
1179   if p_effective_date is not null then
1180     -- l_effective_date := to_date(p_effective_date, 'YYYY/MM/DD');
1181     l_effective_date := p_effective_date ;
1182   end if;
1183   --
1184   ben_proc_common_enrt_rslt.set_elcn_made_or_asnd_dt
1185       (p_validate              => l_validate
1186       ,p_per_in_ler_id         => p_per_in_ler_id
1187       ,p_pgm_id                => p_pgm_id
1188       ,p_pl_id                 => p_pl_id
1189       ,p_enrt_mthd_cd          => p_enrt_mthd_cd
1190       ,p_business_group_id     => p_business_group_id
1191       ,p_effective_date        => l_effective_date);
1192   --
1193   ben_prtt_enrt_result_api.multi_rows_edit
1194       (p_person_id            => p_person_id
1195       ,p_per_in_ler_id        => p_per_in_ler_id
1196       ,p_pgm_id               => p_pgm_id
1197       ,p_business_group_id    => p_business_group_id
1198       ,p_effective_date       => l_effective_date);
1199   --
1200   ben_proc_common_enrt_rslt.process_post_results
1201       (p_validate             => l_validate
1202       ,p_person_id            => p_person_id
1203       ,p_per_in_ler_id        => p_per_in_ler_id
1204       ,p_flx_cr_flag          => p_flx_cr_flag
1205       ,p_enrt_mthd_cd         => p_enrt_mthd_cd
1206       ,p_business_group_id    => p_business_group_id
1207       ,p_effective_date       => l_effective_date
1208       ,p_self_service_flag    => l_self_service_flag
1209       ,p_pl_id                => p_pl_id);
1210   --
1211   ben_proc_common_enrt_rslt.process_post_enrollment
1212       (p_validate             => l_validate
1213       ,p_person_id            => p_person_id
1214       ,p_per_in_ler_id        => p_per_in_ler_id
1215       ,p_pgm_id               => p_pgm_id
1216       ,p_pl_id                => p_pl_id
1217       ,p_enrt_mthd_cd         => p_enrt_mthd_cd
1218       ,p_cls_enrt_flag        => l_cls_enrt_flag
1219       ,p_proc_cd              => p_proc_cd
1220       ,p_business_group_id    => p_business_group_id
1221       ,p_effective_date       => l_effective_date);
1222   --
1223 exception
1224   --
1225   when others then
1226     fnd_msg_pub.add;
1227     ben_det_enrt_rates.clear_globals;
1228   --
1229 end process_post_enrt_calls_w;
1230 
1231   end ben_proc_common_enrt_rslt;