DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PD_RATE_AND_CVG_MODULE

Source


1 Package Body ben_pd_rate_and_cvg_module as
2 /* $Header: bepdcrtc.pkb 120.9 2006/02/28 03:30:36 rgajula noship $ */
3 --
4 g_package  varchar2(33) := '  ben_pd_rate_and_cvg_module.';
5 procedure create_rate_results
6   (
7    p_validate                       in  number     default 0 -- false
8   ,p_copy_entity_result_id          in  number    -- Source vapro
9   ,p_copy_entity_txn_id             in  number    default null
10   ,p_pgm_id                         in  number    default null
11   ,p_ptip_id                        in  number    default null
12   ,p_plip_id                        in  number    default null
13   ,p_pl_id                          in  number    default null
14   ,p_oipl_id                        in  number    default null
15   ,p_oiplip_id                      in  number    default null
16   ,p_cmbn_plip_id                   in  number    default null
17   ,p_cmbn_ptip_id                   in  number    default null
18   ,p_cmbn_ptip_opt_id               in  number    default null
19   ,p_business_group_id              in  number    default null
20   ,p_number_of_copies               in  number    default 0
21   ,p_object_version_number          out nocopy number
22   ,p_effective_date                 in  date
23   ,p_parent_entity_result_id        in number
24   --
25   ,p_opt_id                         in number     default null
26   --
27   ) is
28     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
29     l_proc varchar2(72) := g_package||'create_rate_results';
30     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
31 
32         --
33     cursor c_parent_result(c_parent_pk_id number,
34                         c_parent_table_name varchar2,
35                         c_copy_entity_txn_id number) is
36      select copy_entity_result_id mirror_src_entity_result_id
37      from ben_copy_entity_results cpe,
38            pqh_table_route trt
39      where cpe.information1= c_parent_pk_id
40      and   cpe.result_type_cd = 'DISPLAY'
41      and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
42      and   cpe.table_route_id = trt.table_route_id
43      and   trt.from_clause = 'OAB'
44      and   trt.where_clause = upper(c_parent_table_name) ;
45      ---
46      --
47      -- Bug : 3752407 : Global cursor g_table_route will now be used
48      -- Cursor to get table_route_id
49      --
50      -- cursor c_table_route(c_parent_table_alias varchar2) is
51      -- select table_route_id
52      -- from pqh_table_route trt
53      -- where trt.table_alias = c_parent_table_alias;
54      -- trt.from_clause = 'OAB'
55      -- and   trt.where_clause = upper(c_parent_table_name) ;
56      ---
57    ---------------------------------------------------------------
58    -- START OF BEN_ACTY_BASE_RT_F ----------------------
59    ---------------------------------------------------------------
60    cursor c_abr_from_parent(c_pgm_id           number,
61                             c_ptip_id          number,
62                             c_plip_id          number,
63                             c_pl_id            number,
64                             c_oipl_id          number,
65                             c_oiplip_id        number,
66                             c_cmbn_plip_id     number,
67                             c_cmbn_ptip_id     number,
68                             c_cmbn_ptip_opt_id number,
69                             --
70                             c_opt_id           number
71                             --
72                             ) is
73    select distinct acty_base_rt_id
74    from BEN_ACTY_BASE_RT_F
75    where  (c_pgm_id           is not null and c_pgm_id           = pgm_id) or
76           (c_ptip_id          is not null and c_ptip_id          = ptip_id) or
77           (c_plip_id          is not null and c_plip_id          = plip_id) or
78           (c_pl_id            is not null and c_pl_id            = pl_id ) or
79           (c_oiplip_id        is not null and c_oiplip_id        = oiplip_id) or
80           (c_oipl_id          is not null and c_oipl_id          = oipl_id) or
81           (c_cmbn_plip_id     is not null and c_cmbn_plip_id     = cmbn_plip_id) or
82           (c_cmbn_ptip_id     is not null and c_cmbn_ptip_id     = cmbn_ptip_id) or
83           (c_cmbn_ptip_opt_id is not null and c_cmbn_ptip_opt_id = cmbn_ptip_opt_id) or
84           --
85           (c_opt_id           is not null and c_opt_id           = opt_id);
86           --
87           --
88    cursor c_abr(c_acty_base_rt_id number,c_mirror_src_entity_result_id number,
89                 c_table_alias varchar2) is
90    select  abr.*
91    from BEN_ACTY_BASE_RT_F abr
92    where  abr.acty_base_rt_id = c_acty_base_rt_id
93      -- and abr.business_group_id = p_business_group_id
94      and not exists (
95          select /* */ null
96          from ben_copy_entity_results cpe
97               -- pqh_table_route trt
98          where copy_entity_txn_id = p_copy_entity_txn_id
99          -- and trt.table_route_id = cpe.table_route_id
100          and ( -- c_mirror_src_entity_result_id is null or
101                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
102          -- and trt.where_clause = 'BEN_ACTY_BASE_RT_F'
103          and cpe.table_alias = c_table_alias
104          and information1 = c_acty_base_rt_id
105          -- and information4 = abr.business_group_id
106            and information2 = abr.effective_start_date
107            and information3 = abr.effective_end_date);
108     l_acty_base_rt_id                 number(15);
109     l_out_abr_result_id   number(15);
110     --
111     -- pabodla : mapping data
112     --
113     cursor c_get_mapping_name1(p_id in number,p_date in date) is
114      select pet.element_name element_name
115      from pay_element_types_f pet
116      where  (pet.business_group_id is null
117             or pet.business_group_id = p_business_group_id)
118        and pet.element_type_id = p_id
119        and p_date between nvl(pet.effective_start_date,p_date)
120        and nvl(pet.effective_end_date,p_date) ;
121 
122      cursor c_element_type_start_date(c_element_type_id number) is
123      select min(effective_start_date) effective_start_date
124      from pay_element_types_f
125      where element_type_id = c_element_type_id;
126 
127     cursor c_get_mapping_name2(p_id in number, p_id1 in number, p_date in date) is
128      select piv.name name
129      from pay_input_values_f piv
130      where  ( piv.business_group_id is null or piv.business_group_id = p_business_group_id )
131      and   piv.element_type_id = p_id1
132      and p_date between piv.effective_start_date and
133          piv.effective_end_date
134      and  piv.input_value_id = p_id;
135 
136      cursor c_input_value_start_date(c_input_value_id number) is
137      select min(effective_start_date) effective_start_date
138      from pay_input_values_f
139      where input_value_id = c_input_value_id;
140 
141     -- PDW
142 
143     cursor c_pl_from_plip(c_plip_id  number) is
144     select pl_id
145     from ben_plip_f cpp
146     where cpp.plip_id = c_plip_id
147     and rownum = 1;
148 
149     cursor c_pl_from_oipl(c_oipl_id  number) is
150     select pl_id
151     from ben_oipl_f cop
152     where cop.oipl_id = c_oipl_id
153     and rownum = 1;
154 
155     cursor c_pl_from_oiplip(c_oiplip_id number) is
156     select cpp.pl_id
157     from ben_oiplip_f opp,
158          ben_plip_f   cpp
159     where opp.oiplip_id = c_oiplip_id
160     and   cpp.plip_id = opp.plip_id
161     and   rownum = 1;
162 
163     l_pl_id  ben_pl_f.pl_id%type;
164 
165     -- PDW
166 
167     --
168     l_mapping_id         number;
169     l_mapping_name       varchar2(600);
170     l_mapping_id1        number;
171     l_mapping_name1      varchar2(600);
172     l_mapping_column_name1 pqh_attributes.attribute_name%type;
173     l_mapping_column_name2 pqh_attributes.attribute_name%type;
174 
175     l_input_value_name          pay_input_values_f.name%type;
176 
177     l_abr_acty_base_rt_esd      ben_acty_base_rt_f.effective_start_date%type;
178 
179     l_element_type_start_date   pay_element_types_f.effective_start_date%type;
180     l_input_value_start_date    pay_input_values_f.effective_start_date%type;
181 
182    ---------------------------------------------------------------
183    -- END OF BEN_ACTY_BASE_RT_F ----------------------
184    ---------------------------------------------------------------
185    ---------------------------------------------------------------
186    -- START OF BEN_ACTY_RT_PYMT_SCHED_F ----------------------
187    ---------------------------------------------------------------
188    cursor c_apf_from_parent(c_ACTY_BASE_RT_ID number) is
189    select  acty_rt_pymt_sched_id
190    from BEN_ACTY_RT_PYMT_SCHED_F
191    where  ACTY_BASE_RT_ID = c_ACTY_BASE_RT_ID ;
192    --
193    cursor c_apf(c_acty_rt_pymt_sched_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
194    select  apf.*
195    from BEN_ACTY_RT_PYMT_SCHED_F apf
196    where  apf.acty_rt_pymt_sched_id = c_acty_rt_pymt_sched_id
197      --and apf.business_group_id = p_business_group_id
198      and not exists (
199          select /* */ null
200          from ben_copy_entity_results cpe
201               -- pqh_table_route trt
202          where copy_entity_txn_id = p_copy_entity_txn_id
203          -- and trt.table_route_id = cpe.table_route_id
204          and ( --l_mirror_src_entity_result_id is null or
205                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
206          -- and trt.where_clause = 'BEN_ACTY_RT_PYMT_SCHED_F'
207          and cpe.table_alias = c_table_alias
208          and information1 = c_acty_rt_pymt_sched_id
209          --and information4 = apf.business_group_id
210            and information2 = apf.effective_start_date
211            and information3 = apf.effective_end_date);
212     l_acty_rt_pymt_sched_id                 number(15);
213     l_out_apf_result_id   number(15);
214    ---------------------------------------------------------------
215    -- END OF BEN_ACTY_RT_PYMT_SCHED_F ----------------------
216    ---------------------------------------------------------------
217    ---------------------------------------------------------------
218    -- START OF BEN_PYMT_SCHED_PY_FREQ ----------------------
219    ---------------------------------------------------------------
220    cursor c_psq_from_parent(c_ACTY_RT_PYMT_SCHED_ID number) is
221    select  pymt_sched_py_freq_id
222    from BEN_PYMT_SCHED_PY_FREQ
223    where  ACTY_RT_PYMT_SCHED_ID = c_ACTY_RT_PYMT_SCHED_ID ;
224    --
225    cursor c_psq(c_pymt_sched_py_freq_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
226    select  psq.*
227    from BEN_PYMT_SCHED_PY_FREQ psq
228    where  psq.pymt_sched_py_freq_id = c_pymt_sched_py_freq_id
229      --and psq.business_group_id = p_business_group_id
230      and not exists (
231          select /* */ null
232          from ben_copy_entity_results cpe
233               -- pqh_table_route trt
234          where copy_entity_txn_id = p_copy_entity_txn_id
235          -- and trt.table_route_id = cpe.table_route_id
236          and ( --c_mirror_src_entity_result_id is null or
237                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
238          -- and trt.where_clause = 'BEN_PYMT_SCHED_PY_FREQ'
239          and cpe.table_alias = c_table_alias
240          and information1 = c_pymt_sched_py_freq_id
241          --and information4 = psq.business_group_id
242         );
243     l_pymt_sched_py_freq_id                 number(15);
244     l_out_psq_result_id   number(15);
245    ---------------------------------------------------------------
246    -- END OF BEN_PYMT_SCHED_PY_FREQ ----------------------
247    ---------------------------------------------------------------
248    ---------------------------------------------------------------
249    -- START OF BEN_ACTL_PREM_F ----------------------
250    ---------------------------------------------------------------
251    cursor c_apr_from_parent(c_ACTY_BASE_RT_ID number) is
252    select distinct actl_prem_id
253    from BEN_ACTY_BASE_RT_F
254    where  ACTY_BASE_RT_ID = c_ACTY_BASE_RT_ID ;
255    --
256    cursor c_apr(c_actl_prem_id number,c_mirror_src_entity_result_id number,
257                 c_table_alias varchar2 ) is
258    select  apr.*
259    from BEN_ACTL_PREM_F apr
260    where  apr.actl_prem_id = c_actl_prem_id
261      -- and apr.business_group_id = p_business_group_id
262      and not exists (
263          select /* */ null
264          from ben_copy_entity_results cpe
265               -- pqh_table_route trt
266          where copy_entity_txn_id = p_copy_entity_txn_id
267          -- and trt.table_route_id = cpe.table_route_id
268          and ( -- c_mirror_src_entity_result_id is null or
269                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
270          -- and trt.where_clause = 'BEN_ACTL_PREM_F'
271          and cpe.table_alias = c_table_alias
272          and information1 = c_actl_prem_id
273          -- and information4 = apr.business_group_id
274            and information2 = apr.effective_start_date
275            and information3 = apr.effective_end_date);
276     l_actl_prem_id                 number(15);
277     l_out_apr_result_id   number(15);
278    ---------------------------------------------------------------
279    -- END OF BEN_ACTL_PREM_F ----------------------
280    ---------------------------------------------------------------
281    ---------------------------------------------------------------
282    -- START OF BEN_ACTY_RT_PTD_LMT_F ----------------------
283    ---------------------------------------------------------------
284    cursor c_apl_from_parent(c_ACTY_BASE_RT_ID number) is
285    select  acty_rt_ptd_lmt_id
286    from BEN_ACTY_RT_PTD_LMT_F
287    where  ACTY_BASE_RT_ID = c_ACTY_BASE_RT_ID ;
288    --
289    cursor c_apl(c_acty_rt_ptd_lmt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
290    select  apl.*
291    from BEN_ACTY_RT_PTD_LMT_F apl
292    where  apl.acty_rt_ptd_lmt_id = c_acty_rt_ptd_lmt_id
293      -- and apl.business_group_id = p_business_group_id
294      and not exists (
295          select /* */ null
296          from ben_copy_entity_results cpe
297               -- pqh_table_route trt
298          where copy_entity_txn_id = p_copy_entity_txn_id
299          -- and trt.table_route_id = cpe.table_route_id
300          and ( -- c_mirror_src_entity_result_id is null or
301                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
302          -- and trt.where_clause = 'BEN_ACTY_RT_PTD_LMT_F'
303          and cpe.table_alias = c_table_alias
304          and information1 = c_acty_rt_ptd_lmt_id
305          -- and information4 = apl.business_group_id
306            and information2 = apl.effective_start_date
307            and information3 = apl.effective_end_date);
308     l_acty_rt_ptd_lmt_id                 number(15);
309     l_out_apl_result_id   number(15);
310    ---------------------------------------------------------------
311    -- END OF BEN_ACTY_RT_PTD_LMT_F ----------------------
312    ---------------------------------------------------------------
313    ---------------------------------------------------------------
314    -- START OF BEN_ACTY_VRBL_RT_F ----------------------
315    ---------------------------------------------------------------
316    cursor c_avr_from_parent(c_ACTY_BASE_RT_ID number) is
317    select distinct acty_vrbl_rt_id
318    from BEN_ACTY_VRBL_RT_F
319    where  ACTY_BASE_RT_ID = c_ACTY_BASE_RT_ID ;
320    --
321    cursor c_avr(c_acty_vrbl_rt_id number,c_mirror_src_entity_result_id number,
322                 c_table_alias varchar ) is
323    select  avr.*
324    from BEN_ACTY_VRBL_RT_F avr
325    where  avr.acty_vrbl_rt_id = c_acty_vrbl_rt_id
326      -- and avr.business_group_id = p_business_group_id
327      and not exists (
328          select /* */ null
329          from ben_copy_entity_results cpe
330               -- pqh_table_route trt
331          where copy_entity_txn_id = p_copy_entity_txn_id
332          -- and trt.table_route_id = cpe.table_route_id
333          and ( -- c_mirror_src_entity_result_id is null or
334                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
335          -- and trt.where_clause = 'BEN_ACTY_VRBL_RT_F'
336          and cpe.table_alias = c_table_alias
337          and information1 = c_acty_vrbl_rt_id
338          -- and information4 = avr.business_group_id
339            and information2 = avr.effective_start_date
340            and information3 = avr.effective_end_date);
341    --
342    cursor c_avr_drp(c_acty_vrbl_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
343    select distinct cpe.information262 vrbl_rt_prfl_id
344      from ben_copy_entity_results cpe
345           -- pqh_table_route trt
346      where copy_entity_txn_id = p_copy_entity_txn_id
347      -- and trt.table_route_id = cpe.table_route_id
348      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
349      -- and trt.where_clause = 'BEN_ACTY_VRBL_RT_F'
350      and cpe.table_alias = c_table_alias
351      and information1 = c_acty_vrbl_rt_id
352      -- and information4 = p_business_group_id
353     ;
354    --
355     l_acty_vrbl_rt_id                 number(15);
356     l_out_avr_result_id   number(15);
357    ---------------------------------------------------------------
358    -- END OF BEN_ACTY_VRBL_RT_F ----------------------
359    ---------------------------------------------------------------
360    ---------------------------------------------------------------
361    -- START OF BEN_MTCHG_RT_F ----------------------
362    ---------------------------------------------------------------
363    cursor c_mtr_from_parent(c_ACTY_BASE_RT_ID number) is
364    select  mtchg_rt_id
365    from BEN_MTCHG_RT_F
366    where  ACTY_BASE_RT_ID = c_ACTY_BASE_RT_ID ;
367    --
368    cursor c_mtr(c_mtchg_rt_id number,c_mirror_src_entity_result_id number,
369                 c_table_alias varchar2 ) is
370    select  mtr.*
371    from BEN_MTCHG_RT_F mtr
372    where  mtr.mtchg_rt_id = c_mtchg_rt_id
373      -- and mtr.business_group_id = p_business_group_id
374      and not exists (
375          select /* */ null
376          from ben_copy_entity_results cpe
377               -- pqh_table_route trt
378          where copy_entity_txn_id = p_copy_entity_txn_id
379         --  and trt.table_route_id = cpe.table_route_id
380          and ( -- c_mirror_src_entity_result_id is null or
381                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
382          -- and trt.where_clause = 'BEN_MTCHG_RT_F'
383          and cpe.table_alias = c_table_alias
384          and information1 = c_mtchg_rt_id
385          -- and information4 = mtr.business_group_id
386            and information2 = mtr.effective_start_date
387            and information3 = mtr.effective_end_date);
388     l_mtchg_rt_id                 number(15);
389     l_out_mtr_result_id   number(15);
390    ---------------------------------------------------------------
391    -- END OF BEN_MTCHG_RT_F ----------------------
392    ---------------------------------------------------------------
393    ---------------------------------------------------------------
394    -- START OF BEN_PRTL_MO_RT_PRTN_VAL_F ----------------------
395    ---------------------------------------------------------------
396    cursor c_pmr_from_parent(c_ACTY_BASE_RT_ID number) is
397    select  prtl_mo_rt_prtn_val_id
398    from BEN_PRTL_MO_RT_PRTN_VAL_F
399    where  ACTY_BASE_RT_ID = c_ACTY_BASE_RT_ID ;
400    --
401    cursor c_pmr(c_prtl_mo_rt_prtn_val_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
402    select  pmr.*
403    from BEN_PRTL_MO_RT_PRTN_VAL_F pmr
404    where  pmr.prtl_mo_rt_prtn_val_id = c_prtl_mo_rt_prtn_val_id
405      -- and pmr.business_group_id = p_business_group_id
406      and not exists (
407          select /* */ null
408          from ben_copy_entity_results cpe
409               -- pqh_table_route trt
410          where copy_entity_txn_id = p_copy_entity_txn_id
411          -- and trt.table_route_id = cpe.table_route_id
412          and ( -- c_mirror_src_entity_result_id is null or
413                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
414          -- and trt.where_clause = 'BEN_PRTL_MO_RT_PRTN_VAL_F'
415          and cpe.table_alias = c_table_alias
416          and information1 = c_prtl_mo_rt_prtn_val_id
417          -- and information4 = pmr.business_group_id
418            and information2 = pmr.effective_start_date
419            and information3 = pmr.effective_end_date);
420     l_prtl_mo_rt_prtn_val_id                 number(15);
421     l_out_pmr_result_id   number(15);
422    ---------------------------------------------------------------
423    -- END OF BEN_PRTL_MO_RT_PRTN_VAL_F ----------------------
424    ---------------------------------------------------------------
425    ---------------------------------------------------------------
426    -- START OF BEN_PTD_LMT_F ----------------------
427    ---------------------------------------------------------------
428    cursor c_pdl_from_parent(c_ACTY_RT_PTD_LMT_ID number) is
429    select  ptd_lmt_id
430    from BEN_ACTY_RT_PTD_LMT_F
431    where  ACTY_RT_PTD_LMT_ID = c_ACTY_RT_PTD_LMT_ID ;
432    --
433    cursor c_pdl(c_ptd_lmt_id number,c_mirror_src_entity_result_id number,
434                 c_table_alias varchar2 ) is
435    select  pdl.*
436    from BEN_PTD_LMT_F pdl
437    where  pdl.ptd_lmt_id = c_ptd_lmt_id
438      -- and pdl.business_group_id = p_business_group_id
439      and not exists (
440          select /* */ null
441          from ben_copy_entity_results cpe
442               -- pqh_table_route trt
443          where copy_entity_txn_id = p_copy_entity_txn_id
444          -- and trt.table_route_id = cpe.table_route_id
445          and ( -- c_mirror_src_entity_result_id is null or
446                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
447          -- and trt.where_clause = 'BEN_PTD_LMT_F'
448          and cpe.table_alias = c_table_alias
449          and information1 = c_ptd_lmt_id
450          -- and information4 = pdl.business_group_id
451            and information2 = pdl.effective_start_date
452            and information3 = pdl.effective_end_date);
453     l_ptd_lmt_id                 number(15);
454     l_out_pdl_result_id   number(15);
455    ---------------------------------------------------------------
456    -- END OF BEN_PTD_LMT_F ----------------------
457    ---------------------------------------------------------------
458     ---------------------------------------------------------------
459    -- START OF BEN_EXTRA_INPUT_VALUES ----------------------
460    ---------------------------------------------------------------
461    cursor c_eiv_from_parent(c_ACTY_BASE_RT_ID number) is
462    select  extra_input_value_id
463    from BEN_EXTRA_INPUT_VALUES
464    where  ACTY_BASE_RT_ID = c_ACTY_BASE_RT_ID ;
465    --
466    cursor c_eiv(c_extra_input_value_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
467    select  eiv.*
468    from BEN_EXTRA_INPUT_VALUES eiv
469    where  eiv.extra_input_value_id = c_extra_input_value_id
470      -- and eiv.business_group_id = p_business_group_id
471      and not exists (
472          select /* */ null
473          from ben_copy_entity_results cpe
474               -- pqh_table_route trt
475          where copy_entity_txn_id = p_copy_entity_txn_id
476          -- and trt.table_route_id = cpe.table_route_id
477          and ( -- c_mirror_src_entity_result_id is null or
478                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
479          -- and trt.where_clause = 'BEN_EXTRA_INPUT_VALUES'
480          and cpe.table_alias = c_table_alias
481          and information1 = c_extra_input_value_id
482          -- and information4 = eiv.business_group_id
483          );
484 
485    cursor c_element_type_id(c_acty_base_rt_id in number,
486                             c_copy_entity_txn_id in number,
487                             c_table_alias varchar2) is
488    select cpe.information174 element_type_id
489    from   ben_copy_entity_results cpe
490           -- pqh_table_route tre
491    where  cpe.information1 = c_acty_base_rt_id
492    and    cpe.copy_entity_txn_id = c_copy_entity_txn_id
493    -- and    cpe.table_route_id = tre.table_route_id
494    and    cpe.table_alias = c_table_alias
495    order by cpe.information3 desc;
496 
497    l_extra_input_value_id                 number(15);
498    l_out_eiv_result_id   number(15);
499    l_element_type_id_for_eiv   number;
500    ---------------------------------------------------------------
501    -- END OF BEN_EXTRA_INPUT_VALUES ----------------------
502    ---------------------------------------------------------------
503    ---------------------------------------------------------------
504    -- START OF BEN_ACTY_BASE_RT_CTFN_F ----------------------
505    ---------------------------------------------------------------
506    cursor c_abc_from_parent(c_ACTY_BASE_RT_ID number) is
507    select  acty_base_rt_ctfn_id
508    from BEN_ACTY_BASE_RT_CTFN_F
509    where  ACTY_BASE_RT_ID = c_ACTY_BASE_RT_ID ;
510    --
511    cursor c_abc(c_acty_base_rt_ctfn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
512    select  abc.*
513    from BEN_ACTY_BASE_RT_CTFN_F abc
514    where  abc.acty_base_rt_ctfn_id = c_acty_base_rt_ctfn_id
515      -- and abc.business_group_id = p_business_group_id
516      and not exists (
517          select /* */ null
518          from ben_copy_entity_results cpe
519               -- pqh_table_route trt
520          where copy_entity_txn_id = p_copy_entity_txn_id
521          -- and trt.table_route_id = cpe.table_route_id
522          and ( -- c_mirror_src_entity_result_id is null or
523                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
524          -- and trt.where_clause = 'BEN_ACTY_BASE_RT_CTFN_F'
525          and cpe.table_alias = c_table_alias
526          and information1 = c_acty_base_rt_ctfn_id
527          -- and information4 = abc.business_group_id
528            and information2 = abc.effective_start_date
529            and information3 = abc.effective_end_date);
530     l_acty_base_rt_ctfn_id                 number(15);
531     l_out_abc_result_id   number(15);
532    ---------------------------------------------------------------
533    -- END OF BEN_ACTY_BASE_RT_CTFN_F ----------------------
534    ---------------------------------------------------------------
535 
536      cursor c_object_exists(c_pk_id                number,
537                           c_table_alias          varchar2) is
538      select null
539      from ben_copy_entity_results cpe
540           -- pqh_table_route trt
541      where copy_entity_txn_id = p_copy_entity_txn_id
542      -- and trt.table_route_id = cpe.table_route_id
543      and cpe.table_alias = c_table_alias
544      and information1 = c_pk_id;
545 
546      l_dummy                     varchar2(1);
547 
548      l_mirror_src_entity_result_id    number(15);
549      l_table_route_id               number(15);
550      l_result_type_cd               varchar2(30);
551      l_information5                 ben_copy_entity_results.information5%type;
552      l_number_of_copies             number(15);
553 
554      TYPE rt_ref_csr_typ IS REF CURSOR;
555      c_parent_rec   rt_ref_csr_typ;
556      l_parent_rec   Ben_Acty_base_rt_F%ROWTYPE;
557      l_parent_acty_base_rt_id number;
558      l_Sql          Varchar2(2000) := NULL;
559      l_Bind_Value   Ben_Pgm_F.Pgm_Id%TYPE := NULL;
560 
561   begin
562     l_number_of_copies := p_number_of_copies ;
563      ---------------------------------------------------------------
564      -- START OF BEN_ACTY_BASE_RT_F ----------------------
565      ---------------------------------------------------------------
566    If p_pgm_id is NOT NULL then
567 
568       l_sql := 'select distinct acty_base_rt_id
569       from BEN_ACTY_BASE_RT_F
570      where  pgm_id = :Pgm_Id';
571 
572       l_Bind_Value := p_Pgm_Id;
573 
574    Elsif p_ptip_id is NOT NULL then
575 
576        l_sql := 'select distinct acty_base_rt_id
577        from BEN_ACTY_BASE_RT_F
578        where  ptip_id  = :Ptip_id';
579 
580        l_Bind_Value := p_Ptip_id;
581 
582    Elsif p_plip_id is NOT NULL then
583 
584        l_Sql := 'select distinct acty_base_rt_id
585        from BEN_ACTY_BASE_RT_F
586        where plip_id = :plip_id';
587 
588        l_Bind_Value := p_plip_id;
589 
590    Elsif p_pl_id is NOT NULL then
591 
592         l_sql := 'select distinct acty_base_rt_id
593         from   BEN_ACTY_BASE_RT_F
594         where  pl_id = :pl_Id';
595 
596 	l_Bind_Value := p_pl_Id;
597 
598    Elsif p_oipl_id is NOT NULL then
599 
600    	l_sql := 'select distinct acty_base_rt_id
601         from   BEN_ACTY_BASE_RT_F
602         where  oipl_id = :oipl_id';
603 
604 	l_Bind_Value := p_oipl_id;
605 
606    Elsif p_oiplip_id is NOT NULL then
607 
608           l_sql := 'select distinct acty_base_rt_id
609            from BEN_ACTY_BASE_RT_F
610           where oiplip_id = :oiplip_id';
611 
612 	   l_Bind_Value := p_oiplip_id;
613 
614    Elsif p_cmbn_plip_id is NOT NULL then
615 
616           l_sql := 'select distinct acty_base_rt_id
617            from BEN_ACTY_BASE_RT_F
618           where cmbn_plip_id = :cmbn_plip_id';
619 
620 	   l_Bind_Value := p_cmbn_plip_id;
621 
622    Elsif p_cmbn_ptip_id is NOT NULL then
623 
624           l_sql := 'select distinct acty_base_rt_id
625            from BEN_ACTY_BASE_RT_F
626           where cmbn_ptip_id = :cmbn_ptip_id';
627 
628 	   l_Bind_Value := p_cmbn_ptip_id;
629 
630    Elsif  p_cmbn_ptip_opt_id is NOT NULL Then
631 
632           l_sql := 'select distinct acty_base_rt_id
633            from BEN_ACTY_BASE_RT_F
634           where cmbn_ptip_opt_id = :cmbn_ptip_opt_id';
635 
636 	  l_Bind_Value :=  p_cmbn_ptip_opt_id;
637 
638   Elsif p_opt_id is NOT NULL then
639 
640 
641          l_sql := 'select distinct acty_base_rt_id
642            from BEN_ACTY_BASE_RT_F
643           where opt_id = :opt_id';
644 
645 	  l_Bind_Value := p_opt_id;
646 
647   Else
648 
649         Return;
650 
651   End If;
652      --
653 
654 
655   /*   for l_parent_rec  in c_abr_from_parent(p_pgm_id,p_ptip_id,p_plip_id,p_pl_id,p_oipl_id,
656                             p_oiplip_id,p_cmbn_plip_id,p_cmbn_ptip_id,p_cmbn_ptip_opt_id,
657                             p_opt_id ) loop */
658 
659         --
660 	If l_sql is Null Then
661 	   return;
662         end If;
663 
664 	OPEN c_parent_rec FOR l_sql Using l_Bind_Value;
665 	Loop
666 
667 	Fetch c_Parent_rec into l_parent_acty_base_rt_id;
668 
669         If c_Parent_Rec%NOTFOUND Then
670            Close c_Parent_Rec;
671 	   Exit;
672 
673 	End If;
674 
675 	l_mirror_src_entity_result_id := p_copy_entity_result_id ;
676         --
677         l_acty_base_rt_id := l_parent_acty_base_rt_id ;
678         --
679         l_abr_acty_base_rt_esd := null;
680         for l_abr_rec in c_abr(l_parent_acty_base_rt_id,l_mirror_src_entity_result_id,'ABR' ) loop
681           --
682           l_table_route_id := null ;
683           open ben_plan_design_program_module.g_table_route('ABR');
684             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
685           close ben_plan_design_program_module.g_table_route ;
686           --
687           l_information5  := l_abr_rec.name; --'Intersection';
688           --
689           if p_effective_date between l_abr_rec.effective_start_date
690              and l_abr_rec.effective_end_date then
691            --
692              l_result_type_cd := 'DISPLAY';
693           else
694              l_result_type_cd := 'NO DISPLAY';
695           end if;
696             --
697           l_copy_entity_result_id := null;
698           l_object_version_number := null;
699 
700           --
701           -- To store effective_start_date of element_type
702           -- and input_value for Mapping - Bug 2958658
703           --
704           l_element_type_start_date := null;
705           if l_abr_rec.element_type_id is not null then
706             open c_element_type_start_date(l_abr_rec.element_type_id);
707             fetch c_element_type_start_date into l_element_type_start_date;
708             close c_element_type_start_date;
709            end if;
710 
711           l_input_value_start_date := null;
712           if l_abr_rec.input_value_id is not null then
713             open c_input_value_start_date(l_abr_rec.input_value_id);
714             fetch c_input_value_start_date into l_input_value_start_date;
715             close c_input_value_start_date;
716           end if;
717 
718           --
719           -- pabodla : MAPPING DATA : Store the mapping column information.
720           --
721 
722           l_mapping_name := null;
723           l_mapping_id   := null;
724           l_mapping_name1:= null;
725           l_mapping_id1  := null;
726           --
727           -- Get the defined balance name to display on mapping page.
728           --
729           open c_get_mapping_name1(l_abr_rec.element_type_id,
730                                    NVL(l_element_type_start_date,p_effective_date));
731           fetch c_get_mapping_name1 into l_mapping_name;
732           close c_get_mapping_name1;
733           --
734           l_mapping_id   := l_abr_rec.element_type_id;
735 
736 
737           open c_get_mapping_name2(l_abr_rec.input_value_id, l_abr_rec.element_type_id,
738                                    NVL(l_input_value_start_date,p_effective_date));
739           fetch c_get_mapping_name2 into l_mapping_name1;
740           close c_get_mapping_name2;
741           --
742           l_mapping_id1  := l_abr_rec.input_value_id;
743           --
744           --To set user friendly labels on the mapping page
745           --
746           l_mapping_column_name1 := null;
747           l_mapping_column_name2 :=null;
748           BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
749                                                            l_mapping_column_name1,
750                                                            l_mapping_column_name2,
751                                                            p_copy_entity_txn_id);
752 
753           --
754           -- PDW
755           -- Store pl_id in information283
756 
757             l_pl_id := null;
758             if l_abr_rec.pl_id is not null then
759               l_pl_id := l_abr_rec.pl_id;
760 
761             elsif l_abr_rec.plip_id is not null then
762               open c_pl_from_plip(l_abr_rec.plip_id);
763               fetch c_pl_from_plip into l_pl_id;
764               close c_pl_from_plip;
765 
766             elsif l_abr_rec.oipl_id is not null then
767               open c_pl_from_oipl(l_abr_rec.oipl_id);
768               fetch c_pl_from_oipl into l_pl_id;
769               close c_pl_from_oipl;
770 
771             elsif l_abr_rec.oiplip_id is not null then
772               open c_pl_from_oiplip(l_abr_rec.oiplip_id);
773               fetch c_pl_from_oiplip into l_pl_id;
774               close c_pl_from_oiplip;
775 
776             end if;
777 
778           -- PDW
779 
780           ben_copy_entity_results_api.create_copy_entity_results(
781             p_copy_entity_result_id          => l_copy_entity_result_id,
782             p_copy_entity_txn_id             => p_copy_entity_txn_id,
783             p_result_type_cd                 => l_result_type_cd,
784             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
785             p_parent_entity_result_id        => p_parent_entity_result_id,
786             p_number_of_copies               => l_number_of_copies,
787             p_table_route_id                 => l_table_route_id,
788 	    P_TABLE_ALIAS                    => 'ABR',
789             p_information1     => l_abr_rec.acty_base_rt_id,
790             p_information2     => l_abr_rec.EFFECTIVE_START_DATE,
791             p_information3     => l_abr_rec.EFFECTIVE_END_DATE,
792             p_information4     => l_abr_rec.business_group_id,
793             p_information5     => l_information5 , -- 9999 put name for h-grid
794 
795             p_information111     => l_abr_rec.abr_attribute1,
796             p_information120     => l_abr_rec.abr_attribute10,
797             p_information121     => l_abr_rec.abr_attribute11,
798             p_information122     => l_abr_rec.abr_attribute12,
799             p_information123     => l_abr_rec.abr_attribute13,
800             p_information124     => l_abr_rec.abr_attribute14,
801             p_information125     => l_abr_rec.abr_attribute15,
802             p_information126     => l_abr_rec.abr_attribute16,
803             p_information127     => l_abr_rec.abr_attribute17,
804             p_information128     => l_abr_rec.abr_attribute18,
805             p_information129     => l_abr_rec.abr_attribute19,
806             p_information112     => l_abr_rec.abr_attribute2,
807             p_information130     => l_abr_rec.abr_attribute20,
808             p_information131     => l_abr_rec.abr_attribute21,
809             p_information132     => l_abr_rec.abr_attribute22,
810             p_information133     => l_abr_rec.abr_attribute23,
811             p_information134     => l_abr_rec.abr_attribute24,
812             p_information135     => l_abr_rec.abr_attribute25,
813             p_information136     => l_abr_rec.abr_attribute26,
814             p_information137     => l_abr_rec.abr_attribute27,
815             p_information138     => l_abr_rec.abr_attribute28,
816             p_information139     => l_abr_rec.abr_attribute29,
817             p_information113     => l_abr_rec.abr_attribute3,
818             p_information140     => l_abr_rec.abr_attribute30,
819             p_information114     => l_abr_rec.abr_attribute4,
820             p_information115     => l_abr_rec.abr_attribute5,
821             p_information116     => l_abr_rec.abr_attribute6,
822             p_information117     => l_abr_rec.abr_attribute7,
823             p_information118     => l_abr_rec.abr_attribute8,
824             p_information119     => l_abr_rec.abr_attribute9,
825             p_information110     => l_abr_rec.abr_attribute_category,
826             p_information27     => l_abr_rec.abv_mx_elcn_val_alwd_flag,
827             p_information250     => l_abr_rec.actl_prem_id,
828             p_information17     => l_abr_rec.acty_base_rt_stat_cd,
829             p_information49     => l_abr_rec.acty_typ_cd,
830             p_information11     => l_abr_rec.alws_chg_cd,
831             p_information298     => l_abr_rec.ann_mn_elcn_val,
832             p_information299     => l_abr_rec.ann_mx_elcn_val,
833             p_information23     => l_abr_rec.asmt_to_use_cd,
834             p_information26     => l_abr_rec.asn_on_enrt_flag,
835             p_information28     => l_abr_rec.blw_mn_elcn_alwd_flag,
836             p_information51     => l_abr_rec.bnft_rt_typ_cd,
837             p_information273     => l_abr_rec.clm_comp_lvl_fctr_id,
838             p_information239     => l_abr_rec.cmbn_plip_id,
839             p_information236     => l_abr_rec.cmbn_ptip_id,
840             p_information249     => l_abr_rec.cmbn_ptip_opt_id,
841             p_information254     => l_abr_rec.comp_lvl_fctr_id,
842             p_information247     => l_abr_rec.opt_id,
843             p_information262     => l_abr_rec.cost_allocation_keyflex_id,
844             p_information24     => l_abr_rec.det_pl_ytd_cntrs_cd,
845             p_information39     => l_abr_rec.dflt_flag,
846             p_information297     => l_abr_rec.dflt_val,
847             p_information29     => l_abr_rec.dsply_on_enrt_flag,
848             p_information12     => l_abr_rec.ele_entry_val_cd,
849             p_information45     => l_abr_rec.ele_rqd_flag,
850             -- Data for MAPPING columns.
851             p_information173    => l_mapping_name,
852             p_information174    => l_mapping_id,
853             p_information181    => l_mapping_column_name1,
854             p_information182    => l_mapping_column_name2,
855             -- END other product Mapping columns.
856             p_information44     => l_abr_rec.entr_ann_val_flag,
857             p_information41     => l_abr_rec.entr_val_at_enrt_flag,
858             p_information141     => l_abr_rec.frgn_erg_ded_ident,
859             p_information185     => l_abr_rec.frgn_erg_ded_name,
860             p_information19     => l_abr_rec.frgn_erg_ded_typ_cd,
861             p_information296     => l_abr_rec.incrmt_elcn_val,
862             p_information263     => l_abr_rec.input_va_calc_rl,
863             -- Data for MAPPING columns.
864             p_information177    => l_mapping_name1,
865             p_information178    => l_mapping_id1,
866             -- END other product Mapping columns.
867             p_information268     => l_abr_rec.lwr_lmt_calc_rl,
868             p_information300     => l_abr_rec.lwr_lmt_val,
869             p_information293     => l_abr_rec.mn_elcn_val,
870             p_information294     => l_abr_rec.mx_elcn_val,
871             p_information170     => l_abr_rec.name,
872             p_information14     => l_abr_rec.nnmntry_uom,
873             p_information42     => l_abr_rec.no_mn_elcn_val_dfnd_flag,
874             p_information40     => l_abr_rec.no_mx_elcn_val_dfnd_flag,
875             p_information36     => l_abr_rec.no_std_rt_used_flag,
876             p_information258     => l_abr_rec.oipl_id,
877             p_information227     => l_abr_rec.oiplip_id,
878             p_information46     => l_abr_rec.one_ann_pymt_cd,
879             p_information43     => l_abr_rec.only_one_bal_typ_alwd_flag,
880             p_information264     => l_abr_rec.ordr_num,
881             p_information267     => l_abr_rec.parnt_acty_base_rt_id,
882             p_information53     => l_abr_rec.parnt_chld_cd,
883             p_information266     => l_abr_rec.pay_rate_grade_rule_id,
884             p_information260     => l_abr_rec.pgm_id,
885             p_information261     => l_abr_rec.pl_id,
886             p_information256     => l_abr_rec.plip_id,
887             p_information35     => l_abr_rec.prdct_flx_cr_when_elig_flag,
888             p_information34     => l_abr_rec.proc_each_pp_dflt_flag,
889             p_information18     => l_abr_rec.procg_src_cd,
890             p_information47     => l_abr_rec.prort_mn_ann_elcn_val_cd,
891             p_information274     => l_abr_rec.prort_mn_ann_elcn_val_rl,
892             p_information48     => l_abr_rec.prort_mx_ann_elcn_val_cd,
893             p_information275     => l_abr_rec.prort_mx_ann_elcn_val_rl,
894             p_information16     => l_abr_rec.prtl_mo_det_mthd_cd,
895             p_information281     => l_abr_rec.prtl_mo_det_mthd_rl,
896             p_information20     => l_abr_rec.prtl_mo_eff_dt_det_cd,
897             p_information280     => l_abr_rec.prtl_mo_eff_dt_det_rl,
898             p_information272     => l_abr_rec.ptd_comp_lvl_fctr_id,
899             p_information259     => l_abr_rec.ptip_id,
900             p_information13     => l_abr_rec.rcrrg_cd,
901             p_information15     => l_abr_rec.rndg_cd,
902             p_information279     => l_abr_rec.rndg_rl,
903             p_information54     => l_abr_rec.rt_mlt_cd,
904             p_information50     => l_abr_rec.rt_typ_cd,
905             p_information21     => l_abr_rec.rt_usg_cd,
906             p_information22     => l_abr_rec.subj_to_imptd_incm_flag,
907             p_information55     => l_abr_rec.sub_acty_typ_cd,
908             p_information257     => l_abr_rec.ttl_comp_lvl_fctr_id,
909             p_information52     => l_abr_rec.tx_typ_cd,
910             p_information269     => l_abr_rec.upr_lmt_calc_rl,
911             p_information301     => l_abr_rec.upr_lmt_val,
912             p_information30     => l_abr_rec.use_calc_acty_bs_rt_flag,
913             p_information25     => l_abr_rec.use_to_calc_net_flx_cr_flag,
914             p_information31     => l_abr_rec.uses_ded_sched_flag,
915             p_information37     => l_abr_rec.uses_pymt_sched_flag,
916             p_information32     => l_abr_rec.uses_varbl_rt_flag,
917             p_information295     => l_abr_rec.val,
918             p_information282     => l_abr_rec.val_calc_rl,
919             p_information38     => l_abr_rec.val_ovrid_alwd_flag,
920             p_information271     => l_abr_rec.vstg_for_acty_rt_id,
921             p_information33     => l_abr_rec.vstg_sched_apls_flag,
922             p_information270     => l_abr_rec.wsh_rl_dy_mo_num,
923             p_information283     => l_pl_id,
924             p_INFORMATION186	 => l_abr_rec.MAPPING_TABLE_NAME,   /* Bug 4169120 : Rate By Criteria */
925             p_INFORMATION284     => l_abr_rec.MAPPING_TABLE_PK_ID,  /* Bug 4169120 : Rate By Criteria */
926             p_INFORMATION285     => l_abr_rec.MN_MX_ELCN_RL,        /* Bug 4169044 : Min/Max Rule */
927             p_INFORMATION286     => l_abr_rec.RATE_PERIODIZATION_RL, /* Bug 3700087 : Rate Periodization Rule */
928             p_INFORMATION56      => l_abr_rec.RATE_PERIODIZATION_CD, /* Bug 3700087 : Rate Periodization Code */
929             p_INFORMATION302      => l_abr_rec.CONTEXT_PGM_ID, /* Bug 4725928 */
930             p_INFORMATION303      => l_abr_rec.CONTEXT_PL_ID, /* Bug 4725928 */
931             p_INFORMATION304      => l_abr_rec.CONTEXT_OPT_ID, /* Bug 4725928 */
932 	    p_INFORMATION287      => l_abr_rec.ELEMENT_DET_RL ,        /* Bug 4926267 : CWB Multiple currency  */
933 	    p_INFORMATION57       => l_abr_rec.CURRENCY_DET_CD,        /* Bug 4926267 : CWB Multiple currency  */
934             p_INFORMATION221      => l_abr_rec.ABR_SEQ_NUM,            /* Absenses Enhancement */
935             p_information166      => l_element_type_start_date,
936             p_information306     => l_input_value_start_date,
937             p_information265    => l_abr_rec.object_version_number,
938            --
939             p_object_version_number          => l_object_version_number,
940             p_effective_date                 => p_effective_date       );
941             --
942 
943             if l_out_abr_result_id is null then
944               l_out_abr_result_id := l_copy_entity_result_id;
945             end if;
946 
947             if l_result_type_cd = 'DISPLAY' then
948                l_out_abr_result_id := l_copy_entity_result_id;
949             end if;
950             --
951             --
952             -- To pass as effective date while creating the
953             -- non date-tracked child records
954             if l_abr_acty_base_rt_esd is null then
955               l_abr_acty_base_rt_esd := l_abr_rec.EFFECTIVE_START_DATE;
956             end if;
957 
958              ---------------------------------------------------------------
959              ------------------ RATE_PERIODIZATION_RL  ---------------------
960              ---------------------------------------------------------------
961              --
962              -- Bug 3700087 : Rate Periodization Rule
963              --
964              if l_abr_rec.RATE_PERIODIZATION_RL is not null
965              then
966                 --
967                 ben_plan_design_program_module.create_formula_result
968                 (
969                  p_validate                       =>  0
970                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
971                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
972                 ,p_formula_id                     =>  l_abr_rec.RATE_PERIODIZATION_RL
973                 ,p_business_group_id              =>  l_abr_rec.business_group_id
974                 ,p_number_of_copies               =>  l_number_of_copies
975                 ,p_object_version_number          =>  l_object_version_number
976                 ,p_effective_date                 =>  p_effective_date
977                 );
978                 --
979              end if;
980              --
981              ---------------------------------------------------------------
982              ----------------------- MN_MX_ELCN_RL  ------------------------
983              ---------------------------------------------------------------
984              --
985              -- Bug 4169044 : Min/Max Rule
986              --
987              if l_abr_rec.MN_MX_ELCN_RL is not null
988              then
989                 --
990                 ben_plan_design_program_module.create_formula_result
991                 (
992                  p_validate                       =>  0
993                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
994                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
995                 ,p_formula_id                     =>  l_abr_rec.MN_MX_ELCN_RL
996                 ,p_business_group_id              =>  l_abr_rec.business_group_id
997                 ,p_number_of_copies               =>  l_number_of_copies
998                 ,p_object_version_number          =>  l_object_version_number
999                 ,p_effective_date                 =>  p_effective_date
1000                 );
1001                 --
1002              end if;
1003              --
1004              ---------------------------------------------------------------
1005              -- Copy Lower Limit Calculation Rules if any  (LWR_LMT_CALC_rl
1006              ---------------------------------------------------------------
1007              if l_abr_rec.lwr_lmt_calc_rl is not null then
1008                 --
1009                 ben_plan_design_program_module.create_formula_result
1010                 (
1011                  p_validate                       =>  0
1012                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1013                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1014                 ,p_formula_id                     =>  l_abr_rec.lwr_lmt_calc_rl
1015                 ,p_business_group_id              =>  l_abr_rec.business_group_id
1016                 ,p_number_of_copies               =>  l_number_of_copies
1017                 ,p_object_version_number          =>  l_object_version_number
1018                 ,p_effective_date                 =>  p_effective_date
1019                 );
1020 
1021                 --
1022              end if;
1023 
1024              ---------------------------------------------------------------
1025              -- PRORT_MN_ANN_ELCN_VAL_RL  -----------------
1026              ---------------------------------------------------------------
1027 
1028              if l_abr_rec.prort_mn_ann_elcn_val_rl is not null then
1029                 --
1030                 ben_plan_design_program_module.create_formula_result
1031                 (
1032                  p_validate                       =>  0
1033                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1034                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1035                 ,p_formula_id                     =>  l_abr_rec.prort_mn_ann_elcn_val_rl
1036                 ,p_business_group_id              =>  l_abr_rec.business_group_id
1037                 ,p_number_of_copies               =>  l_number_of_copies
1038                 ,p_object_version_number          =>  l_object_version_number
1039                 ,p_effective_date                 =>  p_effective_date
1040                 );
1041 
1042                 --
1043              end if;
1044 
1045 
1046              ---------------------------------------------------------------
1047              -- PRORT_MX_ANN_ELCN_VAL_RL -----------------
1048              ---------------------------------------------------------------
1049 
1050              if l_abr_rec.prort_mx_ann_elcn_val_rl is not null then
1051                 --
1052                 ben_plan_design_program_module.create_formula_result
1053                 (
1054                  p_validate                       =>  0
1055                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1056                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1057                 ,p_formula_id                     =>  l_abr_rec.prort_mx_ann_elcn_val_rl
1058                 ,p_business_group_id              =>  l_abr_rec.business_group_id
1059                 ,p_number_of_copies               =>  l_number_of_copies
1060                 ,p_object_version_number          =>  l_object_version_number
1061                 ,p_effective_date                 =>  p_effective_date
1062                 );
1063 
1064                 --
1065              end if;
1066 
1067 
1068              ---------------------------------------------------------------
1069              -- PRTL_MO_DET_MTHD_RL -----------------
1070              ---------------------------------------------------------------
1071 
1072 
1073              if l_abr_rec.prtl_mo_det_mthd_rl is not null then
1074                 --
1075                 ben_plan_design_program_module.create_formula_result
1076                 (
1077                  p_validate                       =>  0
1078                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1079                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1080                 ,p_formula_id                     =>  l_abr_rec.prtl_mo_det_mthd_rl
1081                 ,p_business_group_id              =>  l_abr_rec.business_group_id
1082                 ,p_number_of_copies               =>  l_number_of_copies
1083                 ,p_object_version_number          =>  l_object_version_number
1084                 ,p_effective_date                 =>  p_effective_date
1085                 );
1086 
1087                 --
1088               end if;
1089 
1090 
1091              ---------------------------------------------------------------
1092              -- PRTL_MO_EFF_DT_DET_RL -----------------
1093              ---------------------------------------------------------------
1094 
1095              if l_abr_rec.prtl_mo_eff_dt_det_rl is not null then
1096                 --
1097                 ben_plan_design_program_module.create_formula_result
1098                 (
1099                  p_validate                       =>  0
1100                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1101                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1102                 ,p_formula_id                     =>  l_abr_rec.prtl_mo_eff_dt_det_rl
1103                 ,p_business_group_id              =>  l_abr_rec.business_group_id
1104                 ,p_number_of_copies               =>  l_number_of_copies
1105                 ,p_object_version_number          =>  l_object_version_number
1106                 ,p_effective_date                 =>  p_effective_date
1107                 );
1108 
1109                 --
1110              end if;
1111 
1112              ---------------------------------------------------------------
1113              -- RNDG_RL -----------------
1114              ---------------------------------------------------------------
1115 
1116              if l_abr_rec.rndg_rl is not null then
1117                 --
1118                 ben_plan_design_program_module.create_formula_result
1119                 (
1120                  p_validate                       =>  0
1121                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1122                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1123                 ,p_formula_id                     =>  l_abr_rec.rndg_rl
1124                 ,p_business_group_id              =>  l_abr_rec.business_group_id
1125                 ,p_number_of_copies               =>  l_number_of_copies
1126                 ,p_object_version_number          =>  l_object_version_number
1127                 ,p_effective_date                 =>  p_effective_date
1128                 );
1129 
1130                 --
1131              end if;
1132 
1133              ---------------------------------------------------------------
1134              -- Copy Upper Limit Calculation Rules if any (UPR_LMT_CALC_rl
1135              ---------------------------------------------------------------
1136 
1137              if l_abr_rec.upr_lmt_calc_rl is not null then
1138                 --
1139                 ben_plan_design_program_module.create_formula_result
1140                 (
1141                  p_validate                       =>  0
1142                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1143                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1144                 ,p_formula_id                     =>  l_abr_rec.upr_lmt_calc_rl
1145                 ,p_business_group_id              =>  l_abr_rec.business_group_id
1146                 ,p_number_of_copies               =>  l_number_of_copies
1147                 ,p_object_version_number          =>  l_object_version_number
1148                 ,p_effective_date                 =>  p_effective_date
1149                 );
1150 
1151                 --
1152               end if;
1153 
1154               ---------------------------------------------------------------
1155               -- Copy Value Rules if any (VAL_CALC_rl -----------------
1156               ---------------------------------------------------------------
1157 
1158              if l_abr_rec.val_calc_rl is not null then
1159                 --
1160                 ben_plan_design_program_module.create_formula_result
1161                 (
1162                  p_validate                       =>  0
1163                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1164                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1165                 ,p_formula_id                     =>  l_abr_rec.val_calc_rl
1166                 ,p_business_group_id              =>  l_abr_rec.business_group_id
1167                 ,p_number_of_copies               =>  l_number_of_copies
1168                 ,p_object_version_number          =>  l_object_version_number
1169                 ,p_effective_date                 =>  p_effective_date
1170                 );
1171 
1172                 --
1173               end if;
1174 
1175               ---------------------------------------------------------------
1176               -- Copy Value Rules if any (input_va_calc_rl -----------------
1177               ---------------------------------------------------------------
1178 
1179              if l_abr_rec.input_va_calc_rl is not null then
1180                 --
1181                 ben_plan_design_program_module.create_formula_result
1182                 (
1183                  p_validate                       =>  0
1184                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1185                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1186                 ,p_formula_id                     =>  l_abr_rec.input_va_calc_rl
1187                 ,p_business_group_id              =>  l_abr_rec.business_group_id
1188                 ,p_number_of_copies               =>  l_number_of_copies
1189                 ,p_object_version_number          =>  l_object_version_number
1190                 ,p_effective_date                 =>  p_effective_date
1191                 );
1192 
1193                 --
1194               end if;
1195 
1196 	      ---------------------------------------------------------------
1197              ----------------------- ELEMENT_DET_RL  ------------------------
1198              ---------------------------------------------------------------
1199              --
1200              --  Bug 4926267 : CWB Multiple currency
1201              --
1202              if l_abr_rec.ELEMENT_DET_RL is not null
1203              then
1204                 --
1205                 ben_plan_design_program_module.create_formula_result
1206                 (
1207                  p_validate                       =>  0
1208                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1209                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1210                 ,p_formula_id                     =>  l_abr_rec.ELEMENT_DET_RL
1211                 ,p_business_group_id              =>  l_abr_rec.business_group_id
1212                 ,p_number_of_copies               =>  l_number_of_copies
1213                 ,p_object_version_number          =>  l_object_version_number
1214                 ,p_effective_date                 =>  p_effective_date
1215                 );
1216                 --
1217              end if;
1218 
1219               ---------------------------------------------------------------
1220               --  COMP_LVL_FCTR -----------------
1221               ---------------------------------------------------------------
1222 
1223               if l_abr_rec.comp_lvl_fctr_id is not null then
1224               --
1225                 create_drpar_results
1226                  (
1227                    p_validate                      => p_validate
1228                   ,p_copy_entity_result_id         => l_copy_entity_result_id
1229                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
1230                   ,p_comp_lvl_fctr_id              => l_abr_rec.comp_lvl_fctr_id
1231                   ,p_hrs_wkd_in_perd_fctr_id       => null
1232                   ,p_los_fctr_id                   => null
1233                   ,p_pct_fl_tm_fctr_id             => null
1234                   ,p_age_fctr_id                   => null
1235                   ,p_cmbn_age_los_fctr_id          => null
1236                   ,p_business_group_id             => p_business_group_id
1237                   ,p_number_of_copies              => p_number_of_copies
1238                   ,p_object_version_number         => l_object_version_number
1239                   ,p_effective_date                => p_effective_date
1240                  );
1241               --
1242               end if;
1243 
1244               if l_abr_rec.ttl_comp_lvl_fctr_id is not null then
1245               --
1246                 create_drpar_results
1247                  (
1248                    p_validate                      => p_validate
1249                   ,p_copy_entity_result_id         => l_copy_entity_result_id
1250                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
1251                   ,p_comp_lvl_fctr_id              => l_abr_rec.ttl_comp_lvl_fctr_id
1252                   ,p_hrs_wkd_in_perd_fctr_id       => null
1253                   ,p_los_fctr_id                   => null
1254                   ,p_pct_fl_tm_fctr_id             => null
1255                   ,p_age_fctr_id                   => null
1256                   ,p_cmbn_age_los_fctr_id          => null
1257                   ,p_business_group_id             => p_business_group_id
1258                   ,p_number_of_copies              => p_number_of_copies
1259                   ,p_object_version_number         => l_object_version_number
1260                   ,p_effective_date                => p_effective_date
1261                  );
1262               --
1263               end if;
1264 
1265               if l_abr_rec.clm_comp_lvl_fctr_id is not null then
1266               --
1267                 create_drpar_results
1268                  (
1269                    p_validate                      => p_validate
1270                   ,p_copy_entity_result_id         => l_copy_entity_result_id
1271                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
1272                   ,p_comp_lvl_fctr_id              => l_abr_rec.clm_comp_lvl_fctr_id
1273                   ,p_hrs_wkd_in_perd_fctr_id       => null
1274                   ,p_los_fctr_id                   => null
1275                   ,p_pct_fl_tm_fctr_id             => null
1276                   ,p_age_fctr_id                   => null
1277                   ,p_cmbn_age_los_fctr_id          => null
1278                   ,p_business_group_id             => p_business_group_id
1279                   ,p_number_of_copies              => p_number_of_copies
1280                   ,p_object_version_number         => l_object_version_number
1281                   ,p_effective_date                => p_effective_date
1282                  );
1283               --
1284               end if;
1285 
1286               if l_abr_rec.ptd_comp_lvl_fctr_id is not null then
1287               --
1288                 create_drpar_results
1289                  (
1290                    p_validate                      => p_validate
1291                   ,p_copy_entity_result_id         => l_copy_entity_result_id
1292                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
1293                   ,p_comp_lvl_fctr_id              => l_abr_rec.ptd_comp_lvl_fctr_id
1294                   ,p_hrs_wkd_in_perd_fctr_id       => null
1295                   ,p_los_fctr_id                   => null
1296                   ,p_pct_fl_tm_fctr_id             => null
1297                   ,p_age_fctr_id                   => null
1298                   ,p_cmbn_age_los_fctr_id          => null
1299                   ,p_business_group_id             => p_business_group_id
1300                   ,p_number_of_copies              => p_number_of_copies
1301                   ,p_object_version_number         => l_object_version_number
1302                   ,p_effective_date                => p_effective_date
1303                  );
1304               --
1305               end if;
1306 
1307          end loop;
1308 
1309      ---------------------------------------------------------------
1310      -- START OF BEN_ACTY_RT_PYMT_SCHED_F ----------------------
1311      ---------------------------------------------------------------
1312      --
1313      for l_parent_rec  in c_apf_from_parent(l_ACTY_BASE_RT_ID) loop
1314         --
1315         l_mirror_src_entity_result_id := l_out_abr_result_id ;
1316         --
1317         l_acty_rt_pymt_sched_id := l_parent_rec.acty_rt_pymt_sched_id ;
1318         --
1319         for l_apf_rec in c_apf(l_parent_rec.acty_rt_pymt_sched_id,l_mirror_src_entity_result_id,'APF') loop
1320           --
1321           l_table_route_id := null ;
1322           open ben_plan_design_program_module.g_table_route('APF');
1323             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
1324           close ben_plan_design_program_module.g_table_route ;
1325           --
1326           l_information5  :=  hr_general.decode_lookup('BEN_PYMT_SCHED',l_apf_rec.pymt_sched_cd); --'Intersection';
1327           --
1328           if p_effective_date between l_apf_rec.effective_start_date
1329              and l_apf_rec.effective_end_date then
1330            --
1331              l_result_type_cd := 'DISPLAY';
1332           else
1333              l_result_type_cd := 'NO DISPLAY';
1334           end if;
1335             --
1336           l_copy_entity_result_id := null;
1337           l_object_version_number := null;
1338           ben_copy_entity_results_api.create_copy_entity_results(
1339             p_copy_entity_result_id           => l_copy_entity_result_id,
1340             p_copy_entity_txn_id             => p_copy_entity_txn_id,
1341             p_result_type_cd                 => l_result_type_cd,
1342             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
1343             p_parent_entity_result_id      => l_mirror_src_entity_result_id,
1344             p_number_of_copies               => l_number_of_copies,
1345             p_table_route_id                 => l_table_route_id,
1346 	    P_TABLE_ALIAS                    => 'APF',
1347             p_information1     => l_apf_rec.acty_rt_pymt_sched_id,
1348             p_information2     => l_apf_rec.EFFECTIVE_START_DATE,
1349             p_information3     => l_apf_rec.EFFECTIVE_END_DATE,
1350             p_information4     => l_apf_rec.business_group_id,
1351             p_information5     => l_information5 , -- 9999 put name for h-grid
1352 
1353             p_information253     => l_apf_rec.acty_base_rt_id,
1354             p_information111     => l_apf_rec.apf_attribute1,
1355             p_information120     => l_apf_rec.apf_attribute10,
1356             p_information121     => l_apf_rec.apf_attribute11,
1357             p_information122     => l_apf_rec.apf_attribute12,
1358             p_information123     => l_apf_rec.apf_attribute13,
1359             p_information124     => l_apf_rec.apf_attribute14,
1360             p_information125     => l_apf_rec.apf_attribute15,
1361             p_information126     => l_apf_rec.apf_attribute16,
1362             p_information127     => l_apf_rec.apf_attribute17,
1363             p_information128     => l_apf_rec.apf_attribute18,
1364             p_information129     => l_apf_rec.apf_attribute19,
1365             p_information112     => l_apf_rec.apf_attribute2,
1366             p_information130     => l_apf_rec.apf_attribute20,
1367             p_information131     => l_apf_rec.apf_attribute21,
1368             p_information132     => l_apf_rec.apf_attribute22,
1369             p_information133     => l_apf_rec.apf_attribute23,
1370             p_information134     => l_apf_rec.apf_attribute24,
1371             p_information135     => l_apf_rec.apf_attribute25,
1372             p_information136     => l_apf_rec.apf_attribute26,
1373             p_information137     => l_apf_rec.apf_attribute27,
1374             p_information138     => l_apf_rec.apf_attribute28,
1375             p_information139     => l_apf_rec.apf_attribute29,
1376             p_information113     => l_apf_rec.apf_attribute3,
1377             p_information140     => l_apf_rec.apf_attribute30,
1378             p_information114     => l_apf_rec.apf_attribute4,
1379             p_information115     => l_apf_rec.apf_attribute5,
1380             p_information116     => l_apf_rec.apf_attribute6,
1381             p_information117     => l_apf_rec.apf_attribute7,
1382             p_information118     => l_apf_rec.apf_attribute8,
1383             p_information119     => l_apf_rec.apf_attribute9,
1384             p_information110     => l_apf_rec.apf_attribute_category,
1385             p_information11     => l_apf_rec.pymt_sched_cd,
1386             p_information257     => l_apf_rec.pymt_sched_rl,
1387             p_information265    => l_apf_rec.object_version_number,
1388 
1389             p_object_version_number          => l_object_version_number,
1390             p_effective_date                 => p_effective_date       );
1391             --
1392 
1393             if l_out_apf_result_id is null then
1394               l_out_apf_result_id := l_copy_entity_result_id;
1395             end if;
1396 
1397             if l_result_type_cd = 'DISPLAY' then
1398                l_out_apf_result_id := l_copy_entity_result_id ;
1399             end if;
1400             --
1401              ---------------------------------------------------------------
1402              -- PYMT_SCHED_RL --
1403              ---------------------------------------------------------------
1404              --
1405              if l_apf_rec.pymt_sched_rl is not null then
1406                --
1407                ben_plan_design_program_module.create_formula_result
1408                (
1409                  p_validate                       =>  0
1410                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1411                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1412                 ,p_formula_id                     =>  l_apf_rec.pymt_sched_rl
1413                 ,p_business_group_id              =>  l_apf_rec.business_group_id
1414                 ,p_number_of_copies               =>  l_number_of_copies
1415                 ,p_object_version_number          =>  l_object_version_number
1416                 ,p_effective_date                 =>  p_effective_date
1417                 );
1418                 --
1419            end if;
1420            --
1421       end loop;
1422      --
1423      end loop;
1424 
1425     ---------------------------------------------------------------
1426      -- END OF BEN_ACTY_RT_PYMT_SCHED_F ----------------------
1427      ---------------------------------------------------------------
1428      ---------------------------------------------------------------
1429      -- START OF BEN_PYMT_SCHED_PY_FREQ ----------------------
1430      ---------------------------------------------------------------
1431      --
1432      for l_parent_rec  in c_psq_from_parent(l_ACTY_RT_PYMT_SCHED_ID) loop
1433         --
1434         l_mirror_src_entity_result_id := l_out_apf_result_id ;
1435         --
1436         l_pymt_sched_py_freq_id := l_parent_rec.pymt_sched_py_freq_id ;
1437         --
1438         for l_psq_rec in c_psq(l_parent_rec.pymt_sched_py_freq_id,l_mirror_src_entity_result_id,'PSQ') loop
1439           --
1440           l_table_route_id := null ;
1441           open ben_plan_design_program_module.g_table_route('PSQ');
1442             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
1443           close ben_plan_design_program_module.g_table_route ;
1444           --
1445           l_information5  := hr_general.decode_lookup('BEN_FREQ',l_psq_rec.py_freq_cd); --'Intersection';
1446           --
1447           l_result_type_cd := 'DISPLAY';
1448             --
1449           l_copy_entity_result_id := null;
1450           l_object_version_number := null;
1451           ben_copy_entity_results_api.create_copy_entity_results(
1452             p_copy_entity_result_id           => l_copy_entity_result_id,
1453             p_copy_entity_txn_id             => p_copy_entity_txn_id,
1454             p_result_type_cd                 => l_result_type_cd,
1455             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
1456             p_parent_entity_result_id      => l_mirror_src_entity_result_id,
1457             p_number_of_copies               => l_number_of_copies,
1458             p_table_route_id                 => l_table_route_id,
1459 	    P_TABLE_ALIAS                    => 'PSQ',
1460             p_information1     => l_psq_rec.pymt_sched_py_freq_id,
1461             p_information2     => null,
1462             p_information3     => null,
1463             p_information4     => l_psq_rec.business_group_id,
1464             p_information5     => l_information5 , -- 9999 put name for h-grid
1465             p_information257     => l_psq_rec.acty_rt_pymt_sched_id,
1466             p_information12     => l_psq_rec.dflt_flag,
1467             p_information111     => l_psq_rec.psq_attribute1,
1468             p_information120     => l_psq_rec.psq_attribute10,
1469             p_information121     => l_psq_rec.psq_attribute11,
1470             p_information122     => l_psq_rec.psq_attribute12,
1471             p_information123     => l_psq_rec.psq_attribute13,
1472             p_information124     => l_psq_rec.psq_attribute14,
1473             p_information125     => l_psq_rec.psq_attribute15,
1474             p_information126     => l_psq_rec.psq_attribute16,
1475             p_information127     => l_psq_rec.psq_attribute17,
1476             p_information128     => l_psq_rec.psq_attribute18,
1477             p_information129     => l_psq_rec.psq_attribute19,
1478             p_information112     => l_psq_rec.psq_attribute2,
1479             p_information130     => l_psq_rec.psq_attribute20,
1480             p_information131     => l_psq_rec.psq_attribute21,
1481             p_information132     => l_psq_rec.psq_attribute22,
1482             p_information133     => l_psq_rec.psq_attribute23,
1483             p_information134     => l_psq_rec.psq_attribute24,
1484             p_information135     => l_psq_rec.psq_attribute25,
1485             p_information136     => l_psq_rec.psq_attribute26,
1486             p_information137     => l_psq_rec.psq_attribute27,
1487             p_information138     => l_psq_rec.psq_attribute28,
1488             p_information139     => l_psq_rec.psq_attribute29,
1489             p_information113     => l_psq_rec.psq_attribute3,
1490             p_information140     => l_psq_rec.psq_attribute30,
1491             p_information114     => l_psq_rec.psq_attribute4,
1492             p_information115     => l_psq_rec.psq_attribute5,
1493             p_information116     => l_psq_rec.psq_attribute6,
1494             p_information117     => l_psq_rec.psq_attribute7,
1495             p_information118     => l_psq_rec.psq_attribute8,
1496             p_information119     => l_psq_rec.psq_attribute9,
1497             p_information110     => l_psq_rec.psq_attribute_category,
1498             p_information11     => l_psq_rec.py_freq_cd,
1499             p_information265    => l_psq_rec.object_version_number,
1500             p_object_version_number          => l_object_version_number,
1501             p_effective_date                 => p_effective_date       );
1502             --
1503 
1504             if l_out_psq_result_id is null then
1505               l_out_psq_result_id := l_copy_entity_result_id;
1506             end if;
1507 
1508             if l_result_type_cd = 'DISPLAY' then
1509                l_out_psq_result_id := l_copy_entity_result_id ;
1510             end if;
1511             --
1512          end loop;
1513          --
1514        end loop;
1515     ---------------------------------------------------------------
1516     -- END OF BEN_PYMT_SCHED_PY_FREQ ----------------------
1517     ---------------------------------------------------------------
1518         ---------------------------------------------------------------
1519         -- START OF BEN_ACTL_PREM_F ----------------------
1520         ---------------------------------------------------------------
1521         --
1522         /*
1523         **  NOT REQUIRED here as Premium Data will get copied with the Plan
1524         **  or Option to which they are attached - handled by create_premium_results call
1525         */
1526 
1527         ---------------------------------------------------------------
1528         -- START OF BEN_ACTY_RT_PTD_LMT_F ----------------------
1529         ---------------------------------------------------------------
1530         --
1531         for l_parent_rec  in c_apl_from_parent(l_ACTY_BASE_RT_ID) loop
1532            --
1533            l_mirror_src_entity_result_id := l_out_abr_result_id ;
1534 
1535            --
1536            l_acty_rt_ptd_lmt_id := l_parent_rec.acty_rt_ptd_lmt_id ;
1537            --
1538            for l_apl_rec in c_apl(l_parent_rec.acty_rt_ptd_lmt_id,l_mirror_src_entity_result_id,'APL1') loop
1539              --
1540              l_table_route_id := null ;
1541              open ben_plan_design_program_module.g_table_route('APL1');
1542              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
1543              close ben_plan_design_program_module.g_table_route ;
1544              --
1545              l_information5  := ben_plan_design_program_module.get_ptd_lmt_name(l_apl_rec.ptd_lmt_id,p_effective_date);
1546                                 --'Intersection';
1547              --
1548              if p_effective_date between l_apl_rec.effective_start_date
1549                 and l_apl_rec.effective_end_date then
1550               --
1551                 l_result_type_cd := 'DISPLAY';
1552              else
1553                 l_result_type_cd := 'NO DISPLAY';
1554              end if;
1555                --
1556              l_copy_entity_result_id := null;
1557              l_object_version_number := null;
1558              ben_copy_entity_results_api.create_copy_entity_results(
1559                p_copy_entity_result_id          => l_copy_entity_result_id,
1560                p_copy_entity_txn_id             => p_copy_entity_txn_id,
1561                p_result_type_cd                 => l_result_type_cd,
1562                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
1563                p_parent_entity_result_id        => l_mirror_src_entity_result_id,
1564                p_number_of_copies               => l_number_of_copies,
1565                p_table_route_id                 => l_table_route_id,
1566 	       P_TABLE_ALIAS                    => 'APL1',
1567                p_information1     => l_apl_rec.acty_rt_ptd_lmt_id,
1568                p_information2     => l_apl_rec.EFFECTIVE_START_DATE,
1569                p_information3     => l_apl_rec.EFFECTIVE_END_DATE,
1570                p_information4     => l_apl_rec.business_group_id,
1571                p_information5     => l_information5 , -- 9999 put name for h-grid
1572 
1573             p_information253     => l_apl_rec.acty_base_rt_id,
1574             p_information111     => l_apl_rec.apl_attribute1,
1575             p_information120     => l_apl_rec.apl_attribute10,
1576             p_information121     => l_apl_rec.apl_attribute11,
1577             p_information122     => l_apl_rec.apl_attribute12,
1578             p_information123     => l_apl_rec.apl_attribute13,
1579             p_information124     => l_apl_rec.apl_attribute14,
1580             p_information125     => l_apl_rec.apl_attribute15,
1581             p_information126     => l_apl_rec.apl_attribute16,
1582             p_information127     => l_apl_rec.apl_attribute17,
1583             p_information128     => l_apl_rec.apl_attribute18,
1584             p_information129     => l_apl_rec.apl_attribute19,
1585             p_information112     => l_apl_rec.apl_attribute2,
1586             p_information130     => l_apl_rec.apl_attribute20,
1587             p_information131     => l_apl_rec.apl_attribute21,
1588             p_information132     => l_apl_rec.apl_attribute22,
1589             p_information133     => l_apl_rec.apl_attribute23,
1590             p_information134     => l_apl_rec.apl_attribute24,
1591             p_information135     => l_apl_rec.apl_attribute25,
1592             p_information136     => l_apl_rec.apl_attribute26,
1593             p_information137     => l_apl_rec.apl_attribute27,
1594             p_information138     => l_apl_rec.apl_attribute28,
1595             p_information139     => l_apl_rec.apl_attribute29,
1596             p_information113     => l_apl_rec.apl_attribute3,
1597             p_information140     => l_apl_rec.apl_attribute30,
1598             p_information114     => l_apl_rec.apl_attribute4,
1599             p_information115     => l_apl_rec.apl_attribute5,
1600             p_information116     => l_apl_rec.apl_attribute6,
1601             p_information117     => l_apl_rec.apl_attribute7,
1602             p_information118     => l_apl_rec.apl_attribute8,
1603             p_information119     => l_apl_rec.apl_attribute9,
1604             p_information110     => l_apl_rec.apl_attribute_category,
1605             p_information257     => l_apl_rec.ptd_lmt_id,
1606             p_information265     => l_apl_rec.object_version_number,
1607            --
1608 
1609                p_object_version_number          => l_object_version_number,
1610                p_effective_date                 => p_effective_date       );
1611                --
1612 
1613                if l_out_apl_result_id is null then
1614                  l_out_apl_result_id := l_copy_entity_result_id;
1615                end if;
1616 
1617                if l_result_type_cd = 'DISPLAY' then
1618                   l_out_apl_result_id := l_copy_entity_result_id ;
1619                end if;
1620                --
1621             end loop;
1622             --
1623            ---------------------------------------------------------------
1624            -- START OF BEN_PTD_LMT_F ----------------------
1625            ---------------------------------------------------------------
1626            --
1627            for l_parent_rec  in c_pdl_from_parent(l_ACTY_RT_PTD_LMT_ID) loop
1628               --
1629               l_mirror_src_entity_result_id := l_out_apl_result_id ;
1630 
1631               --
1632               l_ptd_lmt_id := l_parent_rec.ptd_lmt_id ;
1633               --
1634               if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
1635                 open c_object_exists(l_ptd_lmt_id,'PDL');
1636                 fetch c_object_exists into l_dummy;
1637                 if c_object_exists%found then
1638                   close c_object_exists;
1639                   exit;
1640                 end if;
1641                 close c_object_exists;
1642               end if;
1643 
1644               for l_pdl_rec in c_pdl(l_parent_rec.ptd_lmt_id,l_mirror_src_entity_result_id,'PDL') loop
1645                 --
1646                 l_table_route_id := null ;
1647                 open ben_plan_design_program_module.g_table_route('PDL');
1648                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
1649                 close ben_plan_design_program_module.g_table_route ;
1650                 --
1651                 l_information5  := l_pdl_rec.name; --'Intersection';
1652                 --
1653                 if p_effective_date between l_pdl_rec.effective_start_date
1654                    and l_pdl_rec.effective_end_date then
1655                  --
1656                    l_result_type_cd := 'DISPLAY';
1657                 else
1658                    l_result_type_cd := 'NO DISPLAY';
1659                 end if;
1660                   --
1661                 l_copy_entity_result_id := null;
1662                 l_object_version_number := null;
1663                 ben_copy_entity_results_api.create_copy_entity_results(
1664                   p_copy_entity_result_id          => l_copy_entity_result_id,
1665                   p_copy_entity_txn_id             => p_copy_entity_txn_id,
1666                   p_result_type_cd                 => l_result_type_cd,
1667                   p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
1668                   p_parent_entity_result_id        => l_mirror_src_entity_result_id,
1669                   p_number_of_copies               => l_number_of_copies,
1670                   p_table_route_id                 => l_table_route_id,
1671 		  P_TABLE_ALIAS                    => 'PDL',
1672                   p_information1     => l_pdl_rec.ptd_lmt_id,
1673                   p_information2     => l_pdl_rec.EFFECTIVE_START_DATE,
1674                   p_information3     => l_pdl_rec.EFFECTIVE_END_DATE,
1675                   p_information4     => l_pdl_rec.business_group_id,
1676                   p_information5     => l_information5 , -- 9999 put name for h-grid
1677 
1678             p_information260     => l_pdl_rec.balance_type_id,
1679             p_information254     => l_pdl_rec.comp_lvl_fctr_id,
1680             p_information11     => l_pdl_rec.lmt_det_cd,
1681             p_information293     => l_pdl_rec.mx_comp_to_cnsdr,
1682             p_information295     => l_pdl_rec.mx_pct_val,
1683             p_information294     => l_pdl_rec.mx_val,
1684             p_information170     => l_pdl_rec.name,
1685             p_information111     => l_pdl_rec.pdl_attribute1,
1686             p_information120     => l_pdl_rec.pdl_attribute10,
1687             p_information121     => l_pdl_rec.pdl_attribute11,
1688             p_information122     => l_pdl_rec.pdl_attribute12,
1689             p_information123     => l_pdl_rec.pdl_attribute13,
1690             p_information124     => l_pdl_rec.pdl_attribute14,
1691             p_information125     => l_pdl_rec.pdl_attribute15,
1692             p_information126     => l_pdl_rec.pdl_attribute16,
1693             p_information127     => l_pdl_rec.pdl_attribute17,
1694             p_information128     => l_pdl_rec.pdl_attribute18,
1695             p_information129     => l_pdl_rec.pdl_attribute19,
1696             p_information112     => l_pdl_rec.pdl_attribute2,
1697             p_information130     => l_pdl_rec.pdl_attribute20,
1698             p_information131     => l_pdl_rec.pdl_attribute21,
1699             p_information132     => l_pdl_rec.pdl_attribute22,
1700             p_information133     => l_pdl_rec.pdl_attribute23,
1701             p_information134     => l_pdl_rec.pdl_attribute24,
1702             p_information135     => l_pdl_rec.pdl_attribute25,
1703             p_information136     => l_pdl_rec.pdl_attribute26,
1704             p_information137     => l_pdl_rec.pdl_attribute27,
1705             p_information138     => l_pdl_rec.pdl_attribute28,
1706             p_information139     => l_pdl_rec.pdl_attribute29,
1707             p_information113     => l_pdl_rec.pdl_attribute3,
1708             p_information140     => l_pdl_rec.pdl_attribute30,
1709             p_information114     => l_pdl_rec.pdl_attribute4,
1710             p_information115     => l_pdl_rec.pdl_attribute5,
1711             p_information116     => l_pdl_rec.pdl_attribute6,
1712             p_information117     => l_pdl_rec.pdl_attribute7,
1713             p_information118     => l_pdl_rec.pdl_attribute8,
1714             p_information119     => l_pdl_rec.pdl_attribute9,
1715             p_information110     => l_pdl_rec.pdl_attribute_category,
1716             p_information261     => l_pdl_rec.ptd_lmt_calc_rl,
1717             p_information265     => l_pdl_rec.object_version_number,
1718 
1719                   p_object_version_number          => l_object_version_number,
1720                   p_effective_date                 => p_effective_date       );
1721                   --
1722 
1723                   if l_out_pdl_result_id is null then
1724                     l_out_pdl_result_id := l_copy_entity_result_id;
1725                   end if;
1726 
1727                   if l_result_type_cd = 'DISPLAY' then
1728                      l_out_pdl_result_id := l_copy_entity_result_id ;
1729                   end if;
1730                   --
1731 
1732                   -- Copy Fast Formulas if any are attached to any column --
1733                   ---------------------------------------------------------------
1734                   -- PTD_LMT_CALC_RL -----------------
1735                   ---------------------------------------------------------------
1736 
1737                   if l_pdl_rec.ptd_lmt_calc_rl is not null then
1738                       --
1739                       ben_plan_design_program_module.create_formula_result
1740                       (
1741                        p_validate                       =>  0
1742                       ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1743                       ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1744                       ,p_formula_id                     =>  l_pdl_rec.ptd_lmt_calc_rl
1745                       ,p_business_group_id              =>  l_pdl_rec.business_group_id
1746                       ,p_number_of_copies               =>  l_number_of_copies
1747                       ,p_object_version_number          =>  l_object_version_number
1748                       ,p_effective_date                 =>  p_effective_date
1749                       );
1750 
1751                       --
1752                   end if;
1753 
1754                   ---------------------------------------------------------------
1755                   --  COMP_LVL_FCTR -----------------
1756                   ---------------------------------------------------------------
1757 
1758                   if l_pdl_rec.comp_lvl_fctr_id is not null then
1759                   --
1760                      create_drpar_results
1761                      (
1762                        p_validate                      => p_validate
1763                       ,p_copy_entity_result_id         => l_copy_entity_result_id
1764                       ,p_copy_entity_txn_id            => p_copy_entity_txn_id
1765                       ,p_comp_lvl_fctr_id              => l_pdl_rec.comp_lvl_fctr_id
1766                       ,p_hrs_wkd_in_perd_fctr_id       => null
1767                       ,p_los_fctr_id                   => null
1768                       ,p_pct_fl_tm_fctr_id             => null
1769                       ,p_age_fctr_id                   => null
1770                       ,p_cmbn_age_los_fctr_id          => null
1771                       ,p_business_group_id             => p_business_group_id
1772                       ,p_number_of_copies              => p_number_of_copies
1773                       ,p_object_version_number         => l_object_version_number
1774                       ,p_effective_date                => p_effective_date
1775                      );
1776                   --
1777                   end if;
1778 
1779                end loop;
1780                --
1781              end loop;
1782           ---------------------------------------------------------------
1783           -- END OF BEN_PTD_LMT_F ----------------------
1784           ---------------------------------------------------------------
1785           end loop;
1786        ---------------------------------------------------------------
1787        -- END OF BEN_ACTY_RT_PTD_LMT_F ----------------------
1788        ---------------------------------------------------------------
1789         ---------------------------------------------------------------
1790         -- START OF BEN_ACTY_VRBL_RT_F ----------------------
1791         ---------------------------------------------------------------
1792         --
1793         hr_utility.set_location('c_avr_from_parent l_ACTY_BASE_RT_ID'||l_ACTY_BASE_RT_ID,100);
1794         for l_parent_rec  in c_avr_from_parent(l_ACTY_BASE_RT_ID) loop
1795            --
1796            l_mirror_src_entity_result_id := l_out_abr_result_id ;
1797            --
1798            l_acty_vrbl_rt_id := l_parent_rec.acty_vrbl_rt_id ;
1799            --
1800            for l_avr_rec in c_avr(l_parent_rec.acty_vrbl_rt_id,l_mirror_src_entity_result_id,'AVR') loop
1801              --
1802              l_table_route_id := null ;
1803              open ben_plan_design_program_module.g_table_route('AVR');
1804              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
1805              close ben_plan_design_program_module.g_table_route ;
1806              --
1807              l_information5  := ben_plan_design_program_module.get_vrbl_rt_prfl_name(l_avr_rec.vrbl_rt_prfl_id,
1808                                                                                      p_effective_date); --'Intersection';
1809              --
1810              if p_effective_date between l_avr_rec.effective_start_date
1811                 and l_avr_rec.effective_end_date then
1812               --
1813                 l_result_type_cd := 'DISPLAY';
1814              else
1815                 l_result_type_cd := 'NO DISPLAY';
1816              end if;
1817                --
1818              l_copy_entity_result_id := null;
1819              l_object_version_number := null;
1820              ben_copy_entity_results_api.create_copy_entity_results(
1821                p_copy_entity_result_id          => l_copy_entity_result_id,
1822                p_copy_entity_txn_id             => p_copy_entity_txn_id,
1823                p_result_type_cd                 => l_result_type_cd,
1824                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
1825                p_parent_entity_result_id        => null, -- Hide BEN_ACTY_VRBL_RT_F for HGrid
1826                p_number_of_copies               => l_number_of_copies,
1827                p_table_route_id                 => l_table_route_id,
1828 	       P_TABLE_ALIAS                    => 'AVR',
1829                p_information1     => l_avr_rec.acty_vrbl_rt_id,
1830                p_information2     => l_avr_rec.EFFECTIVE_START_DATE,
1831                p_information3     => l_avr_rec.EFFECTIVE_END_DATE,
1832                p_information4     => l_avr_rec.business_group_id,
1833                p_information5     => l_information5 , -- 9999 put name for h-grid
1834             p_information253     => l_avr_rec.acty_base_rt_id,
1835             p_information111     => l_avr_rec.avr_attribute1,
1836             p_information120     => l_avr_rec.avr_attribute10,
1837             p_information121     => l_avr_rec.avr_attribute11,
1838             p_information122     => l_avr_rec.avr_attribute12,
1839             p_information123     => l_avr_rec.avr_attribute13,
1840             p_information124     => l_avr_rec.avr_attribute14,
1841             p_information125     => l_avr_rec.avr_attribute15,
1842             p_information126     => l_avr_rec.avr_attribute16,
1843             p_information127     => l_avr_rec.avr_attribute17,
1844             p_information128     => l_avr_rec.avr_attribute18,
1845             p_information129     => l_avr_rec.avr_attribute19,
1846             p_information112     => l_avr_rec.avr_attribute2,
1847             p_information130     => l_avr_rec.avr_attribute20,
1848             p_information131     => l_avr_rec.avr_attribute21,
1849             p_information132     => l_avr_rec.avr_attribute22,
1850             p_information133     => l_avr_rec.avr_attribute23,
1851             p_information134     => l_avr_rec.avr_attribute24,
1852             p_information135     => l_avr_rec.avr_attribute25,
1853             p_information136     => l_avr_rec.avr_attribute26,
1854             p_information137     => l_avr_rec.avr_attribute27,
1855             p_information138     => l_avr_rec.avr_attribute28,
1856             p_information139     => l_avr_rec.avr_attribute29,
1857             p_information113     => l_avr_rec.avr_attribute3,
1858             p_information140     => l_avr_rec.avr_attribute30,
1859             p_information114     => l_avr_rec.avr_attribute4,
1860             p_information115     => l_avr_rec.avr_attribute5,
1861             p_information116     => l_avr_rec.avr_attribute6,
1862             p_information117     => l_avr_rec.avr_attribute7,
1863             p_information118     => l_avr_rec.avr_attribute8,
1864             p_information119     => l_avr_rec.avr_attribute9,
1865             p_information110     => l_avr_rec.avr_attribute_category,
1866             p_information260     => l_avr_rec.ordr_num,
1867             p_information262     => l_avr_rec.vrbl_rt_prfl_id,
1868             p_information265     => l_avr_rec.object_version_number,
1869                p_object_version_number          => l_object_version_number,
1870                p_effective_date                 => p_effective_date       );
1871                --
1872 
1873                if l_out_avr_result_id is null then
1874                  l_out_avr_result_id := l_copy_entity_result_id;
1875                end if;
1876 
1877                if l_result_type_cd = 'DISPLAY' then
1878                   l_out_avr_result_id := l_copy_entity_result_id ;
1879                end if;
1880                --
1881             end loop;
1882 
1883             for l_avr_rec in c_avr_drp(l_parent_rec.acty_vrbl_rt_id,l_mirror_src_entity_result_id,'AVR') loop
1884               -----------------------------------------------------------------------------------------
1885               -- Call to VAPRO
1886               -----------------------------------------------------------------------------------------
1887               hr_utility.set_location('l_avr_rec.vrbl_rt_prfl_id '||l_avr_rec.vrbl_rt_prfl_id,100);
1888               create_vapro_results
1889                 (
1890                  p_validate                    => p_validate
1891                 ,p_copy_entity_result_id       => l_out_avr_result_id
1892                 ,p_copy_entity_txn_id          => p_copy_entity_txn_id
1893                 ,p_vrbl_rt_prfl_id             => l_avr_rec.vrbl_rt_prfl_id
1894                 ,p_business_group_id           => p_business_group_id
1895                 ,p_number_of_copies            => p_number_of_copies
1896                 ,p_object_version_number       => p_object_version_number
1897                 ,p_effective_date              => p_effective_date
1898                 ,p_parent_entity_result_id     => l_out_abr_result_id
1899                 ) ;
1900             end loop;
1901             --
1902           end loop;
1903        ---------------------------------------------------------------
1904        -- END OF BEN_ACTY_VRBL_RT_F ----------------------
1905        ---------------------------------------------------------------
1906         ---------------------------------------------------------------
1907         -- START OF BEN_MTCHG_RT_F ----------------------
1908         ---------------------------------------------------------------
1909         --
1910         for l_parent_rec  in c_mtr_from_parent(l_ACTY_BASE_RT_ID) loop
1911            --
1912            l_mirror_src_entity_result_id := l_out_abr_result_id ;
1913            --
1914            l_mtchg_rt_id := l_parent_rec.mtchg_rt_id ;
1915            --
1916            for l_mtr_rec in c_mtr(l_parent_rec.mtchg_rt_id,l_mirror_src_entity_result_id,'MTR') loop
1917              --
1918              l_table_route_id := null ;
1919              open ben_plan_design_program_module.g_table_route('MTR');
1920              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
1921              close ben_plan_design_program_module.g_table_route ;
1922              --
1923              l_information5  := l_mtr_rec.from_pct_val ||' - '|| l_mtr_rec.to_pct_val; --'Intersection';
1924              --
1925              if p_effective_date between l_mtr_rec.effective_start_date
1926                 and l_mtr_rec.effective_end_date then
1927               --
1928                 l_result_type_cd := 'DISPLAY';
1929              else
1930                 l_result_type_cd := 'NO DISPLAY';
1931              end if;
1932                --
1933              l_copy_entity_result_id := null;
1934              l_object_version_number := null;
1935              ben_copy_entity_results_api.create_copy_entity_results(
1936                p_copy_entity_result_id          => l_copy_entity_result_id,
1937                p_copy_entity_txn_id             => p_copy_entity_txn_id,
1938                p_result_type_cd                 => l_result_type_cd,
1939                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
1940                p_parent_entity_result_id        => l_mirror_src_entity_result_id,
1941                p_number_of_copies               => l_number_of_copies,
1942                p_table_route_id                 => l_table_route_id,
1943 	       P_TABLE_ALIAS                    => 'MTR',
1944                p_information1     => l_mtr_rec.mtchg_rt_id,
1945                p_information2     => l_mtr_rec.EFFECTIVE_START_DATE,
1946                p_information3     => l_mtr_rec.EFFECTIVE_END_DATE,
1947                p_information4     => l_mtr_rec.business_group_id,
1948                p_information5     => l_information5 , -- 9999 put name for h-grid
1949 
1950             p_information253     => l_mtr_rec.acty_base_rt_id,
1951             p_information13     => l_mtr_rec.cntnu_mtch_aftr_mx_rl_flag,
1952             p_information254     => l_mtr_rec.comp_lvl_fctr_id,
1953             p_information293     => l_mtr_rec.from_pct_val,
1954             p_information299     => l_mtr_rec.mn_mtch_amt,
1955             p_information261     => l_mtr_rec.mtchg_rt_calc_rl,
1956             p_information111     => l_mtr_rec.mtr_attribute1,
1957             p_information120     => l_mtr_rec.mtr_attribute10,
1958             p_information121     => l_mtr_rec.mtr_attribute11,
1959             p_information122     => l_mtr_rec.mtr_attribute12,
1960             p_information123     => l_mtr_rec.mtr_attribute13,
1961             p_information124     => l_mtr_rec.mtr_attribute14,
1962             p_information125     => l_mtr_rec.mtr_attribute15,
1963             p_information126     => l_mtr_rec.mtr_attribute16,
1964             p_information127     => l_mtr_rec.mtr_attribute17,
1965             p_information128     => l_mtr_rec.mtr_attribute18,
1966             p_information129     => l_mtr_rec.mtr_attribute19,
1967             p_information112     => l_mtr_rec.mtr_attribute2,
1968             p_information130     => l_mtr_rec.mtr_attribute20,
1969             p_information131     => l_mtr_rec.mtr_attribute21,
1970             p_information132     => l_mtr_rec.mtr_attribute22,
1971             p_information133     => l_mtr_rec.mtr_attribute23,
1972             p_information134     => l_mtr_rec.mtr_attribute24,
1973             p_information135     => l_mtr_rec.mtr_attribute25,
1974             p_information136     => l_mtr_rec.mtr_attribute26,
1975             p_information137     => l_mtr_rec.mtr_attribute27,
1976             p_information138     => l_mtr_rec.mtr_attribute28,
1977             p_information139     => l_mtr_rec.mtr_attribute29,
1978             p_information113     => l_mtr_rec.mtr_attribute3,
1979             p_information140     => l_mtr_rec.mtr_attribute30,
1980             p_information114     => l_mtr_rec.mtr_attribute4,
1981             p_information115     => l_mtr_rec.mtr_attribute5,
1982             p_information116     => l_mtr_rec.mtr_attribute6,
1983             p_information117     => l_mtr_rec.mtr_attribute7,
1984             p_information118     => l_mtr_rec.mtr_attribute8,
1985             p_information119     => l_mtr_rec.mtr_attribute9,
1986             p_information110     => l_mtr_rec.mtr_attribute_category,
1987             p_information296     => l_mtr_rec.mx_amt_of_py_num,
1988             p_information298     => l_mtr_rec.mx_mtch_amt,
1989             p_information297     => l_mtr_rec.mx_pct_of_py_num,
1990             p_information14     => l_mtr_rec.no_mx_amt_of_py_num_flag,
1991             p_information11     => l_mtr_rec.no_mx_mtch_amt_flag,
1992             p_information12     => l_mtr_rec.no_mx_pct_of_py_num_flag,
1993             p_information257     => l_mtr_rec.ordr_num,
1994             p_information295     => l_mtr_rec.pct_val,
1995             p_information294     => l_mtr_rec.to_pct_val,
1996             p_information265     => l_mtr_rec.object_version_number,
1997 
1998                p_object_version_number          => l_object_version_number,
1999                p_effective_date                 => p_effective_date       );
2000                --
2001 
2002                if l_out_mtr_result_id is null then
2003                  l_out_mtr_result_id := l_copy_entity_result_id;
2004                end if;
2005 
2006                if l_result_type_cd = 'DISPLAY' then
2007                   l_out_mtr_result_id := l_copy_entity_result_id ;
2008                end if;
2009                --
2010 
2011                -- Copy Fast Formulas if any are attached to any column --
2012                ---------------------------------------------------------------
2013                -- MTCHG_RT_CALC_RL -----------------
2014                ---------------------------------------------------------------
2015 
2016                if l_mtr_rec.mtchg_rt_calc_rl is not null then
2017                       --
2018                       ben_plan_design_program_module.create_formula_result
2019                       (
2020                        p_validate                       =>  0
2021                       ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2022                       ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2023                       ,p_formula_id                     =>  l_mtr_rec.mtchg_rt_calc_rl
2024                       ,p_business_group_id              =>  l_mtr_rec.business_group_id
2025                       ,p_number_of_copies               =>  l_number_of_copies
2026                       ,p_object_version_number          =>  l_object_version_number
2027                       ,p_effective_date                 =>  p_effective_date
2028                       );
2029 
2030                       --
2031                end if;
2032 
2033 
2034                ---------------------------------------------------------------
2035                --  COMP_LVL_FCTR -----------------
2036                ---------------------------------------------------------------
2037 
2038                if l_mtr_rec.comp_lvl_fctr_id is not null then
2039                --
2040                      create_drpar_results
2041                      (
2042                        p_validate                      => p_validate
2043                       ,p_copy_entity_result_id         => l_copy_entity_result_id
2044                       ,p_copy_entity_txn_id            => p_copy_entity_txn_id
2045                       ,p_comp_lvl_fctr_id              => l_mtr_rec.comp_lvl_fctr_id
2046                       ,p_hrs_wkd_in_perd_fctr_id       => null
2047                       ,p_los_fctr_id                   => null
2048                       ,p_pct_fl_tm_fctr_id             => null
2049                       ,p_age_fctr_id                   => null
2050                       ,p_cmbn_age_los_fctr_id          => null
2051                       ,p_business_group_id             => p_business_group_id
2052                       ,p_number_of_copies              => p_number_of_copies
2053                       ,p_object_version_number         => l_object_version_number
2054                       ,p_effective_date                => p_effective_date
2055                      );
2056                --
2057                end if;
2058 
2059             end loop;
2060             --
2061           end loop;
2062        ---------------------------------------------------------------
2063        -- END OF BEN_MTCHG_RT_F ----------------------
2064        ---------------------------------------------------------------
2065         ---------------------------------------------------------------
2066         -- START OF BEN_PRTL_MO_RT_PRTN_VAL_F ----------------------
2067         ---------------------------------------------------------------
2068         --
2069         for l_parent_rec  in c_pmr_from_parent(l_ACTY_BASE_RT_ID) loop
2070            --
2071            l_mirror_src_entity_result_id := l_out_abr_result_id ;
2072            --
2073            l_prtl_mo_rt_prtn_val_id := l_parent_rec.prtl_mo_rt_prtn_val_id ;
2074            --
2075            for l_pmr_rec in c_pmr(l_parent_rec.prtl_mo_rt_prtn_val_id,l_mirror_src_entity_result_id,'PMRPV') loop
2076              --
2077              l_table_route_id := null ;
2078              open ben_plan_design_program_module.g_table_route('PMRPV');
2079              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2080              close ben_plan_design_program_module.g_table_route ;
2081              --
2082              l_information5  := l_pmr_rec.from_dy_mo_num ||' - '||l_pmr_rec.to_dy_mo_num ;
2083              if l_pmr_rec.pct_val is not null then
2084                l_information5 := l_information5 ||' '||l_pmr_rec.pct_val||'%';
2085              end if;
2086              -- 'Intersection';
2087              --
2088              if p_effective_date between l_pmr_rec.effective_start_date
2089                 and l_pmr_rec.effective_end_date then
2090               --
2091                 l_result_type_cd := 'DISPLAY';
2092              else
2093                 l_result_type_cd := 'NO DISPLAY';
2094              end if;
2095                --
2096              l_copy_entity_result_id := null;
2097              l_object_version_number := null;
2098              ben_copy_entity_results_api.create_copy_entity_results(
2099                p_copy_entity_result_id          => l_copy_entity_result_id,
2100                p_copy_entity_txn_id             => p_copy_entity_txn_id,
2101                p_result_type_cd                 => l_result_type_cd,
2102                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2103                p_parent_entity_result_id        => l_mirror_src_entity_result_id,
2104                p_number_of_copies               => l_number_of_copies,
2105                p_table_route_id                 => l_table_route_id,
2106 	       P_TABLE_ALIAS                    => 'PMRPV',
2107                p_information1     => l_pmr_rec.prtl_mo_rt_prtn_val_id,
2108                p_information2     => l_pmr_rec.EFFECTIVE_START_DATE,
2109                p_information3     => l_pmr_rec.EFFECTIVE_END_DATE,
2110                p_information4     => l_pmr_rec.business_group_id,
2111                p_information5     => l_information5 , -- 9999 put name for h-grid
2112 
2113             p_information250     => l_pmr_rec.actl_prem_id,
2114             p_information253     => l_pmr_rec.acty_base_rt_id,
2115             p_information238     => l_pmr_rec.cvg_amt_calc_mthd_id,
2116             p_information261     => l_pmr_rec.from_dy_mo_num,
2117             p_information293     => l_pmr_rec.pct_val,
2118             p_information111     => l_pmr_rec.pmrpv_attribute1,
2119             p_information120     => l_pmr_rec.pmrpv_attribute10,
2120             p_information121     => l_pmr_rec.pmrpv_attribute11,
2121             p_information122     => l_pmr_rec.pmrpv_attribute12,
2122             p_information123     => l_pmr_rec.pmrpv_attribute13,
2123             p_information124     => l_pmr_rec.pmrpv_attribute14,
2124             p_information125     => l_pmr_rec.pmrpv_attribute15,
2125             p_information126     => l_pmr_rec.pmrpv_attribute16,
2126             p_information127     => l_pmr_rec.pmrpv_attribute17,
2127             p_information128     => l_pmr_rec.pmrpv_attribute18,
2128             p_information129     => l_pmr_rec.pmrpv_attribute19,
2129             p_information112     => l_pmr_rec.pmrpv_attribute2,
2130             p_information130     => l_pmr_rec.pmrpv_attribute20,
2131             p_information131     => l_pmr_rec.pmrpv_attribute21,
2132             p_information132     => l_pmr_rec.pmrpv_attribute22,
2133             p_information133     => l_pmr_rec.pmrpv_attribute23,
2134             p_information134     => l_pmr_rec.pmrpv_attribute24,
2135             p_information135     => l_pmr_rec.pmrpv_attribute25,
2136             p_information136     => l_pmr_rec.pmrpv_attribute26,
2137             p_information137     => l_pmr_rec.pmrpv_attribute27,
2138             p_information138     => l_pmr_rec.pmrpv_attribute28,
2139             p_information139     => l_pmr_rec.pmrpv_attribute29,
2140             p_information113     => l_pmr_rec.pmrpv_attribute3,
2141             p_information140     => l_pmr_rec.pmrpv_attribute30,
2142             p_information114     => l_pmr_rec.pmrpv_attribute4,
2143             p_information115     => l_pmr_rec.pmrpv_attribute5,
2144             p_information116     => l_pmr_rec.pmrpv_attribute6,
2145             p_information117     => l_pmr_rec.pmrpv_attribute7,
2146             p_information118     => l_pmr_rec.pmrpv_attribute8,
2147             p_information119     => l_pmr_rec.pmrpv_attribute9,
2148             p_information110     => l_pmr_rec.pmrpv_attribute_category,
2149             p_information263     => l_pmr_rec.prtl_mo_prortn_rl,
2150             p_information11     => l_pmr_rec.rndg_cd,
2151             p_information262     => l_pmr_rec.rndg_rl,
2152             p_information12     => l_pmr_rec.strt_r_stp_cvg_cd,
2153             p_information260     => l_pmr_rec.to_dy_mo_num,
2154             p_information265    => l_pmr_rec.object_version_number,
2155 	   --
2156            -- Bug No 4440138 Added mappings for PRORATE_BY_DAY_TO_MON_FLAG and NUM_DAYS_MONTH
2157 	   --
2158             p_information13     => l_pmr_rec.PRORATE_BY_DAY_TO_MON_FLAG,
2159             p_information266    => l_pmr_rec.NUM_DAYS_MONTH,
2160 	   -- End Bug No 4440138
2161 	   --
2162                p_object_version_number          => l_object_version_number,
2163                p_effective_date                 => p_effective_date       );
2164                --
2165 
2166                if l_out_pmr_result_id is null then
2167                  l_out_pmr_result_id := l_copy_entity_result_id;
2168                end if;
2169 
2170                if l_result_type_cd = 'DISPLAY' then
2171                   l_out_pmr_result_id := l_copy_entity_result_id ;
2172                end if;
2173                --
2174 
2175                -- Copy Fast Formulas if any are attached to any column --
2176                ---------------------------------------------------------------
2177                -- PRTL_MO_PRORTN_RL -----------------
2178                ---------------------------------------------------------------
2179 
2180                if l_pmr_rec.prtl_mo_prortn_rl is not null then
2181                       --
2182                       ben_plan_design_program_module.create_formula_result
2183                       (
2184                        p_validate                       =>  0
2185                       ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2186                       ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2187                       ,p_formula_id                     =>  l_pmr_rec.prtl_mo_prortn_rl
2188                       ,p_business_group_id              =>  l_pmr_rec.business_group_id
2189                       ,p_number_of_copies               =>  l_number_of_copies
2190                       ,p_object_version_number          =>  l_object_version_number
2191                       ,p_effective_date                 =>  p_effective_date
2192                       );
2193 
2194                       --
2195                end if;
2196 
2197 
2198 
2199                -- Copy Fast Formulas if any are attached to any column --
2200                ---------------------------------------------------------------
2201                -- RNDG_RL -----------------
2202                ---------------------------------------------------------------
2203 
2204                if l_pmr_rec.rndg_rl is not null then
2205                       --
2206                       ben_plan_design_program_module.create_formula_result
2207                       (
2208                        p_validate                       =>  0
2209                       ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2210                       ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2211                       ,p_formula_id                     =>  l_pmr_rec.rndg_rl
2212                       ,p_business_group_id              =>  l_pmr_rec.business_group_id
2213                       ,p_number_of_copies               =>  l_number_of_copies
2214                       ,p_object_version_number          =>  l_object_version_number
2215                       ,p_effective_date                 =>  p_effective_date
2216                       );
2217 
2218                       --
2219                end if;
2220 
2221 
2222             end loop;
2223             --
2224           end loop;
2225        ---------------------------------------------------------------
2226        -- END OF BEN_PRTL_MO_RT_PRTN_VAL_F ----------------------
2227        ---------------------------------------------------------------
2228        ---------------------------------------------------------------
2229        -- START OF BEN_EXTRA_INPUT_VALUES ----------------------
2230        ---------------------------------------------------------------
2231        --
2232        for l_parent_rec  in c_eiv_from_parent(l_ACTY_BASE_RT_ID) loop
2233         --
2234         l_mirror_src_entity_result_id := l_out_abr_result_id ;
2235         --
2236         l_extra_input_value_id := l_parent_rec.extra_input_value_id ;
2237         --
2238         for l_eiv_rec in c_eiv(l_parent_rec.extra_input_value_id,l_mirror_src_entity_result_id,'EIV') loop
2239           --
2240           l_table_route_id := null ;
2241           open ben_plan_design_program_module.g_table_route('EIV');
2242           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2243           close ben_plan_design_program_module.g_table_route ;
2244           --
2245 
2246           open c_element_type_id(l_eiv_rec.acty_base_rt_id,
2247                                  p_copy_entity_txn_id,'ABR');
2248           fetch c_element_type_id into l_element_type_id_for_eiv;
2249           close c_element_type_id;
2250 
2251           l_input_value_name := null;
2252 
2253           open c_get_mapping_name2(l_eiv_rec.input_value_id, l_element_type_id_for_eiv,p_effective_date);
2254           fetch c_get_mapping_name2 into l_input_value_name;
2255           close c_get_mapping_name2;
2256 
2257           l_information5  := l_input_value_name; --'Intersection';
2258           --
2259           l_result_type_cd := 'DISPLAY';
2260           --
2261           l_copy_entity_result_id := null;
2262           l_object_version_number := null;
2263           ben_copy_entity_results_api.create_copy_entity_results(
2264             p_copy_entity_result_id           => l_copy_entity_result_id,
2265             p_copy_entity_txn_id             => p_copy_entity_txn_id,
2266             p_result_type_cd                 => l_result_type_cd,
2267             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2268             p_parent_entity_result_id      => l_mirror_src_entity_result_id,
2269             p_number_of_copies               => l_number_of_copies,
2270             p_table_route_id                 => l_table_route_id,
2271 	    P_TABLE_ALIAS                    => 'EIV',
2272             p_information1     => l_eiv_rec.extra_input_value_id,
2273             p_information2     => null,
2274             p_information3     => null,
2275             p_information4     => l_eiv_rec.business_group_id,
2276             p_information5     => l_information5 , -- 9999 put name for h-grid
2277 
2278             p_information10     =>  l_abr_acty_base_rt_esd,
2279             p_information253     => l_eiv_rec.acty_base_rt_id,
2280             p_information111     => l_eiv_rec.eiv_attribute1,
2281             p_information120     => l_eiv_rec.eiv_attribute10,
2282             p_information121     => l_eiv_rec.eiv_attribute11,
2283             p_information122     => l_eiv_rec.eiv_attribute12,
2284             p_information123     => l_eiv_rec.eiv_attribute13,
2285             p_information124     => l_eiv_rec.eiv_attribute14,
2286             p_information125     => l_eiv_rec.eiv_attribute15,
2287             p_information126     => l_eiv_rec.eiv_attribute16,
2288             p_information127     => l_eiv_rec.eiv_attribute17,
2289             p_information128     => l_eiv_rec.eiv_attribute18,
2290             p_information129     => l_eiv_rec.eiv_attribute19,
2291             p_information112     => l_eiv_rec.eiv_attribute2,
2292             p_information130     => l_eiv_rec.eiv_attribute20,
2293             p_information131     => l_eiv_rec.eiv_attribute21,
2294             p_information132     => l_eiv_rec.eiv_attribute22,
2295             p_information133     => l_eiv_rec.eiv_attribute23,
2296             p_information134     => l_eiv_rec.eiv_attribute24,
2297             p_information135     => l_eiv_rec.eiv_attribute25,
2298             p_information136     => l_eiv_rec.eiv_attribute26,
2299             p_information137     => l_eiv_rec.eiv_attribute27,
2300             p_information138     => l_eiv_rec.eiv_attribute28,
2301             p_information139     => l_eiv_rec.eiv_attribute29,
2302             p_information113     => l_eiv_rec.eiv_attribute3,
2303             p_information140     => l_eiv_rec.eiv_attribute30,
2304             p_information114     => l_eiv_rec.eiv_attribute4,
2305             p_information115     => l_eiv_rec.eiv_attribute5,
2306             p_information116     => l_eiv_rec.eiv_attribute6,
2307             p_information117     => l_eiv_rec.eiv_attribute7,
2308             p_information118     => l_eiv_rec.eiv_attribute8,
2309             p_information119     => l_eiv_rec.eiv_attribute9,
2310             p_information110     => l_eiv_rec.eiv_attribute_category,
2311             p_information260     => l_eiv_rec.extra_input_value_id,
2312             p_information185     => l_eiv_rec.input_text,
2313             p_information261     => l_eiv_rec.input_value_id,
2314             p_information186     => l_eiv_rec.return_var_name,
2315             p_information11     => l_eiv_rec.upd_when_ele_ended_cd,
2316             p_information265    => l_eiv_rec.object_version_number,
2317 
2318             p_information173    => l_input_value_name,
2319             p_information174    => l_eiv_rec.input_value_id,
2320             --
2321             p_object_version_number          => l_object_version_number,
2322             p_effective_date                 => p_effective_date       );
2323             --
2324 
2325             if l_out_eiv_result_id is null then
2326               l_out_eiv_result_id := l_copy_entity_result_id;
2327             end if;
2328 
2329             if l_result_type_cd = 'DISPLAY' then
2330                l_out_eiv_result_id := l_copy_entity_result_id ;
2331             end if;
2332             --
2333          end loop;
2334          --
2335       end loop;
2336       ---------------------------------------------------------------
2337       -- END OF BEN_EXTRA_INPUT_VALUES ----------------------
2338       ---------------------------------------------------------------
2339       ---------------------------------------------------------------
2340       -- START OF BEN_ACTY_BASE_RT_CTFN_F ----------------------
2341       ---------------------------------------------------------------
2342       --
2343       for l_parent_rec  in c_abc_from_parent(l_ACTY_BASE_RT_ID) loop
2344         --
2345         l_mirror_src_entity_result_id := l_out_abr_result_id ;
2346         --
2347         l_acty_base_rt_ctfn_id := l_parent_rec.acty_base_rt_ctfn_id ;
2348         --
2349         for l_abc_rec in c_abc(l_parent_rec.acty_base_rt_ctfn_id,l_mirror_src_entity_result_id,'ABC') loop
2350           --
2351           l_table_route_id := null ;
2352           open ben_plan_design_program_module.g_table_route('ABC');
2353             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2354           close ben_plan_design_program_module.g_table_route ;
2355           --
2356           l_information5  := hr_general.decode_lookup('BEN_ENRT_CTFN_TYP',l_abc_rec.enrt_ctfn_typ_cd);
2357                              --'Intersection';
2358           --
2359           if p_effective_date between l_abc_rec.effective_start_date
2360              and l_abc_rec.effective_end_date then
2361            --
2362              l_result_type_cd := 'DISPLAY';
2363           else
2364              l_result_type_cd := 'NO DISPLAY';
2365           end if;
2366             --
2367           l_copy_entity_result_id := null;
2368           l_object_version_number := null;
2369           ben_copy_entity_results_api.create_copy_entity_results(
2370             p_copy_entity_result_id           => l_copy_entity_result_id,
2371             p_copy_entity_txn_id             => p_copy_entity_txn_id,
2372             p_result_type_cd                 => l_result_type_cd,
2373             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2374             p_parent_entity_result_id      => l_mirror_src_entity_result_id,
2375             p_number_of_copies               => l_number_of_copies,
2376             p_table_route_id                 => l_table_route_id,
2377 	    P_TABLE_ALIAS                    => 'ABC',
2378             p_information1     => l_abc_rec.acty_base_rt_ctfn_id,
2379             p_information2     => l_abc_rec.EFFECTIVE_START_DATE,
2380             p_information3     => l_abc_rec.EFFECTIVE_END_DATE,
2381             p_information4     => l_abc_rec.business_group_id,
2382             p_information5     => l_information5 , -- 9999 put name for h-grid
2383 
2384             p_information111     => l_abc_rec.abc_attribute1,
2385             p_information120     => l_abc_rec.abc_attribute10,
2386             p_information121     => l_abc_rec.abc_attribute11,
2387             p_information122     => l_abc_rec.abc_attribute12,
2388             p_information123     => l_abc_rec.abc_attribute13,
2389             p_information124     => l_abc_rec.abc_attribute14,
2390             p_information125     => l_abc_rec.abc_attribute15,
2391             p_information126     => l_abc_rec.abc_attribute16,
2392             p_information127     => l_abc_rec.abc_attribute17,
2393             p_information128     => l_abc_rec.abc_attribute18,
2394             p_information129     => l_abc_rec.abc_attribute19,
2395             p_information112     => l_abc_rec.abc_attribute2,
2396             p_information130     => l_abc_rec.abc_attribute20,
2397             p_information131     => l_abc_rec.abc_attribute21,
2398             p_information132     => l_abc_rec.abc_attribute22,
2399             p_information133     => l_abc_rec.abc_attribute23,
2400             p_information134     => l_abc_rec.abc_attribute24,
2401             p_information135     => l_abc_rec.abc_attribute25,
2402             p_information136     => l_abc_rec.abc_attribute26,
2403             p_information137     => l_abc_rec.abc_attribute27,
2404             p_information138     => l_abc_rec.abc_attribute28,
2405             p_information139     => l_abc_rec.abc_attribute29,
2406             p_information113     => l_abc_rec.abc_attribute3,
2407             p_information140     => l_abc_rec.abc_attribute30,
2408             p_information114     => l_abc_rec.abc_attribute4,
2409             p_information115     => l_abc_rec.abc_attribute5,
2410             p_information116     => l_abc_rec.abc_attribute6,
2411             p_information117     => l_abc_rec.abc_attribute7,
2412             p_information118     => l_abc_rec.abc_attribute8,
2413             p_information119     => l_abc_rec.abc_attribute9,
2414             p_information110     => l_abc_rec.abc_attribute_category,
2415             p_information253     => l_abc_rec.acty_base_rt_id,
2416             p_information260     => l_abc_rec.ctfn_rqd_when_rl,
2417             p_information11     => l_abc_rec.enrt_ctfn_typ_cd,
2418             p_information12     => l_abc_rec.rqd_flag,
2419             p_information265    => l_abc_rec.object_version_number,
2420 
2421             p_object_version_number          => l_object_version_number,
2422             p_effective_date                 => p_effective_date       );
2423             --
2424 
2425             if l_out_abc_result_id is null then
2426               l_out_abc_result_id := l_copy_entity_result_id;
2427             end if;
2428 
2429             if l_result_type_cd = 'DISPLAY' then
2430                l_out_abc_result_id := l_copy_entity_result_id ;
2431             end if;
2432             --
2433 
2434             -- Copy Fast Formulas if any are attached to any column --
2435             ---------------------------------------------------------------
2436             -- CTFN_RQD_WHEN_RL -----------------
2437             ---------------------------------------------------------------
2438 
2439             if l_abc_rec.ctfn_rqd_when_rl is not null then
2440                       --
2441                       ben_plan_design_program_module.create_formula_result
2442                       (
2443                        p_validate                       =>  0
2444                       ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2445                       ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2446                       ,p_formula_id                     =>  l_abc_rec.ctfn_rqd_when_rl
2447                       ,p_business_group_id              =>  l_abc_rec.business_group_id
2448                       ,p_number_of_copies               =>  l_number_of_copies
2449                       ,p_object_version_number          =>  l_object_version_number
2450                       ,p_effective_date                 =>  p_effective_date
2451                       );
2452             --
2453             end if;
2454 
2455 
2456         end loop;
2457         --
2458       end loop;
2459       ---------------------------------------------------------------
2460       -- END OF BEN_ACTY_BASE_RT_CTFN_F ----------------------
2461       ---------------------------------------------------------------
2462       --
2463     end loop;
2464     ---------------------------------------------------------------
2465     -- END OF BEN_ACTY_BASE_RT_F ----------------------
2466     ---------------------------------------------------------------
2467   end create_rate_results;
2468   --
2469   procedure create_coverage_results
2470     (
2471      p_validate                       in  number     default 0 -- false
2472     ,p_copy_entity_result_id          in  number    -- Source Elpro
2473     ,p_copy_entity_txn_id             in  number    default null
2474     ,p_plip_id                        in  number    default null
2475     ,p_pl_id                          in  number    default null
2476     ,p_oipl_id                        in  number    default null
2477     ,p_business_group_id              in  number    default null
2478     ,p_number_of_copies               in  number    default 0
2479     ,p_object_version_number          out nocopy number
2480     ,p_effective_date                 in  date
2481     ,p_parent_entity_result_id        in number
2482     ) is
2483     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
2484     l_proc varchar2(72) := g_package||'create_rate_results';
2485     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
2486     --
2487     cursor c_parent_result(c_parent_pk_id number,
2488                         c_parent_table_name varchar2,
2489                         c_copy_entity_txn_id number) is
2490      select copy_entity_result_id mirror_src_entity_result_id
2491      from ben_copy_entity_results cpe,
2492           pqh_table_route trt
2493      where cpe.information1= c_parent_pk_id
2494      and   cpe.result_type_cd = 'DISPLAY'
2495      and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
2496      and   cpe.table_route_id = trt.table_route_id
2497      and   trt.from_clause = 'OAB'
2498      and   trt.where_clause = upper(c_parent_table_name) ;
2499      ---
2500      -- Bug : 3752407 : Global cursor g_table_route will now be used
2501      -- Cursor to get table_route_id
2502      --
2503      -- cursor c_table_route(c_parent_table_alias varchar2) is
2504      -- select table_route_id
2505      -- from pqh_table_route trt
2506      -- where trt.table_alias = c_parent_table_alias;
2507      -- trt.from_clause = 'OAB'
2508      -- and   trt.where_clause = upper(c_parent_table_name) ;
2509      ---
2510      l_mirror_src_entity_result_id    number(15);
2511      l_table_route_id               number(15);
2512      l_result_type_cd               varchar2(30);
2513      l_information5                 ben_copy_entity_results.information5%type;
2514      l_number_of_copies             number(15);
2515    ---------------------------------------------------------------
2516    -- START OF BEN_CVG_AMT_CALC_MTHD_F ----------------------
2517    ---------------------------------------------------------------
2518    cursor c_ccm_from_parent( c_pl_id number,c_plip_id number, c_oipl_id number ) is
2519    select distinct cvg_amt_calc_mthd_id
2520    from BEN_CVG_AMT_CALC_MTHD_F
2521    where  (c_pl_id is not null and pl_id = c_pl_id) or
2522           (c_plip_id is not null and c_plip_id = plip_id) or
2523           (c_oipl_id is not null and c_oipl_id = oipl_id)  ;
2524    --
2525    cursor c_ccm(c_cvg_amt_calc_mthd_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
2526    select  ccm.*
2527    from BEN_CVG_AMT_CALC_MTHD_F ccm
2528    where  ccm.cvg_amt_calc_mthd_id = c_cvg_amt_calc_mthd_id
2529      -- and ccm.business_group_id = p_business_group_id
2530      and not exists (
2531          select /* */ null
2532          from ben_copy_entity_results cpe
2533               -- pqh_table_route trt
2534          where copy_entity_txn_id = p_copy_entity_txn_id
2535          -- and trt.table_route_id = cpe.table_route_id
2536          and ( -- c_mirror_src_entity_result_id is null or
2537                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
2538          -- and trt.where_clause = 'BEN_CVG_AMT_CALC_MTHD_F'
2539          and cpe.table_alias = c_table_alias
2540          and information1 = c_cvg_amt_calc_mthd_id
2541          -- and information4 = ccm.business_group_id
2542            and information2 = ccm.effective_start_date
2543            and information3 = ccm.effective_end_date);
2544     l_cvg_amt_calc_mthd_id                 number(15);
2545     l_out_ccm_result_id   number(15);
2546    ---------------------------------------------------------------
2547    -- END OF BEN_CVG_AMT_CALC_MTHD_F ----------------------
2548    ---------------------------------------------------------------
2549    ---------------------------------------------------------------
2550    -- START OF BEN_BNFT_VRBL_RT_RL_F ----------------------
2551    ---------------------------------------------------------------
2552    cursor c_brr_from_parent(c_CVG_AMT_CALC_MTHD_ID number) is
2553    select  bnft_vrbl_rt_rl_id
2554    from BEN_BNFT_VRBL_RT_RL_F
2555    where  CVG_AMT_CALC_MTHD_ID = c_CVG_AMT_CALC_MTHD_ID ;
2556    --
2557    cursor c_brr(c_bnft_vrbl_rt_rl_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
2558    select  brr.*
2559    from BEN_BNFT_VRBL_RT_RL_F brr
2560    where  brr.bnft_vrbl_rt_rl_id = c_bnft_vrbl_rt_rl_id
2561      -- and brr.business_group_id = p_business_group_id
2562      and not exists (
2563          select /* */ null
2564          from ben_copy_entity_results cpe
2565               -- pqh_table_route trt
2566          where copy_entity_txn_id = p_copy_entity_txn_id
2567        --  and trt.table_route_id = cpe.table_route_id
2568          and ( -- c_mirror_src_entity_result_id is null or
2569                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
2570          -- and trt.where_clause = 'BEN_BNFT_VRBL_RT_RL_F'
2571          and cpe.table_alias = c_table_alias
2572          and information1 = c_bnft_vrbl_rt_rl_id
2573          -- and information4 = brr.business_group_id
2574            and information2 = brr.effective_start_date
2575            and information3 = brr.effective_end_date);
2576     l_bnft_vrbl_rt_rl_id                 number(15);
2577     l_out_brr_result_id   number(15);
2578    ---------------------------------------------------------------
2579    -- END OF BEN_BNFT_VRBL_RT_RL_F ----------------------
2580    ---------------------------------------------------------------
2581    ---------------------------------------------------------------
2582    -- START OF BEN_BNFT_VRBL_RT_F ----------------------
2583    ---------------------------------------------------------------
2584    cursor c_bvr_from_parent(c_CVG_AMT_CALC_MTHD_ID number) is
2585    select distinct bnft_vrbl_rt_id
2586    from BEN_BNFT_VRBL_RT_F
2587    where  CVG_AMT_CALC_MTHD_ID = c_CVG_AMT_CALC_MTHD_ID ;
2588    --
2589    cursor c_bvr(c_bnft_vrbl_rt_id number,c_mirror_src_entity_result_id number,
2590                 c_table_alias varchar2 ) is
2591    select  bvr.*
2592    from BEN_BNFT_VRBL_RT_F bvr
2593    where  bvr.bnft_vrbl_rt_id = c_bnft_vrbl_rt_id
2594      -- and bvr.business_group_id = p_business_group_id
2595      and not exists (
2596          select /* */ null
2597          from ben_copy_entity_results cpe
2598               -- pqh_table_route trt
2599          where copy_entity_txn_id = p_copy_entity_txn_id
2600          -- and trt.table_route_id = cpe.table_route_id
2601          and ( -- c_mirror_src_entity_result_id is null or
2602                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
2603          -- and trt.where_clause = 'BEN_BNFT_VRBL_RT_F'
2604          and cpe.table_alias = c_table_alias
2605          and information1 = c_bnft_vrbl_rt_id
2606          -- and information4 = bvr.business_group_id
2607            and information2 = bvr.effective_start_date
2608            and information3 = bvr.effective_end_date);
2609     --
2610    cursor c_bvr_drp(c_bnft_vrbl_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
2611    select distinct cpe.information262 vrbl_rt_prfl_id
2612      from ben_copy_entity_results cpe
2613           -- pqh_table_route trt
2614      where copy_entity_txn_id = p_copy_entity_txn_id
2615      -- and trt.table_route_id = cpe.table_route_id
2616      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
2617      -- and trt.where_clause = 'BEN_BNFT_VRBL_RT_F'
2618      and cpe.table_alias = c_table_alias
2619      and information1 = c_bnft_vrbl_rt_id
2620      -- and information4 = p_business_group_id
2621     ;
2622    --
2623 
2624     l_bnft_vrbl_rt_id                 number(15);
2625     l_out_bvr_result_id   number(15);
2626    ---------------------------------------------------------------
2627    -- END OF BEN_BNFT_VRBL_RT_F ----------------------
2628    ---------------------------------------------------------------
2629     begin
2630      l_number_of_copies := p_number_of_copies ;
2631      ---------------------------------------------------------------
2632      -- START OF BEN_CVG_AMT_CALC_MTHD_F ----------------------
2633      ---------------------------------------------------------------
2634      --
2635      for l_parent_rec  in c_ccm_from_parent(p_pl_id,p_plip_id,p_oipl_id) loop
2636         --
2637         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
2638         --
2639         l_cvg_amt_calc_mthd_id := l_parent_rec.cvg_amt_calc_mthd_id ;
2640         --
2641         for l_ccm_rec in c_ccm(l_parent_rec.cvg_amt_calc_mthd_id,l_mirror_src_entity_result_id,'CCM') loop
2642           --
2643           l_table_route_id := null ;
2644           open ben_plan_design_program_module.g_table_route('CCM');
2645             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2646           close ben_plan_design_program_module.g_table_route ;
2647           --
2648           l_information5  := l_ccm_rec.name; --'Intersection';
2649           --
2650           if p_effective_date between l_ccm_rec.effective_start_date
2651              and l_ccm_rec.effective_end_date then
2652            --
2653              l_result_type_cd := 'DISPLAY';
2654           else
2655              l_result_type_cd := 'NO DISPLAY';
2656           end if;
2657             --
2658           l_copy_entity_result_id := null;
2659           l_object_version_number := null;
2660           ben_copy_entity_results_api.create_copy_entity_results(
2661             p_copy_entity_result_id           => l_copy_entity_result_id,
2662             p_copy_entity_txn_id             => p_copy_entity_txn_id,
2663             p_result_type_cd                 => l_result_type_cd,
2664             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2665             p_parent_entity_result_id        => p_parent_entity_result_id,
2666             p_number_of_copies               => l_number_of_copies,
2667             p_table_route_id                 => l_table_route_id,
2668 	    P_TABLE_ALIAS                    => 'CCM',
2669             p_information1     => l_ccm_rec.cvg_amt_calc_mthd_id,
2670             p_information2     => l_ccm_rec.EFFECTIVE_START_DATE,
2671             p_information3     => l_ccm_rec.EFFECTIVE_END_DATE,
2672             p_information4     => l_ccm_rec.business_group_id,
2673             p_information5     => l_information5 , -- 9999 put name for h-grid
2674             p_information19     => l_ccm_rec.bndry_perd_cd,
2675             p_information20     => l_ccm_rec.bnft_typ_cd,
2676             p_information111     => l_ccm_rec.ccm_attribute1,
2677             p_information120     => l_ccm_rec.ccm_attribute10,
2678             p_information121     => l_ccm_rec.ccm_attribute11,
2679             p_information122     => l_ccm_rec.ccm_attribute12,
2680             p_information123     => l_ccm_rec.ccm_attribute13,
2681             p_information124     => l_ccm_rec.ccm_attribute14,
2682             p_information125     => l_ccm_rec.ccm_attribute15,
2683             p_information126     => l_ccm_rec.ccm_attribute16,
2684             p_information127     => l_ccm_rec.ccm_attribute17,
2685             p_information128     => l_ccm_rec.ccm_attribute18,
2686             p_information129     => l_ccm_rec.ccm_attribute19,
2687             p_information112     => l_ccm_rec.ccm_attribute2,
2688             p_information130     => l_ccm_rec.ccm_attribute20,
2689             p_information131     => l_ccm_rec.ccm_attribute21,
2690             p_information132     => l_ccm_rec.ccm_attribute22,
2691             p_information133     => l_ccm_rec.ccm_attribute23,
2692             p_information134     => l_ccm_rec.ccm_attribute24,
2693             p_information135     => l_ccm_rec.ccm_attribute25,
2694             p_information136     => l_ccm_rec.ccm_attribute26,
2695             p_information137     => l_ccm_rec.ccm_attribute27,
2696             p_information138     => l_ccm_rec.ccm_attribute28,
2697             p_information139     => l_ccm_rec.ccm_attribute29,
2698             p_information113     => l_ccm_rec.ccm_attribute3,
2699             p_information140     => l_ccm_rec.ccm_attribute30,
2700             p_information114     => l_ccm_rec.ccm_attribute4,
2701             p_information115     => l_ccm_rec.ccm_attribute5,
2702             p_information116     => l_ccm_rec.ccm_attribute6,
2703             p_information117     => l_ccm_rec.ccm_attribute7,
2704             p_information118     => l_ccm_rec.ccm_attribute8,
2705             p_information119     => l_ccm_rec.ccm_attribute9,
2706             p_information110     => l_ccm_rec.ccm_attribute_category,
2707             p_information254     => l_ccm_rec.comp_lvl_fctr_id,
2708             p_information21     => l_ccm_rec.cvg_mlt_cd,
2709             p_information15     => l_ccm_rec.dflt_flag,
2710             p_information299     => l_ccm_rec.dflt_val,
2711             p_information14     => l_ccm_rec.entr_val_at_enrt_flag,
2712             p_information295     => l_ccm_rec.incrmt_val,
2713             p_information257     => l_ccm_rec.lwr_lmt_calc_rl,
2714             p_information293     => l_ccm_rec.lwr_lmt_val,
2715             p_information297     => l_ccm_rec.mn_val,
2716             p_information296     => l_ccm_rec.mx_val,
2717             p_information170     => l_ccm_rec.name,
2718             p_information18     => l_ccm_rec.nnmntry_uom,
2719             p_information12     => l_ccm_rec.no_mn_val_dfnd_flag,
2720             p_information11     => l_ccm_rec.no_mx_val_dfnd_flag,
2721             p_information258     => l_ccm_rec.oipl_id,
2722             p_information261     => l_ccm_rec.pl_id,
2723             p_information256     => l_ccm_rec.plip_id,
2724             p_information16     => l_ccm_rec.rndg_cd,
2725             p_information264     => l_ccm_rec.rndg_rl,
2726             p_information22     => l_ccm_rec.rt_typ_cd,
2727             p_information17     => l_ccm_rec.uom,
2728             p_information259     => l_ccm_rec.upr_lmt_calc_rl,
2729             p_information294     => l_ccm_rec.upr_lmt_val,
2730             p_information298     => l_ccm_rec.val,
2731             p_information266     => l_ccm_rec.val_calc_rl,
2732             p_information13     => l_ccm_rec.val_ovrid_alwd_flag,
2733             p_information265    => l_ccm_rec.object_version_number,
2734 
2735             p_object_version_number          => l_object_version_number,
2736             p_effective_date                 => p_effective_date       );
2737             --
2738 
2739             if l_out_ccm_result_id is null then
2740               l_out_ccm_result_id := l_copy_entity_result_id;
2741             end if;
2742 
2743             if l_result_type_cd = 'DISPLAY' then
2744                l_out_ccm_result_id := l_copy_entity_result_id ;
2745             end if;
2746             --
2747 
2748             -- Copy Fast Formulas also if they are attached to any Columns -----
2749             ---------------------------------------------------------------
2750             --  LWR_LMT_CALC_RL -----------------
2751             ---------------------------------------------------------------
2752 
2753             if l_ccm_rec.lwr_lmt_calc_rl is not null then
2754             --
2755                 ben_plan_design_program_module.create_formula_result
2756                 (
2757                  p_validate                       =>  0
2758                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2759                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2760                 ,p_formula_id                     =>  l_ccm_rec.lwr_lmt_calc_rl
2761                 ,p_business_group_id              =>  l_ccm_rec.business_group_id
2762                 ,p_number_of_copies               =>  l_number_of_copies
2763                 ,p_object_version_number          =>  l_object_version_number
2764                 ,p_effective_date                 =>  p_effective_date
2765                 );
2766 
2767             --
2768             end if;
2769 
2770             ---------------------------------------------------------------
2771             --  RNDG_RL -----------------
2772             ---------------------------------------------------------------
2773 
2774             if l_ccm_rec.rndg_rl is not null then
2775             --
2776                 ben_plan_design_program_module.create_formula_result
2777                 (
2778                  p_validate                       =>  0
2779                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2780                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2781                 ,p_formula_id                     =>  l_ccm_rec.rndg_rl
2782                 ,p_business_group_id              =>  l_ccm_rec.business_group_id
2783                 ,p_number_of_copies               =>  l_number_of_copies
2784                 ,p_object_version_number          =>  l_object_version_number
2785                 ,p_effective_date                 =>  p_effective_date
2786                 );
2787 
2788             --
2789             end if;
2790 
2791             ---------------------------------------------------------------
2792             --  UPR_LMT_CALC_RL  -----------------
2793             ---------------------------------------------------------------
2794 
2795             if l_ccm_rec.upr_lmt_calc_rl is not null then
2796             --
2797                 ben_plan_design_program_module.create_formula_result
2798                 (
2799                  p_validate                       =>  0
2800                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2801                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2802                 ,p_formula_id                     =>  l_ccm_rec.upr_lmt_calc_rl
2803                 ,p_business_group_id              =>  l_ccm_rec.business_group_id
2804                 ,p_number_of_copies               =>  l_number_of_copies
2805                 ,p_object_version_number          =>  l_object_version_number
2806                 ,p_effective_date                 =>  p_effective_date
2807                 );
2808 
2809             --
2810             end if;
2811 
2812             ---------------------------------------------------------------
2813             --  VAL_CALC_RL -----------------
2814             ---------------------------------------------------------------
2815 
2816             if l_ccm_rec.val_calc_rl is not null then
2817             --
2818                 ben_plan_design_program_module.create_formula_result
2819                 (
2820                  p_validate                       =>  0
2821                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2822                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2823                 ,p_formula_id                     =>  l_ccm_rec.val_calc_rl
2824                 ,p_business_group_id              =>  l_ccm_rec.business_group_id
2825                 ,p_number_of_copies               =>  l_number_of_copies
2826                 ,p_object_version_number          =>  l_object_version_number
2827                 ,p_effective_date                 =>  p_effective_date
2828                 );
2829 
2830             --
2831             end if;
2832 
2833             ---------------------------------------------------------------
2834             --  COMP_LVL_FCTR -----------------
2835             ---------------------------------------------------------------
2836 
2837             if l_ccm_rec.comp_lvl_fctr_id is not null then
2838             --
2839                 create_drpar_results
2840                  (
2841                    p_validate                      => p_validate
2842                   ,p_copy_entity_result_id         => l_copy_entity_result_id
2843                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
2844                   ,p_comp_lvl_fctr_id              => l_ccm_rec.comp_lvl_fctr_id
2845                   ,p_hrs_wkd_in_perd_fctr_id       => null
2846                   ,p_los_fctr_id                   => null
2847                   ,p_pct_fl_tm_fctr_id             => null
2848                   ,p_age_fctr_id                   => null
2849                   ,p_cmbn_age_los_fctr_id          => null
2850                   ,p_business_group_id             => p_business_group_id
2851                   ,p_number_of_copies              => p_number_of_copies
2852                   ,p_object_version_number         => l_object_version_number
2853                   ,p_effective_date                => p_effective_date
2854                  );
2855             --
2856             end if;
2857 
2858          end loop;
2859          --
2860         ---------------------------------------------------------------
2861         -- START OF BEN_BNFT_VRBL_RT_RL_F ----------------------
2862         ---------------------------------------------------------------
2863         --
2864         for l_parent_rec  in c_brr_from_parent(l_CVG_AMT_CALC_MTHD_ID) loop
2865            --
2866            l_mirror_src_entity_result_id := l_out_ccm_result_id ;
2867 
2868            --
2869            l_bnft_vrbl_rt_rl_id := l_parent_rec.bnft_vrbl_rt_rl_id ;
2870            --
2871            for l_brr_rec in c_brr(l_parent_rec.bnft_vrbl_rt_rl_id,l_mirror_src_entity_result_id,'BRR') loop
2872              --
2873              l_table_route_id := null ;
2874              open ben_plan_design_program_module.g_table_route('BRR');
2875                fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2876              close ben_plan_design_program_module.g_table_route ;
2877              --
2878              l_information5  := ben_plan_design_program_module.get_formula_name(l_brr_rec.formula_id,p_effective_date);
2879                                 --'Intersection';
2880              --
2881              if p_effective_date between l_brr_rec.effective_start_date
2882                 and l_brr_rec.effective_end_date then
2883               --
2884                 l_result_type_cd := 'DISPLAY';
2885              else
2886                 l_result_type_cd := 'NO DISPLAY';
2887              end if;
2888                --
2889              l_copy_entity_result_id := null;
2890              l_object_version_number := null;
2891              ben_copy_entity_results_api.create_copy_entity_results(
2892                p_copy_entity_result_id          => l_copy_entity_result_id,
2893                p_copy_entity_txn_id             => p_copy_entity_txn_id,
2894                p_result_type_cd                 => l_result_type_cd,
2895                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2896                p_parent_entity_result_id        => l_mirror_src_entity_result_id,
2897                p_number_of_copies               => l_number_of_copies,
2898                p_table_route_id                 => l_table_route_id,
2899 	       P_TABLE_ALIAS                    => 'BRR',
2900                p_information1     => l_brr_rec.bnft_vrbl_rt_rl_id,
2901                p_information2     => l_brr_rec.EFFECTIVE_START_DATE,
2902                p_information3     => l_brr_rec.EFFECTIVE_END_DATE,
2903                p_information4     => l_brr_rec.business_group_id,
2904                p_information5     => l_information5 , -- 9999 put name for h-grid
2905             p_information111     => l_brr_rec.brr_attribute1,
2906             p_information120     => l_brr_rec.brr_attribute10,
2907             p_information121     => l_brr_rec.brr_attribute11,
2908             p_information122     => l_brr_rec.brr_attribute12,
2909             p_information123     => l_brr_rec.brr_attribute13,
2910             p_information124     => l_brr_rec.brr_attribute14,
2911             p_information125     => l_brr_rec.brr_attribute15,
2912             p_information126     => l_brr_rec.brr_attribute16,
2913             p_information127     => l_brr_rec.brr_attribute17,
2914             p_information128     => l_brr_rec.brr_attribute18,
2915             p_information129     => l_brr_rec.brr_attribute19,
2916             p_information112     => l_brr_rec.brr_attribute2,
2917             p_information130     => l_brr_rec.brr_attribute20,
2918             p_information131     => l_brr_rec.brr_attribute21,
2919             p_information132     => l_brr_rec.brr_attribute22,
2920             p_information133     => l_brr_rec.brr_attribute23,
2921             p_information134     => l_brr_rec.brr_attribute24,
2922             p_information135     => l_brr_rec.brr_attribute25,
2923             p_information136     => l_brr_rec.brr_attribute26,
2924             p_information137     => l_brr_rec.brr_attribute27,
2925             p_information138     => l_brr_rec.brr_attribute28,
2926             p_information139     => l_brr_rec.brr_attribute29,
2927             p_information113     => l_brr_rec.brr_attribute3,
2928             p_information140     => l_brr_rec.brr_attribute30,
2929             p_information114     => l_brr_rec.brr_attribute4,
2930             p_information115     => l_brr_rec.brr_attribute5,
2931             p_information116     => l_brr_rec.brr_attribute6,
2932             p_information117     => l_brr_rec.brr_attribute7,
2933             p_information118     => l_brr_rec.brr_attribute8,
2934             p_information119     => l_brr_rec.brr_attribute9,
2935             p_information110     => l_brr_rec.brr_attribute_category,
2936             p_information238     => l_brr_rec.cvg_amt_calc_mthd_id,
2937             p_information251     => l_brr_rec.formula_id,
2938             p_information260     => l_brr_rec.ordr_to_aply_num,
2939             p_information265     => l_brr_rec.object_version_number,
2940 
2941                p_object_version_number          => l_object_version_number,
2942                p_effective_date                 => p_effective_date       );
2943                --
2944 
2945                if l_out_brr_result_id is null then
2946                  l_out_brr_result_id := l_copy_entity_result_id;
2947                end if;
2948 
2949                if l_result_type_cd = 'DISPLAY' then
2950                   l_out_brr_result_id := l_copy_entity_result_id ;
2951                end if;
2952                --
2953 
2954                -- Copy Fast Formulas if any are attached to any column --
2955                ---------------------------------------------------------------
2956                --  FORMULA_ID -----------------
2957                ---------------------------------------------------------------
2958 
2959                if l_brr_rec.formula_id is not null then
2960                    --
2961                    ben_plan_design_program_module.create_formula_result
2962                    (
2963                     p_validate                       =>  0
2964                    ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2965                    ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2966                    ,p_formula_id                     =>  l_brr_rec.formula_id
2967                    ,p_business_group_id              =>  l_brr_rec.business_group_id
2968                    ,p_number_of_copies               =>  l_number_of_copies
2969                    ,p_object_version_number          =>  l_object_version_number
2970                    ,p_effective_date                 =>  p_effective_date
2971                    );
2972 
2973                    --
2974                end if;
2975 
2976             end loop;
2977             --
2978           end loop;
2979        ---------------------------------------------------------------
2980        -- END OF BEN_BNFT_VRBL_RT_RL_F ----------------------
2981        ---------------------------------------------------------------
2982         ---------------------------------------------------------------
2983         -- START OF BEN_BNFT_VRBL_RT_F ----------------------
2984         ---------------------------------------------------------------
2985         --
2986         for l_parent_rec  in c_bvr_from_parent(l_CVG_AMT_CALC_MTHD_ID) loop
2987            --
2988            l_mirror_src_entity_result_id := l_out_ccm_result_id ;
2989            --
2990            l_bnft_vrbl_rt_id := l_parent_rec.bnft_vrbl_rt_id ;
2991            --
2992            for l_bvr_rec in c_bvr(l_parent_rec.bnft_vrbl_rt_id,l_mirror_src_entity_result_id,'BVR1') loop
2993              --
2994              l_table_route_id := null ;
2995              open ben_plan_design_program_module.g_table_route('BVR1');
2996              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2997              close ben_plan_design_program_module.g_table_route ;
2998              --
2999              l_information5  := ben_plan_design_program_module.get_vrbl_rt_prfl_name(l_bvr_rec.vrbl_rt_prfl_id
3000                                                                                     ,p_effective_date); --'Intersection';
3001              --
3002              if p_effective_date between l_bvr_rec.effective_start_date
3003                 and l_bvr_rec.effective_end_date then
3004               --
3005                 l_result_type_cd := 'DISPLAY';
3006              else
3007                 l_result_type_cd := 'NO DISPLAY';
3008              end if;
3009                --
3010              l_copy_entity_result_id := null;
3011              l_object_version_number := null;
3012              ben_copy_entity_results_api.create_copy_entity_results(
3013                p_copy_entity_result_id          => l_copy_entity_result_id,
3014                p_copy_entity_txn_id             => p_copy_entity_txn_id,
3015                p_result_type_cd                 => l_result_type_cd,
3016                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3017                p_parent_entity_result_id        => null, -- Hide BEN_BNFT_VRBL_RT_F for HGrid
3018                p_number_of_copies               => l_number_of_copies,
3019                p_table_route_id                 => l_table_route_id,
3020 	       P_TABLE_ALIAS                    => 'BVR1',
3021                p_information1     => l_bvr_rec.bnft_vrbl_rt_id,
3022                p_information2     => l_bvr_rec.EFFECTIVE_START_DATE,
3023                p_information3     => l_bvr_rec.EFFECTIVE_END_DATE,
3024                p_information4     => l_bvr_rec.business_group_id,
3025                p_information5     => l_information5 , -- 9999 put name for h-grid
3026 
3027             p_information111     => l_bvr_rec.bvr_attribute1,
3028             p_information120     => l_bvr_rec.bvr_attribute10,
3029             p_information121     => l_bvr_rec.bvr_attribute11,
3030             p_information122     => l_bvr_rec.bvr_attribute12,
3031             p_information123     => l_bvr_rec.bvr_attribute13,
3032             p_information124     => l_bvr_rec.bvr_attribute14,
3033             p_information125     => l_bvr_rec.bvr_attribute15,
3034             p_information126     => l_bvr_rec.bvr_attribute16,
3035             p_information127     => l_bvr_rec.bvr_attribute17,
3036             p_information128     => l_bvr_rec.bvr_attribute18,
3037             p_information129     => l_bvr_rec.bvr_attribute19,
3038             p_information112     => l_bvr_rec.bvr_attribute2,
3039             p_information130     => l_bvr_rec.bvr_attribute20,
3040             p_information131     => l_bvr_rec.bvr_attribute21,
3041             p_information132     => l_bvr_rec.bvr_attribute22,
3042             p_information133     => l_bvr_rec.bvr_attribute23,
3043             p_information134     => l_bvr_rec.bvr_attribute24,
3044             p_information135     => l_bvr_rec.bvr_attribute25,
3045             p_information136     => l_bvr_rec.bvr_attribute26,
3046             p_information137     => l_bvr_rec.bvr_attribute27,
3047             p_information138     => l_bvr_rec.bvr_attribute28,
3048             p_information139     => l_bvr_rec.bvr_attribute29,
3049             p_information113     => l_bvr_rec.bvr_attribute3,
3050             p_information140     => l_bvr_rec.bvr_attribute30,
3051             p_information114     => l_bvr_rec.bvr_attribute4,
3052             p_information115     => l_bvr_rec.bvr_attribute5,
3053             p_information116     => l_bvr_rec.bvr_attribute6,
3054             p_information117     => l_bvr_rec.bvr_attribute7,
3055             p_information118     => l_bvr_rec.bvr_attribute8,
3056             p_information119     => l_bvr_rec.bvr_attribute9,
3057             p_information110     => l_bvr_rec.bvr_attribute_category,
3058             p_information238     => l_bvr_rec.cvg_amt_calc_mthd_id,
3059             p_information260     => l_bvr_rec.ordr_num,
3060             p_information262     => l_bvr_rec.vrbl_rt_prfl_id,
3061             p_information265     => l_bvr_rec.object_version_number,
3062 
3063                p_object_version_number          => l_object_version_number,
3064                p_effective_date                 => p_effective_date       );
3065                --
3066 
3067                if l_out_bvr_result_id is null then
3068                  l_out_bvr_result_id := l_copy_entity_result_id;
3069                end if;
3070 
3071                if l_result_type_cd = 'DISPLAY' then
3072                   l_out_bvr_result_id := l_copy_entity_result_id ;
3073                end if;
3074                --
3075             end loop;
3076             hr_utility.set_location('l_parent_rec.bnft_vrbl_rt_id  '|| l_parent_rec.bnft_vrbl_rt_id,100);
3077             hr_utility.set_location('l_mirror_src_entity_result_id  '|| l_mirror_src_entity_result_id,100);
3078             for l_bvr_rec in c_bvr_drp(l_parent_rec.bnft_vrbl_rt_id,l_mirror_src_entity_result_id,'BVR1') loop
3079               -----------------------------------------------------------------------------------------
3080               -- Call to VAPRO
3081               -----------------------------------------------------------------------------------------
3082               hr_utility.set_location('l_bvr_rec ',100);
3083               create_vapro_results
3084                 (
3085                  p_validate                    => p_validate
3086                 ,p_copy_entity_result_id       => l_out_bvr_result_id
3087                 ,p_copy_entity_txn_id          => p_copy_entity_txn_id
3088                 ,p_vrbl_rt_prfl_id             => l_bvr_rec.vrbl_rt_prfl_id
3089                 ,p_business_group_id           => p_business_group_id
3090                 ,p_number_of_copies            => p_number_of_copies
3091                 ,p_object_version_number       => p_object_version_number
3092                 ,p_effective_date              => p_effective_date
3093                 ,p_parent_entity_result_id     => l_out_ccm_result_id
3094                 ) ;
3095             end loop;
3096             --
3097           end loop;
3098        ---------------------------------------------------------------
3099        -- END OF BEN_BNFT_VRBL_RT_F ----------------------
3100        ---------------------------------------------------------------
3101        end loop;
3102     ---------------------------------------------------------------
3103     -- END OF BEN_CVG_AMT_CALC_MTHD_F ----------------------
3104     ---------------------------------------------------------------
3105     end create_coverage_results ;
3106   --
3107   procedure create_premium_results
3108     (
3109       p_validate                       in  number    default 0 -- false
3110      ,p_copy_entity_result_id          in  number
3111      ,p_copy_entity_txn_id             in  number    default null
3112      ,p_pl_id                          in  number    default null
3113      ,p_oipl_id                        in  number    default null
3114      ,p_business_group_id              in  number    default null
3115      ,p_number_of_copies               in  number    default 0
3116      ,p_object_version_number          out nocopy number
3117      ,p_effective_date                 in  date
3118      ,p_parent_entity_result_id        in  number
3119      ) is
3120     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
3121     l_proc varchar2(72) := g_package||'create_rate_results';
3122     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
3123     --
3124     cursor c_parent_result(c_parent_pk_id number,
3125                         c_parent_table_name varchar2,
3126                         c_copy_entity_txn_id number) is
3127      select copy_entity_result_id mirror_src_entity_result_id
3128      from ben_copy_entity_results cpe,
3129           pqh_table_route trt
3130      where cpe.information1= c_parent_pk_id
3131      and   cpe.result_type_cd = 'DISPLAY'
3132      and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
3133      and   cpe.table_route_id = trt.table_route_id
3134      and   trt.from_clause = 'OAB'
3135      and   trt.where_clause = upper(c_parent_table_name) ;
3136      --
3137      -- Bug : 3752407 : Global cursor g_table_route will now be used
3138      -- Cursor to get table_route_id
3139      --
3140      -- cursor c_table_route(c_parent_table_alias varchar2) is
3141      -- select table_route_id
3142      -- from pqh_table_route trt
3143      -- where trt.table_alias = c_parent_table_alias;
3144      -- trt.from_clause = 'OAB'
3145      -- and   trt.where_clause = upper(c_parent_table_name) ;
3146      ---
3147      l_mirror_src_entity_result_id    number(15);
3148      l_table_route_id               number(15);
3149      l_result_type_cd               varchar2(30);
3150      l_information5                 ben_copy_entity_results.information5%type;
3151      l_number_of_copies             number(15);
3152    ---------------------------------------------------------------
3153    -- START OF BEN_ACTL_PREM_F ----------------------
3154    ---------------------------------------------------------------
3155    cursor c_apr_from_parent(c_pl_id number,c_oipl_id number) is
3156    select distinct actl_prem_id
3157    from BEN_ACTL_PREM_F
3158    where  (c_pl_id is not null and pl_id = c_pl_id ) or
3159           (c_oipl_id is not null and oipl_id = c_oipl_id) ;
3160    --
3161    cursor c_apr(c_actl_prem_id number,c_mirror_src_entity_result_id number,
3162                 c_table_alias varchar2 ) is
3163    select  apr.*
3164    from BEN_ACTL_PREM_F apr
3165    where  apr.actl_prem_id = c_actl_prem_id
3166      -- and apr.business_group_id = p_business_group_id
3167      and not exists (
3168          select /* */ null
3169          from ben_copy_entity_results cpe
3170               -- pqh_table_route trt
3171          where copy_entity_txn_id = p_copy_entity_txn_id
3172          -- and trt.table_route_id = cpe.table_route_id
3173          and ( -- c_mirror_src_entity_result_id is null or
3174                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
3175          -- and trt.where_clause = 'BEN_ACTL_PREM_F'
3176          and cpe.table_alias = c_table_alias
3177          and information1 = c_actl_prem_id
3178          -- and information4 = apr.business_group_id
3179            and information2 = apr.effective_start_date
3180            and information3 = apr.effective_end_date);
3181     --
3182     l_actl_prem_id                 number(15);
3183     l_out_apr_result_id   number(15);
3184    ---------------------------------------------------------------
3185    -- END OF BEN_ACTL_PREM_F ----------------------
3186    ---------------------------------------------------------------
3187    ---------------------------------------------------------------
3188    -- START OF BEN_PRTL_MO_RT_PRTN_VAL_F ----------------------
3189    ---------------------------------------------------------------
3190    cursor c_pmr_from_parent(c_ACTL_PREM_ID number) is
3191    select  prtl_mo_rt_prtn_val_id
3192    from BEN_PRTL_MO_RT_PRTN_VAL_F
3193    where  ACTL_PREM_ID = c_ACTL_PREM_ID;
3194    --
3195    cursor c_pmr(c_prtl_mo_rt_prtn_val_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
3196    select  pmr.*
3197    from BEN_PRTL_MO_RT_PRTN_VAL_F pmr
3198    where  pmr.prtl_mo_rt_prtn_val_id = c_prtl_mo_rt_prtn_val_id
3199      -- and pmr.business_group_id = p_business_group_id
3200      and not exists (
3201          select /* */ null
3202          from ben_copy_entity_results cpe
3203               -- pqh_table_route trt
3204          where copy_entity_txn_id = p_copy_entity_txn_id
3205          -- and trt.table_route_id = cpe.table_route_id
3206          and ( -- c_mirror_src_entity_result_id is null or
3207                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
3208          -- and trt.where_clause = 'BEN_PRTL_MO_RT_PRTN_VAL_F'
3209          and cpe.table_alias = c_table_alias
3210          and information1 = c_prtl_mo_rt_prtn_val_id
3211          -- and information4 = pmr.business_group_id
3212            and information2 = pmr.effective_start_date
3213            and information3 = pmr.effective_end_date);
3214     l_prtl_mo_rt_prtn_val_id                 number(15);
3215     l_out_pmr_result_id   number(15);
3216    ---------------------------------------------------------------
3217    -- END OF BEN_PRTL_MO_RT_PRTN_VAL_F ----------------------
3218    ---------------------------------------------------------------
3219    ---------------------------------------------------------------
3220    -- START OF BEN_ACTL_PREM_VRBL_RT_F ----------------------
3221    ---------------------------------------------------------------
3222    cursor c_apv_from_parent(c_ACTL_PREM_ID number) is
3223    select distinct actl_prem_vrbl_rt_id
3224    from BEN_ACTL_PREM_VRBL_RT_F
3225    where  ACTL_PREM_ID = c_ACTL_PREM_ID ;
3226    --
3227    cursor c_apv(c_actl_prem_vrbl_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
3228    select  apv.*
3229    from BEN_ACTL_PREM_VRBL_RT_F apv
3230    where  apv.actl_prem_vrbl_rt_id = c_actl_prem_vrbl_rt_id
3231      -- and apv.business_group_id = p_business_group_id
3232      and not exists (
3233          select /* */ null
3234          from ben_copy_entity_results cpe
3235               -- pqh_table_route trt
3236          where copy_entity_txn_id = p_copy_entity_txn_id
3237          -- and trt.table_route_id = cpe.table_route_id
3238          and ( -- c_mirror_src_entity_result_id is null or
3239                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
3240          -- and trt.where_clause = 'BEN_ACTL_PREM_VRBL_RT_F'
3241          and cpe.table_alias = c_table_alias
3242          and information1 = c_actl_prem_vrbl_rt_id
3243          -- and information4 = apv.business_group_id
3244            and information2 = apv.effective_start_date
3245            and information3 = apv.effective_end_date);
3246    --
3247    cursor c_apv_dpr(c_actl_prem_vrbl_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
3248    select distinct cpe.information262 vrbl_rt_prfl_id
3249      from ben_copy_entity_results cpe
3250           -- pqh_table_route trt
3251      where copy_entity_txn_id = p_copy_entity_txn_id
3252      -- and trt.table_route_id = cpe.table_route_id
3253      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
3254      -- and trt.where_clause = 'BEN_ACTL_PREM_VRBL_RT_F'
3255      and cpe.table_alias = c_table_alias
3256      and information1 = c_actl_prem_vrbl_rt_id
3257      -- and information4 = p_business_group_id
3258     ;
3259    --
3260 
3261     l_actl_prem_vrbl_rt_id                 number(15);
3262     l_out_apv_result_id   number(15);
3263    ---------------------------------------------------------------
3264    -- END OF BEN_ACTL_PREM_VRBL_RT_F ----------------------
3265    ---------------------------------------------------------------
3266    ---------------------------------------------------------------
3267    -- START OF BEN_ACTL_PREM_VRBL_RT_RL_F ----------------------
3268    ---------------------------------------------------------------
3269    cursor c_ava_from_parent(c_ACTL_PREM_ID number) is
3270    select  actl_prem_vrbl_rt_rl_id
3271    from BEN_ACTL_PREM_VRBL_RT_RL_F
3272    where  ACTL_PREM_ID = c_ACTL_PREM_ID ;
3273    --
3274    cursor c_ava(c_actl_prem_vrbl_rt_rl_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
3275    select  ava.*
3276    from BEN_ACTL_PREM_VRBL_RT_RL_F ava
3277    where  ava.actl_prem_vrbl_rt_rl_id = c_actl_prem_vrbl_rt_rl_id
3278      -- and ava.business_group_id = p_business_group_id
3279      and not exists (
3280          select /* */ null
3281          from ben_copy_entity_results cpe
3282               -- pqh_table_route trt
3283          where copy_entity_txn_id = p_copy_entity_txn_id
3284          -- and trt.table_route_id = cpe.table_route_id
3285          and ( -- c_mirror_src_entity_result_id is null or
3286                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
3287          -- and trt.where_clause = 'BEN_ACTL_PREM_VRBL_RT_RL_F'
3288          and cpe.table_alias = c_table_alias
3289          and information1 = c_actl_prem_vrbl_rt_rl_id
3290          -- and information4 = ava.business_group_id
3291            and information2 = ava.effective_start_date
3292            and information3 = ava.effective_end_date);
3293     l_actl_prem_vrbl_rt_rl_id                 number(15);
3294     l_out_ava_result_id   number(15);
3295    ---------------------------------------------------------------
3296    -- END OF BEN_ACTL_PREM_VRBL_RT_RL_F ----------------------
3297    ---------------------------------------------------------------
3298     begin
3299      l_number_of_copies := p_number_of_copies ;
3300      ---------------------------------------------------------------
3301      -- START OF BEN_ACTL_PREM_F ----------------------
3302      ---------------------------------------------------------------
3303      --
3304      for l_parent_rec  in c_apr_from_parent(p_pl_id,p_oipl_id) loop
3305         --
3306         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
3307         --
3308         l_actl_prem_id := l_parent_rec.actl_prem_id ;
3309         --
3310         for l_apr_rec in c_apr(l_parent_rec.actl_prem_id,l_mirror_src_entity_result_id,'APR') loop
3311           --
3312           l_table_route_id := null ;
3313           open ben_plan_design_program_module.g_table_route('APR');
3314           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3315           close ben_plan_design_program_module.g_table_route ;
3316           --
3317           l_information5  := l_apr_rec.name; --'Intersection';
3318           --
3319           if p_effective_date between l_apr_rec.effective_start_date
3320              and l_apr_rec.effective_end_date then
3321            --
3322              l_result_type_cd := 'DISPLAY';
3323           else
3324              l_result_type_cd := 'NO DISPLAY';
3325           end if;
3326             --
3327           l_copy_entity_result_id := null;
3328           l_object_version_number := null;
3329           ben_copy_entity_results_api.create_copy_entity_results(
3330             p_copy_entity_result_id          => l_copy_entity_result_id,
3331             p_copy_entity_txn_id             => p_copy_entity_txn_id,
3332             p_result_type_cd                 => l_result_type_cd,
3333             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3334             p_parent_entity_result_id        => p_parent_entity_result_id,
3335             p_number_of_copies               => l_number_of_copies,
3336             p_table_route_id                 => l_table_route_id,
3337 	    P_TABLE_ALIAS                    => 'APR',
3338             p_information1     => l_apr_rec.actl_prem_id,
3339             p_information2     => l_apr_rec.EFFECTIVE_START_DATE,
3340             p_information3     => l_apr_rec.EFFECTIVE_END_DATE,
3341             p_information4     => l_apr_rec.business_group_id,
3342             p_information5     => l_information5 , -- 9999 put name for h-grid
3343 
3344             p_information22     => l_apr_rec.actl_prem_typ_cd,
3345             p_information11     => l_apr_rec.acty_ref_perd_cd,
3346             p_information111     => l_apr_rec.apr_attribute1,
3347             p_information120     => l_apr_rec.apr_attribute10,
3348             p_information121     => l_apr_rec.apr_attribute11,
3349             p_information122     => l_apr_rec.apr_attribute12,
3350             p_information123     => l_apr_rec.apr_attribute13,
3351             p_information124     => l_apr_rec.apr_attribute14,
3352             p_information125     => l_apr_rec.apr_attribute15,
3353             p_information126     => l_apr_rec.apr_attribute16,
3354             p_information127     => l_apr_rec.apr_attribute17,
3355             p_information128     => l_apr_rec.apr_attribute18,
3356             p_information129     => l_apr_rec.apr_attribute19,
3357             p_information112     => l_apr_rec.apr_attribute2,
3358             p_information130     => l_apr_rec.apr_attribute20,
3359             p_information131     => l_apr_rec.apr_attribute21,
3360             p_information132     => l_apr_rec.apr_attribute22,
3361             p_information133     => l_apr_rec.apr_attribute23,
3362             p_information134     => l_apr_rec.apr_attribute24,
3363             p_information135     => l_apr_rec.apr_attribute25,
3364             p_information136     => l_apr_rec.apr_attribute26,
3365             p_information137     => l_apr_rec.apr_attribute27,
3366             p_information138     => l_apr_rec.apr_attribute28,
3367             p_information139     => l_apr_rec.apr_attribute29,
3368             p_information113     => l_apr_rec.apr_attribute3,
3369             p_information140     => l_apr_rec.apr_attribute30,
3370             p_information114     => l_apr_rec.apr_attribute4,
3371             p_information115     => l_apr_rec.apr_attribute5,
3372             p_information116     => l_apr_rec.apr_attribute6,
3373             p_information117     => l_apr_rec.apr_attribute7,
3374             p_information118     => l_apr_rec.apr_attribute8,
3375             p_information119     => l_apr_rec.apr_attribute9,
3376             p_information110     => l_apr_rec.apr_attribute_category,
3377             p_information16     => l_apr_rec.bnft_rt_typ_cd,
3378             p_information254     => l_apr_rec.comp_lvl_fctr_id,
3379             p_information270     => l_apr_rec.cost_allocation_keyflex_id,
3380             p_information13     => l_apr_rec.cr_lkbk_crnt_py_only_flag,
3381             p_information24     => l_apr_rec.cr_lkbk_uom,
3382             p_information293     => l_apr_rec.cr_lkbk_val,
3383             p_information268     => l_apr_rec.lwr_lmt_calc_rl,
3384             p_information295     => l_apr_rec.lwr_lmt_val,
3385             p_information17     => l_apr_rec.mlt_cd,
3386             p_information170     => l_apr_rec.name,
3387             p_information258     => l_apr_rec.oipl_id,
3388             p_information252     => l_apr_rec.organization_id,
3389             p_information261     => l_apr_rec.pl_id,
3390             p_information18     => l_apr_rec.prdct_cd,
3391             p_information20     => l_apr_rec.prem_asnmt_cd,
3392             p_information21     => l_apr_rec.prem_asnmt_lvl_cd,
3393             p_information23     => l_apr_rec.prem_pyr_cd,
3394             p_information25     => l_apr_rec.prsptv_r_rtsptv_cd,
3395             p_information14     => l_apr_rec.prtl_mo_det_mthd_cd,
3396             p_information263     => l_apr_rec.prtl_mo_det_mthd_rl,
3397             p_information19     => l_apr_rec.rndg_cd,
3398             p_information264     => l_apr_rec.rndg_rl,
3399             p_information15     => l_apr_rec.rt_typ_cd,
3400             p_information12     => l_apr_rec.uom,
3401             p_information267     => l_apr_rec.upr_lmt_calc_rl,
3402             p_information294     => l_apr_rec.upr_lmt_val,
3403             p_information287     => l_apr_rec.val,
3404             p_information266     => l_apr_rec.val_calc_rl,
3405             p_information269     => l_apr_rec.vrbl_rt_add_on_calc_rl,
3406             p_information257     => l_apr_rec.wsh_rl_dy_mo_num,
3407             p_information265     => l_apr_rec.object_version_number,
3408 
3409             p_object_version_number          => l_object_version_number,
3410             p_effective_date                 => p_effective_date       );
3411             --
3412 
3413             if l_out_apr_result_id is null then
3414               l_out_apr_result_id := l_copy_entity_result_id;
3415             end if;
3416 
3417             if l_result_type_cd = 'DISPLAY' then
3418                l_out_apr_result_id := l_copy_entity_result_id ;
3419             end if;
3420             --
3421 
3422             ---------------------------------------------------------------
3423             -- LWR_LMT_CALC_RL --
3424             ---------------------------------------------------------------
3425             --
3426             if l_apr_rec.lwr_lmt_calc_rl is not null then
3427             --
3428               ben_plan_design_program_module.create_formula_result
3429               (
3430                  p_validate                       =>  0
3431                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3432                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3433                 ,p_formula_id                     =>  l_apr_rec.lwr_lmt_calc_rl
3434                 ,p_business_group_id              =>  l_apr_rec.business_group_id
3435                 ,p_number_of_copies               =>  l_number_of_copies
3436                 ,p_object_version_number          =>  l_object_version_number
3437                 ,p_effective_date                 =>  p_effective_date
3438                );
3439 
3440              --
3441              end if;
3442              --
3443 
3444              ---------------------------------------------------------------
3445              -- PRTL_MO_DET_MTHD_RL --
3446              ---------------------------------------------------------------
3447              --
3448              if l_apr_rec.prtl_mo_det_mthd_rl is not null then
3449              --
3450                ben_plan_design_program_module.create_formula_result
3451                (
3452                  p_validate                       =>  0
3453                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3454                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3455                 ,p_formula_id                     =>  l_apr_rec.prtl_mo_det_mthd_rl
3456                 ,p_business_group_id              =>  l_apr_rec.business_group_id
3457                 ,p_number_of_copies               =>  l_number_of_copies
3458                 ,p_object_version_number          =>  l_object_version_number
3459                 ,p_effective_date                 =>  p_effective_date
3460                );
3461              --
3462              end if;
3463              --
3464 
3465              ---------------------------------------------------------------
3466              -- RNDG_RL --
3467              ---------------------------------------------------------------
3468              --
3469              if l_apr_rec.rndg_rl is not null then
3470              --
3471                ben_plan_design_program_module.create_formula_result
3472                (
3473                   p_validate                       =>  0
3474                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3475                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3476                  ,p_formula_id                     =>  l_apr_rec.rndg_rl
3477                  ,p_business_group_id              =>  l_apr_rec.business_group_id
3478                  ,p_number_of_copies               =>  l_number_of_copies
3479                  ,p_object_version_number          =>  l_object_version_number
3480                  ,p_effective_date                 =>  p_effective_date
3481                );
3482              --
3483              end if;
3484              --
3485 
3486              ---------------------------------------------------------------
3487              -- UPR_LMT_CALC_RL --
3488              ---------------------------------------------------------------
3489              --
3490              if l_apr_rec.upr_lmt_calc_rl is not null then
3491              --
3492                ben_plan_design_program_module.create_formula_result
3493                (
3494                   p_validate                       =>  0
3495                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3496                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3497                  ,p_formula_id                     =>  l_apr_rec.upr_lmt_calc_rl
3498                  ,p_business_group_id              =>  l_apr_rec.business_group_id
3499                  ,p_number_of_copies               =>  l_number_of_copies
3500                  ,p_object_version_number          =>  l_object_version_number
3501                  ,p_effective_date                 =>  p_effective_date
3502                );
3503              --
3504              end if;
3505              --
3506 
3507              ---------------------------------------------------------------
3508              -- VAL_CALC_RL      --
3509              ---------------------------------------------------------------
3510              --
3511                if l_apr_rec.val_calc_rl is not null then
3512                --
3513                   ben_plan_design_program_module.create_formula_result
3514                   (
3515                      p_validate                       =>  0
3516                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3517                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3518                     ,p_formula_id                     =>  l_apr_rec.val_calc_rl
3519                     ,p_business_group_id              =>  l_apr_rec.business_group_id
3520                     ,p_number_of_copies               =>  l_number_of_copies
3521                     ,p_object_version_number          =>  l_object_version_number
3522                     ,p_effective_date                 =>  p_effective_date
3523                    );
3524                 --
3525                 end if;
3526                 --
3527 
3528              ---------------------------------------------------------------
3529              -- VRBL_RT_ADD_ON_CALC_RL   --
3530              ---------------------------------------------------------------
3531              --
3532                if l_apr_rec.vrbl_rt_add_on_calc_rl is not null then
3533                --
3534                  ben_plan_design_program_module.create_formula_result
3535                  (
3536                     p_validate                       =>  0
3537                    ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3538                    ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3539                    ,p_formula_id                     =>  l_apr_rec.vrbl_rt_add_on_calc_rl
3540                    ,p_business_group_id              =>  l_apr_rec.business_group_id
3541                    ,p_number_of_copies               =>  l_number_of_copies
3542                    ,p_object_version_number          =>  l_object_version_number
3543                    ,p_effective_date                 =>  p_effective_date
3544                   );
3545                --
3546                end if;
3547                --
3548               ---------------------------------------------------------------
3549               --  COMP_LVL_FCTR -----------------
3550               ---------------------------------------------------------------
3551 
3552               if l_apr_rec.comp_lvl_fctr_id is not null then
3553               --
3554                 create_drpar_results
3555                  (
3556                    p_validate                      => p_validate
3557                   ,p_copy_entity_result_id         => l_copy_entity_result_id
3558                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
3559                   ,p_comp_lvl_fctr_id              => l_apr_rec.comp_lvl_fctr_id
3560                   ,p_hrs_wkd_in_perd_fctr_id       => null
3561                   ,p_los_fctr_id                   => null
3562                   ,p_pct_fl_tm_fctr_id             => null
3563                   ,p_age_fctr_id                   => null
3564                   ,p_cmbn_age_los_fctr_id          => null
3565                   ,p_business_group_id             => p_business_group_id
3566                   ,p_number_of_copies              => p_number_of_copies
3567                   ,p_object_version_number         => l_object_version_number
3568                   ,p_effective_date                => p_effective_date
3569                  );
3570               --
3571               end if;
3572 
3573          end loop;
3574          --
3575 
3576         ---------------------------------------------------------------
3577         -- START OF BEN_PRTL_MO_RT_PRTN_VAL_F ----------------------
3578         ---------------------------------------------------------------
3579         --
3580         for l_parent_rec  in c_pmr_from_parent(l_ACTL_PREM_ID) loop
3581            --
3582            l_mirror_src_entity_result_id := l_out_apr_result_id ;
3583            --
3584            l_prtl_mo_rt_prtn_val_id := l_parent_rec.prtl_mo_rt_prtn_val_id ;
3585            --
3586            for l_pmr_rec in c_pmr(l_parent_rec.prtl_mo_rt_prtn_val_id,l_mirror_src_entity_result_id,'PMRPV') loop
3587              --
3588              l_table_route_id := null ;
3589              open ben_plan_design_program_module.g_table_route('PMRPV');
3590              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3591              close ben_plan_design_program_module.g_table_route ;
3592              --
3593              l_information5  := l_pmr_rec.from_dy_mo_num ||' - '||l_pmr_rec.to_dy_mo_num ;
3594              if l_pmr_rec.pct_val is not null then
3595                l_information5 := l_information5 ||' '||l_pmr_rec.pct_val||'%';
3596              end if;
3597              -- 'Intersection';
3598              --
3599              if p_effective_date between l_pmr_rec.effective_start_date
3600                 and l_pmr_rec.effective_end_date then
3601               --
3602                 l_result_type_cd := 'DISPLAY';
3603              else
3604                 l_result_type_cd := 'NO DISPLAY';
3605              end if;
3606                --
3607              l_copy_entity_result_id := null;
3608              l_object_version_number := null;
3609              ben_copy_entity_results_api.create_copy_entity_results(
3610                p_copy_entity_result_id          => l_copy_entity_result_id,
3611                p_copy_entity_txn_id             => p_copy_entity_txn_id,
3612                p_result_type_cd                 => l_result_type_cd,
3613                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3614                p_parent_entity_result_id        => l_mirror_src_entity_result_id,
3615                p_number_of_copies               => l_number_of_copies,
3616                p_table_route_id                 => l_table_route_id,
3617 	       P_TABLE_ALIAS                    => 'PMRPV',
3618                p_information1     => l_pmr_rec.prtl_mo_rt_prtn_val_id,
3619                p_information2     => l_pmr_rec.EFFECTIVE_START_DATE,
3620                p_information3     => l_pmr_rec.EFFECTIVE_END_DATE,
3621                p_information4     => l_pmr_rec.business_group_id,
3622                p_information5     => l_information5 , -- 9999 put name for h-grid
3623 
3624 
3625             p_information250     => l_pmr_rec.actl_prem_id,
3626             p_information253     => l_pmr_rec.acty_base_rt_id,
3627             p_information238     => l_pmr_rec.cvg_amt_calc_mthd_id,
3628             p_information261     => l_pmr_rec.from_dy_mo_num,
3629             p_information293     => l_pmr_rec.pct_val,
3630             p_information111     => l_pmr_rec.pmrpv_attribute1,
3631             p_information120     => l_pmr_rec.pmrpv_attribute10,
3632             p_information121     => l_pmr_rec.pmrpv_attribute11,
3633             p_information122     => l_pmr_rec.pmrpv_attribute12,
3634             p_information123     => l_pmr_rec.pmrpv_attribute13,
3635             p_information124     => l_pmr_rec.pmrpv_attribute14,
3636             p_information125     => l_pmr_rec.pmrpv_attribute15,
3637             p_information126     => l_pmr_rec.pmrpv_attribute16,
3638             p_information127     => l_pmr_rec.pmrpv_attribute17,
3639             p_information128     => l_pmr_rec.pmrpv_attribute18,
3640             p_information129     => l_pmr_rec.pmrpv_attribute19,
3641             p_information112     => l_pmr_rec.pmrpv_attribute2,
3642             p_information130     => l_pmr_rec.pmrpv_attribute20,
3643             p_information131     => l_pmr_rec.pmrpv_attribute21,
3644             p_information132     => l_pmr_rec.pmrpv_attribute22,
3645             p_information133     => l_pmr_rec.pmrpv_attribute23,
3646             p_information134     => l_pmr_rec.pmrpv_attribute24,
3647             p_information135     => l_pmr_rec.pmrpv_attribute25,
3648             p_information136     => l_pmr_rec.pmrpv_attribute26,
3649             p_information137     => l_pmr_rec.pmrpv_attribute27,
3650             p_information138     => l_pmr_rec.pmrpv_attribute28,
3651             p_information139     => l_pmr_rec.pmrpv_attribute29,
3652             p_information113     => l_pmr_rec.pmrpv_attribute3,
3653             p_information140     => l_pmr_rec.pmrpv_attribute30,
3654             p_information114     => l_pmr_rec.pmrpv_attribute4,
3655             p_information115     => l_pmr_rec.pmrpv_attribute5,
3656             p_information116     => l_pmr_rec.pmrpv_attribute6,
3657             p_information117     => l_pmr_rec.pmrpv_attribute7,
3658             p_information118     => l_pmr_rec.pmrpv_attribute8,
3659             p_information119     => l_pmr_rec.pmrpv_attribute9,
3660             p_information110     => l_pmr_rec.pmrpv_attribute_category,
3661             p_information263     => l_pmr_rec.prtl_mo_prortn_rl,
3662             p_information11     => l_pmr_rec.rndg_cd,
3663             p_information262     => l_pmr_rec.rndg_rl,
3664             p_information12     => l_pmr_rec.strt_r_stp_cvg_cd,
3665             p_information260     => l_pmr_rec.to_dy_mo_num,
3666             p_information265    => l_pmr_rec.object_version_number,
3667            --
3668            -- Bug No 4440138 Added mappings for PRORATE_BY_DAY_TO_MON_FLAG and NUM_DAYS_MONTH
3669 	   --
3670             p_information13     => l_pmr_rec.PRORATE_BY_DAY_TO_MON_FLAG,
3671             p_information266    => l_pmr_rec.NUM_DAYS_MONTH,
3672 	   -- End Bug No 4440138
3673 	   --
3674                p_object_version_number          => l_object_version_number,
3675                p_effective_date                 => p_effective_date       );
3676                --
3677 
3678                if l_out_pmr_result_id is null then
3679                  l_out_pmr_result_id := l_copy_entity_result_id;
3680                end if;
3681 
3682                if l_result_type_cd = 'DISPLAY' then
3683                   l_out_pmr_result_id := l_copy_entity_result_id ;
3684                end if;
3685                --
3686 
3687                -- Copy Fast Formulas if any are attached to any column --
3688                ---------------------------------------------------------------
3689                -- PRTL_MO_PRORTN_RL -----------------
3690                ---------------------------------------------------------------
3691 
3692                if l_pmr_rec.prtl_mo_prortn_rl is not null then
3693                       --
3694                       ben_plan_design_program_module.create_formula_result
3695                       (
3696                        p_validate                       =>  0
3697                       ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3698                       ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3699                       ,p_formula_id                     =>  l_pmr_rec.prtl_mo_prortn_rl
3700                       ,p_business_group_id              =>  l_pmr_rec.business_group_id
3701                       ,p_number_of_copies               =>  l_number_of_copies
3702                       ,p_object_version_number          =>  l_object_version_number
3703                       ,p_effective_date                 =>  p_effective_date
3704                       );
3705 
3706                       --
3707                end if;
3708 
3709 
3710 
3711                -- Copy Fast Formulas if any are attached to any column --
3712                ---------------------------------------------------------------
3713                -- RNDG_RL -----------------
3714                ---------------------------------------------------------------
3715 
3716                if l_pmr_rec.rndg_rl is not null then
3717                       --
3718                       ben_plan_design_program_module.create_formula_result
3719                       (
3720                        p_validate                       =>  0
3721                       ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3722                       ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3723                       ,p_formula_id                     =>  l_pmr_rec.rndg_rl
3724                       ,p_business_group_id              =>  l_pmr_rec.business_group_id
3725                       ,p_number_of_copies               =>  l_number_of_copies
3726                       ,p_object_version_number          =>  l_object_version_number
3727                       ,p_effective_date                 =>  p_effective_date
3728                       );
3729 
3730                       --
3731                end if;
3732 
3733 
3734             end loop;
3735             --
3736           end loop;
3737        ---------------------------------------------------------------
3738        -- END OF BEN_PRTL_MO_RT_PRTN_VAL_F ----------------------
3739        ---------------------------------------------------------------
3740         ---------------------------------------------------------------
3741         -- START OF BEN_ACTL_PREM_VRBL_RT_F ----------------------
3742         ---------------------------------------------------------------
3743         --
3744         for l_parent_rec  in c_apv_from_parent(l_ACTL_PREM_ID) loop
3745            --
3746            l_mirror_src_entity_result_id := l_out_apr_result_id ;
3747            --
3748            l_actl_prem_vrbl_rt_id := l_parent_rec.actl_prem_vrbl_rt_id ;
3749            --
3750            for l_apv_rec in c_apv(l_parent_rec.actl_prem_vrbl_rt_id,l_mirror_src_entity_result_id,'APV') loop
3751              --
3752              l_table_route_id := null ;
3753              open ben_plan_design_program_module.g_table_route('APV');
3754              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3755              close ben_plan_design_program_module.g_table_route ;
3756              --
3757              l_information5  := ben_plan_design_program_module.get_vrbl_rt_prfl_name(l_apv_rec.vrbl_rt_prfl_id
3758                                                                                      ,p_effective_date); --'Intersection';
3759              --
3760              if p_effective_date between l_apv_rec.effective_start_date
3761                 and l_apv_rec.effective_end_date then
3762               --
3763                 l_result_type_cd := 'DISPLAY';
3764              else
3765                 l_result_type_cd := 'NO DISPLAY';
3766              end if;
3767                --
3768              l_copy_entity_result_id := null;
3769              l_object_version_number := null;
3770              ben_copy_entity_results_api.create_copy_entity_results(
3771                p_copy_entity_result_id          => l_copy_entity_result_id,
3772                p_copy_entity_txn_id             => p_copy_entity_txn_id,
3773                p_result_type_cd                 => l_result_type_cd,
3774                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3775                p_parent_entity_result_id        => null, -- Hide BEN_ACTL_PREM_VRBL_RT_F for HGrid
3776                p_number_of_copies               => l_number_of_copies,
3777                p_table_route_id                 => l_table_route_id,
3778 	       P_TABLE_ALIAS                    => 'APV',
3779                p_information1     => l_apv_rec.actl_prem_vrbl_rt_id,
3780                p_information2     => l_apv_rec.EFFECTIVE_START_DATE,
3781                p_information3     => l_apv_rec.EFFECTIVE_END_DATE,
3782                p_information4     => l_apv_rec.business_group_id,
3783                p_information5     => l_information5 , -- 9999 put name for h-grid
3784 
3785             p_information250     => l_apv_rec.actl_prem_id,
3786             p_information111     => l_apv_rec.apv_attribute1,
3787             p_information120     => l_apv_rec.apv_attribute10,
3788             p_information121     => l_apv_rec.apv_attribute11,
3789             p_information122     => l_apv_rec.apv_attribute12,
3790             p_information123     => l_apv_rec.apv_attribute13,
3791             p_information124     => l_apv_rec.apv_attribute14,
3792             p_information125     => l_apv_rec.apv_attribute15,
3793             p_information126     => l_apv_rec.apv_attribute16,
3794             p_information127     => l_apv_rec.apv_attribute17,
3795             p_information128     => l_apv_rec.apv_attribute18,
3796             p_information129     => l_apv_rec.apv_attribute19,
3797             p_information112     => l_apv_rec.apv_attribute2,
3798             p_information130     => l_apv_rec.apv_attribute20,
3799             p_information131     => l_apv_rec.apv_attribute21,
3800             p_information132     => l_apv_rec.apv_attribute22,
3801             p_information133     => l_apv_rec.apv_attribute23,
3802             p_information134     => l_apv_rec.apv_attribute24,
3803             p_information135     => l_apv_rec.apv_attribute25,
3804             p_information136     => l_apv_rec.apv_attribute26,
3805             p_information137     => l_apv_rec.apv_attribute27,
3806             p_information138     => l_apv_rec.apv_attribute28,
3807             p_information139     => l_apv_rec.apv_attribute29,
3808             p_information113     => l_apv_rec.apv_attribute3,
3809             p_information140     => l_apv_rec.apv_attribute30,
3810             p_information114     => l_apv_rec.apv_attribute4,
3811             p_information115     => l_apv_rec.apv_attribute5,
3812             p_information116     => l_apv_rec.apv_attribute6,
3813             p_information117     => l_apv_rec.apv_attribute7,
3814             p_information118     => l_apv_rec.apv_attribute8,
3815             p_information119     => l_apv_rec.apv_attribute9,
3816             p_information110     => l_apv_rec.apv_attribute_category,
3817             p_information260     => l_apv_rec.ordr_num,
3818             p_information262     => l_apv_rec.vrbl_rt_prfl_id,
3819             p_information265     => l_apv_rec.object_version_number,
3820 
3821                p_object_version_number          => l_object_version_number,
3822                p_effective_date                 => p_effective_date       );
3823                --
3824 
3825                if l_out_apv_result_id is null then
3826                  l_out_apv_result_id := l_copy_entity_result_id;
3827                end if;
3828 
3829                if l_result_type_cd = 'DISPLAY' then
3830                   l_out_apv_result_id := l_copy_entity_result_id ;
3831                end if;
3832                --
3833             end loop;
3834             hr_utility.set_location('l_parent_rec.actl_prem_vrbl_rt_id  '|| l_parent_rec.actl_prem_vrbl_rt_id,100);
3835             hr_utility.set_location('l_mirror_src_entity_result_id  '|| l_mirror_src_entity_result_id,100);
3836             for l_apv_rec in c_apv_dpr(l_parent_rec.actl_prem_vrbl_rt_id,l_mirror_src_entity_result_id,'APV') loop
3837               -----------------------------------------------------------------------------------------
3838               -- Call to VAPRO
3839               -----------------------------------------------------------------------------------------
3840               hr_utility.set_location('l_apv_rec ',100);
3841               create_vapro_results
3842                 (
3843                  p_validate                    => p_validate
3844                 ,p_copy_entity_result_id       => l_out_apv_result_id
3845                 ,p_copy_entity_txn_id          => p_copy_entity_txn_id
3846                 ,p_vrbl_rt_prfl_id             => l_apv_rec.vrbl_rt_prfl_id
3847                 ,p_business_group_id           => p_business_group_id
3848                 ,p_number_of_copies            => p_number_of_copies
3849                 ,p_object_version_number       => p_object_version_number
3850                 ,p_effective_date              => p_effective_date
3851                 ,p_parent_entity_result_id     => l_out_apr_result_id
3852                 ) ;
3853             end loop;
3854             --
3855           end loop;
3856        ---------------------------------------------------------------
3857        -- END OF BEN_ACTL_PREM_VRBL_RT_F ----------------------
3858        ---------------------------------------------------------------
3859         ---------------------------------------------------------------
3860         -- START OF BEN_ACTL_PREM_VRBL_RT_RL_F ----------------------
3861         ---------------------------------------------------------------
3862         --
3863         for l_parent_rec  in c_ava_from_parent(l_ACTL_PREM_ID) loop
3864            --
3865            l_mirror_src_entity_result_id := l_out_apr_result_id ;
3866 
3867            --
3868            l_actl_prem_vrbl_rt_rl_id := l_parent_rec.actl_prem_vrbl_rt_rl_id ;
3869            --
3870            for l_ava_rec in c_ava(l_parent_rec.actl_prem_vrbl_rt_rl_id,l_mirror_src_entity_result_id,'AVA') loop
3871              --
3872              l_table_route_id := null ;
3873              open ben_plan_design_program_module.g_table_route('AVA');
3874              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3875              close ben_plan_design_program_module.g_table_route ;
3876              --
3877              l_information5  := ben_plan_design_program_module.get_formula_name(l_ava_rec.formula_id,p_effective_date);
3878                                 --'Intersection';
3879              --
3880              if p_effective_date between l_ava_rec.effective_start_date
3881                 and l_ava_rec.effective_end_date then
3882               --
3883                 l_result_type_cd := 'DISPLAY';
3884              else
3885                 l_result_type_cd := 'NO DISPLAY';
3886              end if;
3887                --
3888              l_copy_entity_result_id := null;
3889              l_object_version_number := null;
3890              ben_copy_entity_results_api.create_copy_entity_results(
3891                p_copy_entity_result_id          => l_copy_entity_result_id,
3892                p_copy_entity_txn_id             => p_copy_entity_txn_id,
3893                p_result_type_cd                 => l_result_type_cd,
3894                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3895                p_parent_entity_result_id        => l_mirror_src_entity_result_id,
3896                p_number_of_copies               => l_number_of_copies,
3897                p_table_route_id                 => l_table_route_id,
3898 	       P_TABLE_ALIAS                    => 'AVA',
3899                p_information1     => l_ava_rec.actl_prem_vrbl_rt_rl_id,
3900                p_information2     => l_ava_rec.EFFECTIVE_START_DATE,
3901                p_information3     => l_ava_rec.EFFECTIVE_END_DATE,
3902                p_information4     => l_ava_rec.business_group_id,
3903                p_information5     => l_information5 , -- 9999 put name for h-grid
3904 
3905             p_information250     => l_ava_rec.actl_prem_id,
3906             p_information111     => l_ava_rec.ava_attribute1,
3907             p_information120     => l_ava_rec.ava_attribute10,
3908             p_information121     => l_ava_rec.ava_attribute11,
3909             p_information122     => l_ava_rec.ava_attribute12,
3910             p_information123     => l_ava_rec.ava_attribute13,
3911             p_information124     => l_ava_rec.ava_attribute14,
3912             p_information125     => l_ava_rec.ava_attribute15,
3913             p_information126     => l_ava_rec.ava_attribute16,
3914             p_information127     => l_ava_rec.ava_attribute17,
3915             p_information128     => l_ava_rec.ava_attribute18,
3916             p_information129     => l_ava_rec.ava_attribute19,
3917             p_information112     => l_ava_rec.ava_attribute2,
3918             p_information130     => l_ava_rec.ava_attribute20,
3919             p_information131     => l_ava_rec.ava_attribute21,
3920             p_information132     => l_ava_rec.ava_attribute22,
3921             p_information133     => l_ava_rec.ava_attribute23,
3922             p_information134     => l_ava_rec.ava_attribute24,
3923             p_information135     => l_ava_rec.ava_attribute25,
3924             p_information136     => l_ava_rec.ava_attribute26,
3925             p_information137     => l_ava_rec.ava_attribute27,
3926             p_information138     => l_ava_rec.ava_attribute28,
3927             p_information139     => l_ava_rec.ava_attribute29,
3928             p_information113     => l_ava_rec.ava_attribute3,
3929             p_information140     => l_ava_rec.ava_attribute30,
3930             p_information114     => l_ava_rec.ava_attribute4,
3931             p_information115     => l_ava_rec.ava_attribute5,
3932             p_information116     => l_ava_rec.ava_attribute6,
3933             p_information117     => l_ava_rec.ava_attribute7,
3934             p_information118     => l_ava_rec.ava_attribute8,
3935             p_information119     => l_ava_rec.ava_attribute9,
3936             p_information110     => l_ava_rec.ava_attribute_category,
3937             p_information251     => l_ava_rec.formula_id,
3938             p_information260     => l_ava_rec.ordr_to_aply_num,
3939             p_information11     => l_ava_rec.rt_trtmt_cd,
3940             p_information265    => l_ava_rec.object_version_number,
3941 
3942                p_object_version_number          => l_object_version_number,
3943                p_effective_date                 => p_effective_date       );
3944                --
3945 
3946                if l_out_ava_result_id is null then
3947                  l_out_ava_result_id := l_copy_entity_result_id;
3948                end if;
3949 
3950                if l_result_type_cd = 'DISPLAY' then
3951                   l_out_ava_result_id := l_copy_entity_result_id ;
3952                end if;
3953                --
3954 
3955                -- Copy Fast Formulas if any are attached to any column --
3956                ---------------------------------------------------------------
3957                -- FORMULA_ID -----------------
3958                ---------------------------------------------------------------
3959 
3960                if l_ava_rec.formula_id is not null then
3961                    --
3962                    ben_plan_design_program_module.create_formula_result
3963                    (
3964                     p_validate                       =>  0
3965                    ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3966                    ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3967                    ,p_formula_id                     =>  l_ava_rec.formula_id
3968                    ,p_business_group_id              =>  l_ava_rec.business_group_id
3969                    ,p_number_of_copies               =>  l_number_of_copies
3970                    ,p_object_version_number          =>  l_object_version_number
3971                    ,p_effective_date                 =>  p_effective_date
3972                    );
3973 
3974                    --
3975                end if;
3976 
3977             end loop;
3978             --
3979           end loop;
3980        ---------------------------------------------------------------
3981        -- END OF BEN_ACTL_PREM_VRBL_RT_RL_F ----------------------
3982        ---------------------------------------------------------------
3983        end loop;
3984     ---------------------------------------------------------------
3985     -- END OF BEN_ACTL_PREM_F ----------------------
3986     ---------------------------------------------------------------
3987       null;
3988     end create_premium_results ;
3989   --
3990   procedure create_drpar_results
3991     (
3992      p_validate                       in  number     default 0 -- false
3993     ,p_copy_entity_result_id          in  number    -- Source Elpro
3994     ,p_copy_entity_txn_id             in  number    default null
3995     ,p_comp_lvl_fctr_id               in  number    default null
3996     ,p_hrs_wkd_in_perd_fctr_id        in  number    default null
3997     ,p_los_fctr_id                    in  number    default null
3998     ,p_pct_fl_tm_fctr_id              in  number    default null
3999     ,p_age_fctr_id                    in  number    default null
4000     ,p_cmbn_age_los_fctr_id           in  number    default null
4001     ,p_business_group_id              in  number    default null
4002     ,p_number_of_copies               in  number    default 0
4003     ,p_object_version_number          out nocopy number
4004     ,p_effective_date                 in  date
4005     ,p_no_dup_rslt                    in varchar2   default null
4006     ) is
4007     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
4008     l_proc varchar2(72) := g_package||'create_drpar_results';
4009     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
4010     --
4011     cursor c_parent_result(c_parent_pk_id number,
4012                         c_parent_table_name varchar2,
4013                         c_copy_entity_txn_id number) is
4014      select copy_entity_result_id mirror_src_entity_result_id
4015      from ben_copy_entity_results cpe,
4016         pqh_table_route trt
4017      where cpe.information1= c_parent_pk_id
4018      and   cpe.result_type_cd = 'DISPLAY'
4019      and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
4020      and   cpe.table_route_id = trt.table_route_id
4021      and   trt.from_clause = 'OAB'
4022      and   trt.where_clause = upper(c_parent_table_name) ;
4023      ---
4024      -- Bug : 3752407 : Global cursor g_table_route will now be used
4025      -- Cursor to get table_route_id
4026      --
4027      -- cursor c_table_route(c_parent_table_alias varchar2) is
4028      -- select table_route_id
4029      -- from pqh_table_route trt
4030      -- where trt.table_alias = c_parent_table_alias;
4031      -- trt.from_clause = 'OAB'
4032      -- and   trt.where_clause = upper(c_parent_table_name) ;
4033      ---
4034 
4035      -- Cursor to get parent record's effective_start_date
4036      -- to be stored for non date-tracked child records
4037      cursor c_parent_esd(c_parent_pk_id number,
4038                          -- c_parent_table_name varchar2,
4039                          c_parent_table_alias varchar2,
4040                          c_copy_entity_txn_id number) is
4041      select min(cpe.information2) min_esd
4042      from   ben_copy_entity_results cpe
4043             -- pqh_table_route trt
4044      where  cpe.information1= c_parent_pk_id
4045      and    cpe.copy_entity_txn_id = c_copy_entity_txn_id
4046      --and    cpe.table_route_id = trt.table_route_id
4047      and    cpe.table_alias = c_parent_table_alias;
4048      -- and    trt.from_clause = 'OAB'
4049      -- and    trt.where_clause = upper(c_parent_table_name);
4050 
4051      l_bnb_bnfts_bal_esd ben_bnfts_bal_f.effective_start_date%type;
4052 
4053      l_mirror_src_entity_result_id    number(15);
4054      l_table_route_id               number(15);
4055      l_result_type_cd               varchar2(30);
4056      l_information5                 ben_copy_entity_results.information5%type;
4057      l_number_of_copies             number(15);
4058 
4059    ---------------------------------------------------------------
4060    -- START OF BEN_AGE_FCTR ----------------------
4061    ---------------------------------------------------------------
4062    cursor c_agf(c_age_fctr_id number,c_mirror_src_entity_result_id number,
4063                 c_table_alias varchar2 ) is
4064    select  agf.*
4065    from BEN_AGE_FCTR agf
4066    where  agf.age_fctr_id = c_age_fctr_id
4067      -- and agf.business_group_id = p_business_group_id
4068      and not exists (
4069          select /* */ null
4070          from ben_copy_entity_results cpe
4071               -- pqh_table_route trt
4072          where copy_entity_txn_id = p_copy_entity_txn_id
4073          -- and trt.table_route_id = cpe.table_route_id
4074          and ( -- c_mirror_src_entity_result_id is null or
4075                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
4076          -- and trt.where_clause = 'BEN_AGE_FCTR'
4077          and cpe.table_alias = c_table_alias
4078          and information1 = c_age_fctr_id
4079          -- and information4 = agf.business_group_id
4080         );
4081     l_age_fctr_id                 number(15);
4082     l_out_agf_result_id   number(15);
4083    ---------------------------------------------------------------
4084    -- END OF BEN_AGE_FCTR ----------------------
4085    ---------------------------------------------------------------
4086    ---------------------------------------------------------------
4087    -- START OF BEN_CMBN_AGE_LOS_FCTR ----------------------
4088    ---------------------------------------------------------------
4089    cursor c_cla(c_cmbn_age_los_fctr_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
4090    select  cla.*
4091    from BEN_CMBN_AGE_LOS_FCTR cla
4092    where  cla.cmbn_age_los_fctr_id = c_cmbn_age_los_fctr_id
4093      -- and cla.business_group_id = p_business_group_id
4094      and not exists (
4095          select /* */ null
4096          from ben_copy_entity_results cpe
4097               -- pqh_table_route trt
4098          where copy_entity_txn_id = p_copy_entity_txn_id
4099          -- and trt.table_route_id = cpe.table_route_id
4100          and ( -- c_mirror_src_entity_result_id is null or
4101                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
4102          -- and trt.where_clause = 'BEN_CMBN_AGE_LOS_FCTR'
4103          and cpe.table_alias = c_table_alias
4104          and information1 = c_cmbn_age_los_fctr_id
4105          -- and information4 = cla.business_group_id
4106         );
4107 
4108     l_cmbn_age_los_fctr_id                 number(15);
4109     l_out_cla_result_id   number(15);
4110    ---------------------------------------------------------------
4111    -- END OF BEN_CMBN_AGE_LOS_FCTR ----------------------
4112    ---------------------------------------------------------------
4113    ---------------------------------------------------------------
4114    -- START OF BEN_COMP_LVL_FCTR ----------------------
4115    ---------------------------------------------------------------
4116    cursor c_clf(c_comp_lvl_fctr_id number,c_mirror_src_entity_result_id number,
4117                 c_table_alias varchar2 ) is
4118    select  clf.*
4119    from BEN_COMP_LVL_FCTR clf
4120    where  clf.comp_lvl_fctr_id = c_comp_lvl_fctr_id
4121      -- and clf.business_group_id = p_business_group_id
4122      and not exists (
4123          select /* */ null
4124          from ben_copy_entity_results cpe
4125               -- pqh_table_route trt
4126          where copy_entity_txn_id = p_copy_entity_txn_id
4127          -- and trt.table_route_id = cpe.table_route_id
4128          and ( -- c_mirror_src_entity_result_id is null or
4129                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
4130          -- and trt.where_clause = 'BEN_COMP_LVL_FCTR'
4131          and cpe.table_alias = c_table_alias
4132          and information1 = c_comp_lvl_fctr_id
4133          -- and information4 = clf.business_group_id
4134         );
4135    l_comp_lvl_fctr_id                 number(15);
4136    l_out_clf_result_id   number(15);
4137    --
4138    cursor c_clf_drp(c_comp_lvl_fctr_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
4139    select distinct cpe.information225 bnfts_bal_id
4140      from ben_copy_entity_results cpe
4141           -- pqh_table_route trt
4142      where copy_entity_txn_id = p_copy_entity_txn_id
4143      -- and trt.table_route_id = cpe.table_route_id
4144      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
4145      -- and trt.where_clause = 'BEN_COMP_LVL_FCTR'
4146      and cpe.table_alias = c_table_alias
4147      and information1 = c_comp_lvl_fctr_id
4148      -- and information4 = p_business_group_id
4149     ;
4150    ---------------------------------------------------------------
4151    -- END OF BEN_COMP_LVL_FCTR ----------------------
4152    ---------------------------------------------------------------
4153    ---------------------------------------------------------------
4154    -- START OF BEN_HRS_WKD_IN_PERD_FCTR ----------------------
4155    ---------------------------------------------------------------
4156    cursor c_hwf(c_hrs_wkd_in_perd_fctr_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
4157    select  hwf.*
4158    from BEN_HRS_WKD_IN_PERD_FCTR hwf
4159    where  hwf.hrs_wkd_in_perd_fctr_id = c_hrs_wkd_in_perd_fctr_id
4160      -- and hwf.business_group_id = p_business_group_id
4161      and not exists (
4162          select /* */ null
4163          from ben_copy_entity_results cpe
4164               -- pqh_table_route trt
4165          where copy_entity_txn_id = p_copy_entity_txn_id
4166          -- and trt.table_route_id = cpe.table_route_id
4167          and ( -- c_mirror_src_entity_result_id is null or
4168                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
4169          -- and trt.where_clause = 'BEN_HRS_WKD_IN_PERD_FCTR'
4170          and cpe.table_alias = c_table_alias
4171          and information1 = c_hrs_wkd_in_perd_fctr_id
4172          -- and information4 = hwf.business_group_id
4173         );
4174    --
4175    l_hrs_wkd_in_perd_fctr_id                 number(15);
4176    l_out_hwf_result_id   number(15);
4177    --
4178    cursor c_hwf_drp(c_hrs_wkd_in_perd_fctr_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
4179    select distinct cpe.information225 bnfts_bal_id
4180      from ben_copy_entity_results cpe
4181           -- pqh_table_route trt
4182      where copy_entity_txn_id = p_copy_entity_txn_id
4183      -- and trt.table_route_id = cpe.table_route_id
4184      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
4185      -- and trt.where_clause = 'BEN_HRS_WKD_IN_PERD_FCTR'
4186      and cpe.table_alias = c_table_alias
4187      and information1 = c_hrs_wkd_in_perd_fctr_id
4188      -- and information4 = p_business_group_id
4189     ;
4190    ---------------------------------------------------------------
4191    -- END OF BEN_HRS_WKD_IN_PERD_FCTR ----------------------
4192    ---------------------------------------------------------------
4193    ---------------------------------------------------------------
4194    -- START OF BEN_LOS_FCTR ----------------------
4195    ---------------------------------------------------------------
4196    cursor c_lsf(c_los_fctr_id number,c_mirror_src_entity_result_id number,
4197                 c_table_alias varchar2 ) is
4198    select  lsf.*
4199    from BEN_LOS_FCTR lsf
4200    where  lsf.los_fctr_id = c_los_fctr_id
4201      -- and lsf.business_group_id = p_business_group_id
4202      and not exists (
4203          select /* */ null
4204          from ben_copy_entity_results cpe
4205               -- pqh_table_route trt
4206          where copy_entity_txn_id = p_copy_entity_txn_id
4207          -- and trt.table_route_id = cpe.table_route_id
4208          and ( -- c_mirror_src_entity_result_id is null or
4209                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
4210          -- and trt.where_clause = 'BEN_LOS_FCTR'
4211          and cpe.table_alias = c_table_alias
4212          and information1 = c_los_fctr_id
4213          -- and information4 = lsf.business_group_id
4214         );
4215     l_los_fctr_id                 number(15);
4216     l_out_lsf_result_id   number(15);
4217    ---------------------------------------------------------------
4218    -- END OF BEN_LOS_FCTR ----------------------
4219    ---------------------------------------------------------------
4220    ---------------------------------------------------------------
4221    -- START OF BEN_PCT_FL_TM_FCTR ----------------------
4222    ---------------------------------------------------------------
4223    cursor c_pff(c_pct_fl_tm_fctr_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
4224    select  pff.*
4225    from BEN_PCT_FL_TM_FCTR pff
4226    where  pff.pct_fl_tm_fctr_id = c_pct_fl_tm_fctr_id
4227      -- and pff.business_group_id = p_business_group_id
4228      and not exists (
4229          select /* */ null
4230          from ben_copy_entity_results cpe
4231               -- pqh_table_route trt
4232          where copy_entity_txn_id = p_copy_entity_txn_id
4233          -- and trt.table_route_id = cpe.table_route_id
4234          and ( -- c_mirror_src_entity_result_id is null or
4235                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
4236          -- and trt.where_clause = 'BEN_PCT_FL_TM_FCTR'
4237          and cpe.table_alias = c_table_alias
4238          and information1 = c_pct_fl_tm_fctr_id
4239          -- and information4 = pff.business_group_id
4240         );
4241     l_pct_fl_tm_fctr_id                 number(15);
4242     l_out_pff_result_id   number(15);
4243    ---------------------------------------------------------------
4244    -- END OF BEN_PCT_FL_TM_FCTR ----------------------
4245    ---------------------------------------------------------------
4246    cursor c_get_defined_bal_name (p_defined_balance_id number) is
4247       select  pbt.balance_name||' - '||pbd.dimension_name dsp_name
4248              -- pdb.defined_balance_id defined_balance_id
4249       from pay_balance_types pbt,
4250            pay_balance_dimensions pbd,
4251            pay_defined_balances pdb
4252       where nvl(pdb.business_group_id, p_business_group_id) = p_business_group_id
4253         and pdb.balance_type_id = pbt.balance_type_id
4254         and pdb.balance_dimension_id = pbd.balance_dimension_id
4255         and pdb.defined_balance_id = p_defined_balance_id ;
4256    --
4257    l_mapping_defined_balance_id  number;
4258    l_mapping_defined_balance_name varchar2(600);
4259    l_mapping_column_name1 pqh_attributes.attribute_name%type;
4260    l_mapping_column_name2 pqh_attributes.attribute_name%type;
4261    l_information172       varchar2(300);
4262    --
4263    /*
4264 -- added by sgoyal
4265     l_mapping_id         number;
4266     l_mapping_name       varchar2(600);
4267     l_mapping_id1        number;
4268     l_mapping_name1      varchar2(600);
4269 -- end addition
4270    */
4271 
4272     cursor c_object_exists(c_pk_id                number,
4273                           c_table_alias          varchar2) is
4274     select null
4275     from ben_copy_entity_results cpe
4276          -- pqh_table_route trt
4277     where copy_entity_txn_id = p_copy_entity_txn_id
4278     -- and trt.table_route_id = cpe.table_route_id
4279     and cpe.table_alias = c_table_alias
4280     and information1 = c_pk_id;
4281 
4282    l_dummy                     varchar2(1);
4283 
4284    begin
4285      hr_utility.set_location('Start create_drpar_results',100);
4286      l_number_of_copies := p_number_of_copies ;
4287 
4288       if p_no_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
4289        ben_plan_design_program_module.g_pdw_allow_dup_rslt := ben_plan_design_program_module.g_pdw_no_dup_rslt;
4290      end if;
4291 
4292      if p_age_fctr_id is not null then
4293 
4294         if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
4295           open c_object_exists(p_age_fctr_id,'AGF');
4296           fetch c_object_exists into l_dummy;
4297           if c_object_exists%found then
4298             close c_object_exists;
4299             return;
4300           end if;
4301           close c_object_exists;
4302         end if;
4303      ---------------------------------------------------------------
4304      -- START OF BEN_AGE_FCTR ----------------------
4305      ---------------------------------------------------------------
4306         --
4307         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
4308         --
4309         l_age_fctr_id :=  p_age_fctr_id ;
4310         --
4311         for l_agf_rec in c_agf(p_age_fctr_id,l_mirror_src_entity_result_id,'AGF') loop
4312           --
4313           l_table_route_id := null ;
4314           open ben_plan_design_program_module.g_table_route('AGF');
4315           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
4316           close ben_plan_design_program_module.g_table_route ;
4317           --
4318           l_information5  := l_agf_rec.name; --'Intersection';
4319           --
4320           l_result_type_cd := 'DISPLAY';
4321           --
4322           l_copy_entity_result_id := null;
4323           l_object_version_number := null;
4324           ben_copy_entity_results_api.create_copy_entity_results(
4325             p_copy_entity_result_id          => l_copy_entity_result_id,
4326             p_copy_entity_txn_id             => p_copy_entity_txn_id,
4327             p_result_type_cd                 => l_result_type_cd,
4328             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
4329             p_parent_entity_result_id        => l_mirror_src_entity_result_id,
4330             p_number_of_copies               => l_number_of_copies,
4331             p_table_route_id                 => l_table_route_id,
4332 	    P_TABLE_ALIAS                    => 'AGF',
4333             p_information1     => l_agf_rec.age_fctr_id,
4334             p_information2     => null,
4335             p_information3     => null,
4336             p_information4     => l_agf_rec.business_group_id,
4337             p_information5     => l_information5 , -- 9999 put name for h-grid
4338 
4339             p_information262     => l_agf_rec.age_calc_rl,
4340             p_information16     => l_agf_rec.age_det_cd,
4341             p_information261     => l_agf_rec.age_det_rl,
4342             p_information14     => l_agf_rec.age_to_use_cd,
4343             p_information15     => l_agf_rec.age_uom,
4344             p_information111     => l_agf_rec.agf_attribute1,
4345             p_information120     => l_agf_rec.agf_attribute10,
4346             p_information121     => l_agf_rec.agf_attribute11,
4347             p_information122     => l_agf_rec.agf_attribute12,
4348             p_information123     => l_agf_rec.agf_attribute13,
4349             p_information124     => l_agf_rec.agf_attribute14,
4350             p_information125     => l_agf_rec.agf_attribute15,
4351             p_information126     => l_agf_rec.agf_attribute16,
4352             p_information127     => l_agf_rec.agf_attribute17,
4353             p_information128     => l_agf_rec.agf_attribute18,
4354             p_information129     => l_agf_rec.agf_attribute19,
4355             p_information112     => l_agf_rec.agf_attribute2,
4356             p_information130     => l_agf_rec.agf_attribute20,
4357             p_information131     => l_agf_rec.agf_attribute21,
4358             p_information132     => l_agf_rec.agf_attribute22,
4359             p_information133     => l_agf_rec.agf_attribute23,
4360             p_information134     => l_agf_rec.agf_attribute24,
4361             p_information135     => l_agf_rec.agf_attribute25,
4362             p_information136     => l_agf_rec.agf_attribute26,
4363             p_information137     => l_agf_rec.agf_attribute27,
4364             p_information138     => l_agf_rec.agf_attribute28,
4365             p_information139     => l_agf_rec.agf_attribute29,
4366             p_information113     => l_agf_rec.agf_attribute3,
4367             p_information140     => l_agf_rec.agf_attribute30,
4368             p_information114     => l_agf_rec.agf_attribute4,
4369             p_information115     => l_agf_rec.agf_attribute5,
4370             p_information116     => l_agf_rec.agf_attribute6,
4371             p_information117     => l_agf_rec.agf_attribute7,
4372             p_information118     => l_agf_rec.agf_attribute8,
4373             p_information119     => l_agf_rec.agf_attribute9,
4374             p_information110     => l_agf_rec.agf_attribute_category,
4375             p_information294     => l_agf_rec.mn_age_num,
4376             p_information293     => l_agf_rec.mx_age_num,
4377             p_information170     => l_agf_rec.name,
4378             p_information11     => l_agf_rec.no_mn_age_flag,
4379             p_information12     => l_agf_rec.no_mx_age_flag,
4380             p_information13     => l_agf_rec.rndg_cd,
4381             p_information257     => l_agf_rec.rndg_rl,
4382             p_information265    => l_agf_rec.object_version_number,
4383 
4384             p_object_version_number          => l_object_version_number,
4385             p_effective_date                 => p_effective_date       );
4386             --
4387 
4388             if l_out_agf_result_id is null then
4389               l_out_agf_result_id := l_copy_entity_result_id;
4390             end if;
4391 
4392             if l_result_type_cd = 'DISPLAY' then
4393                l_out_agf_result_id := l_copy_entity_result_id ;
4394             end if;
4395             --
4396 
4397             ------------------------------------------------------------
4398             --   AGE_CALC_RL                                             ---------------------
4399             ------------------------------------------------------------
4400             --
4401                         if l_agf_rec.age_calc_rl is not null then
4402                             --
4403                                 ben_plan_design_program_module.create_formula_result
4404                                 (
4405                                  p_validate                       =>  0
4406                                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4407                                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4408                                 ,p_formula_id                     =>  l_agf_rec.age_calc_rl
4409                                 ,p_business_group_id              =>  l_agf_rec.business_group_id
4410                                 ,p_number_of_copies               =>  l_number_of_copies
4411                                 ,p_object_version_number          =>  l_object_version_number
4412                                 ,p_effective_date                 =>  p_effective_date
4413                                 );
4414                              --
4415                       end if;
4416                       --
4417 
4418                       ------------------------------------------------------------
4419                         --   AGE_DET_RL --------------------------------------------
4420                         ------------------------------------------------------------
4421                         --
4422                         if l_agf_rec.age_det_rl is not null then
4423                             --
4424                                 ben_plan_design_program_module.create_formula_result
4425                                 (
4426                                  p_validate                       =>  0
4427                                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4428                                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4429                                 ,p_formula_id                     =>  l_agf_rec.age_det_rl
4430                                 ,p_business_group_id              =>  l_agf_rec.business_group_id
4431                                 ,p_number_of_copies               =>  l_number_of_copies
4432                                 ,p_object_version_number          =>  l_object_version_number
4433                                 ,p_effective_date                 =>  p_effective_date
4434                                 );
4435                              --
4436                         end if;
4437                       --
4438 
4439                       ------------------------------------------------------------
4440                         --   RNDG_RL    --------------------------------------------
4441                         ------------------------------------------------------------
4442                         --
4443                         if l_agf_rec.rndg_rl is not null then
4444                             --
4445                                 ben_plan_design_program_module.create_formula_result
4446                                 (
4447                                  p_validate                       =>  0
4448                                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4449                                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4450                                 ,p_formula_id                     =>  l_agf_rec.rndg_rl
4451                                 ,p_business_group_id              =>  l_agf_rec.business_group_id
4452                                 ,p_number_of_copies               =>  l_number_of_copies
4453                                 ,p_object_version_number          =>  l_object_version_number
4454                                 ,p_effective_date                 =>  p_effective_date
4455                                 );
4456                              --
4457                         end if;
4458                       --
4459 
4460          end loop;
4461          --
4462     ---------------------------------------------------------------
4463     -- END OF BEN_AGE_FCTR ----------------------
4464     ---------------------------------------------------------------
4465     end if;
4466     if p_cmbn_age_los_fctr_id is not null then
4467 
4468         if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
4469           open c_object_exists(p_cmbn_age_los_fctr_id,'CLA');
4470           fetch c_object_exists into l_dummy;
4471           if c_object_exists%found then
4472             close c_object_exists;
4473             return;
4474           end if;
4475           close c_object_exists;
4476         end if;
4477      ---------------------------------------------------------------
4478      -- START OF BEN_CMBN_AGE_LOS_FCTR ----------------------
4479      ---------------------------------------------------------------
4480         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
4481         --
4482         l_cmbn_age_los_fctr_id := p_cmbn_age_los_fctr_id ;
4483         --
4484         for l_cla_rec in c_cla(p_cmbn_age_los_fctr_id,l_mirror_src_entity_result_id,'CLA') loop
4485           --
4486           l_table_route_id := null ;
4487           open ben_plan_design_program_module.g_table_route('CLA');
4488           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
4489           close ben_plan_design_program_module.g_table_route ;
4490           --
4491           l_information5  := l_cla_rec.name; --'Intersection';
4492           --
4493           l_result_type_cd := 'DISPLAY';
4494             --
4495           l_copy_entity_result_id := null;
4496           l_object_version_number := null;
4497           ben_copy_entity_results_api.create_copy_entity_results(
4498             p_copy_entity_result_id          => l_copy_entity_result_id,
4499             p_copy_entity_txn_id             => p_copy_entity_txn_id,
4500             p_result_type_cd                 => l_result_type_cd,
4501             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
4502             p_parent_entity_result_id        => l_mirror_src_entity_result_id,
4503             p_number_of_copies               => l_number_of_copies,
4504             p_table_route_id                 => l_table_route_id,
4505 	    P_TABLE_ALIAS                    => 'CLA',
4506             p_information1     => l_cla_rec.cmbn_age_los_fctr_id,
4507             p_information2     => null,
4508             p_information3     => null,
4509             p_information4     => l_cla_rec.business_group_id,
4510             p_information5     => l_information5 , -- 9999 put name for h-grid
4511             p_information246     => l_cla_rec.age_fctr_id,
4512             p_information111     => l_cla_rec.cla_attribute1,
4513             p_information120     => l_cla_rec.cla_attribute10,
4514             p_information121     => l_cla_rec.cla_attribute11,
4515             p_information122     => l_cla_rec.cla_attribute12,
4516             p_information123     => l_cla_rec.cla_attribute13,
4517             p_information124     => l_cla_rec.cla_attribute14,
4518             p_information125     => l_cla_rec.cla_attribute15,
4519             p_information126     => l_cla_rec.cla_attribute16,
4520             p_information127     => l_cla_rec.cla_attribute17,
4521             p_information128     => l_cla_rec.cla_attribute18,
4522             p_information129     => l_cla_rec.cla_attribute19,
4523             p_information112     => l_cla_rec.cla_attribute2,
4524             p_information130     => l_cla_rec.cla_attribute20,
4525             p_information131     => l_cla_rec.cla_attribute21,
4526             p_information132     => l_cla_rec.cla_attribute22,
4527             p_information133     => l_cla_rec.cla_attribute23,
4528             p_information134     => l_cla_rec.cla_attribute24,
4529             p_information135     => l_cla_rec.cla_attribute25,
4530             p_information136     => l_cla_rec.cla_attribute26,
4531             p_information137     => l_cla_rec.cla_attribute27,
4532             p_information138     => l_cla_rec.cla_attribute28,
4533             p_information139     => l_cla_rec.cla_attribute29,
4534             p_information113     => l_cla_rec.cla_attribute3,
4535             p_information140     => l_cla_rec.cla_attribute30,
4536             p_information114     => l_cla_rec.cla_attribute4,
4537             p_information115     => l_cla_rec.cla_attribute5,
4538             p_information116     => l_cla_rec.cla_attribute6,
4539             p_information117     => l_cla_rec.cla_attribute7,
4540             p_information118     => l_cla_rec.cla_attribute8,
4541             p_information119     => l_cla_rec.cla_attribute9,
4542             p_information110     => l_cla_rec.cla_attribute_category,
4543             p_information294     => l_cla_rec.cmbnd_max_val,
4544             p_information293     => l_cla_rec.cmbnd_min_val,
4545             p_information243     => l_cla_rec.los_fctr_id,
4546             p_information170     => l_cla_rec.name,
4547             p_information260     => l_cla_rec.ordr_num,
4548             p_information265     => l_cla_rec.object_version_number,
4549 
4550             p_object_version_number          => l_object_version_number,
4551             p_effective_date                 => p_effective_date       );
4552             --
4553 
4554             if l_out_cla_result_id is null then
4555               l_out_cla_result_id := l_copy_entity_result_id;
4556             end if;
4557 
4558             if l_result_type_cd = 'DISPLAY' then
4559                l_out_cla_result_id := l_copy_entity_result_id ;
4560             end if;
4561             --
4562 
4563             -- Bug 2884982 - Copy Age factor and Los factor rows
4564             -- when copying Combined Age Los factor
4565             if l_cla_rec.los_fctr_id is not null then
4566               --
4567                 create_drpar_results
4568                  (
4569                    p_validate                      => p_validate
4570                   ,p_copy_entity_result_id         => l_copy_entity_result_id
4571                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
4572                   ,p_comp_lvl_fctr_id              => null
4573                   ,p_hrs_wkd_in_perd_fctr_id       => null
4574                   ,p_los_fctr_id                   => l_cla_rec.los_fctr_id
4575                   ,p_pct_fl_tm_fctr_id             => null
4576                   ,p_age_fctr_id                   => null
4577                   ,p_cmbn_age_los_fctr_id          => null
4578                   ,p_business_group_id             => p_business_group_id
4579                   ,p_number_of_copies              => p_number_of_copies
4580                   ,p_object_version_number         => l_object_version_number
4581                   ,p_effective_date                => p_effective_date
4582                  );
4583               --
4584               end if;
4585 
4586               if l_cla_rec.age_fctr_id is not null then
4587               --
4588                 create_drpar_results
4589                  (
4590                    p_validate                      => p_validate
4591                   ,p_copy_entity_result_id         => l_copy_entity_result_id
4592                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
4593                   ,p_comp_lvl_fctr_id              => null
4594                   ,p_hrs_wkd_in_perd_fctr_id       => null
4595                   ,p_los_fctr_id                   => null
4596                   ,p_pct_fl_tm_fctr_id             => null
4597                   ,p_age_fctr_id                   => l_cla_rec.age_fctr_id
4598                   ,p_cmbn_age_los_fctr_id          => null
4599                   ,p_business_group_id             => p_business_group_id
4600                   ,p_number_of_copies              => p_number_of_copies
4601                   ,p_object_version_number         => l_object_version_number
4602                   ,p_effective_date                => p_effective_date
4603                  );
4604               --
4605               end if;
4606          end loop;
4607          --
4608     ---------------------------------------------------------------
4609     -- END OF BEN_CMBN_AGE_LOS_FCTR ----------------------
4610     ---------------------------------------------------------------
4611     end if;
4612     if p_comp_lvl_fctr_id is not null then
4613 
4614         if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
4615           open c_object_exists(p_comp_lvl_fctr_id,'CLF');
4616           fetch c_object_exists into l_dummy;
4617           if c_object_exists%found then
4618             close c_object_exists;
4619             return;
4620           end if;
4621           close c_object_exists;
4622         end if;
4623      ---------------------------------------------------------------
4624      -- START OF BEN_COMP_LVL_FCTR ----------------------
4625      ---------------------------------------------------------------
4626      --
4627         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
4628         --
4629         l_comp_lvl_fctr_id := p_comp_lvl_fctr_id ;
4630         --
4631         for l_clf_rec in c_clf(p_comp_lvl_fctr_id,l_mirror_src_entity_result_id,'CLF') loop
4632           --
4633           l_table_route_id := null ;
4634           open ben_plan_design_program_module.g_table_route('CLF');
4635           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
4636           close ben_plan_design_program_module.g_table_route ;
4637           --
4638           l_information5  := l_clf_rec.name; --'Intersection';
4639           --
4640           l_result_type_cd := 'DISPLAY';
4641             --
4642           l_copy_entity_result_id := null;
4643           l_object_version_number := null;
4644           --
4645           -- MAPPING DATA : Store the mapping column information.
4646           --
4647           l_mapping_defined_balance_name := null;
4648           l_mapping_defined_balance_id   := null;
4649           if l_clf_rec.defined_balance_id is not null then
4650              --
4651              -- Get the defined balance name to display on mapping page.
4652              --
4653              open c_get_defined_bal_name(l_clf_rec.defined_balance_id);
4654              fetch c_get_defined_bal_name into l_mapping_defined_balance_name;
4655              close c_get_defined_bal_name;
4656              --
4657              l_mapping_defined_balance_id   := l_clf_rec.defined_balance_id;
4658              --
4659              --To set user friendly labels on the mapping page
4660              --
4661              l_mapping_column_name1 := null;
4662              l_mapping_column_name2 :=null;
4663              BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
4664                                                               l_mapping_column_name1,
4665                                                               l_mapping_column_name2,
4666                                                               p_copy_entity_txn_id);
4667              --
4668           end if;
4669           --
4670 
4671           --
4672           -- To pass parent record's effective_start_date
4673           -- as p_effective_date while creating the
4674           -- non date-tracked child records
4675 
4676           l_bnb_bnfts_bal_esd := null;
4677 
4678           if l_clf_rec.bnfts_bal_id is not null then
4679             open c_parent_esd(l_clf_rec.bnfts_bal_id,'BNB',p_copy_entity_txn_id);
4680             fetch c_parent_esd into l_bnb_bnfts_bal_esd;
4681             close c_parent_esd;
4682           end if;
4683             --
4684           ben_copy_entity_results_api.create_copy_entity_results(
4685             p_copy_entity_result_id          => l_copy_entity_result_id,
4686             p_copy_entity_txn_id             => p_copy_entity_txn_id,
4687             p_result_type_cd                 => l_result_type_cd,
4688             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
4689             p_parent_entity_result_id        => l_mirror_src_entity_result_id,
4690             p_number_of_copies               => l_number_of_copies,
4691             p_table_route_id                 => l_table_route_id,
4692 	    P_TABLE_ALIAS                    => 'CLF',
4693             p_information1     => l_clf_rec.comp_lvl_fctr_id,
4694             p_information2     => null,
4695             p_information3     => null,
4696             p_information4     => l_clf_rec.business_group_id,
4697             p_information5     => l_information5 , -- 9999 put name for h-grid
4698             p_information10     => l_bnb_bnfts_bal_esd,
4699             p_information225     => l_clf_rec.bnfts_bal_id,
4700             p_information111     => l_clf_rec.clf_attribute1,
4701             p_information120     => l_clf_rec.clf_attribute10,
4702             p_information121     => l_clf_rec.clf_attribute11,
4703             p_information122     => l_clf_rec.clf_attribute12,
4704             p_information123     => l_clf_rec.clf_attribute13,
4705             p_information124     => l_clf_rec.clf_attribute14,
4706             p_information125     => l_clf_rec.clf_attribute15,
4707             p_information126     => l_clf_rec.clf_attribute16,
4708             p_information127     => l_clf_rec.clf_attribute17,
4709             p_information128     => l_clf_rec.clf_attribute18,
4710             p_information129     => l_clf_rec.clf_attribute19,
4711             p_information112     => l_clf_rec.clf_attribute2,
4712             p_information130     => l_clf_rec.clf_attribute20,
4713             p_information131     => l_clf_rec.clf_attribute21,
4714             p_information132     => l_clf_rec.clf_attribute22,
4715             p_information133     => l_clf_rec.clf_attribute23,
4716             p_information134     => l_clf_rec.clf_attribute24,
4717             p_information135     => l_clf_rec.clf_attribute25,
4718             p_information136     => l_clf_rec.clf_attribute26,
4719             p_information137     => l_clf_rec.clf_attribute27,
4720             p_information138     => l_clf_rec.clf_attribute28,
4721             p_information139     => l_clf_rec.clf_attribute29,
4722             p_information113     => l_clf_rec.clf_attribute3,
4723             p_information140     => l_clf_rec.clf_attribute30,
4724             p_information114     => l_clf_rec.clf_attribute4,
4725             p_information115     => l_clf_rec.clf_attribute5,
4726             p_information116     => l_clf_rec.clf_attribute6,
4727             p_information117     => l_clf_rec.clf_attribute7,
4728             p_information118     => l_clf_rec.clf_attribute8,
4729             p_information119     => l_clf_rec.clf_attribute9,
4730             p_information110     => l_clf_rec.clf_attribute_category,
4731             p_information11     => l_clf_rec.comp_alt_val_to_use_cd,
4732             p_information262     => l_clf_rec.comp_calc_rl,
4733             p_information18     => l_clf_rec.comp_lvl_det_cd,
4734             p_information257     => l_clf_rec.comp_lvl_det_rl,
4735             p_information15     => l_clf_rec.comp_lvl_uom,
4736             p_information16     => l_clf_rec.comp_src_cd,
4737             -- Data for MAPPING columns.
4738             p_information173    => l_mapping_defined_balance_name,
4739             p_information174    => l_mapping_defined_balance_id,
4740             p_information181    => l_mapping_column_name1,
4741             p_information182    => l_mapping_column_name2,
4742             -- END other product Mapping columns.
4743             p_information294     => l_clf_rec.mn_comp_val,
4744             p_information293     => l_clf_rec.mx_comp_val,
4745             p_information170     => l_clf_rec.name,
4746             p_information13     => l_clf_rec.no_mn_comp_flag,
4747             p_information12     => l_clf_rec.no_mx_comp_flag,
4748             p_information14     => l_clf_rec.rndg_cd,
4749             p_information258     => l_clf_rec.rndg_rl,
4750             p_information17     => l_clf_rec.sttd_sal_prdcty_cd,
4751             p_information166    => NULL,  -- No ESD for Defined Balance
4752             p_information265    => l_clf_rec.object_version_number,
4753 	    p_INFORMATION20      => l_clf_rec.proration_flag,
4754 	    p_INFORMATION21	 => l_clf_rec.start_day_mo,
4755 	    p_INFORMATION22	 => l_clf_rec.end_day_mo,
4756 	    p_INFORMATION23      => l_clf_rec.start_year,
4757 	    p_INFORMATION24      => l_clf_rec.end_year,
4758 
4759             p_object_version_number          => l_object_version_number,
4760             p_effective_date                 => p_effective_date       );
4761             --
4762 
4763             if l_out_clf_result_id is null then
4764               l_out_clf_result_id := l_copy_entity_result_id;
4765             end if;
4766 
4767             if l_result_type_cd = 'DISPLAY' then
4768                l_out_clf_result_id := l_copy_entity_result_id ;
4769             end if;
4770             --
4771 
4772             -- If there are any Fast Formulas attached to any Columns
4773             -- copy them also
4774             -------------------------------------------------------
4775             -- COMP_CALC_RL ----------
4776             -------------------------------------------------------
4777             --
4778                         if l_clf_rec.comp_calc_rl is not null then
4779                             --
4780                                 ben_plan_design_program_module.create_formula_result
4781                                 (
4782                                  p_validate                       =>  0
4783                                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4784                                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4785                                 ,p_formula_id                     =>  l_clf_rec.comp_calc_rl
4786                                 ,p_business_group_id              =>  l_clf_rec.business_group_id
4787                                 ,p_number_of_copies               =>  l_number_of_copies
4788                                 ,p_object_version_number          =>  l_object_version_number
4789                                 ,p_effective_date                 =>  p_effective_date
4790                                 );
4791                              --
4792                         end if;
4793                 --
4794 
4795             -------------------------------------------------------
4796                         -- COMP_LVL_DET_RL
4797                         -------------------------------------------------------
4798                         --
4799                         if l_clf_rec.comp_lvl_det_rl is not null then
4800                             --
4801                                 ben_plan_design_program_module.create_formula_result
4802                                 (
4803                                  p_validate                       =>  0
4804                                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4805                                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4806                                 ,p_formula_id                     =>  l_clf_rec.comp_lvl_det_rl
4807                                 ,p_business_group_id              =>  l_clf_rec.business_group_id
4808                                 ,p_number_of_copies               =>  l_number_of_copies
4809                                 ,p_object_version_number          =>  l_object_version_number
4810                                 ,p_effective_date                 =>  p_effective_date
4811                                 );
4812                              --
4813                         end if;
4814                 --
4815 
4816                         -------------------------------------------------------
4817                         -- RNDG_RL
4818                         -------------------------------------------------------
4819                         --
4820                         if l_clf_rec.rndg_rl is not null then
4821                             --
4822                                 ben_plan_design_program_module.create_formula_result
4823                                 (
4824                                  p_validate                       =>  0
4825                                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4826                                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4827                                 ,p_formula_id                     =>  l_clf_rec.rndg_rl
4828                                 ,p_business_group_id              =>  l_clf_rec.business_group_id
4829                                 ,p_number_of_copies               =>  l_number_of_copies
4830                                 ,p_object_version_number          =>  l_object_version_number
4831                                 ,p_effective_date                 =>  p_effective_date
4832                                 );
4833                              --
4834                         end if;
4835                 --
4836 
4837          end loop;
4838          --
4839          for l_clf_rec in c_clf_drp(p_comp_lvl_fctr_id,l_mirror_src_entity_result_id,'CLF') loop
4840                 ben_pd_rate_and_cvg_module.create_bnft_bal_results
4841                    (
4842                     p_validate                     => p_validate
4843                    ,p_copy_entity_result_id        => l_out_clf_result_id
4844                    ,p_copy_entity_txn_id           => p_copy_entity_txn_id
4845                    ,p_bnfts_bal_id                 => l_clf_rec.bnfts_bal_id
4846                    ,p_business_group_id            => p_business_group_id
4847                    ,p_number_of_copies             => p_number_of_copies
4848                    ,p_object_version_number        => l_object_version_number
4849                    ,p_effective_date               => p_effective_date
4850                    );
4851          end loop;
4852     ---------------------------------------------------------------
4853     -- END OF BEN_COMP_LVL_FCTR ----------------------
4854     ---------------------------------------------------------------
4855     end if;
4856     --
4857     if p_hrs_wkd_in_perd_fctr_id is not null then
4858 
4859         if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
4860           open c_object_exists(p_hrs_wkd_in_perd_fctr_id,'HWF');
4861           fetch c_object_exists into l_dummy;
4862           if c_object_exists%found then
4863             close c_object_exists;
4864             return;
4865           end if;
4866           close c_object_exists;
4867         end if;
4868      ---------------------------------------------------------------
4869      -- START OF BEN_HRS_WKD_IN_PERD_FCTR ----------------------
4870      ---------------------------------------------------------------
4871         --
4872         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
4873         --
4874         l_hrs_wkd_in_perd_fctr_id := p_hrs_wkd_in_perd_fctr_id ;
4875         --
4876         for l_hwf_rec in c_hwf(p_hrs_wkd_in_perd_fctr_id,
4877                                l_mirror_src_entity_result_id,'HWF') loop
4878           --
4879           l_table_route_id := null ;
4880           open ben_plan_design_program_module.g_table_route('HWF');
4881           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
4882           close ben_plan_design_program_module.g_table_route ;
4883           --
4884           l_information5  := l_hwf_rec.name; --'Intersection';
4885           --
4886           l_result_type_cd := 'DISPLAY';
4887             --
4888           l_copy_entity_result_id := null;
4889           l_object_version_number := null;
4890           --
4891           if l_hwf_rec.defined_balance_id is not null then
4892              --
4893              -- Get the defined balance name to display on mapping page.
4894              --
4895              open c_get_defined_bal_name(l_hwf_rec.defined_balance_id);
4896              fetch c_get_defined_bal_name into l_mapping_defined_balance_name;
4897              close c_get_defined_bal_name;
4898              --
4899              l_mapping_defined_balance_id   := l_hwf_rec.defined_balance_id;
4900              --
4901              --To set user friendly labels on the mapping page
4902              --
4903              l_mapping_column_name1 := null;
4904              l_mapping_column_name2 :=null;
4905              BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
4906                                                               l_mapping_column_name1,
4907                                                               l_mapping_column_name2,
4908                                                               p_copy_entity_txn_id);
4909              --
4910           end if;
4911           --
4912 
4913           --
4914           -- To pass parent record's effective_start_date
4915           -- as p_effective_date while creating the
4916           -- non date-tracked child records
4917 
4918           l_bnb_bnfts_bal_esd := null;
4919 
4920           if l_hwf_rec.bnfts_bal_id is not null then
4921             open c_parent_esd(l_hwf_rec.bnfts_bal_id,'BNB',p_copy_entity_txn_id);
4922             fetch c_parent_esd into l_bnb_bnfts_bal_esd;
4923             close c_parent_esd;
4924           end if;
4925 
4926           ben_copy_entity_results_api.create_copy_entity_results(
4927             p_copy_entity_result_id          => l_copy_entity_result_id,
4928             p_copy_entity_txn_id             => p_copy_entity_txn_id,
4929             p_result_type_cd                 => l_result_type_cd,
4930             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
4931             p_parent_entity_result_id        => l_mirror_src_entity_result_id,
4932             p_number_of_copies               => l_number_of_copies,
4933             p_table_route_id                 => l_table_route_id,
4934 	    P_TABLE_ALIAS                    => 'HWF',
4935             p_information1     => l_hwf_rec.hrs_wkd_in_perd_fctr_id,
4936             p_information2     => null,
4937             p_information3     => null,
4938             p_information4     => l_hwf_rec.business_group_id,
4939             p_information5     => l_information5 , -- 9999 put name for h-grid
4940 
4941             p_information10     => l_bnb_bnfts_bal_esd,
4942             p_information225     => l_hwf_rec.bnfts_bal_id,
4943             -- Data for MAPPING columns.
4944             p_information173    => l_mapping_defined_balance_name,
4945             p_information174    => l_mapping_defined_balance_id,
4946             p_information181    => l_mapping_column_name1,
4947             p_information182    => l_mapping_column_name2,
4948             -- END other product Mapping columns.
4949             p_information18     => l_hwf_rec.hrs_alt_val_to_use_cd,
4950             p_information13     => l_hwf_rec.hrs_src_cd,
4951             p_information17     => l_hwf_rec.hrs_wkd_bndry_perd_cd,
4952             p_information257     => l_hwf_rec.hrs_wkd_calc_rl,
4953             p_information15     => l_hwf_rec.hrs_wkd_det_cd,
4954             p_information258     => l_hwf_rec.hrs_wkd_det_rl,
4955             p_information111     => l_hwf_rec.hwf_attribute1,
4956             p_information120     => l_hwf_rec.hwf_attribute10,
4957             p_information121     => l_hwf_rec.hwf_attribute11,
4958             p_information122     => l_hwf_rec.hwf_attribute12,
4959             p_information123     => l_hwf_rec.hwf_attribute13,
4960             p_information124     => l_hwf_rec.hwf_attribute14,
4961             p_information125     => l_hwf_rec.hwf_attribute15,
4962             p_information126     => l_hwf_rec.hwf_attribute16,
4963             p_information127     => l_hwf_rec.hwf_attribute17,
4964             p_information128     => l_hwf_rec.hwf_attribute18,
4965             p_information129     => l_hwf_rec.hwf_attribute19,
4966             p_information112     => l_hwf_rec.hwf_attribute2,
4967             p_information130     => l_hwf_rec.hwf_attribute20,
4968             p_information131     => l_hwf_rec.hwf_attribute21,
4969             p_information132     => l_hwf_rec.hwf_attribute22,
4970             p_information133     => l_hwf_rec.hwf_attribute23,
4971             p_information134     => l_hwf_rec.hwf_attribute24,
4972             p_information135     => l_hwf_rec.hwf_attribute25,
4973             p_information136     => l_hwf_rec.hwf_attribute26,
4974             p_information137     => l_hwf_rec.hwf_attribute27,
4975             p_information138     => l_hwf_rec.hwf_attribute28,
4976             p_information139     => l_hwf_rec.hwf_attribute29,
4977             p_information113     => l_hwf_rec.hwf_attribute3,
4978             p_information140     => l_hwf_rec.hwf_attribute30,
4979             p_information114     => l_hwf_rec.hwf_attribute4,
4980             p_information115     => l_hwf_rec.hwf_attribute5,
4981             p_information116     => l_hwf_rec.hwf_attribute6,
4982             p_information117     => l_hwf_rec.hwf_attribute7,
4983             p_information118     => l_hwf_rec.hwf_attribute8,
4984             p_information119     => l_hwf_rec.hwf_attribute9,
4985             p_information110     => l_hwf_rec.hwf_attribute_category,
4986             p_information293     => l_hwf_rec.mn_hrs_num,
4987             p_information294     => l_hwf_rec.mx_hrs_num,
4988             p_information170     => l_hwf_rec.name,
4989             p_information11     => l_hwf_rec.no_mn_hrs_wkd_flag,
4990             p_information19     => l_hwf_rec.no_mx_hrs_wkd_flag,
4991             p_information16     => l_hwf_rec.once_r_cntug_cd,
4992             p_information12     => l_hwf_rec.pyrl_freq_cd,
4993             p_information14     => l_hwf_rec.rndg_cd,
4994             p_information259     => l_hwf_rec.rndg_rl,
4995             p_information166    => NULL,  -- No ESD for Defined Balance
4996             p_information265    => l_hwf_rec.object_version_number,
4997            --
4998 
4999             p_object_version_number          => l_object_version_number,
5000             p_effective_date                 => p_effective_date       );
5001             --
5002 
5003             if l_out_hwf_result_id is null then
5004               l_out_hwf_result_id := l_copy_entity_result_id;
5005             end if;
5006 
5007             if l_result_type_cd = 'DISPLAY' then
5008                l_out_hwf_result_id := l_copy_entity_result_id ;
5009             end if;
5010             --
5011 
5012             -- Copy Fast Formulas also if they are attached to any columns --
5013 
5014 
5015             ---------------------------------------------------------------
5016             -- HRS_WKD_CALC_RL -----------------
5017             ---------------------------------------------------------------
5018 
5019             if l_hwf_rec.hrs_wkd_calc_rl is not null then
5020                 --
5021                 ben_plan_design_program_module.create_formula_result
5022                 (
5023                  p_validate                       =>  0
5024                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
5025                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
5026                 ,p_formula_id                     =>  l_hwf_rec.hrs_wkd_calc_rl
5027                 ,p_business_group_id              =>  l_hwf_rec.business_group_id
5028                 ,p_number_of_copies               =>  l_number_of_copies
5029                 ,p_object_version_number          =>  l_object_version_number
5030                 ,p_effective_date                 =>  p_effective_date
5031                 );
5032 
5033                 --
5034             end if;
5035 
5036             ---------------------------------------------------------------
5037             -- HRS_WKD_DET_RL -----------------
5038             ---------------------------------------------------------------
5039 
5040             if l_hwf_rec.hrs_wkd_det_rl is not null then
5041                 --
5042                 ben_plan_design_program_module.create_formula_result
5043                 (
5044                 p_validate                       =>  0
5045                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
5046                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
5047                 ,p_formula_id                     =>  l_hwf_rec.hrs_wkd_det_rl
5048                 ,p_business_group_id              =>  l_hwf_rec.business_group_id
5049                 ,p_number_of_copies               =>  l_number_of_copies
5050                 ,p_object_version_number          =>  l_object_version_number
5051                 ,p_effective_date                 =>  p_effective_date
5052                 );
5053 
5054                 --
5055             end if;
5056 
5057             ---------------------------------------------------------------
5058             -- RNDG_RL -----------------
5059             ---------------------------------------------------------------
5060             if l_hwf_rec.rndg_rl is not null then
5061                 --
5062                 ben_plan_design_program_module.create_formula_result
5063                 (
5064                 p_validate                       =>  0
5065                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
5066                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
5067                 ,p_formula_id                     =>  l_hwf_rec.rndg_rl
5068                 ,p_business_group_id              =>  l_hwf_rec.business_group_id
5069                 ,p_number_of_copies               =>  l_number_of_copies
5070                 ,p_object_version_number          =>  l_object_version_number
5071                 ,p_effective_date                 =>  p_effective_date
5072                 );
5073 
5074                 --
5075             end if;
5076 
5077          end loop;
5078          --
5079          for l_hwf_rec in c_hwf_drp(p_hrs_wkd_in_perd_fctr_id,l_mirror_src_entity_result_id,'HWF') loop
5080                 ben_pd_rate_and_cvg_module.create_bnft_bal_results
5081                    (
5082                     p_validate                     => p_validate
5083                    ,p_copy_entity_result_id        => l_out_hwf_result_id
5084                    ,p_copy_entity_txn_id           => p_copy_entity_txn_id
5085                    ,p_bnfts_bal_id                 => l_hwf_rec.bnfts_bal_id
5086                    ,p_business_group_id            => p_business_group_id
5087                    ,p_number_of_copies             => p_number_of_copies
5088                    ,p_object_version_number        => l_object_version_number
5089                    ,p_effective_date               => p_effective_date
5090                    );
5091          end loop;
5092     ---------------------------------------------------------------
5093     -- END OF BEN_HRS_WKD_IN_PERD_FCTR ----------------------
5094     ---------------------------------------------------------------
5095     end if;
5096     --
5097     if p_los_fctr_id is not null then
5098 
5099         if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
5100           open c_object_exists(p_los_fctr_id,'LSF');
5101           fetch c_object_exists into l_dummy;
5102           if c_object_exists%found then
5103             close c_object_exists;
5104             return;
5105           end if;
5106           close c_object_exists;
5107         end if;
5108      ---------------------------------------------------------------
5109      -- START OF BEN_LOS_FCTR ----------------------
5110      ---------------------------------------------------------------
5111         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
5112         --
5113         l_los_fctr_id := p_los_fctr_id ;
5114         --
5115         for l_lsf_rec in c_lsf(p_los_fctr_id,l_mirror_src_entity_result_id,'LSF') loop
5116           --
5117           l_table_route_id := null ;
5118           open ben_plan_design_program_module.g_table_route('LSF');
5119           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
5120           close ben_plan_design_program_module.g_table_route ;
5121           --
5122           l_information5  := l_lsf_rec.name; --'Intersection';
5123           --
5124           l_result_type_cd := 'DISPLAY';
5125             --
5126           l_copy_entity_result_id := null;
5127           l_object_version_number := null;
5128           ben_copy_entity_results_api.create_copy_entity_results(
5129             p_copy_entity_result_id          => l_copy_entity_result_id,
5130             p_copy_entity_txn_id             => p_copy_entity_txn_id,
5131             p_result_type_cd                 => l_result_type_cd,
5132             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
5133             p_parent_entity_result_id        => l_mirror_src_entity_result_id,
5134             p_number_of_copies               => l_number_of_copies,
5135             p_table_route_id                 => l_table_route_id,
5136 	    P_TABLE_ALIAS                    => 'LSF',
5137             p_information1     => l_lsf_rec.los_fctr_id,
5138             p_information2     => null,
5139             p_information3     => null,
5140             p_information4     => l_lsf_rec.business_group_id,
5141             p_information5     => l_information5 , -- 9999 put name for h-grid
5142             p_information18     => l_lsf_rec.hrs_alt_val_to_use_cd,
5143             p_information19     => l_lsf_rec.los_alt_val_to_use_cd,
5144             p_information263     => l_lsf_rec.los_calc_rl,
5145             p_information15     => l_lsf_rec.los_det_cd,
5146             p_information257     => l_lsf_rec.los_det_rl,
5147             p_information14     => l_lsf_rec.los_dt_to_use_cd,
5148             p_information258     => l_lsf_rec.los_dt_to_use_rl,
5149             p_information17     => l_lsf_rec.los_uom,
5150             p_information111     => l_lsf_rec.lsf_attribute1,
5151             p_information120     => l_lsf_rec.lsf_attribute10,
5152             p_information121     => l_lsf_rec.lsf_attribute11,
5153             p_information122     => l_lsf_rec.lsf_attribute12,
5154             p_information123     => l_lsf_rec.lsf_attribute13,
5155             p_information124     => l_lsf_rec.lsf_attribute14,
5156             p_information125     => l_lsf_rec.lsf_attribute15,
5157             p_information126     => l_lsf_rec.lsf_attribute16,
5158             p_information127     => l_lsf_rec.lsf_attribute17,
5159             p_information128     => l_lsf_rec.lsf_attribute18,
5160             p_information129     => l_lsf_rec.lsf_attribute19,
5161             p_information112     => l_lsf_rec.lsf_attribute2,
5162             p_information130     => l_lsf_rec.lsf_attribute20,
5163             p_information131     => l_lsf_rec.lsf_attribute21,
5164             p_information132     => l_lsf_rec.lsf_attribute22,
5165             p_information133     => l_lsf_rec.lsf_attribute23,
5166             p_information134     => l_lsf_rec.lsf_attribute24,
5167             p_information135     => l_lsf_rec.lsf_attribute25,
5168             p_information136     => l_lsf_rec.lsf_attribute26,
5169             p_information137     => l_lsf_rec.lsf_attribute27,
5170             p_information138     => l_lsf_rec.lsf_attribute28,
5171             p_information139     => l_lsf_rec.lsf_attribute29,
5172             p_information113     => l_lsf_rec.lsf_attribute3,
5173             p_information140     => l_lsf_rec.lsf_attribute30,
5174             p_information114     => l_lsf_rec.lsf_attribute4,
5175             p_information115     => l_lsf_rec.lsf_attribute5,
5176             p_information116     => l_lsf_rec.lsf_attribute6,
5177             p_information117     => l_lsf_rec.lsf_attribute7,
5178             p_information118     => l_lsf_rec.lsf_attribute8,
5179             p_information119     => l_lsf_rec.lsf_attribute9,
5180             p_information110     => l_lsf_rec.lsf_attribute_category,
5181             p_information293     => l_lsf_rec.mn_los_num,
5182             p_information294     => l_lsf_rec.mx_los_num,
5183             p_information170     => l_lsf_rec.name,
5184             p_information13     => l_lsf_rec.no_mn_los_num_apls_flag,
5185             p_information12     => l_lsf_rec.no_mx_los_num_apls_flag,
5186             p_information16     => l_lsf_rec.rndg_cd,
5187             p_information259     => l_lsf_rec.rndg_rl,
5188             p_information11     => l_lsf_rec.use_overid_svc_dt_flag,
5189             p_information265    => l_lsf_rec.object_version_number,
5190            --
5191 
5192             p_object_version_number          => l_object_version_number,
5193             p_effective_date                 => p_effective_date       );
5194             --
5195 
5196             if l_out_lsf_result_id is null then
5197               l_out_lsf_result_id := l_copy_entity_result_id;
5198             end if;
5199 
5200             if l_result_type_cd = 'DISPLAY' then
5201                l_out_lsf_result_id := l_copy_entity_result_id ;
5202             end if;
5203             --
5204 
5205             -- Copy Fast Formulas if they are attached to any column
5206 
5207             ---------------------------------------------------------------
5208             -- LOS_CALC_RL ------
5209             ---------------------------------------------------------------
5210             if l_lsf_rec.los_calc_rl is not null then
5211                 --
5212                 ben_plan_design_program_module.create_formula_result
5213                 (
5214                  p_validate                       =>  0
5215                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
5216                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
5217                 ,p_formula_id                     =>  l_lsf_rec.los_calc_rl
5218                 ,p_business_group_id              =>  l_lsf_rec.business_group_id
5219                 ,p_number_of_copies               =>  l_number_of_copies
5220                 ,p_object_version_number          =>  l_object_version_number
5221                 ,p_effective_date                 =>  p_effective_date
5222                 );
5223 
5224                 --
5225             end if;
5226 
5227             ---------------------------------------------------------------
5228             -- LOS_DET_RL ------
5229             ---------------------------------------------------------------
5230             if l_lsf_rec.los_det_rl is not null then
5231                 --
5232                 ben_plan_design_program_module.create_formula_result
5233                 (
5234                  p_validate                       =>  0
5235                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
5236                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
5237                 ,p_formula_id                     =>  l_lsf_rec.los_det_rl
5238                 ,p_business_group_id              =>  l_lsf_rec.business_group_id
5239                 ,p_number_of_copies               =>  l_number_of_copies
5240                 ,p_object_version_number          =>  l_object_version_number
5241                 ,p_effective_date                 =>  p_effective_date
5242                 );
5243 
5244                 --
5245             end if;
5246 
5247 
5248             ---------------------------------------------------------------
5249             -- LOS_DT_TO_USE_RL ------
5250             ---------------------------------------------------------------
5251             if l_lsf_rec.los_dt_to_use_rl is not null then
5252                 --
5253                 ben_plan_design_program_module.create_formula_result
5254                 (
5255                  p_validate                       =>  0
5256                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
5257                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
5258                 ,p_formula_id                     =>  l_lsf_rec.los_dt_to_use_rl
5259                 ,p_business_group_id              =>  l_lsf_rec.business_group_id
5260                 ,p_number_of_copies               =>  l_number_of_copies
5261                 ,p_object_version_number          =>  l_object_version_number
5262                 ,p_effective_date                 =>  p_effective_date
5263                 );
5264 
5265                 --
5266             end if;
5267 
5268             ---------------------------------------------------------------
5269             -- RNDG_RL ------
5270             ---------------------------------------------------------------
5271             if l_lsf_rec.rndg_rl is not null then
5272                 --
5273                 ben_plan_design_program_module.create_formula_result
5274                 (
5275                  p_validate                       =>  0
5276                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
5277                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
5278                 ,p_formula_id                     =>  l_lsf_rec.rndg_rl
5279                 ,p_business_group_id              =>  l_lsf_rec.business_group_id
5280                 ,p_number_of_copies               =>  l_number_of_copies
5281                 ,p_object_version_number          =>  l_object_version_number
5282                 ,p_effective_date                 =>  p_effective_date
5283                 );
5284 
5285                 --
5286             end if;
5287 
5288          end loop;
5289          --
5290     ---------------------------------------------------------------
5291     -- END OF BEN_LOS_FCTR ----------------------
5292     ---------------------------------------------------------------
5293     end if;
5294     if p_pct_fl_tm_fctr_id is not null then
5295 
5296         if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
5297           open c_object_exists(p_pct_fl_tm_fctr_id,'PFF');
5298           fetch c_object_exists into l_dummy;
5299           if c_object_exists%found then
5300             close c_object_exists;
5301             return;
5302           end if;
5303           close c_object_exists;
5304         end if;
5305      ---------------------------------------------------------------
5306      -- START OF BEN_PCT_FL_TM_FCTR ----------------------
5307      ---------------------------------------------------------------
5308         --
5309         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
5310         --
5311         l_pct_fl_tm_fctr_id := p_pct_fl_tm_fctr_id ;
5312         --
5313         for l_pff_rec in c_pff(p_pct_fl_tm_fctr_id,l_mirror_src_entity_result_id,'PFF') loop
5314           --
5315           l_table_route_id := null ;
5316           open ben_plan_design_program_module.g_table_route('PFF');
5317           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
5318           close ben_plan_design_program_module.g_table_route ;
5319           --
5320           l_information5  := l_pff_rec.name; --'Intersection';
5321           --
5322           l_result_type_cd := 'DISPLAY';
5323             --
5324           l_copy_entity_result_id := null;
5325           l_object_version_number := null;
5326           ben_copy_entity_results_api.create_copy_entity_results(
5327             p_copy_entity_result_id          => l_copy_entity_result_id,
5328             p_copy_entity_txn_id             => p_copy_entity_txn_id,
5329             p_result_type_cd                 => l_result_type_cd,
5330             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
5331             p_parent_entity_result_id        => l_mirror_src_entity_result_id,
5332             p_number_of_copies               => l_number_of_copies,
5333             p_table_route_id                 => l_table_route_id,
5334 	    P_TABLE_ALIAS                    => 'PFF',
5335             p_information1     => l_pff_rec.pct_fl_tm_fctr_id,
5336             p_information2     => null,
5337             p_information3     => null,
5338             p_information4     => l_pff_rec.business_group_id,
5339             p_information5     => l_information5 , -- 9999 put name for h-grid
5340 
5341             p_information294     => l_pff_rec.mn_pct_val,
5342             p_information293     => l_pff_rec.mx_pct_val,
5343             p_information218     => l_pff_rec.name,
5344             p_information11     => l_pff_rec.no_mn_pct_val_flag,
5345             p_information12     => l_pff_rec.no_mx_pct_val_flag,
5346             p_information111     => l_pff_rec.pff_attribute1,
5347             p_information120     => l_pff_rec.pff_attribute10,
5348             p_information121     => l_pff_rec.pff_attribute11,
5349             p_information122     => l_pff_rec.pff_attribute12,
5350             p_information123     => l_pff_rec.pff_attribute13,
5351             p_information124     => l_pff_rec.pff_attribute14,
5352             p_information125     => l_pff_rec.pff_attribute15,
5353             p_information126     => l_pff_rec.pff_attribute16,
5354             p_information127     => l_pff_rec.pff_attribute17,
5355             p_information128     => l_pff_rec.pff_attribute18,
5356             p_information129     => l_pff_rec.pff_attribute19,
5357             p_information112     => l_pff_rec.pff_attribute2,
5358             p_information130     => l_pff_rec.pff_attribute20,
5359             p_information131     => l_pff_rec.pff_attribute21,
5360             p_information132     => l_pff_rec.pff_attribute22,
5361             p_information133     => l_pff_rec.pff_attribute23,
5362             p_information134     => l_pff_rec.pff_attribute24,
5363             p_information135     => l_pff_rec.pff_attribute25,
5364             p_information136     => l_pff_rec.pff_attribute26,
5365             p_information137     => l_pff_rec.pff_attribute27,
5366             p_information138     => l_pff_rec.pff_attribute28,
5367             p_information139     => l_pff_rec.pff_attribute29,
5368             p_information113     => l_pff_rec.pff_attribute3,
5369             p_information140     => l_pff_rec.pff_attribute30,
5370             p_information114     => l_pff_rec.pff_attribute4,
5371             p_information115     => l_pff_rec.pff_attribute5,
5372             p_information116     => l_pff_rec.pff_attribute6,
5373             p_information117     => l_pff_rec.pff_attribute7,
5374             p_information118     => l_pff_rec.pff_attribute8,
5375             p_information119     => l_pff_rec.pff_attribute9,
5376             p_information110     => l_pff_rec.pff_attribute_category,
5377             p_information15     => l_pff_rec.rndg_cd,
5378             p_information257     => l_pff_rec.rndg_rl,
5379             p_information13     => l_pff_rec.use_prmry_asnt_only_flag,
5380             p_information14     => l_pff_rec.use_sum_of_all_asnts_flag,
5381             p_information265    => l_pff_rec.object_version_number,
5382 
5383             p_object_version_number          => l_object_version_number,
5384             p_effective_date                 => p_effective_date       );
5385             --
5386 
5387             if l_out_pff_result_id is null then
5388               l_out_pff_result_id := l_copy_entity_result_id;
5389             end if;
5390 
5391             if l_result_type_cd = 'DISPLAY' then
5392                l_out_pff_result_id := l_copy_entity_result_id ;
5393             end if;
5394             --
5395 
5396             -- Copy Fast Formulas if any
5397             ---------------------------------------------------------------
5398             -- RNDG_RL -----------------
5399             ---------------------------------------------------------------
5400 
5401             if l_pff_rec.rndg_rl is not null then
5402             --
5403             ben_plan_design_program_module.create_formula_result
5404             (
5405              p_validate                       =>  0
5406             ,p_copy_entity_result_id          =>  l_copy_entity_result_id
5407             ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
5408             ,p_formula_id                     =>  l_pff_rec.rndg_rl
5409             ,p_business_group_id              =>  l_pff_rec.business_group_id
5410             ,p_number_of_copies               =>  l_number_of_copies
5411             ,p_object_version_number          =>  l_object_version_number
5412             ,p_effective_date                 =>  p_effective_date
5413             );
5414 
5415             --
5416             end if;
5417 
5418 
5419          end loop;
5420          --
5421     ---------------------------------------------------------------
5422     -- END OF BEN_PCT_FL_TM_FCTR ----------------------
5423     ---------------------------------------------------------------
5424     end if;
5425     hr_utility.set_location('end create_drpar_results',100);
5426    end create_drpar_results ;
5427   --
5428 
5429   procedure create_vrb_rt_elg_prf_results
5430     (
5431      p_validate                       in  number    default 0 -- false
5432     ,p_copy_entity_result_id          in  number
5433     ,p_copy_entity_txn_id             in  number    default null
5434     ,p_vrbl_rt_prfl_id                in  number
5435     ,p_business_group_id              in  number    default null
5436     ,p_number_of_copies               in  number    default 0
5437     ,p_object_version_number          out nocopy number
5438     ,p_effective_date                 in  date
5439     ) is
5440     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
5441     l_proc varchar2(72) := g_package||'create_vrb_rt_elg_prf_results';
5442     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
5443     --
5444     ---------------------------------------------------------------
5445     -- START OF BEN_VRBL_RT_ELIG_PRFL_F ----------------------
5446     ---------------------------------------------------------------
5447     cursor c_vep_from_parent(c_VRBL_RT_PRFL_ID number) is
5448     select  distinct vrbl_rt_elig_prfl_id
5449     from BEN_VRBL_RT_ELIG_PRFL_F
5450     where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
5451     --
5452     cursor c_vep(c_vrbl_rt_elig_prfl_id number,c_mirror_src_entity_result_id number,
5453                  c_table_alias varchar2 ) is
5454     select  vep.*
5455     from BEN_VRBL_RT_ELIG_PRFL_F vep
5456     where  vep.vrbl_rt_elig_prfl_id = c_vrbl_rt_elig_prfl_id
5457      -- and vep.business_group_id = p_business_group_id
5458      and not exists (
5459          select /* */ null
5460          from ben_copy_entity_results cpe
5461               -- pqh_table_route trt
5462          where copy_entity_txn_id = p_copy_entity_txn_id
5463          -- and trt.table_route_id = cpe.table_route_id
5464          and ( -- c_mirror_src_entity_result_id is null or
5465                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
5466          -- and trt.where_clause = 'BEN_VRBL_RT_ELIG_PRFL_F'
5467          and cpe.table_alias = c_table_alias
5468          and information1 = c_vrbl_rt_elig_prfl_id
5469          -- and information4 = vep.business_group_id
5470          and information2 = vep.effective_start_date
5471          and information3 = vep.effective_end_date
5472         );
5473 
5474       --
5475       -- Bug : 3752407 : Global cursor g_table_route will now be used
5476       -- Cursor to get table_route_id
5477       --
5478       -- cursor c_table_route(c_parent_table_alias varchar2) is
5479       -- select table_route_id
5480       -- from pqh_table_route trt
5481       -- where trt.table_alias = c_parent_table_alias;
5482       -- trt.from_clause = 'OAB'
5483       -- and   trt.where_clause = upper(c_parent_table_name) ;
5484 
5485       l_vrbl_rt_elig_prfl_id                 number(15);
5486       l_out_vep_result_id   number(15);
5487 
5488       cursor c_elp_from_parent(c_VRBL_RT_ELIG_PRFL_ID number) is
5489       select  distinct eligy_prfl_id
5490       from BEN_VRBL_RT_ELIG_PRFL_F
5491       where VRBL_RT_ELIG_PRFL_ID = c_VRBL_RT_ELIG_PRFL_ID;
5492 
5493      ---------------------------------------------------------------
5494      -- END OF BEN_VRBL_RT_ELIG_PRFL_F ----------------------
5495      ---------------------------------------------------------------
5496 
5497      l_mirror_src_entity_result_id number(15);
5498      l_table_route_id              number(15);
5499      l_result_type_cd              varchar2(30);
5500      l_information5                ben_copy_entity_results.information5%type;
5501      l_number_of_copies            number(15);
5502 
5503      l_mndtry_flag                 ben_vrbl_rt_elig_prfl_f.mndtry_flag%type;
5504 
5505     --ENH Avoid duplicate ELPRO's
5506      l_mirror_g_pdw_allow_dup_rslt varchar2(30);
5507 
5508 --Bug 5059695
5509      l_dummy_g_pdw_allow_dup_rslt varchar2(30);
5510 --End Bug 5059695
5511 
5512     begin
5513       l_number_of_copies := p_number_of_copies ;
5514 
5515           -- Bug 5059695 : Fetch the transaction category
5516 	if(ben_plan_design_elpro_module.g_copy_entity_txn_id <> p_copy_entity_txn_id) then
5517 
5518 	   ben_plan_design_elpro_module.g_copy_entity_txn_id := p_copy_entity_txn_id;
5519 
5520 	       open ben_plan_design_elpro_module.g_trasaction_categories(p_copy_entity_txn_id) ;
5521 		fetch  ben_plan_design_elpro_module.g_trasaction_categories into ben_plan_design_elpro_module.g_trasaction_category;
5522 	       close ben_plan_design_elpro_module.g_trasaction_categories;
5523 
5524 	end if;
5525 --End Bug 5059695
5526      ---------------------------------------------------------------
5527      -- START OF BEN_VRBL_RT_ELIG_PRFL_F ----------------------
5528      ---------------------------------------------------------------
5529      --
5530      for l_parent_rec  in c_vep_from_parent(p_VRBL_RT_PRFL_ID) loop
5531         --
5532         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
5533         --
5534         l_vrbl_rt_elig_prfl_id := l_parent_rec.vrbl_rt_elig_prfl_id ;
5535         --
5536         for l_vep_rec in c_vep(l_parent_rec.vrbl_rt_elig_prfl_id,l_mirror_src_entity_result_id,'VEP') loop
5537           --
5538           l_table_route_id := null ;
5539           open ben_plan_design_program_module.g_table_route('VEP');
5540           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
5541           close ben_plan_design_program_module.g_table_route ;
5542           --
5543           l_information5  := ben_plan_design_program_module.get_eligy_prfl_name(l_vep_rec.eligy_prfl_id
5544                                                                                ,p_effective_date); --'Intersection';
5545           --
5546           if p_effective_date between l_vep_rec.effective_start_date
5547              and l_vep_rec.effective_end_date then
5548            --
5549              l_result_type_cd := 'DISPLAY';
5550           else
5551              l_result_type_cd := 'NO DISPLAY';
5552           end if;
5553             --
5554           l_copy_entity_result_id := null;
5555           l_object_version_number := null;
5556           ben_copy_entity_results_api.create_copy_entity_results(
5557             p_copy_entity_result_id          => l_copy_entity_result_id,
5558             p_copy_entity_txn_id             => p_copy_entity_txn_id,
5559             p_result_type_cd                 => l_result_type_cd,
5560             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
5561             p_parent_entity_result_id        =>  NULL, -- Hide for HGrid
5562             p_number_of_copies               => l_number_of_copies,
5563             p_table_route_id                 => l_table_route_id,
5564 	    P_TABLE_ALIAS                    => 'VEP',
5565             p_information1       => l_vep_rec.vrbl_rt_elig_prfl_id,
5566             p_information2       => l_vep_rec.EFFECTIVE_START_DATE,
5567             p_information3       => l_vep_rec.EFFECTIVE_END_DATE,
5568             p_information4       => l_vep_rec.business_group_id,
5569             p_information5       => l_information5,
5570             p_information263     => l_vep_rec.eligy_prfl_id,
5571             p_information11      => l_vep_rec.mndtry_flag,
5572             p_information111     => l_vep_rec.vep_attribute1,
5573             p_information120     => l_vep_rec.vep_attribute10,
5574             p_information121     => l_vep_rec.vep_attribute11,
5575             p_information122     => l_vep_rec.vep_attribute12,
5576             p_information123     => l_vep_rec.vep_attribute13,
5577             p_information124     => l_vep_rec.vep_attribute14,
5578             p_information125     => l_vep_rec.vep_attribute15,
5579             p_information126     => l_vep_rec.vep_attribute16,
5580             p_information127     => l_vep_rec.vep_attribute17,
5581             p_information128     => l_vep_rec.vep_attribute18,
5582             p_information129     => l_vep_rec.vep_attribute19,
5583             p_information112     => l_vep_rec.vep_attribute2,
5584             p_information130     => l_vep_rec.vep_attribute20,
5585             p_information131     => l_vep_rec.vep_attribute21,
5586             p_information132     => l_vep_rec.vep_attribute22,
5587             p_information133     => l_vep_rec.vep_attribute23,
5588             p_information134     => l_vep_rec.vep_attribute24,
5589             p_information135     => l_vep_rec.vep_attribute25,
5590             p_information136     => l_vep_rec.vep_attribute26,
5591             p_information137     => l_vep_rec.vep_attribute27,
5592             p_information138     => l_vep_rec.vep_attribute28,
5593             p_information139     => l_vep_rec.vep_attribute29,
5594             p_information113     => l_vep_rec.vep_attribute3,
5595             p_information140     => l_vep_rec.vep_attribute30,
5596             p_information114     => l_vep_rec.vep_attribute4,
5597             p_information115     => l_vep_rec.vep_attribute5,
5598             p_information116     => l_vep_rec.vep_attribute6,
5599             p_information117     => l_vep_rec.vep_attribute7,
5600             p_information118     => l_vep_rec.vep_attribute8,
5601             p_information119     => l_vep_rec.vep_attribute9,
5602             p_information110     => l_vep_rec.vep_attribute_category,
5603             p_information262     => l_vep_rec.vrbl_rt_prfl_id,
5604             p_information265     => l_vep_rec.object_version_number,
5605             p_object_version_number          => l_object_version_number,
5606             p_effective_date                 => p_effective_date       );
5607             --
5608 
5609             if l_out_vep_result_id is null then
5610               l_out_vep_result_id := l_copy_entity_result_id;
5611             end if;
5612 
5613             if l_result_type_cd = 'DISPLAY' then
5614                l_out_vep_result_id := l_copy_entity_result_id ;
5615                l_mndtry_flag       := l_vep_rec.mndtry_flag;
5616             end if;
5617             --
5618          end loop;
5619          --
5620 
5621  	 l_mirror_g_pdw_allow_dup_rslt := ben_plan_design_program_module.g_pdw_allow_dup_rslt;
5622 
5623          -- Create Eligibility Profiles and Criteria
5624 
5625   -- Bug 5059695
5626 	    if(ben_plan_design_elpro_module.g_trasaction_category = 'PQHGSP') then
5627 	        l_dummy_g_pdw_allow_dup_rslt := null;
5628 	    else
5629 	       l_dummy_g_pdw_allow_dup_rslt := ben_plan_design_program_module.g_pdw_no_dup_rslt;
5630 	    end if;
5631 -- End Bug 5059695
5632 
5633          for l_parent_rec  in c_elp_from_parent(l_vrbl_rt_elig_prfl_id) loop
5634            ben_plan_design_elpro_module.create_elig_prfl_results
5635            (
5636              p_validate                       => p_validate
5637             ,p_mirror_src_entity_result_id    => l_out_vep_result_id
5638             ,p_parent_entity_result_id        => p_copy_entity_result_id -- Result id of Vapro
5639             ,p_copy_entity_txn_id             => p_copy_entity_txn_id
5640             ,p_eligy_prfl_id                  => l_parent_rec.eligy_prfl_id
5641             ,p_mndtry_flag                    => l_mndtry_flag
5642             ,p_business_group_id              => p_business_group_id
5643             ,p_number_of_copies               => p_number_of_copies
5644             ,p_object_version_number          => l_object_version_number
5645             ,p_effective_date                 => p_effective_date
5646 	    ,p_no_dup_rslt		      => l_dummy_g_pdw_allow_dup_rslt
5647            );
5648 	   -- ENH Avoid duplicates in Eligibility Profiles
5649    	   --Passed the value PDW_NO_DUP_RSLT to create_elig_prfl_results so that
5650 	   --no duplicate results are created
5651 
5652          end loop;
5653 	 ben_plan_design_program_module.g_pdw_allow_dup_rslt := l_mirror_g_pdw_allow_dup_rslt;
5654 	 -- ENH Avoid duplicates in Eligibility Profiles
5655 	 --reset the global allow dup results
5656 
5657        end loop;
5658     ---------------------------------------------------------------
5659     -- END OF BEN_VRBL_RT_ELIG_PRFL_F ----------------------
5660     ---------------------------------------------------------------
5661 
5662   end ;
5663 
5664   procedure create_vapro_results
5665     (
5666      p_validate                       in  number     default 0 -- false
5667     ,p_copy_entity_result_id          in  number    -- Source vapro
5668     ,p_copy_entity_txn_id             in  number    default null
5669     ,p_vrbl_rt_prfl_id                in  number    default null
5670     ,p_business_group_id              in  number    default null
5671     ,p_number_of_copies               in  number    default 0
5672     ,p_object_version_number          out nocopy number
5673     ,p_effective_date                 in  date
5674     ,p_parent_entity_result_id        in  number
5675     ,p_no_dup_rslt                    in varchar2    default null
5676     ) is
5677     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
5678     l_proc varchar2(72) := g_package||'create_rate_results';
5679     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
5680     --
5681     cursor c_parent_result(c_parent_pk_id number,
5682                         c_parent_table_name varchar2,
5683                         c_copy_entity_txn_id number) is
5684      select copy_entity_result_id mirror_src_entity_result_id
5685      from ben_copy_entity_results cpe,
5686         pqh_table_route trt
5687      where cpe.information1= c_parent_pk_id
5688      and   cpe.result_type_cd = 'DISPLAY'
5689      and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
5690      and   cpe.table_route_id = trt.table_route_id
5691      and   trt.from_clause = 'OAB'
5692      and   trt.where_clause = upper(c_parent_table_name) ;
5693      ---
5694      -- Bug : 3752407 : Global cursor g_table_route will now be used
5695      -- Cursor to get table_route_id
5696      --
5697      -- cursor c_table_route(c_parent_table_alias varchar2) is
5698      -- select table_route_id
5699      -- from pqh_table_route trt
5700      -- where trt.table_alias = c_parent_table_alias;
5701      -- trt.from_clause = 'OAB'
5702      -- and   trt.where_clause = upper(c_parent_table_name) ;
5703      ---
5704      l_mirror_src_entity_result_id    number(15);
5705      l_table_route_id               number(15);
5706      l_result_type_cd               varchar2(30);
5707      l_information5                 ben_copy_entity_results.information5%type;
5708      l_number_of_copies             number(15);
5709      l_mapping_id         number;
5710      l_mapping_name       varchar2(600);
5711      l_mapping_id1        number;
5712      l_mapping_name1      varchar2(600);
5713     l_mapping_column_name1 pqh_attributes.attribute_name%type;
5714     l_mapping_column_name2 pqh_attributes.attribute_name%type;
5715 
5716    ---------------------------------------------------------------
5717    -- START OF BEN_VRBL_RT_PRFL_F ----------------------
5718    ---------------------------------------------------------------
5719    cursor c_vpf(c_vrbl_rt_prfl_id number,c_mirror_src_entity_result_id number,
5720                 c_table_alias varchar2 ) is
5721    select  vpf.*
5722    from BEN_VRBL_RT_PRFL_F vpf
5723    where  vpf.vrbl_rt_prfl_id = c_vrbl_rt_prfl_id
5724      -- and vpf.business_group_id = p_business_group_id
5725      and not exists (
5726          select /* */ null
5727          from ben_copy_entity_results cpe
5728               -- pqh_table_route trt
5729          where copy_entity_txn_id = p_copy_entity_txn_id
5730          -- and trt.table_route_id = cpe.table_route_id
5731          and ( -- c_mirror_src_entity_result_id is null or
5732                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
5733          -- and trt.where_clause = 'BEN_VRBL_RT_PRFL_F'
5734          and cpe.table_alias = c_table_alias
5735          and information1 = c_vrbl_rt_prfl_id
5736          -- and information4 = vpf.business_group_id
5737            and information2 = vpf.effective_start_date
5738            and information3 = vpf.effective_end_date);
5739     l_vrbl_rt_prfl_id                 number(15);
5740     l_out_vpf_result_id   number(15);
5741    ---------------------------------------------------------------
5742    -- END OF BEN_VRBL_RT_PRFL_F ----------------------
5743    ---------------------------------------------------------------
5744    ---------------------------------------------------------------
5745    -- START OF BEN_AGE_RT_F ----------------------
5746    ---------------------------------------------------------------
5747    cursor c_art_from_parent(c_VRBL_RT_PRFL_ID number) is
5748    select distinct age_rt_id
5749    from BEN_AGE_RT_F
5750    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
5751    --
5752    cursor c_art(c_age_rt_id number,c_mirror_src_entity_result_id number,
5753                 c_table_alias varchar2 ) is
5754    select  art.*
5755    from BEN_AGE_RT_F art
5756    where  art.age_rt_id = c_age_rt_id
5757      -- and art.business_group_id = p_business_group_id
5758      and not exists (
5759          select /* */ null
5760          from ben_copy_entity_results cpe
5761               -- pqh_table_route trt
5762          where copy_entity_txn_id = p_copy_entity_txn_id
5763          -- and trt.table_route_id = cpe.table_route_id
5764          and ( -- c_mirror_src_entity_result_id is null or
5765                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
5766          -- and trt.where_clause = 'BEN_AGE_RT_F'
5767          and cpe.table_alias = c_table_alias
5768          and information1 = c_age_rt_id
5769          -- and information4 = art.business_group_id
5770            and information2 = art.effective_start_date
5771            and information3 = art.effective_end_date);
5772     l_age_rt_id                 number(15);
5773     l_out_art_result_id   number(15);
5774    --
5775    cursor c_art_drp(c_age_rt_id number,c_mirror_src_entity_result_id number,
5776                     c_table_alias varchar2 ) is
5777    select distinct cpe.information246 age_fctr_id
5778          from ben_copy_entity_results cpe
5779               -- pqh_table_route trt
5780          where copy_entity_txn_id = p_copy_entity_txn_id
5781          -- and trt.table_route_id = cpe.table_route_id
5782          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
5783          -- and trt.where_clause = 'BEN_AGE_RT_F'
5784          and cpe.table_alias = c_table_alias
5785          and information1 = c_age_rt_id
5786          -- and information4 = p_business_group_id
5787         ;
5788    ---------------------------------------------------------------
5789    -- END OF BEN_AGE_RT_F ----------------------
5790    ---------------------------------------------------------------
5791    ---------------------------------------------------------------
5792    -- START OF BEN_ASNT_SET_RT_F ----------------------
5793    ---------------------------------------------------------------
5794    cursor c_asr_from_parent(c_VRBL_RT_PRFL_ID number) is
5795    select  asnt_set_rt_id
5796    from BEN_ASNT_SET_RT_F
5797    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
5798    --
5799    cursor c_asr(c_asnt_set_rt_id number,c_mirror_src_entity_result_id number,
5800                 c_table_alias varchar2 ) is
5801    select  asr.*
5802    from BEN_ASNT_SET_RT_F asr
5803    where  asr.asnt_set_rt_id = c_asnt_set_rt_id
5804      -- and asr.business_group_id = p_business_group_id
5805      and not exists (
5806          select /* */ null
5807          from ben_copy_entity_results cpe
5808               -- pqh_table_route trt
5809          where copy_entity_txn_id = p_copy_entity_txn_id
5810          -- and trt.table_route_id = cpe.table_route_id
5811          and ( -- c_mirror_src_entity_result_id is null or
5812                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
5813          -- and trt.where_clause = 'BEN_ASNT_SET_RT_F'
5814          and cpe.table_alias = c_table_alias
5815          and information1 = c_asnt_set_rt_id
5816          -- and information4 = asr.business_group_id
5817            and information2 = asr.effective_start_date
5818            and information3 = asr.effective_end_date);
5819     l_asnt_set_rt_id                 number(15);
5820     l_out_asr_result_id   number(15);
5821     --
5822     -- pabodla : mapping data
5823     --
5824     cursor c_get_mapping_name3(p_id in number) is
5825       select assignment_set_name
5826       from hr_assignment_sets
5827       where business_group_id = p_business_group_id
5828         and assignment_set_id = p_id;
5829     --
5830    ---------------------------------------------------------------
5831    -- END OF BEN_ASNT_SET_RT_F ----------------------
5832    ---------------------------------------------------------------
5833    ---------------------------------------------------------------
5834    -- START OF BEN_BENFTS_GRP_RT_F ----------------------
5835    ---------------------------------------------------------------
5836    cursor c_brg_from_parent(c_VRBL_RT_PRFL_ID number) is
5837    select distinct benfts_grp_rt_id
5838    from BEN_BENFTS_GRP_RT_F
5839    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
5840    --
5841    cursor c_brg(c_benfts_grp_rt_id number,c_mirror_src_entity_result_id number,
5842                 c_table_alias varchar2 ) is
5843    select  brg.*
5844    from BEN_BENFTS_GRP_RT_F brg
5845    where  brg.benfts_grp_rt_id = c_benfts_grp_rt_id
5846      -- and brg.business_group_id = p_business_group_id
5847      and not exists (
5848          select /* */ null
5849          from ben_copy_entity_results cpe
5850               -- pqh_table_route trt
5851          where copy_entity_txn_id = p_copy_entity_txn_id
5852          -- and trt.table_route_id = cpe.table_route_id
5853          and ( -- c_mirror_src_entity_result_id is null or
5854                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
5855          -- and trt.where_clause = 'BEN_BENFTS_GRP_RT_F'
5856          and cpe.table_alias = c_table_alias
5857          and information1 = c_benfts_grp_rt_id
5858          -- and information4 = brg.business_group_id
5859            and information2 = brg.effective_start_date
5860            and information3 = brg.effective_end_date);
5861     l_benfts_grp_rt_id                 number(15);
5862     l_out_brg_result_id   number(15);
5863    --
5864    cursor c_brg_bg(c_benfts_grp_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
5865    select distinct cpe.information222 benfts_grp_id
5866          from ben_copy_entity_results cpe
5867               -- pqh_table_route trt
5868          where copy_entity_txn_id = p_copy_entity_txn_id
5869          -- and trt.table_route_id = cpe.table_route_id
5870          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
5871          -- and trt.where_clause = 'BEN_BENFTS_GRP_RT_F'
5872          and cpe.table_alias = c_table_alias
5873          and information1 = c_benfts_grp_rt_id
5874          -- and information4 = p_business_group_id
5875         ;
5876    ---------------------------------------------------------------
5877    -- END OF BEN_BENFTS_GRP_RT_F ----------------------
5878    ---------------------------------------------------------------
5879 
5880    ---------------------------------------------------------------
5881    -- START OF BEN_BRGNG_UNIT_RT_F ----------------------
5882    ---------------------------------------------------------------
5883    cursor c_bur_from_parent(c_VRBL_RT_PRFL_ID number) is
5884    select  brgng_unit_rt_id
5885    from BEN_BRGNG_UNIT_RT_F
5886    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
5887    --
5888    cursor c_bur(c_brgng_unit_rt_id number,c_mirror_src_entity_result_id number,
5889                 c_table_alias varchar2 ) is
5890    select  bur.*
5891    from BEN_BRGNG_UNIT_RT_F bur
5892    where  bur.brgng_unit_rt_id = c_brgng_unit_rt_id
5893      -- and bur.business_group_id = p_business_group_id
5894      and not exists (
5895          select /* */ null
5896          from ben_copy_entity_results cpe
5897               -- pqh_table_route trt
5898          where copy_entity_txn_id = p_copy_entity_txn_id
5899          -- and trt.table_route_id = cpe.table_route_id
5900          and ( -- c_mirror_src_entity_result_id is null or
5901                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
5902          -- and trt.where_clause = 'BEN_BRGNG_UNIT_RT_F'
5903          and cpe.table_alias = c_table_alias
5904          and information1 = c_brgng_unit_rt_id
5905          -- and information4 = bur.business_group_id
5906            and information2 = bur.effective_start_date
5907            and information3 = bur.effective_end_date);
5908     l_brgng_unit_rt_id                 number(15);
5909     l_out_bur_result_id   number(15);
5910    ---------------------------------------------------------------
5911    -- END OF BEN_BRGNG_UNIT_RT_F ----------------------
5912    ---------------------------------------------------------------
5913    ---------------------------------------------------------------
5914    -- START OF BEN_CMBN_AGE_LOS_RT_F ----------------------
5915    ---------------------------------------------------------------
5916    cursor c_cmr_from_parent(c_VRBL_RT_PRFL_ID number) is
5917    select distinct cmbn_age_los_rt_id
5918    from BEN_CMBN_AGE_LOS_RT_F
5919    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
5920    --
5921    cursor c_cmr(c_cmbn_age_los_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
5922    select  cmr.*
5923    from BEN_CMBN_AGE_LOS_RT_F cmr
5924    where  cmr.cmbn_age_los_rt_id = c_cmbn_age_los_rt_id
5925      -- and cmr.business_group_id = p_business_group_id
5926      and not exists (
5927          select /* */ null
5928          from ben_copy_entity_results cpe
5929               -- pqh_table_route trt
5930          where copy_entity_txn_id = p_copy_entity_txn_id
5931          -- and trt.table_route_id = cpe.table_route_id
5932          and ( -- c_mirror_src_entity_result_id is null or
5933                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
5934          -- and trt.where_clause = 'BEN_CMBN_AGE_LOS_RT_F'
5935          and cpe.table_alias = c_table_alias
5936          and information1 = c_cmbn_age_los_rt_id
5937          -- and information4 = cmr.business_group_id
5938            and information2 = cmr.effective_start_date
5939            and information3 = cmr.effective_end_date);
5940     l_cmbn_age_los_rt_id                 number(15);
5941     l_out_cmr_result_id   number(15);
5942    --
5943    cursor c_cmr_drp(c_cmbn_age_los_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
5944    select distinct cpe.information223 cmbn_age_los_fctr_id
5945          from ben_copy_entity_results cpe
5946               -- pqh_table_route trt
5947          where copy_entity_txn_id = p_copy_entity_txn_id
5948          -- and trt.table_route_id = cpe.table_route_id
5949          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
5950          -- and trt.where_clause = 'BEN_CMBN_AGE_LOS_RT_F'
5951          and cpe.table_alias = c_table_alias
5952          and information1 = c_cmbn_age_los_rt_id
5953          -- and information4 = p_business_group_id
5954         ;
5955    ---------------------------------------------------------------
5956    -- END OF BEN_CMBN_AGE_LOS_RT_F ----------------------
5957    ---------------------------------------------------------------
5958    ---------------------------------------------------------------
5959    -- START OF BEN_COMP_LVL_RT_F ----------------------
5960    ---------------------------------------------------------------
5961    cursor c_clr_from_parent(c_VRBL_RT_PRFL_ID number) is
5962    select distinct comp_lvl_rt_id
5963    from BEN_COMP_LVL_RT_F
5964    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
5965    --
5966    cursor c_clr(c_comp_lvl_rt_id number,c_mirror_src_entity_result_id number,
5967                 c_table_alias varchar2 ) is
5968    select  clr.*
5969    from BEN_COMP_LVL_RT_F clr
5970    where  clr.comp_lvl_rt_id = c_comp_lvl_rt_id
5971      -- and clr.business_group_id = p_business_group_id
5972      and not exists (
5973          select /* */ null
5974          from ben_copy_entity_results cpe
5975               -- pqh_table_route trt
5976          where copy_entity_txn_id = p_copy_entity_txn_id
5977          -- and trt.table_route_id = cpe.table_route_id
5978          and ( -- c_mirror_src_entity_result_id is null or
5979                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
5980          -- and trt.where_clause = 'BEN_COMP_LVL_RT_F'
5981          and cpe.table_alias = c_table_alias
5982          and information1 = c_comp_lvl_rt_id
5983          -- and information4 = clr.business_group_id
5984            and information2 = clr.effective_start_date
5985            and information3 = clr.effective_end_date);
5986     l_comp_lvl_rt_id                 number(15);
5987     l_out_clr_result_id   number(15);
5988    --
5989    cursor c_clr_drp(c_comp_lvl_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
5990    select distinct cpe.information254 comp_lvl_fctr_id
5991          from ben_copy_entity_results cpe
5992               -- pqh_table_route trt
5993          where copy_entity_txn_id = p_copy_entity_txn_id
5994          -- and trt.table_route_id = cpe.table_route_id
5995          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
5996          -- and trt.where_clause = 'BEN_COMP_LVL_RT_F'
5997          and cpe.table_alias = c_table_alias
5998          and information1 = c_comp_lvl_rt_id
5999          -- and information4 = p_business_group_id
6000         ;
6001    ---------------------------------------------------------------
6002    -- END OF BEN_COMP_LVL_RT_F ----------------------
6003    ---------------------------------------------------------------
6004    ---------------------------------------------------------------
6005    -- START OF BEN_DSBLD_RT_F ----------------------
6006    ---------------------------------------------------------------
6007    cursor c_dbr_from_parent(c_VRBL_RT_PRFL_ID number) is
6008    select  dsbld_rt_id
6009    from BEN_DSBLD_RT_F
6010    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6011    --
6012    cursor c_dbr(c_dsbld_rt_id number,c_mirror_src_entity_result_id number,
6013                 c_table_alias varchar2 ) is
6014    select  dbr.*
6015    from BEN_DSBLD_RT_F dbr
6016    where  dbr.dsbld_rt_id = c_dsbld_rt_id
6017      -- and dbr.business_group_id = p_business_group_id
6018      and not exists (
6019          select /* */ null
6020          from ben_copy_entity_results cpe
6021               -- pqh_table_route trt
6022          where copy_entity_txn_id = p_copy_entity_txn_id
6023          -- and trt.table_route_id = cpe.table_route_id
6024          and ( -- c_mirror_src_entity_result_id is null or
6025                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6026          -- and trt.where_clause = 'BEN_DSBLD_RT_F'
6027          and cpe.table_alias = c_table_alias
6028          and information1 = c_dsbld_rt_id
6029          -- and information4 = dbr.business_group_id
6030            and information2 = dbr.effective_start_date
6031            and information3 = dbr.effective_end_date);
6032     l_dsbld_rt_id                 number(15);
6033     l_out_dbr_result_id   number(15);
6034    ---------------------------------------------------------------
6035    -- END OF BEN_DSBLD_RT_F ----------------------
6036    ---------------------------------------------------------------
6037    ---------------------------------------------------------------
6038    -- START OF BEN_EE_STAT_RT_F ----------------------
6039    ---------------------------------------------------------------
6040    cursor c_esr_from_parent(c_VRBL_RT_PRFL_ID number) is
6041    select  ee_stat_rt_id
6042    from BEN_EE_STAT_RT_F
6043    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6044    --
6045    cursor c_esr(c_ee_stat_rt_id number,c_mirror_src_entity_result_id number,
6046                 c_table_alias varchar2 ) is
6047    select  esr.*
6048    from BEN_EE_STAT_RT_F esr
6049    where  esr.ee_stat_rt_id = c_ee_stat_rt_id
6050      -- and esr.business_group_id = p_business_group_id
6051      and not exists (
6052          select /* */ null
6053          from ben_copy_entity_results cpe
6054               -- pqh_table_route trt
6055          where copy_entity_txn_id = p_copy_entity_txn_id
6056          -- and trt.table_route_id = cpe.table_route_id
6057          and ( -- c_mirror_src_entity_result_id is null or
6058                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6059          -- and trt.where_clause = 'BEN_EE_STAT_RT_F'
6060          and cpe.table_alias = c_table_alias
6061          and information1 = c_ee_stat_rt_id
6062          -- and information4 = esr.business_group_id
6063            and information2 = esr.effective_start_date
6064            and information3 = esr.effective_end_date);
6065     l_ee_stat_rt_id                 number(15);
6066     l_out_esr_result_id   number(15);
6067     --
6068     -- pabodla : mapping data
6069     --
6070     cursor c_get_mapping_name4(p_id in number) is
6071       select nvl(atl.user_status, stl.user_status) dsp_meaning
6072       from per_assignment_status_types s,
6073            per_ass_status_type_amends a ,
6074            per_business_groups bus ,
6075            per_assignment_status_types_tl stl ,
6076            per_ass_status_type_amends_tl atl
6077       where a.assignment_status_type_id (+) = s.assignment_status_type_id
6078         and a.business_group_id (+) = p_business_group_id
6079         and nvl(s.business_group_id, p_business_group_id) = p_business_group_id
6080         and nvl(s.legislation_code, bus.legislation_code) = bus.legislation_code
6081         -- and bus.business_group_id = p_business_group_id
6082         and bus.business_group_id = nvl(s.business_group_id, p_business_group_id)
6083         and s.assignment_status_type_id = p_id
6084         and nvl(a.active_flag, s.active_flag) = 'Y'
6085         and atl.ass_status_type_amend_id (+) = a.ass_status_type_amend_id
6086         and atl.language (+) = userenv('LANG')
6087         and stl.assignment_status_type_id = s.assignment_status_type_id
6088         and stl.language  = userenv('LANG');
6089     --
6090    ---------------------------------------------------------------
6091    -- END OF BEN_EE_STAT_RT_F ----------------------
6092    ---------------------------------------------------------------
6093    ---------------------------------------------------------------
6094    -- START OF BEN_FL_TM_PT_TM_RT_F ----------------------
6095    ---------------------------------------------------------------
6096    cursor c_ftr_from_parent(c_VRBL_RT_PRFL_ID number) is
6097    select  fl_tm_pt_tm_rt_id
6098    from BEN_FL_TM_PT_TM_RT_F
6099    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6100    --
6101    cursor c_ftr(c_fl_tm_pt_tm_rt_id number,c_mirror_src_entity_result_id number,
6102                 c_table_alias varchar2 ) is
6103    select  ftr.*
6104    from BEN_FL_TM_PT_TM_RT_F ftr
6105    where  ftr.fl_tm_pt_tm_rt_id = c_fl_tm_pt_tm_rt_id
6106      -- and ftr.business_group_id = p_business_group_id
6107      and not exists (
6108          select /* */ null
6109          from ben_copy_entity_results cpe
6110               -- pqh_table_route trt
6111          where copy_entity_txn_id = p_copy_entity_txn_id
6112          -- and trt.table_route_id = cpe.table_route_id
6113          and ( -- c_mirror_src_entity_result_id is null or
6114                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6115          -- and trt.where_clause = 'BEN_FL_TM_PT_TM_RT_F'
6116          and cpe.table_alias = c_table_alias
6117          and information1 = c_fl_tm_pt_tm_rt_id
6118          -- and information4 = ftr.business_group_id
6119            and information2 = ftr.effective_start_date
6120            and information3 = ftr.effective_end_date);
6121 
6122     l_fl_tm_pt_tm_rt_id                 number(15);
6123     l_out_ftr_result_id   number(15);
6124    ---------------------------------------------------------------
6125    -- END OF BEN_FL_TM_PT_TM_RT_F ----------------------
6126    ---------------------------------------------------------------
6127    ---------------------------------------------------------------
6128    -- START OF BEN_GNDR_RT_F ----------------------
6129    ---------------------------------------------------------------
6130    cursor c_gnr_from_parent(c_VRBL_RT_PRFL_ID number) is
6131    select  gndr_rt_id
6132    from BEN_GNDR_RT_F
6133    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6134    --
6135    cursor c_gnr(c_gndr_rt_id number,c_mirror_src_entity_result_id number,
6136                 c_table_alias varchar2 ) is
6137    select  gnr.*
6138    from BEN_GNDR_RT_F gnr
6139    where  gnr.gndr_rt_id = c_gndr_rt_id
6140      -- and gnr.business_group_id = p_business_group_id
6141      and not exists (
6142          select /* */ null
6143          from ben_copy_entity_results cpe
6144               -- pqh_table_route trt
6145          where copy_entity_txn_id = p_copy_entity_txn_id
6146          -- and trt.table_route_id = cpe.table_route_id
6147          and ( -- c_mirror_src_entity_result_id is null or
6148                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6149          -- and trt.where_clause = 'BEN_GNDR_RT_F'
6150          and cpe.table_alias = c_table_alias
6151          and information1 = c_gndr_rt_id
6152          -- and information4 = gnr.business_group_id
6153            and information2 = gnr.effective_start_date
6154            and information3 = gnr.effective_end_date);
6155     l_gndr_rt_id                 number(15);
6156     l_out_gnr_result_id   number(15);
6157    ---------------------------------------------------------------
6158    -- END OF BEN_GNDR_RT_F ----------------------
6159    ---------------------------------------------------------------
6160    ---------------------------------------------------------------
6161    -- START OF BEN_GRADE_RT_F ----------------------
6162    ---------------------------------------------------------------
6163    cursor c_grr_from_parent(c_VRBL_RT_PRFL_ID number) is
6164    select  grade_rt_id
6165    from BEN_GRADE_RT_F
6166    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6167    --
6168    cursor c_grr(c_grade_rt_id number,c_mirror_src_entity_result_id number,
6169                 c_table_alias varchar2 ) is
6170    select  grr.*
6171    from BEN_GRADE_RT_F grr
6172    where  grr.grade_rt_id = c_grade_rt_id
6173      -- and grr.business_group_id = p_business_group_id
6174      and not exists (
6175          select /* */ null
6176          from ben_copy_entity_results cpe
6177               -- pqh_table_route trt
6178          where copy_entity_txn_id = p_copy_entity_txn_id
6179          -- and trt.table_route_id = cpe.table_route_id
6180          and ( -- c_mirror_src_entity_result_id is null or
6181                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6182          -- and trt.where_clause = 'BEN_GRADE_RT_F'
6183          and cpe.table_alias = c_table_alias
6184          and information1 = c_grade_rt_id
6185          -- and information4 = grr.business_group_id
6186            and information2 = grr.effective_start_date
6187            and information3 = grr.effective_end_date);
6188     l_grade_rt_id                 number(15);
6189     l_out_grr_result_id   number(15);
6190     --
6191     cursor c_get_mapping_name5(p_id in number,p_date in date) is
6192       select gra.name dsp_name
6193       from per_grades_vl gra
6194       where business_group_id  = p_business_group_id
6195         and gra.grade_id = p_id
6196         and p_date between date_from and nvl(date_to, p_date) ;
6197     --
6198 
6199     cursor c_grade_start_date(c_grade_id number) is
6200     select date_from
6201     from per_grades
6202     where grade_id = c_grade_id;
6203 
6204     l_grade_start_date  per_grades.date_from%type;
6205    ---------------------------------------------------------------
6206    -- END OF BEN_GRADE_RT_F ----------------------
6207    ---------------------------------------------------------------
6208    ---------------------------------------------------------------
6209    -- START OF BEN_HRLY_SLRD_RT_F ----------------------
6210    ---------------------------------------------------------------
6211    cursor c_hsr_from_parent(c_VRBL_RT_PRFL_ID number) is
6212    select  hrly_slrd_rt_id
6213    from BEN_HRLY_SLRD_RT_F
6214    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6215    --
6216    cursor c_hsr(c_hrly_slrd_rt_id number,c_mirror_src_entity_result_id number,
6217                 c_table_alias varchar2 ) is
6218    select  hsr.*
6219    from BEN_HRLY_SLRD_RT_F hsr
6220    where  hsr.hrly_slrd_rt_id = c_hrly_slrd_rt_id
6221      -- and hsr.business_group_id = p_business_group_id
6222      and not exists (
6223          select /* */ null
6224          from ben_copy_entity_results cpe
6225               -- pqh_table_route trt
6226          where copy_entity_txn_id = p_copy_entity_txn_id
6227          -- and trt.table_route_id = cpe.table_route_id
6228          and ( -- c_mirror_src_entity_result_id is null or
6229                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6230          -- and trt.where_clause = 'BEN_HRLY_SLRD_RT_F'
6231          and cpe.table_alias = c_table_alias
6232          and information1 = c_hrly_slrd_rt_id
6233          -- and information4 = hsr.business_group_id
6234            and information2 = hsr.effective_start_date
6235            and information3 = hsr.effective_end_date);
6236     l_hrly_slrd_rt_id                 number(15);
6237     l_out_hsr_result_id   number(15);
6238    ---------------------------------------------------------------
6239    -- END OF BEN_HRLY_SLRD_RT_F ----------------------
6240    ---------------------------------------------------------------
6241    ---------------------------------------------------------------
6242    -- START OF BEN_HRS_WKD_IN_PERD_RT_F ----------------------
6243    ---------------------------------------------------------------
6244    cursor c_hwr_from_parent(c_VRBL_RT_PRFL_ID number) is
6245    select distinct hrs_wkd_in_perd_rt_id
6246    from BEN_HRS_WKD_IN_PERD_RT_F
6247    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6248    --
6249    cursor c_hwr(c_hrs_wkd_in_perd_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
6250    select  hwr.*
6251    from BEN_HRS_WKD_IN_PERD_RT_F hwr
6252    where  hwr.hrs_wkd_in_perd_rt_id = c_hrs_wkd_in_perd_rt_id
6253      -- and hwr.business_group_id = p_business_group_id
6254      and not exists (
6255          select /* */ null
6256          from ben_copy_entity_results cpe
6257               -- pqh_table_route trt
6258          where copy_entity_txn_id = p_copy_entity_txn_id
6259          -- and trt.table_route_id = cpe.table_route_id
6260          and ( -- c_mirror_src_entity_result_id is null or
6261                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6262          -- and trt.where_clause = 'BEN_HRS_WKD_IN_PERD_RT_F'
6263          and cpe.table_alias = c_table_alias
6264          and information1 = c_hrs_wkd_in_perd_rt_id
6265          -- and information4 = hwr.business_group_id
6266            and information2 = hwr.effective_start_date
6267            and information3 = hwr.effective_end_date);
6268     l_hrs_wkd_in_perd_rt_id                 number(15);
6269     l_out_hwr_result_id   number(15);
6270    --
6271    cursor c_hwr_drp(c_hrs_wkd_in_perd_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
6272    select distinct cpe.information224 hrs_wkd_in_perd_fctr_id
6273          from ben_copy_entity_results cpe
6274               -- pqh_table_route trt
6275          where copy_entity_txn_id = p_copy_entity_txn_id
6276          -- and trt.table_route_id = cpe.table_route_id
6277          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
6278          -- and trt.where_clause = 'BEN_HRS_WKD_IN_PERD_RT_F'
6279          and cpe.table_alias = c_table_alias
6280          and information1 = c_hrs_wkd_in_perd_rt_id
6281          -- and information4 = p_business_group_id
6282         ;
6283    ---------------------------------------------------------------
6284    -- END OF BEN_HRS_WKD_IN_PERD_RT_F ----------------------
6285    ---------------------------------------------------------------
6286    ---------------------------------------------------------------
6287    -- START OF BEN_LBR_MMBR_RT_F ----------------------
6288    ---------------------------------------------------------------
6289    cursor c_lmm_from_parent(c_VRBL_RT_PRFL_ID number) is
6290    select  lbr_mmbr_rt_id
6291    from BEN_LBR_MMBR_RT_F
6292    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6293    --
6294    cursor c_lmm(c_lbr_mmbr_rt_id number,c_mirror_src_entity_result_id number,
6295                 c_table_alias varchar2 ) is
6296    select  lmm.*
6297    from BEN_LBR_MMBR_RT_F lmm
6298    where  lmm.lbr_mmbr_rt_id = c_lbr_mmbr_rt_id
6299      -- and lmm.business_group_id = p_business_group_id
6300      and not exists (
6301          select /* */ null
6302          from ben_copy_entity_results cpe
6303               -- pqh_table_route trt
6304          where copy_entity_txn_id = p_copy_entity_txn_id
6305          -- and trt.table_route_id = cpe.table_route_id
6306          and ( -- c_mirror_src_entity_result_id is null or
6307                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6308          -- and trt.where_clause = 'BEN_LBR_MMBR_RT_F'
6309          and cpe.table_alias = c_table_alias
6310          and information1 = c_lbr_mmbr_rt_id
6311          -- and information4 = lmm.business_group_id
6312            and information2 = lmm.effective_start_date
6313            and information3 = lmm.effective_end_date);
6314     l_lbr_mmbr_rt_id                 number(15);
6315     l_out_lmm_result_id   number(15);
6316    ---------------------------------------------------------------
6317    -- END OF BEN_LBR_MMBR_RT_F ----------------------
6318    ---------------------------------------------------------------
6319    ---------------------------------------------------------------
6320    -- START OF BEN_LGL_ENTY_RT_F ----------------------
6321    ---------------------------------------------------------------
6322    cursor c_ler_from_parent(c_VRBL_RT_PRFL_ID number) is
6323    select  lgl_enty_rt_id
6324    from BEN_LGL_ENTY_RT_F
6325    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6326    --
6327    cursor c_ler(c_lgl_enty_rt_id number,c_mirror_src_entity_result_id number,
6328                 c_table_alias varchar2 ) is
6329    select  ler.*
6330    from BEN_LGL_ENTY_RT_F ler
6331    where  ler.lgl_enty_rt_id = c_lgl_enty_rt_id
6332      -- and ler.business_group_id = p_business_group_id
6333      and not exists (
6334          select /* */ null
6335          from ben_copy_entity_results cpe
6336               -- pqh_table_route trt
6337          where copy_entity_txn_id = p_copy_entity_txn_id
6338          -- and trt.table_route_id = cpe.table_route_id
6339          and ( -- c_mirror_src_entity_result_id is null or
6340                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6341          -- and trt.where_clause = 'BEN_LGL_ENTY_RT_F'
6342          and cpe.table_alias = c_table_alias
6343          and information1 = c_lgl_enty_rt_id
6344          -- and information4 = ler.business_group_id
6345            and information2 = ler.effective_start_date
6346            and information3 = ler.effective_end_date);
6347     l_lgl_enty_rt_id                 number(15);
6348     l_out_ler_result_id   number(15);
6349     --
6350     -- pabodla : mapping data
6351     --
6352     cursor c_get_mapping_name6(p_id in number,p_date in date) is
6353       select hou.name dsp_name
6354       from hr_organization_units_v hou ,
6355            hr_organization_information hoi
6356       where business_group_id  = p_business_group_id
6357         and hou.organization_id = p_id
6358         and p_date between date_from and nvl(date_to, p_date)
6359         and hou.organization_id = hoi.organization_id
6360         and hoi.org_information2 = 'Y'
6361         and hoi.org_information1 = 'HR_LEGAL'
6362         and hoi.org_information_context || '' ='CLASS' ;
6363 
6364    cursor c_organization_start_date(c_organization_id number) is
6365    select date_from
6366    from hr_all_organization_units
6367    where organization_id = c_organization_id;
6368 
6369    l_organization_start_date  hr_all_organization_units.date_from%type;
6370    ---------------------------------------------------------------
6371    -- END OF BEN_LGL_ENTY_RT_F ----------------------
6372    ---------------------------------------------------------------
6373    ---------------------------------------------------------------
6374    -- START OF BEN_LOA_RSN_RT_F ----------------------
6375    ---------------------------------------------------------------
6376    cursor c_lar_from_parent(c_VRBL_RT_PRFL_ID number) is
6377    select  loa_rsn_rt_id
6378    from BEN_LOA_RSN_RT_F
6379    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6380    --
6381    cursor c_lar(c_loa_rsn_rt_id number,c_mirror_src_entity_result_id number,
6382                 c_table_alias varchar2 ) is
6383    select  lar.*
6384    from BEN_LOA_RSN_RT_F lar
6385    where  lar.loa_rsn_rt_id = c_loa_rsn_rt_id
6386      -- and lar.business_group_id = p_business_group_id
6387      and not exists (
6388          select /* */ null
6389          from ben_copy_entity_results cpe
6390               -- pqh_table_route trt
6391          where copy_entity_txn_id = p_copy_entity_txn_id
6392          -- and trt.table_route_id = cpe.table_route_id
6393          and ( -- c_mirror_src_entity_result_id is null or
6394                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6395          -- and trt.where_clause = 'BEN_LOA_RSN_RT_F'
6396          and cpe.table_alias = c_table_alias
6397          and information1 = c_loa_rsn_rt_id
6398          -- and information4 = lar.business_group_id
6399            and information2 = lar.effective_start_date
6400            and information3 = lar.effective_end_date);
6401     l_loa_rsn_rt_id                 number(15);
6402     l_out_lar_result_id   number(15);
6403 --PADMAJA
6404     --
6405     -- pabodla : mapping data
6406     --
6407     cursor c_get_mapping_name7(p_id in number,p_date in date) is
6408       select abt.name
6409       from per_absence_attendance_types abt
6410       where abt.business_group_id = p_business_group_id
6411         and abt.absence_attendance_type_id  = p_id
6412         and  p_date between abt.date_effective
6413         and nvl(abt.date_end, p_date);
6414     --
6415 
6416     cursor c_get_mapping_name8(p_id in number,p_id1 in number,p_date in date) is
6417       select hl.meaning name
6418       from per_abs_attendance_reasons abr,
6419            hr_leg_lookups hl
6420       where abr.business_group_id = p_business_group_id
6421         and abr.absence_attendance_type_id = p_id
6422         and abr.abs_attendance_reason_id = p_id1
6423         and abr.name = hl.lookup_code
6424         and hl.lookup_type = 'ABSENCE_REASON'
6425         and hl.enabled_flag = 'Y'
6426         and p_date between
6427         nvl(hl.start_date_active, p_date)
6428         and nvl(hl.end_date_active, p_date);
6429      --
6430 
6431      cursor c_absence_type_start_date(c_absence_attendance_type_id number) is
6432      select date_effective
6433      from per_absence_attendance_types
6434      where absence_attendance_type_id = c_absence_attendance_type_id;
6435 
6436      l_absence_type_start_date per_absence_attendance_types.date_effective%type;
6437    ---------------------------------------------------------------
6438    -- END OF BEN_LOA_RSN_RT_F ----------------------
6439    ---------------------------------------------------------------
6440    ---------------------------------------------------------------
6441    -- START OF BEN_LOS_RT_F ----------------------
6442    ---------------------------------------------------------------
6443    cursor c_lsr_from_parent(c_VRBL_RT_PRFL_ID number) is
6444    select distinct los_rt_id
6445    from BEN_LOS_RT_F
6446    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6447    --
6448    cursor c_lsr(c_los_rt_id number,c_mirror_src_entity_result_id number,
6449                 c_table_alias varchar2 ) is
6450    select  lsr.*
6451    from BEN_LOS_RT_F lsr
6452    where  lsr.los_rt_id = c_los_rt_id
6453      -- and lsr.business_group_id = p_business_group_id
6454      and not exists (
6455          select /* */ null
6456          from ben_copy_entity_results cpe
6457               -- pqh_table_route trt
6458          where copy_entity_txn_id = p_copy_entity_txn_id
6459          -- and trt.table_route_id = cpe.table_route_id
6460          and ( -- c_mirror_src_entity_result_id is null or
6461                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6462          -- and trt.where_clause = 'BEN_LOS_RT_F'
6463          and cpe.table_alias = c_table_alias
6464          and information1 = c_los_rt_id
6465          -- and information4 = lsr.business_group_id
6466            and information2 = lsr.effective_start_date
6467            and information3 = lsr.effective_end_date);
6468     l_los_rt_id                 number(15);
6469     l_out_lsr_result_id   number(15);
6470    --
6471    cursor c_lsr_drp(c_los_rt_id number,c_mirror_src_entity_result_id number,
6472                     c_table_alias varchar2 ) is
6473    select distinct cpe.information243 los_fctr_id
6474          from ben_copy_entity_results cpe
6475               -- pqh_table_route trt
6476          where copy_entity_txn_id = p_copy_entity_txn_id
6477          -- and trt.table_route_id = cpe.table_route_id
6478          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
6479          -- and trt.where_clause = 'BEN_LOS_RT_F'
6480          and cpe.table_alias = c_table_alias
6481          and information1 = c_los_rt_id
6482          -- and information4 = p_business_group_id
6483         ;
6484    ---------------------------------------------------------------
6485    -- END OF BEN_LOS_RT_F ----------------------
6486    ---------------------------------------------------------------
6487    ---------------------------------------------------------------
6488    -- START OF BEN_LVG_RSN_RT_F ----------------------
6489    ---------------------------------------------------------------
6490    cursor c_lrn_from_parent(c_VRBL_RT_PRFL_ID number) is
6491    select  lvg_rsn_rt_id
6492    from BEN_LVG_RSN_RT_F
6493    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6494    --
6495    cursor c_lrn(c_lvg_rsn_rt_id number,c_mirror_src_entity_result_id number,
6496                 c_table_alias varchar2 ) is
6497    select  lrn.*
6498    from BEN_LVG_RSN_RT_F lrn
6499    where  lrn.lvg_rsn_rt_id = c_lvg_rsn_rt_id
6500      -- and lrn.business_group_id = p_business_group_id
6501      and not exists (
6502          select /* */ null
6503          from ben_copy_entity_results cpe
6504               -- pqh_table_route trt
6505          where copy_entity_txn_id = p_copy_entity_txn_id
6506          -- and trt.table_route_id = cpe.table_route_id
6507          and ( -- c_mirror_src_entity_result_id is null or
6508                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6509          -- and trt.where_clause = 'BEN_LVG_RSN_RT_F'
6510          and cpe.table_alias = c_table_alias
6511          and information1 = c_lvg_rsn_rt_id
6512          -- and information4 = lrn.business_group_id
6513            and information2 = lrn.effective_start_date
6514            and information3 = lrn.effective_end_date);
6515     l_lvg_rsn_rt_id                 number(15);
6516     l_out_lrn_result_id   number(15);
6517    ---------------------------------------------------------------
6518    -- END OF BEN_LVG_RSN_RT_F ----------------------
6519    ---------------------------------------------------------------
6520    ---------------------------------------------------------------
6521    -- START OF BEN_ORG_UNIT_RT_F ----------------------
6522    ---------------------------------------------------------------
6523    cursor c_our_from_parent(c_VRBL_RT_PRFL_ID number) is
6524    select  org_unit_rt_id
6525    from BEN_ORG_UNIT_RT_F
6526    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6527    --
6528    cursor c_our(c_org_unit_rt_id number,c_mirror_src_entity_result_id number,
6529                 c_table_alias varchar2 ) is
6530    select  our.*
6531    from BEN_ORG_UNIT_RT_F our
6532    where  our.org_unit_rt_id = c_org_unit_rt_id
6533      -- and our.business_group_id = p_business_group_id
6534      and not exists (
6535          select /* */ null
6536          from ben_copy_entity_results cpe
6537               -- pqh_table_route trt
6538          where copy_entity_txn_id = p_copy_entity_txn_id
6539          -- and trt.table_route_id = cpe.table_route_id
6540          and ( -- c_mirror_src_entity_result_id is null or
6541                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6542          -- and trt.where_clause = 'BEN_ORG_UNIT_RT_F'
6543          and cpe.table_alias = c_table_alias
6544          and information1 = c_org_unit_rt_id
6545          -- and information4 = our.business_group_id
6546            and information2 = our.effective_start_date
6547            and information3 = our.effective_end_date);
6548 --PADMAJA
6549 
6550     --
6551     -- pabodla : mapping data - Bug 2716749
6552     --
6553     cursor c_get_mapping_name9(p_id in number,p_date in date) is
6554            select name
6555            from hr_all_organization_units_vl
6556            where business_group_id = business_group_id
6557              and organization_id = p_id
6558              and internal_external_flag = 'INT'
6559              and p_date between nvl(date_from, p_date)
6560                    and nvl(date_to, p_date)
6561              order by name;
6562     --
6563     l_org_unit_rt_id                 number(15);
6564     l_out_our_result_id   number(15);
6565    ---------------------------------------------------------------
6566    -- END OF BEN_ORG_UNIT_RT_F ----------------------
6567    ---------------------------------------------------------------
6568    ---------------------------------------------------------------
6569    -- START OF BEN_PCT_FL_TM_RT_F ----------------------
6570    ---------------------------------------------------------------
6571    cursor c_pfr_from_parent(c_VRBL_RT_PRFL_ID number) is
6572    select distinct pct_fl_tm_rt_id
6573    from BEN_PCT_FL_TM_RT_F
6574    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6575    --
6576    cursor c_pfr(c_pct_fl_tm_rt_id number,c_mirror_src_entity_result_id number,
6577                 c_table_alias varchar2 ) is
6578    select  pfr.*
6579    from BEN_PCT_FL_TM_RT_F pfr
6580    where  pfr.pct_fl_tm_rt_id = c_pct_fl_tm_rt_id
6581      -- and pfr.business_group_id = p_business_group_id
6582      and not exists (
6583          select /* */ null
6584          from ben_copy_entity_results cpe
6585               -- pqh_table_route trt
6586          where copy_entity_txn_id = p_copy_entity_txn_id
6587          -- and trt.table_route_id = cpe.table_route_id
6588          and ( -- c_mirror_src_entity_result_id is null or
6589                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6590          -- and trt.where_clause = 'BEN_PCT_FL_TM_RT_F'
6591          and cpe.table_alias = c_table_alias
6592          and information1 = c_pct_fl_tm_rt_id
6593          -- and information4 = pfr.business_group_id
6594            and information2 = pfr.effective_start_date
6595            and information3 = pfr.effective_end_date);
6596     l_pct_fl_tm_rt_id                 number(15);
6597     l_out_pfr_result_id   number(15);
6598    --
6599    cursor c_pfr_drp(c_pct_fl_tm_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
6600    select distinct cpe.information233 pct_fl_tm_fctr_id
6601          from ben_copy_entity_results cpe
6602               -- pqh_table_route trt
6603          where copy_entity_txn_id = p_copy_entity_txn_id
6604          -- and trt.table_route_id = cpe.table_route_id
6605          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
6606          -- and trt.where_clause = 'BEN_PCT_FL_TM_RT_F'
6607          and cpe.table_alias = c_table_alias
6608          and information1 = c_pct_fl_tm_rt_id
6609          -- and information4 = p_business_group_id
6610         ;
6611    ---------------------------------------------------------------
6612    -- END OF BEN_PCT_FL_TM_RT_F ----------------------
6613    ---------------------------------------------------------------
6614    ---------------------------------------------------------------
6615    -- START OF BEN_PER_TYP_RT_F ----------------------
6616    ---------------------------------------------------------------
6617    cursor c_ptr_from_parent(c_VRBL_RT_PRFL_ID number) is
6618    select  per_typ_rt_id
6619    from BEN_PER_TYP_RT_F
6620    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6621    --
6622    cursor c_ptr(c_per_typ_rt_id number,c_mirror_src_entity_result_id number,
6623                 c_table_alias varchar2 ) is
6624    select  ptr.*
6625    from BEN_PER_TYP_RT_F ptr
6626    where  ptr.per_typ_rt_id = c_per_typ_rt_id
6627      -- and ptr.business_group_id = p_business_group_id
6628      and not exists (
6629          select /* */ null
6630          from ben_copy_entity_results cpe
6631               -- pqh_table_route trt
6632          where copy_entity_txn_id = p_copy_entity_txn_id
6633          -- and trt.table_route_id = cpe.table_route_id
6634          and ( -- c_mirror_src_entity_result_id is null or
6635                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6636          -- and trt.where_clause = 'BEN_PER_TYP_RT_F'
6637          and cpe.table_alias = c_table_alias
6638          and information1 = c_per_typ_rt_id
6639          -- and information4 = ptr.business_group_id
6640            and information2 = ptr.effective_start_date
6641            and information3 = ptr.effective_end_date);
6642     l_per_typ_rt_id                 number(15);
6643     l_out_ptr_result_id   number(15);
6644     --
6645     -- pabodla : mapping data
6646     --
6647     cursor c_get_person_type_name(p_person_typ_id in number) is
6648       select ptl.user_person_type
6649       from per_person_types ppt,
6650          hr_leg_lookups hrlkup,
6651          per_person_types_tl ptl
6652     where active_flag = 'Y'
6653       -- and business_group_id = p_business_group_id
6654       and hrlkup.lookup_type = 'PERSON_TYPE'
6655       and hrlkup.lookup_code =  ppt.system_person_type
6656       and ppt.active_flag = 'Y'
6657       and ppt.person_type_id = p_person_typ_id
6658       and ppt.person_type_id = ptl.person_type_id
6659       and ptl.language = userenv('LANG');
6660     --
6661     l_mapping_person_type_id   number;
6662     l_mapping_person_type_name varchar2(600);
6663    --
6664    ---------------------------------------------------------------
6665    -- END OF BEN_PER_TYP_RT_F ----------------------
6666    ---------------------------------------------------------------
6667    ---------------------------------------------------------------
6668    -- START OF BEN_POE_RT_F ----------------------
6669    ---------------------------------------------------------------
6670    cursor c_prt_from_parent(c_VRBL_RT_PRFL_ID number) is
6671    select  poe_rt_id
6672    from BEN_POE_RT_F
6673    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6674    --
6675    cursor c_prt(c_poe_rt_id number,c_mirror_src_entity_result_id number,
6676                 c_table_alias varchar2 ) is
6677    select  prt.*
6678    from BEN_POE_RT_F prt
6679    where  prt.poe_rt_id = c_poe_rt_id
6680      -- and prt.business_group_id = p_business_group_id
6681      and not exists (
6682          select /* */ null
6683          from ben_copy_entity_results cpe
6684               -- pqh_table_route trt
6685          where copy_entity_txn_id = p_copy_entity_txn_id
6686          -- and trt.table_route_id = cpe.table_route_id
6687          and ( -- c_mirror_src_entity_result_id is null or
6688                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6689          -- and trt.where_clause = 'BEN_POE_RT_F'
6690          and cpe.table_alias = c_table_alias
6691          and information1 = c_poe_rt_id
6692          -- and information4 = prt.business_group_id
6693            and information2 = prt.effective_start_date
6694            and information3 = prt.effective_end_date);
6695     l_poe_rt_id                 number(15);
6696     l_out_prt_result_id   number(15);
6697    ---------------------------------------------------------------
6698    -- END OF BEN_POE_RT_F ----------------------
6699    ---------------------------------------------------------------
6700    ---------------------------------------------------------------
6701    -- START OF BEN_PPL_GRP_RT_F ----------------------
6702    ---------------------------------------------------------------
6703    cursor c_pgr_from_parent(c_VRBL_RT_PRFL_ID number) is
6704    select  ppl_grp_rt_id
6705    from BEN_PPL_GRP_RT_F
6706    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6707    --
6708    cursor c_pgr(c_ppl_grp_rt_id number,c_mirror_src_entity_result_id number,
6709                 c_table_alias varchar2 ) is
6710    select  pgr.*
6711    from BEN_PPL_GRP_RT_F pgr
6712    where  pgr.ppl_grp_rt_id = c_ppl_grp_rt_id
6713      -- and pgr.business_group_id = p_business_group_id
6714      and not exists (
6715          select /* */ null
6716          from ben_copy_entity_results cpe
6717               -- pqh_table_route trt
6718          where copy_entity_txn_id = p_copy_entity_txn_id
6719          -- and trt.table_route_id = cpe.table_route_id
6720          and ( -- c_mirror_src_entity_result_id is null or
6721                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6722          -- and trt.where_clause = 'BEN_PPL_GRP_RT_F'
6723          and cpe.table_alias = c_table_alias
6724          and information1 = c_ppl_grp_rt_id
6725          -- and information4 = pgr.business_group_id
6726            and information2 = pgr.effective_start_date
6727            and information3 = pgr.effective_end_date);
6728     l_ppl_grp_rt_id                 number(15);
6729     l_out_pgr_result_id   number(15);
6730    ---------------------------------------------------------------
6731    -- END OF BEN_PPL_GRP_RT_F ----------------------
6732    ---------------------------------------------------------------
6733    ---------------------------------------------------------------
6734    -- START OF BEN_PSTL_ZIP_RT_F ----------------------
6735    ---------------------------------------------------------------
6736    cursor c_pzr_from_parent(c_VRBL_RT_PRFL_ID number) is
6737    select distinct pstl_zip_rt_id
6738    from BEN_PSTL_ZIP_RT_F
6739    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6740    --
6741    cursor c_pzr(c_pstl_zip_rt_id number,c_mirror_src_entity_result_id number,
6742                 c_table_alias varchar2 ) is
6743    select  pzr.*
6744    from BEN_PSTL_ZIP_RT_F pzr
6745    where  pzr.pstl_zip_rt_id = c_pstl_zip_rt_id
6746      -- and pzr.business_group_id = p_business_group_id
6747      and not exists (
6748          select /* */ null
6749          from ben_copy_entity_results cpe
6750               -- pqh_table_route trt
6751          where copy_entity_txn_id = p_copy_entity_txn_id
6752          -- and trt.table_route_id = cpe.table_route_id
6753          and ( -- c_mirror_src_entity_result_id is null or
6754                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6755          -- and trt.where_clause = 'BEN_PSTL_ZIP_RT_F'
6756          and cpe.table_alias = c_table_alias
6757          and information1 = c_pstl_zip_rt_id
6758          -- and information4 = pzr.business_group_id
6759            and information2 = pzr.effective_start_date
6760            and information3 = pzr.effective_end_date);
6761     l_pstl_zip_rt_id                 number(15);
6762     l_out_pzr_result_id   number(15);
6763    --
6764    cursor c_pzr_pstl(c_pstl_zip_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
6765    select distinct cpe.information245 pstl_zip_rng_id
6766          from ben_copy_entity_results cpe
6767               -- pqh_table_route trt
6768          where copy_entity_txn_id = p_copy_entity_txn_id
6769          -- and trt.table_route_id = cpe.table_route_id
6770          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
6771          -- and trt.where_clause = 'BEN_PSTL_ZIP_RT_F'
6772          and cpe.table_alias = c_table_alias
6773          and information1 = c_pstl_zip_rt_id
6774          -- and information4 = p_business_group_id
6775         ;
6776    ---------------------------------------------------------------
6777    -- END OF BEN_PSTL_ZIP_RT_F ----------------------
6778    ---------------------------------------------------------------
6779    ---------------------------------------------------------------
6780    -- START OF BEN_PYRL_RT_F ----------------------
6781    ---------------------------------------------------------------
6782    cursor c_pr__from_parent(c_VRBL_RT_PRFL_ID number) is
6783    select  pyrl_rt_id
6784    from BEN_PYRL_RT_F
6785    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6786    --
6787    cursor c_pr_(c_pyrl_rt_id number,c_mirror_src_entity_result_id number,
6788                 c_table_alias varchar2 ) is
6789    select  pr_.*
6790    from BEN_PYRL_RT_F pr_
6791    where  pr_.pyrl_rt_id = c_pyrl_rt_id
6792      -- and pr_.business_group_id = p_business_group_id
6793      and not exists (
6794          select /* */ null
6795          from ben_copy_entity_results cpe
6796               -- pqh_table_route trt
6797          where copy_entity_txn_id = p_copy_entity_txn_id
6798          -- and trt.table_route_id = cpe.table_route_id
6799          and ( -- c_mirror_src_entity_result_id is null or
6800                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6801          -- and trt.where_clause = 'BEN_PYRL_RT_F'
6802          and cpe.table_alias = c_table_alias
6803          and information1 = c_pyrl_rt_id
6804          -- and information4 = pr_.business_group_id
6805            and information2 = pr_.effective_start_date
6806            and information3 = pr_.effective_end_date);
6807     l_pyrl_rt_id                 number(15);
6808     l_out_pr__result_id   number(15);
6809     --
6810     cursor c_get_mapping_name12(p_id in number,p_date in date) is
6811       select prl.payroll_name dsp_payroll_name
6812       from pay_all_payrolls_f prl
6813       where prl.business_group_id  = p_business_group_id
6814         and prl.payroll_id = p_id
6815         and p_date between prl.effective_start_date and prl.effective_end_date ;
6816     --
6817 
6818     cursor c_payroll_start_date(c_payroll_id number) is
6819     select min(effective_start_date) effective_start_date
6820     from pay_all_payrolls_f
6821     where payroll_id = c_payroll_id;
6822 
6823     l_payroll_start_date pay_all_payrolls_f.effective_start_date%type;
6824    ---------------------------------------------------------------
6825    -- END OF BEN_PYRL_RT_F ----------------------
6826    ---------------------------------------------------------------
6827    ---------------------------------------------------------------
6828    -- START OF BEN_PY_BSS_RT_F ----------------------
6829    ---------------------------------------------------------------
6830    cursor c_pbr_from_parent(c_VRBL_RT_PRFL_ID number) is
6831    select  py_bss_rt_id
6832    from BEN_PY_BSS_RT_F
6833    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6834    --
6835    cursor c_pbr(c_py_bss_rt_id number,c_mirror_src_entity_result_id number,
6836                 c_table_alias varchar2 ) is
6837    select  pbr.*
6838    from BEN_PY_BSS_RT_F pbr
6839    where  pbr.py_bss_rt_id = c_py_bss_rt_id
6840      -- and pbr.business_group_id = p_business_group_id
6841      and not exists (
6842          select /* */ null
6843          from ben_copy_entity_results cpe
6844               -- pqh_table_route trt
6845          where copy_entity_txn_id = p_copy_entity_txn_id
6846          -- and trt.table_route_id = cpe.table_route_id
6847          and ( -- c_mirror_src_entity_result_id is null or
6848                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6849          -- and trt.where_clause = 'BEN_PY_BSS_RT_F'
6850          and cpe.table_alias = c_table_alias
6851          and information1 = c_py_bss_rt_id
6852          -- and information4 = pbr.business_group_id
6853            and information2 = pbr.effective_start_date
6854            and information3 = pbr.effective_end_date);
6855     --
6856     -- pabodla : mapping data
6857     --
6858     cursor c_get_mapping_name13(p_id in number) is
6859      select name from per_pay_bases
6860      where business_group_id = p_business_group_id
6861        and pay_basis_id = p_id;
6862 
6863     l_py_bss_rt_id                 number(15);
6864     l_out_pbr_result_id   number(15);
6865    ---------------------------------------------------------------
6866    -- END OF BEN_PY_BSS_RT_F ----------------------
6867    ---------------------------------------------------------------
6868    ---------------------------------------------------------------
6869    -- START OF BEN_SCHEDD_HRS_RT_F ----------------------
6870    ---------------------------------------------------------------
6871    cursor c_shr_from_parent(c_VRBL_RT_PRFL_ID number) is
6872    select  schedd_hrs_rt_id
6873    from BEN_SCHEDD_HRS_RT_F
6874    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6875    --
6876    cursor c_shr(c_schedd_hrs_rt_id number,c_mirror_src_entity_result_id number,
6877                 c_table_alias varchar2 ) is
6878    select  shr.*
6879    from BEN_SCHEDD_HRS_RT_F shr
6880    where  shr.schedd_hrs_rt_id = c_schedd_hrs_rt_id
6881      -- and shr.business_group_id = p_business_group_id
6882      and not exists (
6883          select /* */ null
6884          from ben_copy_entity_results cpe
6885               -- pqh_table_route trt
6886          where copy_entity_txn_id = p_copy_entity_txn_id
6887          -- and trt.table_route_id = cpe.table_route_id
6888          and ( -- c_mirror_src_entity_result_id is null or
6889                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6890          -- and trt.where_clause = 'BEN_SCHEDD_HRS_RT_F'
6891          and cpe.table_alias = c_table_alias
6892          and information1 = c_schedd_hrs_rt_id
6893          -- and information4 = shr.business_group_id
6894            and information2 = shr.effective_start_date
6895            and information3 = shr.effective_end_date);
6896     l_schedd_hrs_rt_id                 number(15);
6897     l_out_shr_result_id   number(15);
6898    ---------------------------------------------------------------
6899    -- END OF BEN_SCHEDD_HRS_RT_F ----------------------
6900    ---------------------------------------------------------------
6901    ---------------------------------------------------------------
6902    -- START OF BEN_SVC_AREA_RT_F ----------------------
6903    ---------------------------------------------------------------
6904    cursor c_sar_from_parent(c_VRBL_RT_PRFL_ID number) is
6905    select distinct svc_area_rt_id
6906    from BEN_SVC_AREA_RT_F
6907    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6908    --
6909    cursor c_sar(c_svc_area_rt_id number,c_mirror_src_entity_result_id number,
6910                 c_table_alias varchar2 ) is
6911    select  sar.*
6912    from BEN_SVC_AREA_RT_F sar
6913    where  sar.svc_area_rt_id = c_svc_area_rt_id
6914      -- and sar.business_group_id = p_business_group_id
6915      and not exists (
6916          select /* */ null
6917          from ben_copy_entity_results cpe
6918               -- pqh_table_route trt
6919          where copy_entity_txn_id = p_copy_entity_txn_id
6920          -- and trt.table_route_id = cpe.table_route_id
6921          and ( -- c_mirror_src_entity_result_id is null or
6922                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6923          -- and trt.where_clause = 'BEN_SVC_AREA_RT_F'
6924          and cpe.table_alias = c_table_alias
6925          and information1 = c_svc_area_rt_id
6926          -- and information4 = sar.business_group_id
6927            and information2 = sar.effective_start_date
6928            and information3 = sar.effective_end_date);
6929     l_svc_area_rt_id                 number(15);
6930     l_out_sar_result_id   number(15);
6931    --
6932    cursor c_sar_srv(c_svc_area_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
6933    select distinct cpe.information241   svc_area_id
6934          from ben_copy_entity_results cpe
6935               -- pqh_table_route trt
6936          where copy_entity_txn_id = p_copy_entity_txn_id
6937          -- and trt.table_route_id = cpe.table_route_id
6938          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
6939          -- and trt.where_clause = 'BEN_SVC_AREA_RT_F'
6940          and cpe.table_alias = c_table_alias
6941          and information1 = c_svc_area_rt_id
6942          -- and information4 = p_business_group_id
6943         ;
6944    ---------------------------------------------------------------
6945    -- END OF BEN_SVC_AREA_RT_F ----------------------
6946    ---------------------------------------------------------------
6947    ---------------------------------------------------------------
6948    -- START OF BEN_TBCO_USE_RT_F ----------------------
6949    ---------------------------------------------------------------
6950    cursor c_tur_from_parent(c_VRBL_RT_PRFL_ID number) is
6951    select  tbco_use_rt_id
6952    from BEN_TBCO_USE_RT_F
6953    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6954    --
6955    cursor c_tur(c_tbco_use_rt_id number,c_mirror_src_entity_result_id number,
6956                 c_table_alias varchar2 ) is
6957    select  tur.*
6958    from BEN_TBCO_USE_RT_F tur
6959    where  tur.tbco_use_rt_id = c_tbco_use_rt_id
6960      -- and tur.business_group_id = p_business_group_id
6961      and not exists (
6962          select /* */ null
6963          from ben_copy_entity_results cpe
6964               -- pqh_table_route trt
6965          where copy_entity_txn_id = p_copy_entity_txn_id
6966          -- and trt.table_route_id = cpe.table_route_id
6967          and ( -- c_mirror_src_entity_result_id is null or
6968                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6969          -- and trt.where_clause = 'BEN_TBCO_USE_RT_F'
6970          and cpe.table_alias = c_table_alias
6971          and information1 = c_tbco_use_rt_id
6972          -- and information4 = tur.business_group_id
6973            and information2 = tur.effective_start_date
6974            and information3 = tur.effective_end_date);
6975     l_tbco_use_rt_id                 number(15);
6976     l_out_tur_result_id   number(15);
6977    ---------------------------------------------------------------
6978    -- END OF BEN_TBCO_USE_RT_F ----------------------
6979    ---------------------------------------------------------------
6980    ---------------------------------------------------------------
6981    -- START OF BEN_TTL_CVG_VOL_RT_F ----------------------
6982    ---------------------------------------------------------------
6983    cursor c_tcv_from_parent(c_VRBL_RT_PRFL_ID number) is
6984    select  ttl_cvg_vol_rt_id
6985    from BEN_TTL_CVG_VOL_RT_F
6986    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
6987    --
6988    cursor c_tcv(c_ttl_cvg_vol_rt_id number,c_mirror_src_entity_result_id number,
6989                 c_table_alias varchar2 ) is
6990    select  tcv.*
6991    from BEN_TTL_CVG_VOL_RT_F tcv
6992    where  tcv.ttl_cvg_vol_rt_id = c_ttl_cvg_vol_rt_id
6993      -- and tcv.business_group_id = p_business_group_id
6994      and not exists (
6995          select /* */ null
6996          from ben_copy_entity_results cpe
6997               -- pqh_table_route trt
6998          where copy_entity_txn_id = p_copy_entity_txn_id
6999          -- and trt.table_route_id = cpe.table_route_id
7000          and ( -- c_mirror_src_entity_result_id is null or
7001                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7002          -- and trt.where_clause = 'BEN_TTL_CVG_VOL_RT_F'
7003          and cpe.table_alias = c_table_alias
7004          and information1 = c_ttl_cvg_vol_rt_id
7005          -- and information4 = tcv.business_group_id
7006            and information2 = tcv.effective_start_date
7007            and information3 = tcv.effective_end_date);
7008     l_ttl_cvg_vol_rt_id                 number(15);
7009     l_out_tcv_result_id   number(15);
7010    ---------------------------------------------------------------
7011    -- END OF BEN_TTL_CVG_VOL_RT_F ----------------------
7012    ---------------------------------------------------------------
7013    ---------------------------------------------------------------
7014    -- START OF BEN_TTL_PRTT_RT_F ----------------------
7015    ---------------------------------------------------------------
7016    cursor c_ttp_from_parent(c_VRBL_RT_PRFL_ID number) is
7017    select  ttl_prtt_rt_id
7018    from BEN_TTL_PRTT_RT_F
7019    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7020    --
7021    cursor c_ttp(c_ttl_prtt_rt_id number,c_mirror_src_entity_result_id number,
7022                 c_table_alias varchar2 ) is
7023    select  ttp.*
7024    from BEN_TTL_PRTT_RT_F ttp
7025    where  ttp.ttl_prtt_rt_id = c_ttl_prtt_rt_id
7026      -- and ttp.business_group_id = p_business_group_id
7027      and not exists (
7028          select /* */ null
7029          from ben_copy_entity_results cpe
7030               -- pqh_table_route trt
7031          where copy_entity_txn_id = p_copy_entity_txn_id
7032          -- and trt.table_route_id = cpe.table_route_id
7033          and ( -- c_mirror_src_entity_result_id is null or
7034                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7035          -- and trt.where_clause = 'BEN_TTL_PRTT_RT_F'
7036          and cpe.table_alias = c_table_alias
7037          and information1 = c_ttl_prtt_rt_id
7038          -- and information4 = ttp.business_group_id
7039            and information2 = ttp.effective_start_date
7040            and information3 = ttp.effective_end_date);
7041     l_ttl_prtt_rt_id                 number(15);
7042     l_out_ttp_result_id   number(15);
7043    ---------------------------------------------------------------
7044    -- END OF BEN_TTL_PRTT_RT_F ----------------------
7045    ---------------------------------------------------------------
7046    ---------------------------------------------------------------
7047    -- START OF BEN_VRBL_MTCHG_RT_F ----------------------
7048    ---------------------------------------------------------------
7049    cursor c_vmr_from_parent(c_VRBL_RT_PRFL_ID number) is
7050    select  vrbl_mtchg_rt_id
7051    from BEN_VRBL_MTCHG_RT_F
7052    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7053    --
7054    cursor c_vmr(c_vrbl_mtchg_rt_id number,c_mirror_src_entity_result_id number,
7055                 c_table_alias varchar2 ) is
7056    select  vmr.*
7057    from BEN_VRBL_MTCHG_RT_F vmr
7058    where  vmr.vrbl_mtchg_rt_id = c_vrbl_mtchg_rt_id
7059      -- and vmr.business_group_id = p_business_group_id
7060      and not exists (
7061          select /* */ null
7062          from ben_copy_entity_results cpe
7063               -- pqh_table_route trt
7064          where copy_entity_txn_id = p_copy_entity_txn_id
7065          -- and trt.table_route_id = cpe.table_route_id
7066          and ( -- c_mirror_src_entity_result_id is null or
7067                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7068          -- and trt.where_clause = 'BEN_VRBL_MTCHG_RT_F'
7069          and cpe.table_alias = c_table_alias
7070          and information1 = c_vrbl_mtchg_rt_id
7071          -- and information4 = vmr.business_group_id
7072            and information2 = vmr.effective_start_date
7073            and information3 = vmr.effective_end_date);
7074     l_vrbl_mtchg_rt_id                 number(15);
7075     l_out_vmr_result_id   number(15);
7076    ---------------------------------------------------------------
7077    -- END OF BEN_VRBL_MTCHG_RT_F ----------------------
7078    ---------------------------------------------------------------
7079    ---------------------------------------------------------------
7080    -- START OF BEN_VRBL_RT_PRFL_RL_F ----------------------
7081    ---------------------------------------------------------------
7082    cursor c_vpr_from_parent(c_VRBL_RT_PRFL_ID number) is
7083    select  vrbl_rt_prfl_rl_id
7084    from BEN_VRBL_RT_PRFL_RL_F
7085    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7086    --
7087    cursor c_vpr(c_vrbl_rt_prfl_rl_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7088    select  vpr.*
7089    from BEN_VRBL_RT_PRFL_RL_F vpr
7090    where  vpr.vrbl_rt_prfl_rl_id = c_vrbl_rt_prfl_rl_id
7091      -- and vpr.business_group_id = p_business_group_id
7092      and not exists (
7093          select /* */ null
7094          from ben_copy_entity_results cpe
7095               -- pqh_table_route trt
7096          where copy_entity_txn_id = p_copy_entity_txn_id
7097          -- and trt.table_route_id = cpe.table_route_id
7098          and ( -- c_mirror_src_entity_result_id is null or
7099                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7100          -- and trt.where_clause = 'BEN_VRBL_RT_PRFL_RL_F'
7101          and cpe.table_alias = c_table_alias
7102          and information1 = c_vrbl_rt_prfl_rl_id
7103          -- and information4 = vpr.business_group_id
7104            and information2 = vpr.effective_start_date
7105            and information3 = vpr.effective_end_date);
7106     l_vrbl_rt_prfl_rl_id                 number(15);
7107     l_out_vpr_result_id   number(15);
7108    ---------------------------------------------------------------
7109    -- END OF BEN_VRBL_RT_PRFL_RL_F ----------------------
7110    ---------------------------------------------------------------
7111    ---------------------------------------------------------------
7112    -- START OF BEN_WK_LOC_RT_F ----------------------
7113    ---------------------------------------------------------------
7114    cursor c_wlr_from_parent(c_VRBL_RT_PRFL_ID number) is
7115    select  wk_loc_rt_id
7116    from BEN_WK_LOC_RT_F
7117    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7118    --
7119    cursor c_wlr(c_wk_loc_rt_id number,c_mirror_src_entity_result_id number,
7120                 c_table_alias varchar2 ) is
7121    select  wlr.*
7122    from BEN_WK_LOC_RT_F wlr
7123    where  wlr.wk_loc_rt_id = c_wk_loc_rt_id
7124      -- and wlr.business_group_id = p_business_group_id
7125      and not exists (
7126          select /* */ null
7127          from ben_copy_entity_results cpe
7128               -- pqh_table_route trt
7129          where copy_entity_txn_id = p_copy_entity_txn_id
7130          -- and trt.table_route_id = cpe.table_route_id
7131          and ( -- c_mirror_src_entity_result_id is null or
7132                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7133          -- and trt.where_clause = 'BEN_WK_LOC_RT_F'
7134          and cpe.table_alias = c_table_alias
7135          and information1 = c_wk_loc_rt_id
7136          -- and information4 = wlr.business_group_id
7137            and information2 = wlr.effective_start_date
7138            and information3 = wlr.effective_end_date);
7139     l_wk_loc_rt_id                 number(15);
7140     l_out_wlr_result_id   number(15);
7141     --
7142     -- pabodla : mapping data
7143     --
7144     cursor c_get_mapping_name10(p_id in number,p_date in date) is
7145       select loc.location_code dsp_location_code
7146       from hr_locations loc
7147       where loc.location_id = p_id
7148         and p_date <= nvl( loc.inactive_date, p_date);
7149 
7150     cursor c_location_inactive_date(c_location_id number) is
7151     select inactive_date
7152     from hr_locations
7153     where location_id = c_location_id;
7154 
7155     l_location_inactive_date hr_locations.inactive_date%type;
7156    ---------------------------------------------------------------
7157    -- END OF BEN_WK_LOC_RT_F ----------------------
7158    ---------------------------------------------------------------
7159    ---------------------------------------------------------------
7160    -- START OF BEN_COMPTNCY_RT_F ----------------------
7161    ---------------------------------------------------------------
7162    cursor c_cty_from_parent(c_VRBL_RT_PRFL_ID number) is
7163    select  comptncy_rt_id
7164    from BEN_COMPTNCY_RT_F
7165    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7166    --
7167    cursor c_cty(c_comptncy_rt_id number,c_mirror_src_entity_result_id number,
7168                 c_table_alias varchar2 ) is
7169    select  cty.*
7170    from BEN_COMPTNCY_RT_F cty
7171    where  cty.comptncy_rt_id = c_comptncy_rt_id
7172      -- and cty.business_group_id = p_business_group_id
7173      and not exists (
7174          select /* */ null
7175          from ben_copy_entity_results cpe
7176               -- pqh_table_route trt
7177          where copy_entity_txn_id = p_copy_entity_txn_id
7178          -- and trt.table_route_id = cpe.table_route_id
7179          and ( -- c_mirror_src_entity_result_id is null or
7180                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7181          -- and trt.where_clause = 'BEN_COMPTNCY_RT_F'
7182          and cpe.table_alias = c_table_alias
7183          and information1 = c_comptncy_rt_id
7184          -- and information4 = cty.business_group_id
7185            and information2 = cty.effective_start_date
7186            and information3 = cty.effective_end_date);
7187     l_comptncy_rt_id                 number(15);
7188     l_out_cty_result_id   number(15);
7189     --
7190     cursor c_get_mapping_name16(p_COMPETENCE_ID number,p_date date) is
7191     select name
7192       from per_competences_vl
7193      where COMPETENCE_ID = p_COMPETENCE_ID
7194        and p_date
7195            between  Date_from  and nvl(Date_to, p_date);
7196     --
7197     cursor c_get_mapping_name17(p_rating_level_id number,
7198                                 p_business_group_id number
7199                                ) is
7200      select rtl.name name
7201      from per_rating_levels_vl rtl
7202      where nvl(rtl.business_group_id, p_business_group_id) = p_business_group_id     and   rtl.rating_level_id = p_rating_level_id;
7203    --
7204    cursor c_competence_start_date(c_competence_id number) is
7205    select date_from
7206    from per_competences
7207    where competence_id = c_competence_id;
7208 
7209    l_competence_start_date  per_competences.date_from%type;
7210    ---------------------------------------------------------------
7211    -- END OF BEN_COMPTNCY_RT_F ----------------------
7212    ---------------------------------------------------------------
7213    ---------------------------------------------------------------
7214    -- START OF BEN_JOB_RT_F ----------------------
7215    ---------------------------------------------------------------
7216    cursor c_jrt_from_parent(c_VRBL_RT_PRFL_ID number) is
7217    select  job_rt_id
7218    from BEN_JOB_RT_F
7219    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7220    --
7221    cursor c_jrt(c_job_rt_id number,c_mirror_src_entity_result_id number,
7222                 c_table_alias varchar2 ) is
7223    select  jrt.*
7224    from BEN_JOB_RT_F jrt
7225    where  jrt.job_rt_id = c_job_rt_id
7226      -- and jrt.business_group_id = p_business_group_id
7227      and not exists (
7228          select /* */ null
7229          from ben_copy_entity_results cpe
7230               -- pqh_table_route trt
7231          where copy_entity_txn_id = p_copy_entity_txn_id
7232          -- and trt.table_route_id = cpe.table_route_id
7233          and ( -- c_mirror_src_entity_result_id is null or
7234                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7235          -- and trt.where_clause = 'BEN_JOB_RT_F'
7236          and cpe.table_alias = c_table_alias
7237          and information1 = c_job_rt_id
7238          -- and information4 = jrt.business_group_id
7239            and information2 = jrt.effective_start_date
7240            and information3 = jrt.effective_end_date);
7241     --
7242     -- pabodla : mapping data
7243     --
7244     cursor c_get_mapping_name11(p_id in number,p_date in date) is
7245       select name
7246       from per_jobs_vl
7247       where business_group_id = p_business_group_id
7248         and job_id = p_id
7249         and p_date between date_from and nvl(date_to,p_date);
7250 
7251     --
7252     --
7253 
7254      cursor c_job_start_date(c_job_id number) is
7255      select date_from
7256      from per_jobs
7257      where job_id = c_job_id;
7258 
7259     l_job_rt_id                 number(15);
7260     l_out_jrt_result_id   number(15);
7261     l_job_start_date      per_jobs.date_from%type;
7262    ---------------------------------------------------------------
7263    -- END OF BEN_JOB_RT_F ----------------------
7264    ---------------------------------------------------------------
7265    ---------------------------------------------------------------
7266    -- START OF BEN_PSTN_RT_F ----------------------
7267    ---------------------------------------------------------------
7268    cursor c_pst_from_parent(c_VRBL_RT_PRFL_ID number) is
7269    select  pstn_rt_id
7270    from BEN_PSTN_RT_F
7271    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7272    --
7273    cursor c_pst(c_pstn_rt_id number,c_mirror_src_entity_result_id number,
7274                 c_table_alias varchar2 ) is
7275    select  pst.*
7276    from BEN_PSTN_RT_F pst
7277    where  pst.pstn_rt_id = c_pstn_rt_id
7278      -- and pst.business_group_id = p_business_group_id
7279      and not exists (
7280          select /* */ null
7281          from ben_copy_entity_results cpe
7282               -- pqh_table_route trt
7283          where copy_entity_txn_id = p_copy_entity_txn_id
7284          -- and trt.table_route_id = cpe.table_route_id
7285          and ( -- c_mirror_src_entity_result_id is null or
7286                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7287          -- and trt.where_clause = 'BEN_PSTN_RT_F'
7288          and cpe.table_alias = c_table_alias
7289          and information1 = c_pstn_rt_id
7290          -- and information4 = pst.business_group_id
7291            and information2 = pst.effective_start_date
7292            and information3 = pst.effective_end_date);
7293     --
7294     -- pabodla : mapping data
7295     --
7296     cursor c_get_mapping_name14(p_id in number) is
7297        select name
7298        from per_positions
7299        where business_group_id = p_business_group_id
7300          and position_id = p_id;
7301 
7302      cursor c_position_start_date(c_position_id number) is
7303      select date_effective
7304      from per_positions
7305      where position_id = c_position_id;
7306 
7307     l_pstn_rt_id                 number(15);
7308     l_out_pst_result_id   number(15);
7309     l_position_start_date per_positions.date_effective%type;
7310    ---------------------------------------------------------------
7311    -- END OF BEN_PSTN_RT_F ----------------------
7312    ---------------------------------------------------------------
7313    ---------------------------------------------------------------
7314    -- START OF BEN_QUAL_TITL_RT_F ----------------------
7315    ---------------------------------------------------------------
7316    cursor c_qtr_from_parent(c_VRBL_RT_PRFL_ID number) is
7317    select  qual_titl_rt_id
7318    from BEN_QUAL_TITL_RT_F
7319    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7320    --
7321    cursor c_qtr(c_qual_titl_rt_id number,c_mirror_src_entity_result_id number,
7322                 c_table_alias varchar2 ) is
7323    select  qtr.*
7324    from BEN_QUAL_TITL_RT_F qtr
7325    where  qtr.qual_titl_rt_id = c_qual_titl_rt_id
7326      --and qtr.business_group_id = p_business_group_id
7327      and not exists (
7328          select /* */ null
7329          from ben_copy_entity_results cpe
7330               -- pqh_table_route trt
7331          where copy_entity_txn_id = p_copy_entity_txn_id
7332          -- and trt.table_route_id = cpe.table_route_id
7333          and ( -- c_mirror_src_entity_result_id is null or
7334                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7335          -- and trt.where_clause = 'BEN_QUAL_TITL_RT_F'
7336          and cpe.table_alias = c_table_alias
7337          and information1 = c_qual_titl_rt_id
7338          -- and information4 = qtr.business_group_id
7339            and information2 = qtr.effective_start_date
7340            and information3 = qtr.effective_end_date);
7341    --
7342    -- pabodla : mapping data
7343    --
7344    cursor c_get_mapping_name15(p_id in number) is
7345       select name
7346       from per_qualification_types_vl
7347       where qualification_type_id  = p_id;
7348 
7349     l_qual_titl_rt_id                 number(15);
7350     l_out_qtr_result_id   number(15);
7351    ---------------------------------------------------------------
7352    -- END OF BEN_QUAL_TITL_RT_F ----------------------
7353    ---------------------------------------------------------------
7354    ---------------------------------------------------------------
7355    -- START OF BEN_CBR_QUALD_BNF_RT_F ----------------------
7356    ---------------------------------------------------------------
7357    cursor c_cqr_from_parent(c_VRBL_RT_PRFL_ID number) is
7358    select  cbr_quald_bnf_rt_id
7359    from BEN_CBR_QUALD_BNF_RT_F
7360    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7361    --
7362    cursor c_cqr(c_cbr_quald_bnf_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7363    select  cqr.*
7364    from BEN_CBR_QUALD_BNF_RT_F cqr
7365    where  cqr.cbr_quald_bnf_rt_id = c_cbr_quald_bnf_rt_id
7366      --and cqr.business_group_id = p_business_group_id
7367      and not exists (
7368          select /* */ null
7369          from ben_copy_entity_results cpe
7370               -- pqh_table_route trt
7371          where copy_entity_txn_id = p_copy_entity_txn_id
7372          -- and trt.table_route_id = cpe.table_route_id
7373          and ( -- c_mirror_src_entity_result_id is null or
7374                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7375          -- and trt.where_clause = 'BEN_CBR_QUALD_BNF_RT_F'
7376          and cpe.table_alias = c_table_alias
7377          and information1 = c_cbr_quald_bnf_rt_id
7378          -- and information4 = cqr.business_group_id
7379            and information2 = cqr.effective_start_date
7380            and information3 = cqr.effective_end_date);
7381     l_cbr_quald_bnf_rt_id                 number(15);
7382     l_out_cqr_result_id   number(15);
7383    ---------------------------------------------------------------
7384    -- END OF BEN_CBR_QUALD_BNF_RT_F ----------------------
7385    ---------------------------------------------------------------
7386    ---------------------------------------------------------------
7387    -- START OF BEN_CNTNG_PRTN_PRFL_RT_F ----------------------
7388    ---------------------------------------------------------------
7389    cursor c_cpn_from_parent(c_VRBL_RT_PRFL_ID number) is
7390    select  cntng_prtn_prfl_rt_id
7391    from BEN_CNTNG_PRTN_PRFL_RT_F
7392    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7393    --
7394    cursor c_cpn(c_cntng_prtn_prfl_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7395    select  cpn.*
7396    from BEN_CNTNG_PRTN_PRFL_RT_F cpn
7397    where  cpn.cntng_prtn_prfl_rt_id = c_cntng_prtn_prfl_rt_id
7398      --and cpn.business_group_id = p_business_group_id
7399      and not exists (
7400          select /* */ null
7401          from ben_copy_entity_results cpe
7402               -- pqh_table_route trt
7403          where copy_entity_txn_id = p_copy_entity_txn_id
7404          -- and trt.table_route_id = cpe.table_route_id
7405          and ( -- c_mirror_src_entity_result_id is null or
7406                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7407          -- and trt.where_clause = 'BEN_CNTNG_PRTN_PRFL_RT_F'
7408          and cpe.table_alias = c_table_alias
7409          and information1 = c_cntng_prtn_prfl_rt_id
7410          -- and information4 = cpn.business_group_id
7411            and information2 = cpn.effective_start_date
7412            and information3 = cpn.effective_end_date);
7413     l_cntng_prtn_prfl_rt_id                 number(15);
7414     l_out_cpn_result_id   number(15);
7415    ---------------------------------------------------------------
7416    -- END OF BEN_CNTNG_PRTN_PRFL_RT_F ----------------------
7417    ---------------------------------------------------------------
7418    ---------------------------------------------------------------
7419    -- START OF BEN_DPNT_CVRD_OTHR_PL_RT_F ----------------------
7420    ---------------------------------------------------------------
7421    cursor c_dcl_from_parent(c_VRBL_RT_PRFL_ID number) is
7422    select  dpnt_cvrd_othr_pl_rt_id
7423    from BEN_DPNT_CVRD_OTHR_PL_RT_F
7424    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7425    --
7426    cursor c_dcl(c_dpnt_cvrd_othr_pl_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7427    select  dcl.*
7428    from BEN_DPNT_CVRD_OTHR_PL_RT_F dcl
7429    where  dcl.dpnt_cvrd_othr_pl_rt_id = c_dpnt_cvrd_othr_pl_rt_id
7430      --and dcl.business_group_id = p_business_group_id
7431      and not exists (
7432          select /* */ null
7433          from ben_copy_entity_results cpe
7434               -- pqh_table_route trt
7435          where copy_entity_txn_id = p_copy_entity_txn_id
7436          -- and trt.table_route_id = cpe.table_route_id
7437          and ( -- c_mirror_src_entity_result_id is null or
7438                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7439          -- and trt.where_clause = 'BEN_DPNT_CVRD_OTHR_PL_RT_F'
7440          and cpe.table_alias = c_table_alias
7441          and information1 = c_dpnt_cvrd_othr_pl_rt_id
7442          -- and information4 = dcl.business_group_id
7443            and information2 = dcl.effective_start_date
7444            and information3 = dcl.effective_end_date);
7445     l_dpnt_cvrd_othr_pl_rt_id                 number(15);
7446     l_out_dcl_result_id   number(15);
7447    ---------------------------------------------------------------
7448    -- END OF BEN_DPNT_CVRD_OTHR_PL_RT_F ----------------------
7449    ---------------------------------------------------------------
7450    ---------------------------------------------------------------
7451    -- START OF BEN_DPNT_CVRD_PLIP_RT_F ----------------------
7452    ---------------------------------------------------------------
7453    cursor c_dcp_from_parent(c_VRBL_RT_PRFL_ID number) is
7454    select  dpnt_cvrd_plip_rt_id
7455    from BEN_DPNT_CVRD_PLIP_RT_F
7456    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7457    --
7458    cursor c_dcp(c_dpnt_cvrd_plip_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7459    select  dcp.*
7460    from BEN_DPNT_CVRD_PLIP_RT_F dcp
7461    where  dcp.dpnt_cvrd_plip_rt_id = c_dpnt_cvrd_plip_rt_id
7462      --and dcp.business_group_id = p_business_group_id
7463      and not exists (
7464          select /* */ null
7465          from ben_copy_entity_results cpe
7466               -- pqh_table_route trt
7467          where copy_entity_txn_id = p_copy_entity_txn_id
7468          -- and trt.table_route_id = cpe.table_route_id
7469          and ( -- c_mirror_src_entity_result_id is null or
7470                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7471          -- and trt.where_clause = 'BEN_DPNT_CVRD_PLIP_RT_F'
7472          and cpe.table_alias = c_table_alias
7473          and information1 = c_dpnt_cvrd_plip_rt_id
7474          -- and information4 = dcp.business_group_id
7475            and information2 = dcp.effective_start_date
7476            and information3 = dcp.effective_end_date);
7477     l_dpnt_cvrd_plip_rt_id                 number(15);
7478     l_out_dcp_result_id   number(15);
7479    ---------------------------------------------------------------
7480    -- END OF BEN_DPNT_CVRD_PLIP_RT_F ----------------------
7481    ---------------------------------------------------------------
7482    ---------------------------------------------------------------
7483    -- START OF BEN_DPNT_CVRD_OTHR_PTIP_RT_F ----------------------
7484    ---------------------------------------------------------------
7485    cursor c_dco_from_parent(c_VRBL_RT_PRFL_ID number) is
7486    select  dpnt_cvrd_othr_ptip_rt_id
7487    from BEN_DPNT_CVRD_OTHR_PTIP_RT_F
7488    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7489    --
7490    cursor c_dco(c_dpnt_cvrd_othr_ptip_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7491    select  dco.*
7492    from BEN_DPNT_CVRD_OTHR_PTIP_RT_F dco
7493    where  dco.dpnt_cvrd_othr_ptip_rt_id = c_dpnt_cvrd_othr_ptip_rt_id
7494      --and dco.business_group_id = p_business_group_id
7495      and not exists (
7496          select /* */ null
7497          from ben_copy_entity_results cpe
7498               -- pqh_table_route trt
7499          where copy_entity_txn_id = p_copy_entity_txn_id
7500          -- and trt.table_route_id = cpe.table_route_id
7501          and ( -- c_mirror_src_entity_result_id is null or
7502                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7503          -- and trt.where_clause = 'BEN_DPNT_CVRD_OTHR_PTIP_RT_F'
7504          and cpe.table_alias = c_table_alias
7505          and information1 = c_dpnt_cvrd_othr_ptip_rt_id
7506          -- and information4 = dco.business_group_id
7507            and information2 = dco.effective_start_date
7508            and information3 = dco.effective_end_date);
7509     l_dpnt_cvrd_othr_ptip_rt_id                 number(15);
7510     l_out_dco_result_id   number(15);
7511    ---------------------------------------------------------------
7512    -- END OF BEN_DPNT_CVRD_OTHR_PTIP_RT_F ----------------------
7513    ---------------------------------------------------------------
7514    ---------------------------------------------------------------
7515    -- START OF BEN_DPNT_CVRD_OTHR_PGM_RT_F ----------------------
7516    ---------------------------------------------------------------
7517    cursor c_dop_from_parent(c_VRBL_RT_PRFL_ID number) is
7518    select  dpnt_cvrd_othr_pgm_rt_id
7519    from BEN_DPNT_CVRD_OTHR_PGM_RT_F
7520    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7521    --
7522    cursor c_dop(c_dpnt_cvrd_othr_pgm_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7523    select  dop.*
7524    from BEN_DPNT_CVRD_OTHR_PGM_RT_F dop
7525    where  dop.dpnt_cvrd_othr_pgm_rt_id = c_dpnt_cvrd_othr_pgm_rt_id
7526      --and dop.business_group_id = p_business_group_id
7527      and not exists (
7528          select /* */ null
7529          from ben_copy_entity_results cpe
7530               -- pqh_table_route trt
7531          where copy_entity_txn_id = p_copy_entity_txn_id
7532          -- and trt.table_route_id = cpe.table_route_id
7533          and ( -- c_mirror_src_entity_result_id is null or
7534                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7535          -- and trt.where_clause = 'BEN_DPNT_CVRD_OTHR_PGM_RT_F'
7536          and cpe.table_alias = c_table_alias
7537          and information1 = c_dpnt_cvrd_othr_pgm_rt_id
7538          -- and information4 = dop.business_group_id
7539            and information2 = dop.effective_start_date
7540            and information3 = dop.effective_end_date);
7541     l_dpnt_cvrd_othr_pgm_rt_id                 number(15);
7542     l_out_dop_result_id   number(15);
7543    ---------------------------------------------------------------
7544    -- END OF BEN_DPNT_CVRD_OTHR_PGM_RT_F ----------------------
7545    ---------------------------------------------------------------
7546    ---------------------------------------------------------------
7547    -- START OF BEN_PRTT_ANTHR_PL_RT_F ----------------------
7548    ---------------------------------------------------------------
7549    cursor c_pap_from_parent(c_VRBL_RT_PRFL_ID number) is
7550    select  prtt_anthr_pl_rt_id
7551    from BEN_PRTT_ANTHR_PL_RT_F
7552    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7553    --
7554    cursor c_pap(c_prtt_anthr_pl_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7555    select  pap.*
7556    from BEN_PRTT_ANTHR_PL_RT_F pap
7557    where  pap.prtt_anthr_pl_rt_id = c_prtt_anthr_pl_rt_id
7558      --and pap.business_group_id = p_business_group_id
7559      and not exists (
7560          select /* */ null
7561          from ben_copy_entity_results cpe
7562               -- pqh_table_route trt
7563          where copy_entity_txn_id = p_copy_entity_txn_id
7564          -- and trt.table_route_id = cpe.table_route_id
7565          and ( -- c_mirror_src_entity_result_id is null or
7566                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7567          -- and trt.where_clause = 'BEN_PRTT_ANTHR_PL_RT_F'
7568          and cpe.table_alias = c_table_alias
7569          and information1 = c_prtt_anthr_pl_rt_id
7570          -- and information4 = pap.business_group_id
7571            and information2 = pap.effective_start_date
7572            and information3 = pap.effective_end_date);
7573     l_prtt_anthr_pl_rt_id                 number(15);
7574     l_out_pap_result_id   number(15);
7575    ---------------------------------------------------------------
7576    -- END OF BEN_PRTT_ANTHR_PL_RT_F ----------------------
7577    ---------------------------------------------------------------
7578    ---------------------------------------------------------------
7579    -- START OF BEN_ENRLD_ANTHR_OIPL_RT_F ----------------------
7580    ---------------------------------------------------------------
7581    cursor c_eao_from_parent(c_VRBL_RT_PRFL_ID number) is
7582    select  enrld_anthr_oipl_rt_id
7583    from BEN_ENRLD_ANTHR_OIPL_RT_F
7584    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7585    --
7586    cursor c_eao(c_enrld_anthr_oipl_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7587    select  eao.*
7588    from BEN_ENRLD_ANTHR_OIPL_RT_F eao
7589    where  eao.enrld_anthr_oipl_rt_id = c_enrld_anthr_oipl_rt_id
7590      --and eao.business_group_id = p_business_group_id
7591      and not exists (
7592          select /* */ null
7593          from ben_copy_entity_results cpe
7594               -- pqh_table_route trt
7595          where copy_entity_txn_id = p_copy_entity_txn_id
7596          -- and trt.table_route_id = cpe.table_route_id
7597          and ( -- c_mirror_src_entity_result_id is null or
7598                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7599          -- and trt.where_clause = 'BEN_ENRLD_ANTHR_OIPL_RT_F'
7600          and cpe.table_alias = c_table_alias
7601          and information1 = c_enrld_anthr_oipl_rt_id
7602          -- and information4 = eao.business_group_id
7603            and information2 = eao.effective_start_date
7604            and information3 = eao.effective_end_date);
7605     l_enrld_anthr_oipl_rt_id                 number(15);
7606     l_out_eao_result_id   number(15);
7607    ---------------------------------------------------------------
7608    -- END OF BEN_ENRLD_ANTHR_OIPL_RT_F ----------------------
7609    ---------------------------------------------------------------
7610    ---------------------------------------------------------------
7611    -- START OF BEN_ENRLD_ANTHR_PL_RT_F ----------------------
7612    ---------------------------------------------------------------
7613    cursor c_enl_from_parent(c_VRBL_RT_PRFL_ID number) is
7614    select  enrld_anthr_pl_rt_id
7615    from BEN_ENRLD_ANTHR_PL_RT_F
7616    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7617    --
7618    cursor c_enl(c_enrld_anthr_pl_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7619    select  enl.*
7620    from BEN_ENRLD_ANTHR_PL_RT_F enl
7621    where  enl.enrld_anthr_pl_rt_id = c_enrld_anthr_pl_rt_id
7622      --and enl.business_group_id = p_business_group_id
7623      and not exists (
7624          select /* */ null
7625          from ben_copy_entity_results cpe
7626               -- pqh_table_route trt
7627          where copy_entity_txn_id = p_copy_entity_txn_id
7628          -- and trt.table_route_id = cpe.table_route_id
7629          and ( -- c_mirror_src_entity_result_id is null or
7630                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7631          -- and trt.where_clause = 'BEN_ENRLD_ANTHR_PL_RT_F'
7632          and cpe.table_alias = c_table_alias
7633          and information1 = c_enrld_anthr_pl_rt_id
7634          -- and information4 = enl.business_group_id
7635            and information2 = enl.effective_start_date
7636            and information3 = enl.effective_end_date);
7637     l_enrld_anthr_pl_rt_id                 number(15);
7638     l_out_enl_result_id   number(15);
7639    ---------------------------------------------------------------
7640    -- END OF BEN_ENRLD_ANTHR_PL_RT_F ----------------------
7641    ---------------------------------------------------------------
7642    ---------------------------------------------------------------
7643    -- START OF BEN_ENRLD_ANTHR_PLIP_RT_F ----------------------
7644    ---------------------------------------------------------------
7645    cursor c_ear_from_parent(c_VRBL_RT_PRFL_ID number) is
7646    select  enrld_anthr_plip_rt_id
7647    from BEN_ENRLD_ANTHR_PLIP_RT_F
7648    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7649    --
7650    cursor c_ear(c_enrld_anthr_plip_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7651    select  ear.*
7652    from BEN_ENRLD_ANTHR_PLIP_RT_F ear
7653    where  ear.enrld_anthr_plip_rt_id = c_enrld_anthr_plip_rt_id
7654      --and ear.business_group_id = p_business_group_id
7655      and not exists (
7656          select /* */ null
7657          from ben_copy_entity_results cpe
7658               -- pqh_table_route trt
7659          where copy_entity_txn_id = p_copy_entity_txn_id
7660          -- and trt.table_route_id = cpe.table_route_id
7661          and ( -- c_mirror_src_entity_result_id is null or
7662                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7663          -- and trt.where_clause = 'BEN_ENRLD_ANTHR_PLIP_RT_F'
7664          and cpe.table_alias = c_table_alias
7665          and information1 = c_enrld_anthr_plip_rt_id
7666          -- and information4 = ear.business_group_id
7667            and information2 = ear.effective_start_date
7668            and information3 = ear.effective_end_date);
7669     l_enrld_anthr_plip_rt_id                 number(15);
7670     l_out_ear_result_id   number(15);
7671    ---------------------------------------------------------------
7672    -- END OF BEN_ENRLD_ANTHR_PLIP_RT_F ----------------------
7673    ---------------------------------------------------------------
7674    ---------------------------------------------------------------
7675    -- START OF BEN_ENRLD_ANTHR_PTIP_RT_F ----------------------
7676    ---------------------------------------------------------------
7677    cursor c_ent_from_parent(c_VRBL_RT_PRFL_ID number) is
7678    select  enrld_anthr_ptip_rt_id
7679    from BEN_ENRLD_ANTHR_PTIP_RT_F
7680    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7681    --
7682    cursor c_ent(c_enrld_anthr_ptip_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7683    select  ent.*
7684    from BEN_ENRLD_ANTHR_PTIP_RT_F ent
7685    where  ent.enrld_anthr_ptip_rt_id = c_enrld_anthr_ptip_rt_id
7686      --and ent.business_group_id = p_business_group_id
7687      and not exists (
7688          select /* */ null
7689          from ben_copy_entity_results cpe
7690               -- pqh_table_route trt
7691          where copy_entity_txn_id = p_copy_entity_txn_id
7692          -- and trt.table_route_id = cpe.table_route_id
7693          and ( -- c_mirror_src_entity_result_id is null or
7694                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7695          -- and trt.where_clause = 'BEN_ENRLD_ANTHR_PTIP_RT_F'
7696          and cpe.table_alias = c_table_alias
7697          and information1 = c_enrld_anthr_ptip_rt_id
7698          -- and information4 = ent.business_group_id
7699            and information2 = ent.effective_start_date
7700            and information3 = ent.effective_end_date);
7701     l_enrld_anthr_ptip_rt_id                 number(15);
7702     l_out_ent_result_id   number(15);
7703    ---------------------------------------------------------------
7704    -- END OF BEN_ENRLD_ANTHR_PTIP_RT_F ----------------------
7705    ---------------------------------------------------------------
7706    ---------------------------------------------------------------
7707    -- START OF BEN_ENRLD_ANTHR_PGM_RT_F ----------------------
7708    ---------------------------------------------------------------
7709    cursor c_epm_from_parent(c_VRBL_RT_PRFL_ID number) is
7710    select  enrld_anthr_pgm_rt_id
7711    from BEN_ENRLD_ANTHR_PGM_RT_F
7712    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7713    --
7714    cursor c_epm(c_enrld_anthr_pgm_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7715    select  epm.*
7716    from BEN_ENRLD_ANTHR_PGM_RT_F epm
7717    where  epm.enrld_anthr_pgm_rt_id = c_enrld_anthr_pgm_rt_id
7718      --and epm.business_group_id = p_business_group_id
7719      and not exists (
7720          select /* */ null
7721          from ben_copy_entity_results cpe
7722               -- pqh_table_route trt
7723          where copy_entity_txn_id = p_copy_entity_txn_id
7724          -- and trt.table_route_id = cpe.table_route_id
7725          and ( -- c_mirror_src_entity_result_id is null or
7726                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7727          -- and trt.where_clause = 'BEN_ENRLD_ANTHR_PGM_RT_F'
7728          and cpe.table_alias = c_table_alias
7729          and information1 = c_enrld_anthr_pgm_rt_id
7730          -- and information4 = epm.business_group_id
7731            and information2 = epm.effective_start_date
7732            and information3 = epm.effective_end_date);
7733     l_enrld_anthr_pgm_rt_id                 number(15);
7734     l_out_epm_result_id   number(15);
7735    ---------------------------------------------------------------
7736    -- END OF BEN_ENRLD_ANTHR_PGM_RT_F ----------------------
7737    ---------------------------------------------------------------
7738    ---------------------------------------------------------------
7739    -- START OF BEN_NO_OTHR_CVG_RT_F ----------------------
7740    ---------------------------------------------------------------
7741    cursor c_noc_from_parent(c_VRBL_RT_PRFL_ID number) is
7742    select  no_othr_cvg_rt_id
7743    from BEN_NO_OTHR_CVG_RT_F
7744    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7745    --
7746    cursor c_noc(c_no_othr_cvg_rt_id number,c_mirror_src_entity_result_id number,                c_table_alias varchar2 ) is
7747    select  noc.*
7748    from BEN_NO_OTHR_CVG_RT_F noc
7749    where  noc.no_othr_cvg_rt_id = c_no_othr_cvg_rt_id
7750      --and noc.business_group_id = p_business_group_id
7751      and not exists (
7752          select /* */ null
7753          from ben_copy_entity_results cpe
7754               -- pqh_table_route trt
7755          where copy_entity_txn_id = p_copy_entity_txn_id
7756          -- and trt.table_route_id = cpe.table_route_id
7757          and ( -- c_mirror_src_entity_result_id is null or
7758                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7759          -- and trt.where_clause = 'BEN_NO_OTHR_CVG_RT_F'
7760          and cpe.table_alias = c_table_alias
7761          and information1 = c_no_othr_cvg_rt_id
7762          -- and information4 = noc.business_group_id
7763            and information2 = noc.effective_start_date
7764            and information3 = noc.effective_end_date);
7765     l_no_othr_cvg_rt_id                 number(15);
7766     l_out_noc_result_id   number(15);
7767    ---------------------------------------------------------------
7768    -- END OF BEN_NO_OTHR_CVG_RT_F ----------------------
7769    ---------------------------------------------------------------
7770    ---------------------------------------------------------------
7771    -- START OF BEN_OPTD_MDCR_RT_F ----------------------
7772    ---------------------------------------------------------------
7773    cursor c_omr_from_parent(c_VRBL_RT_PRFL_ID number) is
7774    select  optd_mdcr_rt_id
7775    from BEN_OPTD_MDCR_RT_F
7776    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7777    --
7778    cursor c_omr(c_optd_mdcr_rt_id number,c_mirror_src_entity_result_id number,
7779                 c_table_alias varchar2 ) is
7780    select  omr.*
7781    from BEN_OPTD_MDCR_RT_F omr
7782    where  omr.optd_mdcr_rt_id = c_optd_mdcr_rt_id
7783      --and omr.business_group_id = p_business_group_id
7784      and not exists (
7785          select /* */ null
7786          from ben_copy_entity_results cpe
7787               -- pqh_table_route trt
7788          where copy_entity_txn_id = p_copy_entity_txn_id
7789          -- and trt.table_route_id = cpe.table_route_id
7790          and ( -- c_mirror_src_entity_result_id is null or
7791                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7792          -- and trt.where_clause = 'BEN_OPTD_MDCR_RT_F'
7793          and cpe.table_alias = c_table_alias
7794          and information1 = c_optd_mdcr_rt_id
7795          -- and information4 = omr.business_group_id
7796            and information2 = omr.effective_start_date
7797            and information3 = omr.effective_end_date);
7798     l_optd_mdcr_rt_id                 number(15);
7799     l_out_omr_result_id   number(15);
7800    ---------------------------------------------------------------
7801    -- END OF BEN_OPTD_MDCR_RT_F ----------------------
7802    ---------------------------------------------------------------
7803    ---------------------------------------------------------------
7804    -- START OF BEN_DPNT_OTHR_PTIP_RT_F ----------------------
7805    ---------------------------------------------------------------
7806    cursor c_dot_from_parent(c_VRBL_RT_PRFL_ID number) is
7807    select  dpnt_othr_ptip_rt_id
7808    from BEN_DPNT_OTHR_PTIP_RT_F
7809    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7810    --
7811    cursor c_dot(c_dpnt_othr_ptip_rt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
7812    select  dot.*
7813    from BEN_DPNT_OTHR_PTIP_RT_F dot
7814    where  dot.dpnt_othr_ptip_rt_id = c_dpnt_othr_ptip_rt_id
7815      --and dot.business_group_id = p_business_group_id
7816      and not exists (
7817          select /* */ null
7818          from ben_copy_entity_results cpe
7819               -- pqh_table_route trt
7820          where copy_entity_txn_id = p_copy_entity_txn_id
7821          -- and trt.table_route_id = cpe.table_route_id
7822          and ( -- c_mirror_src_entity_result_id is null or
7823                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7824          -- and trt.where_clause = 'BEN_DPNT_OTHR_PTIP_RT_F'
7825          and cpe.table_alias = c_table_alias
7826          and information1 = c_dpnt_othr_ptip_rt_id
7827          -- and information4 = dot.business_group_id
7828            and information2 = dot.effective_start_date
7829            and information3 = dot.effective_end_date);
7830     l_dpnt_othr_ptip_rt_id                 number(15);
7831     l_out_dot_result_id   number(15);
7832    ---------------------------------------------------------------
7833    -- END OF BEN_DPNT_OTHR_PTIP_RT_F ----------------------
7834    ---------------------------------------------------------------
7835    ---------------------------------------------------------------
7836    -- START OF BEN_PERF_RTNG_RT_F ----------------------
7837    ---------------------------------------------------------------
7838    cursor c_prr_from_parent(c_VRBL_RT_PRFL_ID number) is
7839    select  perf_rtng_rt_id
7840    from BEN_PERF_RTNG_RT_F
7841    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7842    --
7843    cursor c_prr(c_perf_rtng_rt_id number,c_mirror_src_entity_result_id number,
7844                 c_table_alias varchar2 ) is
7845    select  prr.*
7846    from BEN_PERF_RTNG_RT_F prr
7847    where  prr.perf_rtng_rt_id = c_perf_rtng_rt_id
7848      --and prr.business_group_id = p_business_group_id
7849      and not exists (
7850          select /* */ null
7851          from ben_copy_entity_results cpe
7852               -- pqh_table_route trt
7853          where copy_entity_txn_id = p_copy_entity_txn_id
7854          -- and trt.table_route_id = cpe.table_route_id
7855          and ( -- c_mirror_src_entity_result_id is null or
7856                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7857          -- and trt.where_clause = 'BEN_PERF_RTNG_RT_F'
7858          and cpe.table_alias = c_table_alias
7859          and information1 = c_perf_rtng_rt_id
7860          -- and information4 = prr.business_group_id
7861            and information2 = prr.effective_start_date
7862            and information3 = prr.effective_end_date);
7863     l_perf_rtng_rt_id                 number(15);
7864     l_out_prr_result_id   number(15);
7865    ---------------------------------------------------------------
7866    -- END OF BEN_PERF_RTNG_RT_F ----------------------
7867    ---------------------------------------------------------------
7868    ---------------------------------------------------------------
7869    -- START OF BEN_QUA_IN_GR_RT_F ----------------------
7870    ---------------------------------------------------------------
7871    cursor c_qig_from_parent(c_VRBL_RT_PRFL_ID number) is
7872    select  qua_in_gr_rt_id
7873    from BEN_QUA_IN_GR_RT_F
7874    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7875    --
7876    cursor c_qig(c_qua_in_gr_rt_id number,c_mirror_src_entity_result_id number,
7877                 c_table_alias varchar2 ) is
7878    select  qig.*
7879    from BEN_QUA_IN_GR_RT_F qig
7880    where  qig.qua_in_gr_rt_id = c_qua_in_gr_rt_id
7881      --and qig.business_group_id = p_business_group_id
7882      and not exists (
7883          select /* */ null
7884          from ben_copy_entity_results cpe
7885               -- pqh_table_route trt
7886          where copy_entity_txn_id = p_copy_entity_txn_id
7887          -- and trt.table_route_id = cpe.table_route_id
7888          and ( -- c_mirror_src_entity_result_id is null or
7889                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7890          -- and trt.where_clause = 'BEN_QUA_IN_GR_RT_F'
7891          and cpe.table_alias = c_table_alias
7892          and information1 = c_qua_in_gr_rt_id
7893          -- and information4 = qig.business_group_id
7894            and information2 = qig.effective_start_date
7895            and information3 = qig.effective_end_date);
7896     l_qua_in_gr_rt_id                 number(15);
7897     l_out_qig_result_id   number(15);
7898    ---------------------------------------------------------------
7899    -- END OF BEN_QUA_IN_GR_RT_F ----------------------
7900    ---------------------------------------------------------------
7901    ---------------------------------------------------------------
7902    -- START OF BEN_OTHR_PTIP_RT_F ----------------------
7903    ---------------------------------------------------------------
7904    cursor c_opr_from_parent(c_VRBL_RT_PRFL_ID number) is
7905    select  othr_ptip_rt_id
7906    from BEN_OTHR_PTIP_RT_F
7907    where  VRBL_RT_PRFL_ID = c_VRBL_RT_PRFL_ID ;
7908    --
7909    cursor c_opr(c_othr_ptip_rt_id number,c_mirror_src_entity_result_id number,
7910                 c_table_alias varchar2 ) is
7911    select  opr.*
7912    from BEN_OTHR_PTIP_RT_F opr
7913    where  opr.othr_ptip_rt_id = c_othr_ptip_rt_id
7914      --and opr.business_group_id = p_business_group_id
7915      and not exists (
7916          select /* */ null
7917          from ben_copy_entity_results cpe
7918               -- pqh_table_route trt
7919          where copy_entity_txn_id = p_copy_entity_txn_id
7920          -- and trt.table_route_id = cpe.table_route_id
7921          and ( -- c_mirror_src_entity_result_id is null or
7922                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
7923          -- and trt.where_clause = 'BEN_OTHR_PTIP_RT_F'
7924          and cpe.table_alias = c_table_alias
7925          and information1 = c_othr_ptip_rt_id
7926          -- and information4 = opr.business_group_id
7927            and information2 = opr.effective_start_date
7928            and information3 = opr.effective_end_date);
7929     l_othr_ptip_rt_id                 number(15);
7930     l_out_opr_result_id   number(15);
7931    ---------------------------------------------------------------
7932    -- END OF BEN_OTHR_PTIP_RT_F ----------------------
7933    ---------------------------------------------------------------
7934 
7935    cursor c_object_exists(c_pk_id                number,
7936                           c_table_alias          varchar2) is
7937     select null
7938     from ben_copy_entity_results cpe
7939          -- pqh_table_route trt
7940     where copy_entity_txn_id = p_copy_entity_txn_id
7941     -- and trt.table_route_id = cpe.table_route_id
7942     and cpe.table_alias = c_table_alias
7943     and information1 = c_pk_id;
7944 
7945    l_dummy                     varchar2(1);
7946   begin
7947 
7948      if p_no_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
7949        ben_plan_design_program_module.g_pdw_allow_dup_rslt := ben_plan_design_program_module.g_pdw_no_dup_rslt;
7950      end if;
7951 
7952      if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
7953        open c_object_exists(p_vrbl_rt_prfl_id,'VPF');
7954        fetch c_object_exists into l_dummy;
7955        if c_object_exists%found then
7956          close c_object_exists;
7957          return;
7958        end if;
7959        close c_object_exists;
7960      end if;
7961 
7962      l_number_of_copies := p_number_of_copies ;
7963      ---------------------------------------------------------------
7964      -- START OF BEN_VRBL_RT_PRFL_F ----------------------
7965      ---------------------------------------------------------------
7966         --
7967         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
7968         l_vrbl_rt_prfl_id := p_vrbl_rt_prfl_id ;
7969         --
7970         hr_utility.set_location('l_vrbl_rt_prfl_id'||l_vrbl_rt_prfl_id,100);
7971         for l_vpf_rec in c_vpf(l_vrbl_rt_prfl_id,l_mirror_src_entity_result_id,'VPF') loop
7972           --
7973           l_table_route_id := null ;
7974           open ben_plan_design_program_module.g_table_route('VPF');
7975             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
7976           close ben_plan_design_program_module.g_table_route ;
7977           --
7978           l_information5  := l_vpf_rec.name; --'Intersection';
7979           --
7980           if p_effective_date between l_vpf_rec.effective_start_date
7981              and l_vpf_rec.effective_end_date then
7982            --
7983              l_result_type_cd := 'DISPLAY';
7984           else
7985              l_result_type_cd := 'NO DISPLAY';
7986           end if;
7987             --
7988           l_copy_entity_result_id := null;
7989           l_object_version_number := null;
7990           ben_copy_entity_results_api.create_copy_entity_results(
7991             p_copy_entity_result_id          => l_copy_entity_result_id,
7992             p_copy_entity_txn_id             => p_copy_entity_txn_id,
7993             p_result_type_cd                 => l_result_type_cd,
7994             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
7995             p_parent_entity_result_id        => p_parent_entity_result_id, -- To hide intermediate level in Hgrid
7996             p_number_of_copies               => l_number_of_copies,
7997             p_table_route_id                 => l_table_route_id,
7998 	    P_TABLE_ALIAS                    => 'VPF',
7999             p_information1     => l_vpf_rec.vrbl_rt_prfl_id,
8000             p_information2     => l_vpf_rec.EFFECTIVE_START_DATE,
8001             p_information3     => l_vpf_rec.EFFECTIVE_END_DATE,
8002             p_information4     => l_vpf_rec.business_group_id,
8003             p_information5     => l_information5 , -- 9999 put name for h-grid
8004 
8005             p_information67     => l_vpf_rec.acty_ref_perd_cd,
8006             p_information72     => l_vpf_rec.acty_typ_cd,
8007             p_information76     => l_vpf_rec.alwys_cnt_all_prtts_flag,
8008             p_information75     => l_vpf_rec.alwys_sum_all_cvg_flag,
8009             p_information297     => l_vpf_rec.ann_mn_elcn_val,
8010             p_information298     => l_vpf_rec.ann_mx_elcn_val,
8011             p_information71     => l_vpf_rec.asmt_to_use_cd,
8012             p_information74     => l_vpf_rec.bnft_rt_typ_cd,
8013             p_information254     => l_vpf_rec.comp_lvl_fctr_id,
8014             p_information300     => l_vpf_rec.dflt_elcn_val,
8015             p_information299     => l_vpf_rec.incrmnt_elcn_val,
8016             p_information260     => l_vpf_rec.lwr_lmt_calc_rl,
8017             p_information295     => l_vpf_rec.lwr_lmt_val,
8018             p_information68     => l_vpf_rec.mlt_cd,
8019             p_information302     => l_vpf_rec.mn_elcn_val,
8020             p_information301     => l_vpf_rec.mx_elcn_val,
8021             p_information170     => l_vpf_rec.name,
8022             p_information69     => l_vpf_rec.no_mn_elcn_val_dfnd_flag,
8023             p_information70     => l_vpf_rec.no_mx_elcn_val_dfnd_flag,
8024             p_information258     => l_vpf_rec.oipl_id,
8025             p_information261     => l_vpf_rec.pl_id,
8026             p_information228     => l_vpf_rec.pl_typ_opt_typ_id,
8027             p_information79     => l_vpf_rec.rndg_cd,
8028             p_information269     => l_vpf_rec.rndg_rl,
8029             p_information38     => l_vpf_rec.rt_age_flag,
8030             p_information45     => l_vpf_rec.rt_asnt_set_flag,
8031             p_information35     => l_vpf_rec.rt_benfts_grp_flag,
8032             p_information37     => l_vpf_rec.rt_brgng_unit_flag,
8033             p_information24     => l_vpf_rec.rt_cbr_quald_bnf_flag,
8034             p_information54     => l_vpf_rec.rt_cmbn_age_los_flag,
8035             p_information23     => l_vpf_rec.rt_cntng_prtn_prfl_flag,
8036             p_information47     => l_vpf_rec.rt_comp_lvl_flag,
8037             p_information25     => l_vpf_rec.rt_comptncy_flag,
8038             p_information11     => l_vpf_rec.rt_dpnt_cvrd_pgm_flag,
8039             p_information82     => l_vpf_rec.rt_dpnt_cvrd_pl_flag,
8040             p_information29     => l_vpf_rec.rt_dpnt_cvrd_plip_flag,
8041             p_information30     => l_vpf_rec.rt_dpnt_cvrd_ptip_flag,
8042             p_information20     => l_vpf_rec.rt_dpnt_othr_ptip_flag,
8043             p_information58     => l_vpf_rec.rt_dsbld_flag,
8044             p_information42     => l_vpf_rec.rt_ee_stat_flag,
8045             p_information12     => l_vpf_rec.rt_enrld_oipl_flag,
8046             p_information16     => l_vpf_rec.rt_enrld_pgm_flag,
8047             p_information13     => l_vpf_rec.rt_enrld_pl_flag,
8048             p_information14     => l_vpf_rec.rt_enrld_plip_flag,
8049             p_information15     => l_vpf_rec.rt_enrld_ptip_flag,
8050             p_information41     => l_vpf_rec.rt_fl_tm_pt_tm_flag,
8051             p_information63     => l_vpf_rec.rt_gndr_flag,
8052             p_information43     => l_vpf_rec.rt_grd_flag,
8053             p_information59     => l_vpf_rec.rt_hlth_cvg_flag,
8054             p_information31     => l_vpf_rec.rt_hrly_slrd_flag,
8055             p_information46     => l_vpf_rec.rt_hrs_wkd_flag,
8056             p_information80     => l_vpf_rec.rt_job_flag,
8057             p_information33     => l_vpf_rec.rt_lbr_mmbr_flag,
8058             p_information34     => l_vpf_rec.rt_lgl_enty_flag,
8059             p_information49     => l_vpf_rec.rt_loa_rsn_flag,
8060             p_information39     => l_vpf_rec.rt_los_flag,
8061             p_information27     => l_vpf_rec.rt_lvg_rsn_flag,
8062             p_information19     => l_vpf_rec.rt_no_othr_cvg_flag,
8063             p_information26     => l_vpf_rec.rt_optd_mdcr_flag,
8064             p_information48     => l_vpf_rec.rt_org_unit_flag,
8065             p_information18     => l_vpf_rec.rt_othr_ptip_flag,
8066             p_information44     => l_vpf_rec.rt_pct_fl_tm_flag,
8067             p_information40     => l_vpf_rec.rt_per_typ_flag,
8068             p_information21     => l_vpf_rec.rt_perf_rtng_flag,
8069             p_information60     => l_vpf_rec.rt_poe_flag,
8070             p_information57     => l_vpf_rec.rt_ppl_grp_flag,
8071             p_information53     => l_vpf_rec.rt_prfl_rl_flag,
8072             p_information17     => l_vpf_rec.rt_prtt_anthr_pl_flag,
8073             p_information55     => l_vpf_rec.rt_prtt_pl_flag,
8074             p_information32     => l_vpf_rec.rt_pstl_cd_flag,
8075             p_information28     => l_vpf_rec.rt_pstn_flag,
8076             p_information52     => l_vpf_rec.rt_py_bss_flag,
8077             p_information50     => l_vpf_rec.rt_pyrl_flag,
8078             p_information22     => l_vpf_rec.rt_qua_in_gr_flag,
8079             p_information81     => l_vpf_rec.rt_qual_titl_flag,
8080             p_information51     => l_vpf_rec.rt_schedd_hrs_flag,
8081             p_information56     => l_vpf_rec.rt_svc_area_flag,
8082             p_information64     => l_vpf_rec.rt_tbco_use_flag,
8083             p_information61     => l_vpf_rec.rt_ttl_cvg_vol_flag,
8084             p_information62     => l_vpf_rec.rt_ttl_prtt_flag,
8085             p_information73     => l_vpf_rec.rt_typ_cd,
8086             p_information36     => l_vpf_rec.rt_wk_loc_flag,
8087             p_information65     => l_vpf_rec.tx_typ_cd,
8088             p_information293     => l_vpf_rec.ultmt_lwr_lmt,
8089             p_information259     => l_vpf_rec.ultmt_lwr_lmt_calc_rl,
8090             p_information294     => l_vpf_rec.ultmt_upr_lmt,
8091             p_information257     => l_vpf_rec.ultmt_upr_lmt_calc_rl,
8092             p_information263     => l_vpf_rec.upr_lmt_calc_rl,
8093             p_information296     => l_vpf_rec.upr_lmt_val,
8094             p_information303     => l_vpf_rec.val,
8095             p_information268     => l_vpf_rec.val_calc_rl,
8096             p_information111     => l_vpf_rec.vpf_attribute1,
8097             p_information120     => l_vpf_rec.vpf_attribute10,
8098             p_information121     => l_vpf_rec.vpf_attribute11,
8099             p_information122     => l_vpf_rec.vpf_attribute12,
8100             p_information123     => l_vpf_rec.vpf_attribute13,
8101             p_information124     => l_vpf_rec.vpf_attribute14,
8102             p_information125     => l_vpf_rec.vpf_attribute15,
8103             p_information126     => l_vpf_rec.vpf_attribute16,
8104             p_information127     => l_vpf_rec.vpf_attribute17,
8105             p_information128     => l_vpf_rec.vpf_attribute18,
8106             p_information129     => l_vpf_rec.vpf_attribute19,
8107             p_information112     => l_vpf_rec.vpf_attribute2,
8108             p_information130     => l_vpf_rec.vpf_attribute20,
8109             p_information131     => l_vpf_rec.vpf_attribute21,
8110             p_information132     => l_vpf_rec.vpf_attribute22,
8111             p_information133     => l_vpf_rec.vpf_attribute23,
8112             p_information134     => l_vpf_rec.vpf_attribute24,
8113             p_information135     => l_vpf_rec.vpf_attribute25,
8114             p_information136     => l_vpf_rec.vpf_attribute26,
8115             p_information137     => l_vpf_rec.vpf_attribute27,
8116             p_information138     => l_vpf_rec.vpf_attribute28,
8117             p_information139     => l_vpf_rec.vpf_attribute29,
8118             p_information113     => l_vpf_rec.vpf_attribute3,
8119             p_information140     => l_vpf_rec.vpf_attribute30,
8120             p_information114     => l_vpf_rec.vpf_attribute4,
8121             p_information115     => l_vpf_rec.vpf_attribute5,
8122             p_information116     => l_vpf_rec.vpf_attribute6,
8123             p_information117     => l_vpf_rec.vpf_attribute7,
8124             p_information118     => l_vpf_rec.vpf_attribute8,
8125             p_information119     => l_vpf_rec.vpf_attribute9,
8126             p_information110     => l_vpf_rec.vpf_attribute_category,
8127             p_information77     => l_vpf_rec.vrbl_rt_prfl_stat_cd,
8128             p_information66     => l_vpf_rec.vrbl_rt_trtmt_cd,
8129             p_information78     => l_vpf_rec.vrbl_usg_cd,
8130             p_information83     => l_vpf_rec.rt_elig_prfl_flag,
8131             p_information265    => l_vpf_rec.object_version_number,
8132            --
8133 
8134             p_object_version_number          => l_object_version_number,
8135             p_effective_date                 => p_effective_date       );
8136             --
8137 
8138             if l_out_vpf_result_id is null then
8139               l_out_vpf_result_id := l_copy_entity_result_id;
8140             end if;
8141 
8142             if l_result_type_cd = 'DISPLAY' then
8143                l_out_vpf_result_id := l_copy_entity_result_id ;
8144             end if;
8145             --
8146 
8147             -- Copy Fast Formulas if any are attached to any column --
8148             ---------------------------------------------------------------
8149             -- LWR_LMT_CALC_RL -----------------
8150             ---------------------------------------------------------------
8151 
8152             if l_vpf_rec.lwr_lmt_calc_rl is not null then
8153                 --
8154                 ben_plan_design_program_module.create_formula_result
8155                 (
8156                  p_validate                       =>  0
8157                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
8158                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
8159                 ,p_formula_id                     =>  l_vpf_rec.lwr_lmt_calc_rl
8160                 ,p_business_group_id              =>  l_vpf_rec.business_group_id
8161                 ,p_number_of_copies               =>  l_number_of_copies
8162                 ,p_object_version_number          =>  l_object_version_number
8163                 ,p_effective_date                 =>  p_effective_date
8164                 );
8165 
8166                 --
8167             end if;
8168 
8169             ---------------------------------------------------------------
8170             -- RNDG_RL -----------------
8171             ---------------------------------------------------------------
8172 
8173             if l_vpf_rec.rndg_rl is not null then
8174                 --
8175                 ben_plan_design_program_module.create_formula_result
8176                 (
8177                  p_validate                       =>  0
8178                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
8179                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
8180                 ,p_formula_id                     =>  l_vpf_rec.rndg_rl
8181                 ,p_business_group_id              =>  l_vpf_rec.business_group_id
8182                 ,p_number_of_copies               =>  l_number_of_copies
8183                 ,p_object_version_number          =>  l_object_version_number
8184                 ,p_effective_date                 =>  p_effective_date
8185                 );
8186 
8187                 --
8188             end if;
8189 
8190             ---------------------------------------------------------------
8191             -- ULTMT_LWR_LMT_CALC_RL -----------------
8192             ---------------------------------------------------------------
8193 
8194             if l_vpf_rec.ultmt_lwr_lmt_calc_rl is not null then
8195                 --
8196                 ben_plan_design_program_module.create_formula_result
8197                 (
8198                  p_validate                       =>  0
8199                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
8200                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
8201                 ,p_formula_id                     =>  l_vpf_rec.ultmt_lwr_lmt_calc_rl
8202                 ,p_business_group_id              =>  l_vpf_rec.business_group_id
8203                 ,p_number_of_copies               =>  l_number_of_copies
8204                 ,p_object_version_number          =>  l_object_version_number
8205                 ,p_effective_date                 =>  p_effective_date
8206                 );
8207 
8208                 --
8209             end if;
8210 
8211             ---------------------------------------------------------------
8212             -- ULTMT_UPR_LMT_CALC_RL -----------------
8213             ---------------------------------------------------------------
8214 
8215             if l_vpf_rec.ultmt_upr_lmt_calc_rl is not null then
8216                 --
8217                 ben_plan_design_program_module.create_formula_result
8218                 (
8219                  p_validate                       =>  0
8220                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
8221                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
8222                 ,p_formula_id                     =>  l_vpf_rec.ultmt_upr_lmt_calc_rl
8223                 ,p_business_group_id              =>  l_vpf_rec.business_group_id
8224                 ,p_number_of_copies               =>  l_number_of_copies
8225                 ,p_object_version_number          =>  l_object_version_number
8226                 ,p_effective_date                 =>  p_effective_date
8227                 );
8228 
8229                 --
8230             end if;
8231 
8232             ---------------------------------------------------------------
8233             -- UPR_LMT_CALC_RL -----------------
8234             ---------------------------------------------------------------
8235 
8236             if l_vpf_rec.upr_lmt_calc_rl is not null then
8237                 --
8238                 ben_plan_design_program_module.create_formula_result
8239                 (
8240                  p_validate                       =>  0
8241                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
8242                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
8243                 ,p_formula_id                     =>  l_vpf_rec.upr_lmt_calc_rl
8244                 ,p_business_group_id              =>  l_vpf_rec.business_group_id
8245                 ,p_number_of_copies               =>  l_number_of_copies
8246                 ,p_object_version_number          =>  l_object_version_number
8247                 ,p_effective_date                 =>  p_effective_date
8248                 );
8249 
8250                 --
8251             end if;
8252 
8253 
8254             ---------------------------------------------------------------
8255             -- VAL_CALC_RL -----------------
8256             ---------------------------------------------------------------
8257 
8258             if l_vpf_rec.val_calc_rl is not null then
8259                 --
8260                 ben_plan_design_program_module.create_formula_result
8261                 (
8262                  p_validate                       =>  0
8263                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
8264                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
8265                 ,p_formula_id                     =>  l_vpf_rec.val_calc_rl
8266                 ,p_business_group_id              =>  l_vpf_rec.business_group_id
8267                 ,p_number_of_copies               =>  l_number_of_copies
8268                 ,p_object_version_number          =>  l_object_version_number
8269                 ,p_effective_date                 =>  p_effective_date
8270                 );
8271 
8272                 --
8273             end if;
8274 
8275             ---------------------------------------------------------------
8276             --  COMP_LVL_FCTR -----------------
8277             ---------------------------------------------------------------
8278 
8279             if l_vpf_rec.comp_lvl_fctr_id is not null then
8280             --
8281                 create_drpar_results
8282                  (
8283                    p_validate                      => p_validate
8284                   ,p_copy_entity_result_id         => l_copy_entity_result_id
8285                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
8286                   ,p_comp_lvl_fctr_id              => l_vpf_rec.comp_lvl_fctr_id
8287                   ,p_hrs_wkd_in_perd_fctr_id       => null
8288                   ,p_los_fctr_id                   => null
8289                   ,p_pct_fl_tm_fctr_id             => null
8290                   ,p_age_fctr_id                   => null
8291                   ,p_cmbn_age_los_fctr_id          => null
8292                   ,p_business_group_id             => p_business_group_id
8293                   ,p_number_of_copies              => p_number_of_copies
8294                   ,p_object_version_number         => l_object_version_number
8295                   ,p_effective_date                => p_effective_date
8296                  );
8297             --
8298             end if;
8299 
8300          end loop;
8301          --
8302 
8303          -- Create Variable Rate Eligibility Profile results
8304          create_vrb_rt_elg_prf_results
8305          (
8306            p_validate                       =>  p_validate
8307           ,p_copy_entity_result_id          =>  l_out_vpf_result_id
8308           ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
8309           ,p_vrbl_rt_prfl_id                =>  l_vrbl_rt_prfl_id
8310           ,p_business_group_id              =>  p_business_group_id
8311           ,p_number_of_copies               =>  p_number_of_copies
8312           ,p_object_version_number          =>  l_object_version_number
8313           ,p_effective_date                 =>  p_effective_date
8314          );
8315 
8316          --
8317          ---------------------------------------------------------------
8318          -- START OF BEN_AGE_RT_F ----------------------
8319          ---------------------------------------------------------------
8320          --
8321          for l_parent_rec  in c_art_from_parent(l_VRBL_RT_PRFL_ID) loop
8322             --
8323             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
8324 
8325             --
8326             l_age_rt_id := l_parent_rec.age_rt_id ;
8327             --
8328             for l_art_rec in c_art(l_parent_rec.age_rt_id,l_mirror_src_entity_result_id,'ART') loop
8329               --
8330               l_table_route_id := null ;
8331               open ben_plan_design_program_module.g_table_route('ART');
8332               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8333               close ben_plan_design_program_module.g_table_route ;
8334               --
8335               l_information5  := ben_plan_design_program_module.get_age_fctr_name(l_art_rec.age_fctr_id)
8336                                  || ben_plan_design_program_module.get_exclude_message(l_art_rec.excld_flag);
8337                                   --'Intersection';
8338               --
8339               if p_effective_date between l_art_rec.effective_start_date
8340                  and l_art_rec.effective_end_date then
8341                --
8342                  l_result_type_cd := 'DISPLAY';
8343               else
8344                  l_result_type_cd := 'NO DISPLAY';
8345               end if;
8346                 --
8347               l_copy_entity_result_id := null;
8348               l_object_version_number := null;
8349               ben_copy_entity_results_api.create_copy_entity_results(
8350                 p_copy_entity_result_id          => l_copy_entity_result_id,
8351                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
8352                 p_result_type_cd                 => l_result_type_cd,
8353                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
8354                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
8355                 p_number_of_copies               => l_number_of_copies,
8356                 p_table_route_id                 => l_table_route_id,
8357 		P_TABLE_ALIAS                    => 'ART',
8358                 p_information1     => l_art_rec.age_rt_id,
8359                 p_information2     => l_art_rec.EFFECTIVE_START_DATE,
8360                 p_information3     => l_art_rec.EFFECTIVE_END_DATE,
8361                 p_information4     => l_art_rec.business_group_id,
8362                 p_information5     => l_information5 , -- 9999 put name for h-grid
8363 
8364             p_information246     => l_art_rec.age_fctr_id,
8365             p_information111     => l_art_rec.art_attribute1,
8366             p_information120     => l_art_rec.art_attribute10,
8367             p_information121     => l_art_rec.art_attribute11,
8368             p_information122     => l_art_rec.art_attribute12,
8369             p_information123     => l_art_rec.art_attribute13,
8370             p_information124     => l_art_rec.art_attribute14,
8371             p_information125     => l_art_rec.art_attribute15,
8372             p_information126     => l_art_rec.art_attribute16,
8373             p_information127     => l_art_rec.art_attribute17,
8374             p_information128     => l_art_rec.art_attribute18,
8375             p_information129     => l_art_rec.art_attribute19,
8376             p_information112     => l_art_rec.art_attribute2,
8377             p_information130     => l_art_rec.art_attribute20,
8378             p_information131     => l_art_rec.art_attribute21,
8379             p_information132     => l_art_rec.art_attribute22,
8380             p_information133     => l_art_rec.art_attribute23,
8381             p_information134     => l_art_rec.art_attribute24,
8382             p_information135     => l_art_rec.art_attribute25,
8383             p_information136     => l_art_rec.art_attribute26,
8384             p_information137     => l_art_rec.art_attribute27,
8385             p_information138     => l_art_rec.art_attribute28,
8386             p_information139     => l_art_rec.art_attribute29,
8387             p_information113     => l_art_rec.art_attribute3,
8388             p_information140     => l_art_rec.art_attribute30,
8389             p_information114     => l_art_rec.art_attribute4,
8390             p_information115     => l_art_rec.art_attribute5,
8391             p_information116     => l_art_rec.art_attribute6,
8392             p_information117     => l_art_rec.art_attribute7,
8393             p_information118     => l_art_rec.art_attribute8,
8394             p_information119     => l_art_rec.art_attribute9,
8395             p_information110     => l_art_rec.art_attribute_category,
8396             p_information11     => l_art_rec.excld_flag,
8397             p_information260     => l_art_rec.ordr_num,
8398             p_information262     => l_art_rec.vrbl_rt_prfl_id,
8399             p_information265     => l_art_rec.object_version_number,
8400 
8401                 p_object_version_number          => l_object_version_number,
8402                 p_effective_date                 => p_effective_date       );
8403                 --
8404 
8405                 if l_out_art_result_id is null then
8406                  l_out_art_result_id := l_copy_entity_result_id;
8407                 end if;
8408 
8409                 if l_result_type_cd = 'DISPLAY' then
8410                    l_out_art_result_id := l_copy_entity_result_id ;
8411                 end if;
8412                 --
8413              end loop;
8414              --
8415              for l_art_rec in c_art_drp(l_parent_rec.age_rt_id,l_mirror_src_entity_result_id,'ART') loop
8416                create_drpar_results
8417                  (
8418                    p_validate                      => p_validate
8419                   ,p_copy_entity_result_id         => l_out_art_result_id
8420                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
8421                   ,p_comp_lvl_fctr_id              => null
8422                   ,p_hrs_wkd_in_perd_fctr_id       => null
8423                   ,p_los_fctr_id                   => null
8424                   ,p_pct_fl_tm_fctr_id             => null
8425                   ,p_age_fctr_id                   => l_art_rec.age_fctr_id
8426                   ,p_cmbn_age_los_fctr_id          => null
8427                   ,p_business_group_id             => p_business_group_id
8428                   ,p_number_of_copies              => p_number_of_copies
8429                   ,p_object_version_number         => l_object_version_number
8430                   ,p_effective_date                => p_effective_date
8431                  );
8432              end loop;
8433              --
8434            end loop;
8435         ---------------------------------------------------------------
8436         -- END OF BEN_AGE_RT_F ----------------------
8437         ---------------------------------------------------------------
8438          ---------------------------------------------------------------
8439          -- START OF BEN_ASNT_SET_RT_F ----------------------
8440          ---------------------------------------------------------------
8441          --
8442          hr_utility.set_location('START OF BEN_ASNT_SET_RT_F ',100);
8443          --
8444          for l_parent_rec  in c_asr_from_parent(l_VRBL_RT_PRFL_ID) loop
8445             --
8446             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
8447 
8448             --
8449             l_asnt_set_rt_id := l_parent_rec.asnt_set_rt_id ;
8450             hr_utility.set_location('l_asnt_set_rt_id '||l_asnt_set_rt_id,100);
8451             --
8452             for l_asr_rec in c_asr(l_parent_rec.asnt_set_rt_id,l_mirror_src_entity_result_id,'ASR') loop
8453               --
8454               l_table_route_id := null ;
8455               open ben_plan_design_program_module.g_table_route('ASR');
8456               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8457               close ben_plan_design_program_module.g_table_route ;
8458               --
8459               l_information5  := ben_plan_design_program_module.get_assignment_set_name(l_asr_rec.assignment_set_id)
8460                                  || ben_plan_design_program_module.get_exclude_message(l_asr_rec.excld_flag);
8461                                  --'Intersection';
8462               --
8463               if p_effective_date between l_asr_rec.effective_start_date
8464                  and l_asr_rec.effective_end_date then
8465                --
8466                  l_result_type_cd := 'DISPLAY';
8467               else
8468                  l_result_type_cd := 'NO DISPLAY';
8469               end if;
8470                 --
8471               l_copy_entity_result_id := null;
8472               l_object_version_number := null;
8473               --
8474               -- pabodla : MAPPING DATA : Store the mapping column information.
8475               --
8476 
8477               l_mapping_name := null;
8478               l_mapping_id   := null;
8479               --
8480               -- Get the defined balance name to display on mapping page.
8481               --
8482               open c_get_mapping_name3(l_asr_rec.assignment_set_id);
8483               fetch c_get_mapping_name3 into l_mapping_name;
8484               close c_get_mapping_name3;
8485               --
8486               l_mapping_id   := l_asr_rec.assignment_set_id;
8487               --
8488               --To set user friendly labels on the mapping page
8489               --
8490               l_mapping_column_name1 := null;
8491               l_mapping_column_name2 :=null;
8492               BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
8493                                                                l_mapping_column_name1,
8494                                                                l_mapping_column_name2,
8495                                                                p_copy_entity_txn_id);
8496               --
8497               hr_utility.set_location('l_mapping_id '||l_mapping_id,100);
8498               hr_utility.set_location('l_mapping_name '||l_mapping_name,100);
8499               ben_copy_entity_results_api.create_copy_entity_results(
8500                 p_copy_entity_result_id          => l_copy_entity_result_id,
8501                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
8502                 p_result_type_cd                 => l_result_type_cd,
8503                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
8504                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
8505                 p_number_of_copies               => l_number_of_copies,
8506                 p_table_route_id                 => l_table_route_id,
8507 		P_TABLE_ALIAS                    => 'ASR',
8508                 p_information1     => l_asr_rec.asnt_set_rt_id,
8509                 p_information2     => l_asr_rec.EFFECTIVE_START_DATE,
8510                 p_information3     => l_asr_rec.EFFECTIVE_END_DATE,
8511                 p_information4     => l_asr_rec.business_group_id,
8512                 p_information5     => l_information5 , -- 9999 put name for h-grid
8513 
8514             p_information111     => l_asr_rec.asr_attribute1,
8515             p_information120     => l_asr_rec.asr_attribute10,
8516             p_information121     => l_asr_rec.asr_attribute11,
8517             p_information122     => l_asr_rec.asr_attribute12,
8518             p_information123     => l_asr_rec.asr_attribute13,
8519             p_information124     => l_asr_rec.asr_attribute14,
8520             p_information125     => l_asr_rec.asr_attribute15,
8521             p_information126     => l_asr_rec.asr_attribute16,
8522             p_information127     => l_asr_rec.asr_attribute17,
8523             p_information128     => l_asr_rec.asr_attribute18,
8524             p_information129     => l_asr_rec.asr_attribute19,
8525             p_information112     => l_asr_rec.asr_attribute2,
8526             p_information130     => l_asr_rec.asr_attribute20,
8527             p_information131     => l_asr_rec.asr_attribute21,
8528             p_information132     => l_asr_rec.asr_attribute22,
8529             p_information133     => l_asr_rec.asr_attribute23,
8530             p_information134     => l_asr_rec.asr_attribute24,
8531             p_information135     => l_asr_rec.asr_attribute25,
8532             p_information136     => l_asr_rec.asr_attribute26,
8533             p_information137     => l_asr_rec.asr_attribute27,
8534             p_information138     => l_asr_rec.asr_attribute28,
8535             p_information139     => l_asr_rec.asr_attribute29,
8536             p_information113     => l_asr_rec.asr_attribute3,
8537             p_information140     => l_asr_rec.asr_attribute30,
8538             p_information114     => l_asr_rec.asr_attribute4,
8539             p_information115     => l_asr_rec.asr_attribute5,
8540             p_information116     => l_asr_rec.asr_attribute6,
8541             p_information117     => l_asr_rec.asr_attribute7,
8542             p_information118     => l_asr_rec.asr_attribute8,
8543             p_information119     => l_asr_rec.asr_attribute9,
8544             p_information110     => l_asr_rec.asr_attribute_category,
8545             -- Data for MAPPING columns.
8546             p_information173    => l_mapping_name,
8547             p_information174    => l_mapping_id,
8548             p_information181    => l_mapping_column_name1,
8549             p_information182    => l_mapping_column_name2,
8550             -- END other product Mapping columns.
8551             p_information11     => l_asr_rec.excld_flag,
8552             p_information257     => l_asr_rec.ordr_num,
8553             p_information262     => l_asr_rec.vrbl_rt_prfl_id,
8554             p_information166    => NULL, -- No ESD for Assignment Set
8555             p_information265    => l_asr_rec.object_version_number,
8556 
8557                 p_object_version_number          => l_object_version_number,
8558                 p_effective_date                 => p_effective_date       );
8559                 --
8560 
8561                 if l_out_asr_result_id is null then
8562                   l_out_asr_result_id := l_copy_entity_result_id;
8563                 end if;
8564 
8565                 if l_result_type_cd = 'DISPLAY' then
8566                    l_out_asr_result_id := l_copy_entity_result_id ;
8567                 end if;
8568                 --
8569              end loop;
8570              --
8571            end loop;
8572          hr_utility.set_location('END OF BEN_ASNT_SET_RT_F ',100);
8573         ---------------------------------------------------------------
8574         -- END OF BEN_ASNT_SET_RT_F ----------------------
8575         ---------------------------------------------------------------
8576          ---------------------------------------------------------------
8577          -- START OF BEN_BENFTS_GRP_RT_F ----------------------
8578          ---------------------------------------------------------------
8579          --
8580          for l_parent_rec  in c_brg_from_parent(l_VRBL_RT_PRFL_ID) loop
8581             --
8582             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
8583 
8584             --
8585             l_benfts_grp_rt_id := l_parent_rec.benfts_grp_rt_id ;
8586             --
8587             for l_brg_rec in c_brg(l_parent_rec.benfts_grp_rt_id,l_mirror_src_entity_result_id,'BRG') loop
8588               --
8589               l_table_route_id := null ;
8590               open ben_plan_design_program_module.g_table_route('BRG');
8591               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8592               close ben_plan_design_program_module.g_table_route ;
8593               --
8594               l_information5  := ben_plan_design_program_module.get_benfts_grp_name(l_brg_rec.benfts_grp_id)
8595                                  || ben_plan_design_program_module.get_exclude_message(l_brg_rec.excld_flag);
8596                                  --'Intersection';
8597               --
8598               if p_effective_date between l_brg_rec.effective_start_date
8599                  and l_brg_rec.effective_end_date then
8600                --
8601                  l_result_type_cd := 'DISPLAY';
8602               else
8603                  l_result_type_cd := 'NO DISPLAY';
8604               end if;
8605                 --
8606               l_copy_entity_result_id := null;
8607               l_object_version_number := null;
8608               ben_copy_entity_results_api.create_copy_entity_results(
8609                 p_copy_entity_result_id          => l_copy_entity_result_id,
8610                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
8611                 p_result_type_cd                 => l_result_type_cd,
8612                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
8613                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
8614                 p_number_of_copies               => l_number_of_copies,
8615                 p_table_route_id                 => l_table_route_id,
8616 		P_TABLE_ALIAS                    => 'BRG',
8617                 p_information1     => l_brg_rec.benfts_grp_rt_id,
8618                 p_information2     => l_brg_rec.EFFECTIVE_START_DATE,
8619                 p_information3     => l_brg_rec.EFFECTIVE_END_DATE,
8620                 p_information4     => l_brg_rec.business_group_id,
8621                 p_information5     => l_information5 , -- 9999 put name for h-grid
8622 
8623             p_information222     => l_brg_rec.benfts_grp_id,
8624             p_information111     => l_brg_rec.brg_attribute1,
8625             p_information120     => l_brg_rec.brg_attribute10,
8626             p_information121     => l_brg_rec.brg_attribute11,
8627             p_information122     => l_brg_rec.brg_attribute12,
8628             p_information123     => l_brg_rec.brg_attribute13,
8629             p_information124     => l_brg_rec.brg_attribute14,
8630             p_information125     => l_brg_rec.brg_attribute15,
8631             p_information126     => l_brg_rec.brg_attribute16,
8632             p_information127     => l_brg_rec.brg_attribute17,
8633             p_information128     => l_brg_rec.brg_attribute18,
8634             p_information129     => l_brg_rec.brg_attribute19,
8635             p_information112     => l_brg_rec.brg_attribute2,
8636             p_information130     => l_brg_rec.brg_attribute20,
8637             p_information131     => l_brg_rec.brg_attribute21,
8638             p_information132     => l_brg_rec.brg_attribute22,
8639             p_information133     => l_brg_rec.brg_attribute23,
8640             p_information134     => l_brg_rec.brg_attribute24,
8641             p_information135     => l_brg_rec.brg_attribute25,
8642             p_information136     => l_brg_rec.brg_attribute26,
8643             p_information137     => l_brg_rec.brg_attribute27,
8644             p_information138     => l_brg_rec.brg_attribute28,
8645             p_information139     => l_brg_rec.brg_attribute29,
8646             p_information113     => l_brg_rec.brg_attribute3,
8647             p_information140     => l_brg_rec.brg_attribute30,
8648             p_information114     => l_brg_rec.brg_attribute4,
8649             p_information115     => l_brg_rec.brg_attribute5,
8650             p_information116     => l_brg_rec.brg_attribute6,
8651             p_information117     => l_brg_rec.brg_attribute7,
8652             p_information118     => l_brg_rec.brg_attribute8,
8653             p_information119     => l_brg_rec.brg_attribute9,
8654             p_information110     => l_brg_rec.brg_attribute_category,
8655             p_information11     => l_brg_rec.excld_flag,
8656             p_information257     => l_brg_rec.ordr_num,
8657             p_information262     => l_brg_rec.vrbl_rt_prfl_id,
8658             p_information265     => l_brg_rec.object_version_number,
8659            --
8660 
8661                 p_object_version_number          => l_object_version_number,
8662                 p_effective_date                 => p_effective_date       );
8663                 --
8664 
8665                 if l_out_brg_result_id is null then
8666                   l_out_brg_result_id := l_copy_entity_result_id;
8667                 end if;
8668 
8669                 if l_result_type_cd = 'DISPLAY' then
8670                    l_out_brg_result_id := l_copy_entity_result_id ;
8671                 end if;
8672                 --
8673              end loop;
8674              --
8675              for l_brg_rec in c_brg_bg(l_parent_rec.benfts_grp_rt_id,l_mirror_src_entity_result_id,'BRG') loop
8676                 ben_pd_rate_and_cvg_module.create_bnft_group_results
8677                    (
8678                     p_validate                     => p_validate
8679                    ,p_copy_entity_result_id        => l_out_brg_result_id
8680                    ,p_copy_entity_txn_id           => p_copy_entity_txn_id
8681                    ,p_benfts_grp_id                => l_brg_rec.benfts_grp_id
8682                    ,p_business_group_id            => p_business_group_id
8683                    ,p_number_of_copies             => p_number_of_copies
8684                    ,p_object_version_number        => l_object_version_number
8685                    ,p_effective_date               => p_effective_date
8686                    );
8687              end loop;
8688            end loop;
8689         ---------------------------------------------------------------
8690         -- END OF BEN_BENFTS_GRP_RT_F ----------------------
8691         ---------------------------------------------------------------
8692 
8693         ---------------------------------------------------------------
8694         -- START OF BEN_BRGNG_UNIT_RT_F ----------------------
8695         ---------------------------------------------------------------
8696         --
8697          for l_parent_rec  in c_bur_from_parent(l_VRBL_RT_PRFL_ID) loop
8698             --
8699             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
8700 
8701             --
8702             l_brgng_unit_rt_id := l_parent_rec.brgng_unit_rt_id ;
8703             --
8704             for l_bur_rec in c_bur(l_parent_rec.brgng_unit_rt_id,l_mirror_src_entity_result_id,'BUR') loop
8705               --
8706               l_table_route_id := null ;
8707               open ben_plan_design_program_module.g_table_route('BUR');
8708               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8709               close ben_plan_design_program_module.g_table_route ;
8710               --
8711               l_information5  := hr_general.decode_lookup('BARGAINING_UNIT_CODE',l_bur_rec.brgng_unit_cd)
8712                                  || ben_plan_design_program_module.get_exclude_message(l_bur_rec.excld_flag);
8713                                  --'Intersection';
8714               --
8715               if p_effective_date between l_bur_rec.effective_start_date
8716                  and l_bur_rec.effective_end_date then
8717                --
8718                  l_result_type_cd := 'DISPLAY';
8719               else
8720                  l_result_type_cd := 'NO DISPLAY';
8721               end if;
8722                 --
8723               l_copy_entity_result_id := null;
8724               l_object_version_number := null;
8725               ben_copy_entity_results_api.create_copy_entity_results(
8726                 p_copy_entity_result_id          => l_copy_entity_result_id,
8727                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
8728                 p_result_type_cd                 => l_result_type_cd,
8729                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
8730                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
8731                 p_number_of_copies               => l_number_of_copies,
8732                 p_table_route_id                 => l_table_route_id,
8733 		P_TABLE_ALIAS                    => 'BUR',
8734                 p_information1     => l_bur_rec.brgng_unit_rt_id,
8735                 p_information2     => l_bur_rec.EFFECTIVE_START_DATE,
8736                 p_information3     => l_bur_rec.EFFECTIVE_END_DATE,
8737                 p_information4     => l_bur_rec.business_group_id,
8738                 p_information5     => l_information5 , -- 9999 put name for h-grid
8739 
8740             p_information12     => l_bur_rec.brgng_unit_cd,
8741             p_information111     => l_bur_rec.bur_attribute1,
8742             p_information120     => l_bur_rec.bur_attribute10,
8743             p_information121     => l_bur_rec.bur_attribute11,
8744             p_information122     => l_bur_rec.bur_attribute12,
8745             p_information123     => l_bur_rec.bur_attribute13,
8746             p_information124     => l_bur_rec.bur_attribute14,
8747             p_information125     => l_bur_rec.bur_attribute15,
8748             p_information126     => l_bur_rec.bur_attribute16,
8749             p_information127     => l_bur_rec.bur_attribute17,
8750             p_information128     => l_bur_rec.bur_attribute18,
8751             p_information129     => l_bur_rec.bur_attribute19,
8752             p_information112     => l_bur_rec.bur_attribute2,
8753             p_information130     => l_bur_rec.bur_attribute20,
8754             p_information131     => l_bur_rec.bur_attribute21,
8755             p_information132     => l_bur_rec.bur_attribute22,
8756             p_information133     => l_bur_rec.bur_attribute23,
8757             p_information134     => l_bur_rec.bur_attribute24,
8758             p_information135     => l_bur_rec.bur_attribute25,
8759             p_information136     => l_bur_rec.bur_attribute26,
8760             p_information137     => l_bur_rec.bur_attribute27,
8761             p_information138     => l_bur_rec.bur_attribute28,
8762             p_information139     => l_bur_rec.bur_attribute29,
8763             p_information113     => l_bur_rec.bur_attribute3,
8764             p_information140     => l_bur_rec.bur_attribute30,
8765             p_information114     => l_bur_rec.bur_attribute4,
8766             p_information115     => l_bur_rec.bur_attribute5,
8767             p_information116     => l_bur_rec.bur_attribute6,
8768             p_information117     => l_bur_rec.bur_attribute7,
8769             p_information118     => l_bur_rec.bur_attribute8,
8770             p_information119     => l_bur_rec.bur_attribute9,
8771             p_information110     => l_bur_rec.bur_attribute_category,
8772             p_information11     => l_bur_rec.excld_flag,
8773             p_information260     => l_bur_rec.ordr_num,
8774             p_information262     => l_bur_rec.vrbl_rt_prfl_id,
8775             p_information265     => l_bur_rec.object_version_number,
8776            --
8777 
8778                 p_object_version_number          => l_object_version_number,
8779                 p_effective_date                 => p_effective_date       );
8780                 --
8781 
8782                 if l_out_bur_result_id is null then
8783                   l_out_bur_result_id := l_copy_entity_result_id;
8784                 end if;
8785 
8786                 if l_result_type_cd = 'DISPLAY' then
8787                    l_out_bur_result_id := l_copy_entity_result_id ;
8788                 end if;
8789                 --
8790              end loop;
8791              --
8792            end loop;
8793         ---------------------------------------------------------------
8794         -- END OF BEN_BRGNG_UNIT_RT_F ----------------------
8795         ---------------------------------------------------------------
8796          ---------------------------------------------------------------
8797          -- START OF BEN_CMBN_AGE_LOS_RT_F ----------------------
8798          ---------------------------------------------------------------
8799          --
8800          for l_parent_rec  in c_cmr_from_parent(l_VRBL_RT_PRFL_ID) loop
8801             --
8802             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
8803 
8804             --
8805             l_cmbn_age_los_rt_id := l_parent_rec.cmbn_age_los_rt_id ;
8806             --
8807             for l_cmr_rec in c_cmr(l_parent_rec.cmbn_age_los_rt_id,l_mirror_src_entity_result_id,'CMR') loop
8808               --
8809               l_table_route_id := null ;
8810               open ben_plan_design_program_module.g_table_route('CMR');
8811               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8812               close ben_plan_design_program_module.g_table_route ;
8813               --
8814               l_information5  := ben_plan_design_program_module.get_cmbn_age_los_fctr_name(l_cmr_rec.cmbn_age_los_fctr_id)
8815                                  || ben_plan_design_program_module.get_exclude_message(l_cmr_rec.excld_flag);
8816                                  --'Intersection';
8817               --
8818               if p_effective_date between l_cmr_rec.effective_start_date
8819                  and l_cmr_rec.effective_end_date then
8820                --
8821                  l_result_type_cd := 'DISPLAY';
8822               else
8823                  l_result_type_cd := 'NO DISPLAY';
8824               end if;
8825                 --
8826               l_copy_entity_result_id := null;
8827               l_object_version_number := null;
8828               ben_copy_entity_results_api.create_copy_entity_results(
8829                 p_copy_entity_result_id          => l_copy_entity_result_id,
8830                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
8831                 p_result_type_cd                 => l_result_type_cd,
8832                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
8833                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
8834                 p_number_of_copies               => l_number_of_copies,
8835                 p_table_route_id                 => l_table_route_id,
8836 		P_TABLE_ALIAS                    => 'CMR',
8837                 p_information1     => l_cmr_rec.cmbn_age_los_rt_id,
8838                 p_information2     => l_cmr_rec.EFFECTIVE_START_DATE,
8839                 p_information3     => l_cmr_rec.EFFECTIVE_END_DATE,
8840                 p_information4     => l_cmr_rec.business_group_id,
8841                 p_information5     => l_information5 , -- 9999 put name for h-grid
8842             p_information223     => l_cmr_rec.cmbn_age_los_fctr_id,
8843             p_information111     => l_cmr_rec.cmr_attribute1,
8844             p_information120     => l_cmr_rec.cmr_attribute10,
8845             p_information121     => l_cmr_rec.cmr_attribute11,
8846             p_information122     => l_cmr_rec.cmr_attribute12,
8847             p_information123     => l_cmr_rec.cmr_attribute13,
8848             p_information124     => l_cmr_rec.cmr_attribute14,
8849             p_information125     => l_cmr_rec.cmr_attribute15,
8850             p_information126     => l_cmr_rec.cmr_attribute16,
8851             p_information127     => l_cmr_rec.cmr_attribute17,
8852             p_information128     => l_cmr_rec.cmr_attribute18,
8853             p_information129     => l_cmr_rec.cmr_attribute19,
8854             p_information112     => l_cmr_rec.cmr_attribute2,
8855             p_information130     => l_cmr_rec.cmr_attribute20,
8856             p_information131     => l_cmr_rec.cmr_attribute21,
8857             p_information132     => l_cmr_rec.cmr_attribute22,
8858             p_information133     => l_cmr_rec.cmr_attribute23,
8859             p_information134     => l_cmr_rec.cmr_attribute24,
8860             p_information135     => l_cmr_rec.cmr_attribute25,
8861             p_information136     => l_cmr_rec.cmr_attribute26,
8862             p_information137     => l_cmr_rec.cmr_attribute27,
8863             p_information138     => l_cmr_rec.cmr_attribute28,
8864             p_information139     => l_cmr_rec.cmr_attribute29,
8865             p_information113     => l_cmr_rec.cmr_attribute3,
8866             p_information140     => l_cmr_rec.cmr_attribute30,
8867             p_information114     => l_cmr_rec.cmr_attribute4,
8868             p_information115     => l_cmr_rec.cmr_attribute5,
8869             p_information116     => l_cmr_rec.cmr_attribute6,
8870             p_information117     => l_cmr_rec.cmr_attribute7,
8871             p_information118     => l_cmr_rec.cmr_attribute8,
8872             p_information119     => l_cmr_rec.cmr_attribute9,
8873             p_information110     => l_cmr_rec.cmr_attribute_category,
8874             p_information11     => l_cmr_rec.excld_flag,
8875             p_information257     => l_cmr_rec.ordr_num,
8876             p_information262     => l_cmr_rec.vrbl_rt_prfl_id,
8877             p_information265     => l_cmr_rec.object_version_number,
8878 
8879                 p_object_version_number          => l_object_version_number,
8880                 p_effective_date                 => p_effective_date       );
8881                 --
8882 
8883                 if l_out_cmr_result_id is null then
8884                   l_out_cmr_result_id := l_copy_entity_result_id;
8885                 end if;
8886 
8887                 if l_result_type_cd = 'DISPLAY' then
8888                    l_out_cmr_result_id := l_copy_entity_result_id ;
8889                 end if;
8890                 --
8891              end loop;
8892              --
8893             for l_cmr_rec in c_cmr_drp(l_parent_rec.cmbn_age_los_rt_id,l_mirror_src_entity_result_id,'CMR') loop
8894                create_drpar_results
8895                  (
8896                    p_validate                      => p_validate
8897                   ,p_copy_entity_result_id         => l_out_cmr_result_id
8898                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
8899                   ,p_comp_lvl_fctr_id              => null
8900                   ,p_hrs_wkd_in_perd_fctr_id       => null
8901                   ,p_los_fctr_id                   => null
8902                   ,p_pct_fl_tm_fctr_id             => null
8903                   ,p_age_fctr_id                   => null
8904                   ,p_cmbn_age_los_fctr_id          => l_cmr_rec.cmbn_age_los_fctr_id
8905                   ,p_business_group_id             => p_business_group_id
8906                   ,p_number_of_copies              => p_number_of_copies
8907                   ,p_object_version_number         => l_object_version_number
8908                   ,p_effective_date                => p_effective_date
8909                  );
8910              end loop;
8911            end loop;
8912          hr_utility.set_location('END OF BEN_CMBN_AGE_LOS_RT_F',100);
8913         ---------------------------------------------------------------
8914         -- END OF BEN_CMBN_AGE_LOS_RT_F ----------------------
8915         ---------------------------------------------------------------
8916          ---------------------------------------------------------------
8917          -- START OF BEN_COMP_LVL_RT_F ----------------------
8918          ---------------------------------------------------------------
8919          --
8920          hr_utility.set_location('START OF BEN_COMP_LVL_RT_F',100);
8921          for l_parent_rec  in c_clr_from_parent(l_VRBL_RT_PRFL_ID) loop
8922             --
8923             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
8924 
8925             --
8926             l_comp_lvl_rt_id := l_parent_rec.comp_lvl_rt_id ;
8927             --
8928             hr_utility.set_location('l_comp_lvl_rt_id '||l_comp_lvl_rt_id,100);
8929             for l_clr_rec in c_clr(l_parent_rec.comp_lvl_rt_id,l_mirror_src_entity_result_id,'CLR') loop
8930               --
8931               l_table_route_id := null ;
8932               open ben_plan_design_program_module.g_table_route('CLR');
8933               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8934               close ben_plan_design_program_module.g_table_route ;
8935               --
8936               l_information5  := ben_plan_design_program_module.get_comp_lvl_fctr_name(l_clr_rec.comp_lvl_fctr_id)
8937                                  || ben_plan_design_program_module.get_exclude_message(l_clr_rec.excld_flag);
8938                                  --'Intersection';
8939               --
8940               if p_effective_date between l_clr_rec.effective_start_date
8941                  and l_clr_rec.effective_end_date then
8942                --
8943                  l_result_type_cd := 'DISPLAY';
8944               else
8945                  l_result_type_cd := 'NO DISPLAY';
8946               end if;
8947                 --
8948               l_copy_entity_result_id := null;
8949               l_object_version_number := null;
8950               ben_copy_entity_results_api.create_copy_entity_results(
8951                 p_copy_entity_result_id          => l_copy_entity_result_id,
8952                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
8953                 p_result_type_cd                 => l_result_type_cd,
8954                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
8955                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
8956                 p_number_of_copies               => l_number_of_copies,
8957                 p_table_route_id                 => l_table_route_id,
8958 		P_TABLE_ALIAS                    => 'CLR',
8959                 p_information1     => l_clr_rec.comp_lvl_rt_id,
8960                 p_information2     => l_clr_rec.EFFECTIVE_START_DATE,
8961                 p_information3     => l_clr_rec.EFFECTIVE_END_DATE,
8962                 p_information4     => l_clr_rec.business_group_id,
8963                 p_information5     => l_information5 , -- 9999 put name for h-grid
8964 
8965             p_information111     => l_clr_rec.clr_attribute1,
8966             p_information120     => l_clr_rec.clr_attribute10,
8967             p_information121     => l_clr_rec.clr_attribute11,
8968             p_information122     => l_clr_rec.clr_attribute12,
8969             p_information123     => l_clr_rec.clr_attribute13,
8970             p_information124     => l_clr_rec.clr_attribute14,
8971             p_information125     => l_clr_rec.clr_attribute15,
8972             p_information126     => l_clr_rec.clr_attribute16,
8973             p_information127     => l_clr_rec.clr_attribute17,
8974             p_information128     => l_clr_rec.clr_attribute18,
8975             p_information129     => l_clr_rec.clr_attribute19,
8976             p_information112     => l_clr_rec.clr_attribute2,
8977             p_information130     => l_clr_rec.clr_attribute20,
8978             p_information131     => l_clr_rec.clr_attribute21,
8979             p_information132     => l_clr_rec.clr_attribute22,
8980             p_information133     => l_clr_rec.clr_attribute23,
8981             p_information134     => l_clr_rec.clr_attribute24,
8982             p_information135     => l_clr_rec.clr_attribute25,
8983             p_information136     => l_clr_rec.clr_attribute26,
8984             p_information137     => l_clr_rec.clr_attribute27,
8985             p_information138     => l_clr_rec.clr_attribute28,
8986             p_information139     => l_clr_rec.clr_attribute29,
8987             p_information113     => l_clr_rec.clr_attribute3,
8988             p_information140     => l_clr_rec.clr_attribute30,
8989             p_information114     => l_clr_rec.clr_attribute4,
8990             p_information115     => l_clr_rec.clr_attribute5,
8991             p_information116     => l_clr_rec.clr_attribute6,
8992             p_information117     => l_clr_rec.clr_attribute7,
8993             p_information118     => l_clr_rec.clr_attribute8,
8994             p_information119     => l_clr_rec.clr_attribute9,
8995             p_information110     => l_clr_rec.clr_attribute_category,
8996             p_information254     => l_clr_rec.comp_lvl_fctr_id,
8997             p_information11     => l_clr_rec.excld_flag,
8998             p_information260     => l_clr_rec.ordr_num,
8999             p_information262     => l_clr_rec.vrbl_rt_prfl_id,
9000             p_information265     => l_clr_rec.object_version_number,
9001 
9002                 p_object_version_number          => l_object_version_number,
9003                 p_effective_date                 => p_effective_date       );
9004                 --
9005 
9006                 if l_out_clr_result_id is null then
9007                   l_out_clr_result_id := l_copy_entity_result_id;
9008                 end if;
9009 
9010                 if l_result_type_cd = 'DISPLAY' then
9011                    l_out_clr_result_id := l_copy_entity_result_id ;
9012                 end if;
9013                 --
9014              end loop;
9015              --
9016             hr_utility.set_location('     l_parent_rec.comp_lvl_rt_id '||l_parent_rec.comp_lvl_rt_id,100);
9017             for l_clr_rec in c_clr_drp(l_parent_rec.comp_lvl_rt_id,l_mirror_src_entity_result_id,'CLR') loop
9018                create_drpar_results
9019                  (
9020                    p_validate                      => p_validate
9021                   ,p_copy_entity_result_id         => l_out_clr_result_id
9022                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
9023                   ,p_comp_lvl_fctr_id              => l_clr_rec.comp_lvl_fctr_id
9024                   ,p_hrs_wkd_in_perd_fctr_id       => null
9025                   ,p_los_fctr_id                   => null
9026                   ,p_pct_fl_tm_fctr_id             => null
9027                   ,p_age_fctr_id                   => null
9028                   ,p_cmbn_age_los_fctr_id          => null
9029                   ,p_business_group_id             => p_business_group_id
9030                   ,p_number_of_copies              => p_number_of_copies
9031                   ,p_object_version_number         => l_object_version_number
9032                   ,p_effective_date                => p_effective_date
9033                  );
9034              end loop;
9035            end loop;
9036          hr_utility.set_location('END OF BEN_COMP_LVL_RT_F',100);
9037         ---------------------------------------------------------------
9038         -- END OF BEN_COMP_LVL_RT_F ----------------------
9039         ---------------------------------------------------------------
9040          ---------------------------------------------------------------
9041          -- START OF BEN_DSBLD_RT_F ----------------------
9042          ---------------------------------------------------------------
9043          --
9044          for l_parent_rec  in c_dbr_from_parent(l_VRBL_RT_PRFL_ID) loop
9045             --
9046             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
9047 
9048             --
9049             l_dsbld_rt_id := l_parent_rec.dsbld_rt_id ;
9050             --
9051             for l_dbr_rec in c_dbr(l_parent_rec.dsbld_rt_id,l_mirror_src_entity_result_id,'DBR') loop
9052               --
9053               l_table_route_id := null ;
9054               open ben_plan_design_program_module.g_table_route('DBR');
9055               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9056               close ben_plan_design_program_module.g_table_route ;
9057               --
9058               l_information5  := hr_general.decode_lookup('REGISTERED_DISABLED',l_dbr_rec.dsbld_cd)
9059                                  || ben_plan_design_program_module.get_exclude_message(l_dbr_rec.excld_flag);
9060                                  --'Intersection';
9061               --
9062               if p_effective_date between l_dbr_rec.effective_start_date
9063                  and l_dbr_rec.effective_end_date then
9064                --
9065                  l_result_type_cd := 'DISPLAY';
9066               else
9067                  l_result_type_cd := 'NO DISPLAY';
9068               end if;
9069                 --
9070               l_copy_entity_result_id := null;
9071               l_object_version_number := null;
9072               ben_copy_entity_results_api.create_copy_entity_results(
9073                 p_copy_entity_result_id          => l_copy_entity_result_id,
9074                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
9075                 p_result_type_cd                 => l_result_type_cd,
9076                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
9077                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9078                 p_number_of_copies               => l_number_of_copies,
9079                 p_table_route_id                 => l_table_route_id,
9080 		P_TABLE_ALIAS                    => 'DBR',
9081                 p_information1     => l_dbr_rec.dsbld_rt_id,
9082                 p_information2     => l_dbr_rec.EFFECTIVE_START_DATE,
9083                 p_information3     => l_dbr_rec.EFFECTIVE_END_DATE,
9084                 p_information4     => l_dbr_rec.business_group_id,
9085                 p_information5     => l_information5 , -- 9999 put name for h-grid
9086 
9087             p_information111     => l_dbr_rec.dbr_attribute1,
9088             p_information120     => l_dbr_rec.dbr_attribute10,
9089             p_information121     => l_dbr_rec.dbr_attribute11,
9090             p_information122     => l_dbr_rec.dbr_attribute12,
9091             p_information123     => l_dbr_rec.dbr_attribute13,
9092             p_information124     => l_dbr_rec.dbr_attribute14,
9093             p_information125     => l_dbr_rec.dbr_attribute15,
9094             p_information126     => l_dbr_rec.dbr_attribute16,
9095             p_information127     => l_dbr_rec.dbr_attribute17,
9096             p_information128     => l_dbr_rec.dbr_attribute18,
9097             p_information129     => l_dbr_rec.dbr_attribute19,
9098             p_information112     => l_dbr_rec.dbr_attribute2,
9099             p_information130     => l_dbr_rec.dbr_attribute20,
9100             p_information131     => l_dbr_rec.dbr_attribute21,
9101             p_information132     => l_dbr_rec.dbr_attribute22,
9102             p_information133     => l_dbr_rec.dbr_attribute23,
9103             p_information134     => l_dbr_rec.dbr_attribute24,
9104             p_information135     => l_dbr_rec.dbr_attribute25,
9105             p_information136     => l_dbr_rec.dbr_attribute26,
9106             p_information137     => l_dbr_rec.dbr_attribute27,
9107             p_information138     => l_dbr_rec.dbr_attribute28,
9108             p_information139     => l_dbr_rec.dbr_attribute29,
9109             p_information113     => l_dbr_rec.dbr_attribute3,
9110             p_information140     => l_dbr_rec.dbr_attribute30,
9111             p_information114     => l_dbr_rec.dbr_attribute4,
9112             p_information115     => l_dbr_rec.dbr_attribute5,
9113             p_information116     => l_dbr_rec.dbr_attribute6,
9114             p_information117     => l_dbr_rec.dbr_attribute7,
9115             p_information118     => l_dbr_rec.dbr_attribute8,
9116             p_information119     => l_dbr_rec.dbr_attribute9,
9117             p_information110     => l_dbr_rec.dbr_attribute_category,
9118             p_information11     => l_dbr_rec.dsbld_cd,
9119             p_information12     => l_dbr_rec.excld_flag,
9120             p_information260     => l_dbr_rec.ordr_num,
9121             p_information262     => l_dbr_rec.vrbl_rt_prfl_id,
9122             p_information265     => l_dbr_rec.object_version_number,
9123 
9124                 p_object_version_number          => l_object_version_number,
9125                 p_effective_date                 => p_effective_date       );
9126                 --
9127 
9128                 if l_out_dbr_result_id is null then
9129                   l_out_dbr_result_id := l_copy_entity_result_id;
9130                 end if;
9131 
9132                 if l_result_type_cd = 'DISPLAY' then
9133                    l_out_dbr_result_id := l_copy_entity_result_id ;
9134                 end if;
9135                 --
9136              end loop;
9137              --
9138            end loop;
9139         ---------------------------------------------------------------
9140         -- END OF BEN_DSBLD_RT_F ----------------------
9141         ---------------------------------------------------------------
9142          ---------------------------------------------------------------
9143          -- START OF BEN_EE_STAT_RT_F ----------------------
9144          ---------------------------------------------------------------
9145          --
9146          hr_utility.set_location('START OF BEN_EE_STAT_RT_F',100);
9147          for l_parent_rec  in c_esr_from_parent(l_VRBL_RT_PRFL_ID) loop
9148             --
9149             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
9150 
9151             --
9152             l_ee_stat_rt_id := l_parent_rec.ee_stat_rt_id ;
9153             --
9154             for l_esr_rec in c_esr(l_parent_rec.ee_stat_rt_id,l_mirror_src_entity_result_id,'ESR') loop
9155               --
9156               hr_utility.set_location('l_parent_rec.ee_stat_rt_id '||l_parent_rec.ee_stat_rt_id,100);
9157               l_table_route_id := null ;
9158               open ben_plan_design_program_module.g_table_route('ESR');
9159                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9160               close ben_plan_design_program_module.g_table_route ;
9161               --
9162               l_information5  := ben_plan_design_program_module.get_assignment_sts_type_name(l_esr_rec.assignment_status_type_id)
9163                                  || ben_plan_design_program_module.get_exclude_message(l_esr_rec.excld_flag);
9164                                  --'Intersection';
9165               --
9166               if p_effective_date between l_esr_rec.effective_start_date
9167                  and l_esr_rec.effective_end_date then
9168                --
9169                  l_result_type_cd := 'DISPLAY';
9170               else
9171                  l_result_type_cd := 'NO DISPLAY';
9172               end if;
9173                 --
9174               l_copy_entity_result_id := null;
9175               l_object_version_number := null;
9176 
9177               --
9178               -- pabodla : MAPPING DATA : Store the mapping column information.
9179               --
9180 
9181               l_mapping_name := null;
9182               l_mapping_id   := null;
9183               --
9184               -- Get the defined balance name to display on mapping page.
9185               --
9186               open c_get_mapping_name4(l_esr_rec.assignment_status_type_id);
9187               fetch c_get_mapping_name4 into l_mapping_name;
9188               close c_get_mapping_name4;
9189               --
9190               l_mapping_id   := l_esr_rec.assignment_status_type_id;
9191               --
9192               --To set user friendly labels on the mapping page
9193               --
9194               l_mapping_column_name1 := null;
9195               l_mapping_column_name2 :=null;
9196               BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
9197                                                                l_mapping_column_name1,
9198                                                                l_mapping_column_name2,
9199                                                                p_copy_entity_txn_id);
9200               --
9201               hr_utility.set_location('l_mapping_id '||l_mapping_id,100);
9202               hr_utility.set_location('l_mapping_name '||l_mapping_name,100);
9203               --
9204               ben_copy_entity_results_api.create_copy_entity_results(
9205                 p_copy_entity_result_id          => l_copy_entity_result_id,
9206                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
9207                 p_result_type_cd                 => l_result_type_cd,
9208                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
9209                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9210                 p_number_of_copies               => l_number_of_copies,
9211                 p_table_route_id                 => l_table_route_id,
9212 		P_TABLE_ALIAS                    => 'ESR',
9213                 p_information1     => l_esr_rec.ee_stat_rt_id,
9214                 p_information2     => l_esr_rec.EFFECTIVE_START_DATE,
9215                 p_information3     => l_esr_rec.EFFECTIVE_END_DATE,
9216                 p_information4     => l_esr_rec.business_group_id,
9217                 p_information5     => l_information5 , -- 9999 put name for h-grid
9218 
9219             -- Data for MAPPING columns.
9220             p_information173    => l_mapping_name,
9221             p_information174    => l_mapping_id,
9222             p_information181    => l_mapping_column_name1,
9223             p_information182    => l_mapping_column_name2,
9224             -- END other product Mapping columns.
9225             p_information111     => l_esr_rec.esr_attribute1,
9226             p_information120     => l_esr_rec.esr_attribute10,
9227             p_information121     => l_esr_rec.esr_attribute11,
9228             p_information122     => l_esr_rec.esr_attribute12,
9229             p_information123     => l_esr_rec.esr_attribute13,
9230             p_information124     => l_esr_rec.esr_attribute14,
9231             p_information125     => l_esr_rec.esr_attribute15,
9232             p_information126     => l_esr_rec.esr_attribute16,
9233             p_information127     => l_esr_rec.esr_attribute17,
9234             p_information128     => l_esr_rec.esr_attribute18,
9235             p_information129     => l_esr_rec.esr_attribute19,
9236             p_information112     => l_esr_rec.esr_attribute2,
9237             p_information130     => l_esr_rec.esr_attribute20,
9238             p_information131     => l_esr_rec.esr_attribute21,
9239             p_information132     => l_esr_rec.esr_attribute22,
9240             p_information133     => l_esr_rec.esr_attribute23,
9241             p_information134     => l_esr_rec.esr_attribute24,
9242             p_information135     => l_esr_rec.esr_attribute25,
9243             p_information136     => l_esr_rec.esr_attribute26,
9244             p_information137     => l_esr_rec.esr_attribute27,
9245             p_information138     => l_esr_rec.esr_attribute28,
9246             p_information139     => l_esr_rec.esr_attribute29,
9247             p_information113     => l_esr_rec.esr_attribute3,
9248             p_information140     => l_esr_rec.esr_attribute30,
9249             p_information114     => l_esr_rec.esr_attribute4,
9250             p_information115     => l_esr_rec.esr_attribute5,
9251             p_information116     => l_esr_rec.esr_attribute6,
9252             p_information117     => l_esr_rec.esr_attribute7,
9253             p_information118     => l_esr_rec.esr_attribute8,
9254             p_information119     => l_esr_rec.esr_attribute9,
9255             p_information110     => l_esr_rec.esr_attribute_category,
9256             p_information11     => l_esr_rec.excld_flag,
9257             p_information257     => l_esr_rec.ordr_num,
9258             p_information262     => l_esr_rec.vrbl_rt_prfl_id,
9259             p_information166     => NULL, -- No ESD for Assignment Status
9260             p_information265    => l_esr_rec.object_version_number,
9261            --
9262 
9263                 p_object_version_number          => l_object_version_number,
9264                 p_effective_date                 => p_effective_date       );
9265                 --
9266 
9267                 if l_out_esr_result_id is null then
9268                   l_out_esr_result_id := l_copy_entity_result_id;
9269                 end if;
9270 
9271                 if l_result_type_cd = 'DISPLAY' then
9272                    l_out_esr_result_id := l_copy_entity_result_id ;
9273                 end if;
9274                 --
9275              end loop;
9276              --
9277            end loop;
9278          hr_utility.set_location('END OF BEN_EE_STAT_RT_F ',100);
9279         ---------------------------------------------------------------
9280         -- END OF BEN_EE_STAT_RT_F ----------------------
9281         ---------------------------------------------------------------
9282          ---------------------------------------------------------------
9283          -- START OF BEN_FL_TM_PT_TM_RT_F ----------------------
9284          ---------------------------------------------------------------
9285          --
9286          for l_parent_rec  in c_ftr_from_parent(l_VRBL_RT_PRFL_ID) loop
9287             --
9288             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
9289 
9290             --
9291             l_fl_tm_pt_tm_rt_id := l_parent_rec.fl_tm_pt_tm_rt_id ;
9292             --
9293             for l_ftr_rec in c_ftr(l_parent_rec.fl_tm_pt_tm_rt_id,l_mirror_src_entity_result_id,'FTR') loop
9294               --
9295               l_table_route_id := null ;
9296               open ben_plan_design_program_module.g_table_route('FTR');
9297               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9298               close ben_plan_design_program_module.g_table_route ;
9299               --
9300               l_information5  := hr_general.decode_lookup('EMP_CAT',l_ftr_rec.fl_tm_pt_tm_cd)
9301                                  || ben_plan_design_program_module.get_exclude_message(l_ftr_rec.excld_flag); --'Intersection';
9302               --
9303               if p_effective_date between l_ftr_rec.effective_start_date
9304                  and l_ftr_rec.effective_end_date then
9305                --
9306                  l_result_type_cd := 'DISPLAY';
9307               else
9308                  l_result_type_cd := 'NO DISPLAY';
9309               end if;
9310                 --
9311               l_copy_entity_result_id := null;
9312               l_object_version_number := null;
9313               ben_copy_entity_results_api.create_copy_entity_results(
9314                 p_copy_entity_result_id          => l_copy_entity_result_id,
9315                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
9316                 p_result_type_cd                 => l_result_type_cd,
9317                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
9318                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9319                 p_number_of_copies               => l_number_of_copies,
9320                 p_table_route_id                 => l_table_route_id,
9321 		P_TABLE_ALIAS                    => 'FTR',
9322                 p_information1     => l_ftr_rec.fl_tm_pt_tm_rt_id,
9323                 p_information2     => l_ftr_rec.EFFECTIVE_START_DATE,
9324                 p_information3     => l_ftr_rec.EFFECTIVE_END_DATE,
9325                 p_information4     => l_ftr_rec.business_group_id,
9326                 p_information5     => l_information5 , -- 9999 put name for h-grid
9327 
9328             p_information11     => l_ftr_rec.excld_flag,
9329             p_information12     => l_ftr_rec.fl_tm_pt_tm_cd,
9330             p_information111     => l_ftr_rec.ftr_attribute1,
9331             p_information120     => l_ftr_rec.ftr_attribute10,
9332             p_information121     => l_ftr_rec.ftr_attribute11,
9333             p_information122     => l_ftr_rec.ftr_attribute12,
9334             p_information123     => l_ftr_rec.ftr_attribute13,
9335             p_information124     => l_ftr_rec.ftr_attribute14,
9336             p_information125     => l_ftr_rec.ftr_attribute15,
9337             p_information126     => l_ftr_rec.ftr_attribute16,
9338             p_information127     => l_ftr_rec.ftr_attribute17,
9339             p_information128     => l_ftr_rec.ftr_attribute18,
9340             p_information129     => l_ftr_rec.ftr_attribute19,
9341             p_information112     => l_ftr_rec.ftr_attribute2,
9342             p_information130     => l_ftr_rec.ftr_attribute20,
9343             p_information131     => l_ftr_rec.ftr_attribute21,
9344             p_information132     => l_ftr_rec.ftr_attribute22,
9345             p_information133     => l_ftr_rec.ftr_attribute23,
9346             p_information134     => l_ftr_rec.ftr_attribute24,
9347             p_information135     => l_ftr_rec.ftr_attribute25,
9348             p_information136     => l_ftr_rec.ftr_attribute26,
9349             p_information137     => l_ftr_rec.ftr_attribute27,
9350             p_information138     => l_ftr_rec.ftr_attribute28,
9351             p_information139     => l_ftr_rec.ftr_attribute29,
9352             p_information113     => l_ftr_rec.ftr_attribute3,
9353             p_information140     => l_ftr_rec.ftr_attribute30,
9354             p_information114     => l_ftr_rec.ftr_attribute4,
9355             p_information115     => l_ftr_rec.ftr_attribute5,
9356             p_information116     => l_ftr_rec.ftr_attribute6,
9357             p_information117     => l_ftr_rec.ftr_attribute7,
9358             p_information118     => l_ftr_rec.ftr_attribute8,
9359             p_information119     => l_ftr_rec.ftr_attribute9,
9360             p_information110     => l_ftr_rec.ftr_attribute_category,
9361             p_information260     => l_ftr_rec.ordr_num,
9362             p_information262     => l_ftr_rec.vrbl_rt_prfl_id,
9363             p_information265     => l_ftr_rec.object_version_number,
9364            --
9365 
9366                 p_object_version_number          => l_object_version_number,
9367                 p_effective_date                 => p_effective_date       );
9368                 --
9369 
9370                 if l_out_ftr_result_id is null then
9371                   l_out_ftr_result_id := l_copy_entity_result_id;
9372                 end if;
9373 
9374                 if l_result_type_cd = 'DISPLAY' then
9375                    l_out_ftr_result_id := l_copy_entity_result_id ;
9376                 end if;
9377                 --
9378              end loop;
9379              --
9380            end loop;
9381         ---------------------------------------------------------------
9382         -- END OF BEN_FL_TM_PT_TM_RT_F ----------------------
9383         ---------------------------------------------------------------
9384          ---------------------------------------------------------------
9385          -- START OF BEN_GNDR_RT_F ----------------------
9386          ---------------------------------------------------------------
9387          --
9388          for l_parent_rec  in c_gnr_from_parent(l_VRBL_RT_PRFL_ID) loop
9389             --
9390             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
9391 
9392             --
9393             l_gndr_rt_id := l_parent_rec.gndr_rt_id ;
9394             --
9395             for l_gnr_rec in c_gnr(l_parent_rec.gndr_rt_id,l_mirror_src_entity_result_id,'GNR') loop
9396               --
9397               l_table_route_id := null ;
9398               open ben_plan_design_program_module.g_table_route('GNR');
9399                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9400               close ben_plan_design_program_module.g_table_route ;
9401               --
9402               l_information5  := hr_general.decode_lookup('BEN_GNDR',l_gnr_rec.gndr_cd)
9403                                  || ben_plan_design_program_module.get_exclude_message(l_gnr_rec.excld_flag); --'Intersection';
9404               --
9405               if p_effective_date between l_gnr_rec.effective_start_date
9406                  and l_gnr_rec.effective_end_date then
9407                --
9408                  l_result_type_cd := 'DISPLAY';
9409               else
9410                  l_result_type_cd := 'NO DISPLAY';
9411               end if;
9412                 --
9413               l_copy_entity_result_id := null;
9414               l_object_version_number := null;
9415               ben_copy_entity_results_api.create_copy_entity_results(
9416                 p_copy_entity_result_id          => l_copy_entity_result_id,
9417                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
9418                 p_result_type_cd                 => l_result_type_cd,
9419                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
9420                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9421                 p_number_of_copies               => l_number_of_copies,
9422                 p_table_route_id                 => l_table_route_id,
9423 		P_TABLE_ALIAS                    => 'GNR',
9424                 p_information1     => l_gnr_rec.gndr_rt_id,
9425                 p_information2     => l_gnr_rec.EFFECTIVE_START_DATE,
9426                 p_information3     => l_gnr_rec.EFFECTIVE_END_DATE,
9427                 p_information4     => l_gnr_rec.business_group_id,
9428                 p_information5     => l_information5 , -- 9999 put name for h-grid
9429 
9430             p_information12     => l_gnr_rec.excld_flag,
9431             p_information11     => l_gnr_rec.gndr_cd,
9432             p_information111     => l_gnr_rec.gnr_attribute1,
9433             p_information120     => l_gnr_rec.gnr_attribute10,
9434             p_information121     => l_gnr_rec.gnr_attribute11,
9435             p_information122     => l_gnr_rec.gnr_attribute12,
9436             p_information123     => l_gnr_rec.gnr_attribute13,
9437             p_information124     => l_gnr_rec.gnr_attribute14,
9438             p_information125     => l_gnr_rec.gnr_attribute15,
9439             p_information126     => l_gnr_rec.gnr_attribute16,
9440             p_information127     => l_gnr_rec.gnr_attribute17,
9441             p_information128     => l_gnr_rec.gnr_attribute18,
9442             p_information129     => l_gnr_rec.gnr_attribute19,
9443             p_information112     => l_gnr_rec.gnr_attribute2,
9444             p_information130     => l_gnr_rec.gnr_attribute20,
9445             p_information131     => l_gnr_rec.gnr_attribute21,
9446             p_information132     => l_gnr_rec.gnr_attribute22,
9447             p_information133     => l_gnr_rec.gnr_attribute23,
9448             p_information134     => l_gnr_rec.gnr_attribute24,
9449             p_information135     => l_gnr_rec.gnr_attribute25,
9450             p_information136     => l_gnr_rec.gnr_attribute26,
9451             p_information137     => l_gnr_rec.gnr_attribute27,
9452             p_information138     => l_gnr_rec.gnr_attribute28,
9453             p_information139     => l_gnr_rec.gnr_attribute29,
9454             p_information113     => l_gnr_rec.gnr_attribute3,
9455             p_information140     => l_gnr_rec.gnr_attribute30,
9456             p_information114     => l_gnr_rec.gnr_attribute4,
9457             p_information115     => l_gnr_rec.gnr_attribute5,
9458             p_information116     => l_gnr_rec.gnr_attribute6,
9459             p_information117     => l_gnr_rec.gnr_attribute7,
9460             p_information118     => l_gnr_rec.gnr_attribute8,
9461             p_information119     => l_gnr_rec.gnr_attribute9,
9462             p_information110     => l_gnr_rec.gnr_attribute_category,
9463             p_information257     => l_gnr_rec.ordr_num,
9464             p_information262     => l_gnr_rec.vrbl_rt_prfl_id,
9465             p_information265     => l_gnr_rec.object_version_number,
9466            --
9467 
9468                 p_object_version_number          => l_object_version_number,
9469                 p_effective_date                 => p_effective_date       );
9470                 --
9471 
9472                 if l_out_gnr_result_id is null then
9473                   l_out_gnr_result_id := l_copy_entity_result_id;
9474                 end if;
9475 
9476                 if l_result_type_cd = 'DISPLAY' then
9477                    l_out_gnr_result_id := l_copy_entity_result_id ;
9478                 end if;
9479                 --
9480              end loop;
9481              --
9482            end loop;
9483         ---------------------------------------------------------------
9484         -- END OF BEN_GNDR_RT_F ----------------------
9485         ---------------------------------------------------------------
9486          ---------------------------------------------------------------
9487          -- START OF BEN_GRADE_RT_F ----------------------
9488          ---------------------------------------------------------------
9489          --
9490          hr_utility.set_location('START OF BEN_GRADE_RT_F',100);
9491          for l_parent_rec  in c_grr_from_parent(l_VRBL_RT_PRFL_ID) loop
9492             --
9493             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
9494 
9495             --
9496             l_grade_rt_id := l_parent_rec.grade_rt_id ;
9497             --
9498             hr_utility.set_location('l_grade_rt_id '||l_grade_rt_id,100);
9499             for l_grr_rec in c_grr(l_parent_rec.grade_rt_id,l_mirror_src_entity_result_id,'GRR') loop
9500               --
9501               l_table_route_id := null ;
9502               open ben_plan_design_program_module.g_table_route('GRR');
9503                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9504               close ben_plan_design_program_module.g_table_route ;
9505               --
9506               l_information5  := ben_plan_design_program_module.get_grade_name(l_grr_rec.grade_id)
9507                                  || ben_plan_design_program_module.get_exclude_message(l_grr_rec.excld_flag); --'Intersection';
9508               --
9509               if p_effective_date between l_grr_rec.effective_start_date
9510                  and l_grr_rec.effective_end_date then
9511                --
9512                  l_result_type_cd := 'DISPLAY';
9513               else
9514                  l_result_type_cd := 'NO DISPLAY';
9515               end if;
9516                 --
9517               l_copy_entity_result_id := null;
9518               l_object_version_number := null;
9519 
9520               -- To store effective_start_date of grade
9521               -- for Mapping - Bug 2958658
9522               --
9523               l_grade_start_date := null;
9524               if l_grr_rec.grade_id is not null then
9525                 open c_grade_start_date(l_grr_rec.grade_id);
9526                 fetch c_grade_start_date into l_grade_start_date;
9527                 close c_grade_start_date;
9528               end if;
9529 
9530               --
9531               -- pabodla : MAPPING DATA : Store the mapping column information.
9532               --
9533 
9534               l_mapping_name := null;
9535               l_mapping_id   := null;
9536               --
9537               -- Get the grade name to display on mapping page.
9538               --
9539               open c_get_mapping_name5(l_grr_rec.grade_id,NVL(l_grade_start_date,p_effective_date));
9540               fetch c_get_mapping_name5 into l_mapping_name;
9541               close c_get_mapping_name5;
9542               --
9543               l_mapping_id   := l_grr_rec.grade_id;
9544               --
9545               --To set user friendly labels on the mapping page
9546               --
9547               l_mapping_column_name1 := null;
9548               l_mapping_column_name2 :=null;
9549               BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
9550                                                                l_mapping_column_name1,
9551                                                                l_mapping_column_name2,
9552                                                                p_copy_entity_txn_id);
9553               --
9554               hr_utility.set_location('l_mapping_id '||l_mapping_id,100);
9555               hr_utility.set_location('l_mapping_name '||l_mapping_name,100);
9556 
9557               ben_copy_entity_results_api.create_copy_entity_results(
9558                 p_copy_entity_result_id          => l_copy_entity_result_id,
9559                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
9560                 p_result_type_cd                 => l_result_type_cd,
9561                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
9562                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9563                 p_number_of_copies               => l_number_of_copies,
9564                 p_table_route_id                 => l_table_route_id,
9565 		P_TABLE_ALIAS                    => 'GRR',
9566                 p_information1     => l_grr_rec.grade_rt_id,
9567                 p_information2     => l_grr_rec.EFFECTIVE_START_DATE,
9568                 p_information3     => l_grr_rec.EFFECTIVE_END_DATE,
9569                 p_information4     => l_grr_rec.business_group_id,
9570                 p_information5     => l_information5 , -- 9999 put name for h-grid
9571             p_information11     => l_grr_rec.excld_flag,
9572             -- Data for MAPPING columns.
9573             p_information173    => l_mapping_name,
9574             p_information174    => l_mapping_id,
9575             p_information181    => l_mapping_column_name1,
9576             p_information182    => l_mapping_column_name2,
9577             -- END other product Mapping columns.
9578             p_information111     => l_grr_rec.grr_attribute1,
9579             p_information120     => l_grr_rec.grr_attribute10,
9580             p_information121     => l_grr_rec.grr_attribute11,
9581             p_information122     => l_grr_rec.grr_attribute12,
9582             p_information123     => l_grr_rec.grr_attribute13,
9583             p_information124     => l_grr_rec.grr_attribute14,
9584             p_information125     => l_grr_rec.grr_attribute15,
9585             p_information126     => l_grr_rec.grr_attribute16,
9586             p_information127     => l_grr_rec.grr_attribute17,
9587             p_information128     => l_grr_rec.grr_attribute18,
9588             p_information129     => l_grr_rec.grr_attribute19,
9589             p_information112     => l_grr_rec.grr_attribute2,
9590             p_information130     => l_grr_rec.grr_attribute20,
9591             p_information131     => l_grr_rec.grr_attribute21,
9592             p_information132     => l_grr_rec.grr_attribute22,
9593             p_information133     => l_grr_rec.grr_attribute23,
9594             p_information134     => l_grr_rec.grr_attribute24,
9595             p_information135     => l_grr_rec.grr_attribute25,
9596             p_information136     => l_grr_rec.grr_attribute26,
9597             p_information137     => l_grr_rec.grr_attribute27,
9598             p_information138     => l_grr_rec.grr_attribute28,
9599             p_information139     => l_grr_rec.grr_attribute29,
9600             p_information113     => l_grr_rec.grr_attribute3,
9601             p_information140     => l_grr_rec.grr_attribute30,
9602             p_information114     => l_grr_rec.grr_attribute4,
9603             p_information115     => l_grr_rec.grr_attribute5,
9604             p_information116     => l_grr_rec.grr_attribute6,
9605             p_information117     => l_grr_rec.grr_attribute7,
9606             p_information118     => l_grr_rec.grr_attribute8,
9607             p_information119     => l_grr_rec.grr_attribute9,
9608             p_information110     => l_grr_rec.grr_attribute_category,
9609             p_information260     => l_grr_rec.ordr_num,
9610             p_information262     => l_grr_rec.vrbl_rt_prfl_id,
9611             p_information166     => l_grade_start_date,
9612             p_information265     => l_grr_rec.object_version_number,
9613 
9614                 p_object_version_number          => l_object_version_number,
9615                 p_effective_date                 => p_effective_date       );
9616                 --
9617 
9618                 if l_out_grr_result_id is null then
9619                   l_out_grr_result_id := l_copy_entity_result_id;
9620                 end if;
9621 
9622                 if l_result_type_cd = 'DISPLAY' then
9623                    l_out_grr_result_id := l_copy_entity_result_id ;
9624                 end if;
9625                 --
9626              end loop;
9627              --
9628            end loop;
9629          hr_utility.set_location('END OF BEN_GRADE_RT_F',100);
9630         ---------------------------------------------------------------
9631         -- END OF BEN_GRADE_RT_F ----------------------
9632         ---------------------------------------------------------------
9633          ---------------------------------------------------------------
9634          -- START OF BEN_HRLY_SLRD_RT_F ----------------------
9635          ---------------------------------------------------------------
9636          --
9637          for l_parent_rec  in c_hsr_from_parent(l_VRBL_RT_PRFL_ID) loop
9638             --
9639             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
9640 
9641             --
9642             l_hrly_slrd_rt_id := l_parent_rec.hrly_slrd_rt_id ;
9643             --
9644             for l_hsr_rec in c_hsr(l_parent_rec.hrly_slrd_rt_id,l_mirror_src_entity_result_id,'HSR') loop
9645               --
9646               l_table_route_id := null ;
9647               open ben_plan_design_program_module.g_table_route('HSR');
9648               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9649               close ben_plan_design_program_module.g_table_route ;
9650               --
9651               l_information5  := hr_general.decode_lookup('HOURLY_SALARIED_CODE',l_hsr_rec.hrly_slrd_cd)
9652                                  || ben_plan_design_program_module.get_exclude_message(l_hsr_rec.excld_flag); --'Intersection';
9653               --
9654               if p_effective_date between l_hsr_rec.effective_start_date
9655                  and l_hsr_rec.effective_end_date then
9656                --
9657                  l_result_type_cd := 'DISPLAY';
9658               else
9659                  l_result_type_cd := 'NO DISPLAY';
9660               end if;
9661                 --
9662               l_copy_entity_result_id := null;
9663               l_object_version_number := null;
9664               ben_copy_entity_results_api.create_copy_entity_results(
9665                 p_copy_entity_result_id          => l_copy_entity_result_id,
9666                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
9667                 p_result_type_cd                 => l_result_type_cd,
9668                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
9669                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9670                 p_number_of_copies               => l_number_of_copies,
9671                 p_table_route_id                 => l_table_route_id,
9672 		P_TABLE_ALIAS                    => 'HSR',
9673                 p_information1     => l_hsr_rec.hrly_slrd_rt_id,
9674                 p_information2     => l_hsr_rec.EFFECTIVE_START_DATE,
9675                 p_information3     => l_hsr_rec.EFFECTIVE_END_DATE,
9676                 p_information4     => l_hsr_rec.business_group_id,
9677                 p_information5     => l_information5 , -- 9999 put name for h-grid
9678 
9679             p_information11     => l_hsr_rec.excld_flag,
9680             p_information12     => l_hsr_rec.hrly_slrd_cd,
9681             p_information111     => l_hsr_rec.hsr_attribute1,
9682             p_information120     => l_hsr_rec.hsr_attribute10,
9683             p_information121     => l_hsr_rec.hsr_attribute11,
9684             p_information122     => l_hsr_rec.hsr_attribute12,
9685             p_information123     => l_hsr_rec.hsr_attribute13,
9686             p_information124     => l_hsr_rec.hsr_attribute14,
9687             p_information125     => l_hsr_rec.hsr_attribute15,
9688             p_information126     => l_hsr_rec.hsr_attribute16,
9689             p_information127     => l_hsr_rec.hsr_attribute17,
9690             p_information128     => l_hsr_rec.hsr_attribute18,
9691             p_information129     => l_hsr_rec.hsr_attribute19,
9692             p_information112     => l_hsr_rec.hsr_attribute2,
9693             p_information130     => l_hsr_rec.hsr_attribute20,
9694             p_information131     => l_hsr_rec.hsr_attribute21,
9695             p_information132     => l_hsr_rec.hsr_attribute22,
9696             p_information133     => l_hsr_rec.hsr_attribute23,
9697             p_information134     => l_hsr_rec.hsr_attribute24,
9698             p_information135     => l_hsr_rec.hsr_attribute25,
9699             p_information136     => l_hsr_rec.hsr_attribute26,
9700             p_information137     => l_hsr_rec.hsr_attribute27,
9701             p_information138     => l_hsr_rec.hsr_attribute28,
9702             p_information139     => l_hsr_rec.hsr_attribute29,
9703             p_information113     => l_hsr_rec.hsr_attribute3,
9704             p_information140     => l_hsr_rec.hsr_attribute30,
9705             p_information114     => l_hsr_rec.hsr_attribute4,
9706             p_information115     => l_hsr_rec.hsr_attribute5,
9707             p_information116     => l_hsr_rec.hsr_attribute6,
9708             p_information117     => l_hsr_rec.hsr_attribute7,
9709             p_information118     => l_hsr_rec.hsr_attribute8,
9710             p_information119     => l_hsr_rec.hsr_attribute9,
9711             p_information110     => l_hsr_rec.hsr_attribute_category,
9712             p_information257     => l_hsr_rec.ordr_num,
9713             p_information262     => l_hsr_rec.vrbl_rt_prfl_id,
9714             p_information265     => l_hsr_rec.object_version_number,
9715 
9716                 p_object_version_number          => l_object_version_number,
9717                 p_effective_date                 => p_effective_date       );
9718                 --
9719 
9720                 if l_out_hsr_result_id is null then
9721                   l_out_hsr_result_id := l_copy_entity_result_id;
9722                 end if;
9723 
9724                 if l_result_type_cd = 'DISPLAY' then
9725                    l_out_hsr_result_id := l_copy_entity_result_id ;
9726                 end if;
9727                 --
9728              end loop;
9729              --
9730            end loop;
9731         ---------------------------------------------------------------
9732         -- END OF BEN_HRLY_SLRD_RT_F ----------------------
9733         ---------------------------------------------------------------
9734          ---------------------------------------------------------------
9735          -- START OF BEN_HRS_WKD_IN_PERD_RT_F ----------------------
9736          ---------------------------------------------------------------
9737          --
9738          hr_utility.set_location('START OF BEN_HRS_WKD_IN_PERD_RT_F ',100);
9739          for l_parent_rec  in c_hwr_from_parent(l_VRBL_RT_PRFL_ID) loop
9740             --
9741             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
9742 
9743             --
9744             l_hrs_wkd_in_perd_rt_id := l_parent_rec.hrs_wkd_in_perd_rt_id ;
9745             --
9746             hr_utility.set_location('l_hrs_wkd_in_perd_rt_id '||l_hrs_wkd_in_perd_rt_id,100);
9747             for l_hwr_rec in c_hwr(l_parent_rec.hrs_wkd_in_perd_rt_id,l_mirror_src_entity_result_id,'HWR') loop
9748               --
9749               l_table_route_id := null ;
9750               open ben_plan_design_program_module.g_table_route('HWR');
9751               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9752               close ben_plan_design_program_module.g_table_route ;
9753               --
9754               l_information5  := ben_plan_design_program_module.get_hrs_wkd_in_perd_fctr_name(l_hwr_rec.hrs_wkd_in_perd_fctr_id)
9755                                  || ben_plan_design_program_module.get_exclude_message(l_hwr_rec.excld_flag);
9756                                  --'Intersection';
9757               --
9758               if p_effective_date between l_hwr_rec.effective_start_date
9759                  and l_hwr_rec.effective_end_date then
9760                --
9761                  l_result_type_cd := 'DISPLAY';
9762               else
9763                  l_result_type_cd := 'NO DISPLAY';
9764               end if;
9765                 --
9766               l_copy_entity_result_id := null;
9767               l_object_version_number := null;
9768               ben_copy_entity_results_api.create_copy_entity_results(
9769                 p_copy_entity_result_id          => l_copy_entity_result_id,
9770                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
9771                 p_result_type_cd                 => l_result_type_cd,
9772                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
9773                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9774                 p_number_of_copies               => l_number_of_copies,
9775                 p_table_route_id                 => l_table_route_id,
9776 		P_TABLE_ALIAS                    => 'HWR',
9777                 p_information1     => l_hwr_rec.hrs_wkd_in_perd_rt_id,
9778                 p_information2     => l_hwr_rec.EFFECTIVE_START_DATE,
9779                 p_information3     => l_hwr_rec.EFFECTIVE_END_DATE,
9780                 p_information4     => l_hwr_rec.business_group_id,
9781                 p_information5     => l_information5 , -- 9999 put name for h-grid
9782 
9783             p_information11     => l_hwr_rec.excld_flag,
9784             p_information224     => l_hwr_rec.hrs_wkd_in_perd_fctr_id,
9785             p_information111     => l_hwr_rec.hwr_attribute1,
9786             p_information120     => l_hwr_rec.hwr_attribute10,
9787             p_information121     => l_hwr_rec.hwr_attribute11,
9788             p_information122     => l_hwr_rec.hwr_attribute12,
9789             p_information123     => l_hwr_rec.hwr_attribute13,
9790             p_information124     => l_hwr_rec.hwr_attribute14,
9791             p_information125     => l_hwr_rec.hwr_attribute15,
9792             p_information126     => l_hwr_rec.hwr_attribute16,
9793             p_information127     => l_hwr_rec.hwr_attribute17,
9794             p_information128     => l_hwr_rec.hwr_attribute18,
9795             p_information129     => l_hwr_rec.hwr_attribute19,
9796             p_information112     => l_hwr_rec.hwr_attribute2,
9797             p_information130     => l_hwr_rec.hwr_attribute20,
9798             p_information131     => l_hwr_rec.hwr_attribute21,
9799             p_information132     => l_hwr_rec.hwr_attribute22,
9800             p_information133     => l_hwr_rec.hwr_attribute23,
9801             p_information134     => l_hwr_rec.hwr_attribute24,
9802             p_information135     => l_hwr_rec.hwr_attribute25,
9803             p_information136     => l_hwr_rec.hwr_attribute26,
9804             p_information137     => l_hwr_rec.hwr_attribute27,
9805             p_information138     => l_hwr_rec.hwr_attribute28,
9806             p_information139     => l_hwr_rec.hwr_attribute29,
9807             p_information113     => l_hwr_rec.hwr_attribute3,
9808             p_information140     => l_hwr_rec.hwr_attribute30,
9809             p_information114     => l_hwr_rec.hwr_attribute4,
9810             p_information115     => l_hwr_rec.hwr_attribute5,
9811             p_information116     => l_hwr_rec.hwr_attribute6,
9812             p_information117     => l_hwr_rec.hwr_attribute7,
9813             p_information118     => l_hwr_rec.hwr_attribute8,
9814             p_information119     => l_hwr_rec.hwr_attribute9,
9815             p_information110     => l_hwr_rec.hwr_attribute_category,
9816             p_information260     => l_hwr_rec.ordr_num,
9817             p_information262     => l_hwr_rec.vrbl_rt_prfl_id,
9818             p_information265     => l_hwr_rec.object_version_number,
9819            --
9820 
9821                 p_object_version_number          => l_object_version_number,
9822                 p_effective_date                 => p_effective_date       );
9823                 --
9824 
9825                 if l_out_hwr_result_id is null then
9826                   l_out_hwr_result_id := l_copy_entity_result_id;
9827                 end if;
9828 
9829                 if l_result_type_cd = 'DISPLAY' then
9830                    l_out_hwr_result_id := l_copy_entity_result_id ;
9831                 end if;
9832                 --
9833              end loop;
9834              --
9835             for l_hwr_rec in c_hwr_drp(l_parent_rec.hrs_wkd_in_perd_rt_id,l_mirror_src_entity_result_id,'HWR') loop
9836             hr_utility.set_location('l_parent_rec.hrs_wkd_in_perd_rt_id '||l_parent_rec.hrs_wkd_in_perd_rt_id,100);
9837                create_drpar_results
9838                  (
9839                    p_validate                      => p_validate
9840                   ,p_copy_entity_result_id         => l_out_hwr_result_id
9841                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
9842                   ,p_comp_lvl_fctr_id              => null
9843                   ,p_hrs_wkd_in_perd_fctr_id       => l_hwr_rec.hrs_wkd_in_perd_fctr_id
9844                   ,p_los_fctr_id                   => null
9845                   ,p_pct_fl_tm_fctr_id             => null
9846                   ,p_age_fctr_id                   => null
9847                   ,p_cmbn_age_los_fctr_id          => null
9848                   ,p_business_group_id             => p_business_group_id
9849                   ,p_number_of_copies              => p_number_of_copies
9850                   ,p_object_version_number         => l_object_version_number
9851                   ,p_effective_date                => p_effective_date
9852                  );
9853              end loop;
9854            end loop;
9855          hr_utility.set_location('END OF BEN_HRS_WKD_IN_PERD_RT_F ',100);
9856         ---------------------------------------------------------------
9857         -- END OF BEN_HRS_WKD_IN_PERD_RT_F ----------------------
9858         ---------------------------------------------------------------
9859          ---------------------------------------------------------------
9860          -- START OF BEN_LBR_MMBR_RT_F ----------------------
9861          ---------------------------------------------------------------
9862          --
9863          for l_parent_rec  in c_lmm_from_parent(l_VRBL_RT_PRFL_ID) loop
9864             --
9865             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
9866 
9867             --
9868             l_lbr_mmbr_rt_id := l_parent_rec.lbr_mmbr_rt_id ;
9869             --
9870             for l_lmm_rec in c_lmm(l_parent_rec.lbr_mmbr_rt_id,l_mirror_src_entity_result_id,'LMM') loop
9871               --
9872               l_table_route_id := null ;
9873               open ben_plan_design_program_module.g_table_route('LMM');
9874                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9875               close ben_plan_design_program_module.g_table_route ;
9876               --
9877               l_information5  := ben_plan_design_program_module.get_lbr_mmbr_name(l_lmm_rec.lbr_mmbr_flag)
9878                                  || ben_plan_design_program_module.get_exclude_message(l_lmm_rec.excld_flag);
9879                                  --'Intersection';
9880               --
9881               if p_effective_date between l_lmm_rec.effective_start_date
9882                  and l_lmm_rec.effective_end_date then
9883                --
9884                  l_result_type_cd := 'DISPLAY';
9885               else
9886                  l_result_type_cd := 'NO DISPLAY';
9887               end if;
9888                 --
9889               l_copy_entity_result_id := null;
9890               l_object_version_number := null;
9891               ben_copy_entity_results_api.create_copy_entity_results(
9892                 p_copy_entity_result_id          => l_copy_entity_result_id,
9893                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
9894                 p_result_type_cd                 => l_result_type_cd,
9895                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
9896                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9897                 p_number_of_copies               => l_number_of_copies,
9898                 p_table_route_id                 => l_table_route_id,
9899 		P_TABLE_ALIAS                    => 'LMM',
9900                 p_information1     => l_lmm_rec.lbr_mmbr_rt_id,
9901                 p_information2     => l_lmm_rec.EFFECTIVE_START_DATE,
9902                 p_information3     => l_lmm_rec.EFFECTIVE_END_DATE,
9903                 p_information4     => l_lmm_rec.business_group_id,
9904                 p_information5     => l_information5 , -- 9999 put name for h-grid
9905 
9906             p_information12     => l_lmm_rec.excld_flag,
9907             p_information11     => l_lmm_rec.lbr_mmbr_flag,
9908             p_information111     => l_lmm_rec.lmm_attribute1,
9909             p_information120     => l_lmm_rec.lmm_attribute10,
9910             p_information121     => l_lmm_rec.lmm_attribute11,
9911             p_information122     => l_lmm_rec.lmm_attribute12,
9912             p_information123     => l_lmm_rec.lmm_attribute13,
9913             p_information124     => l_lmm_rec.lmm_attribute14,
9914             p_information125     => l_lmm_rec.lmm_attribute15,
9915             p_information126     => l_lmm_rec.lmm_attribute16,
9916             p_information127     => l_lmm_rec.lmm_attribute17,
9917             p_information128     => l_lmm_rec.lmm_attribute18,
9918             p_information129     => l_lmm_rec.lmm_attribute19,
9919             p_information112     => l_lmm_rec.lmm_attribute2,
9920             p_information130     => l_lmm_rec.lmm_attribute20,
9921             p_information131     => l_lmm_rec.lmm_attribute21,
9922             p_information132     => l_lmm_rec.lmm_attribute22,
9923             p_information133     => l_lmm_rec.lmm_attribute23,
9924             p_information134     => l_lmm_rec.lmm_attribute24,
9925             p_information135     => l_lmm_rec.lmm_attribute25,
9926             p_information136     => l_lmm_rec.lmm_attribute26,
9927             p_information137     => l_lmm_rec.lmm_attribute27,
9928             p_information138     => l_lmm_rec.lmm_attribute28,
9929             p_information139     => l_lmm_rec.lmm_attribute29,
9930             p_information113     => l_lmm_rec.lmm_attribute3,
9931             p_information140     => l_lmm_rec.lmm_attribute30,
9932             p_information114     => l_lmm_rec.lmm_attribute4,
9933             p_information115     => l_lmm_rec.lmm_attribute5,
9934             p_information116     => l_lmm_rec.lmm_attribute6,
9935             p_information117     => l_lmm_rec.lmm_attribute7,
9936             p_information118     => l_lmm_rec.lmm_attribute8,
9937             p_information119     => l_lmm_rec.lmm_attribute9,
9938             p_information110     => l_lmm_rec.lmm_attribute_category,
9939             p_information257     => l_lmm_rec.ordr_num,
9940             p_information262     => l_lmm_rec.vrbl_rt_prfl_id,
9941             p_information265     => l_lmm_rec.object_version_number,
9942            --
9943 
9944                 p_object_version_number          => l_object_version_number,
9945                 p_effective_date                 => p_effective_date       );
9946                 --
9947 
9948                 if l_out_lmm_result_id is null then
9949                   l_out_lmm_result_id := l_copy_entity_result_id;
9950                 end if;
9951 
9952                 if l_result_type_cd = 'DISPLAY' then
9953                    l_out_lmm_result_id := l_copy_entity_result_id ;
9954                 end if;
9955                 --
9956              end loop;
9957              --
9958            end loop;
9959         ---------------------------------------------------------------
9960         -- END OF BEN_LBR_MMBR_RT_F ----------------------
9961         ---------------------------------------------------------------
9962          ---------------------------------------------------------------
9963          -- START OF BEN_LGL_ENTY_RT_F ----------------------
9964          ---------------------------------------------------------------
9965          --
9966          hr_utility.set_location('START OF BEN_LGL_ENTY_RT_F ',100);
9967          for l_parent_rec  in c_ler_from_parent(l_VRBL_RT_PRFL_ID) loop
9968             --
9969             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
9970 
9971             --
9972             l_lgl_enty_rt_id := l_parent_rec.lgl_enty_rt_id ;
9973             --
9974             hr_utility.set_location('l_lgl_enty_rt_id '||l_lgl_enty_rt_id,100);
9975             for l_ler_rec in c_ler(l_parent_rec.lgl_enty_rt_id,l_mirror_src_entity_result_id,'LER1') loop
9976               --
9977               l_table_route_id := null ;
9978               open ben_plan_design_program_module.g_table_route('LER1');
9979                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9980               close ben_plan_design_program_module.g_table_route ;
9981               --
9982               l_information5  := ben_plan_design_program_module.get_organization_name(l_ler_rec.organization_id)
9983                                  || ben_plan_design_program_module.get_exclude_message(l_ler_rec.excld_flag);
9984                                  --'Intersection';
9985               --
9986               if p_effective_date between l_ler_rec.effective_start_date
9987                  and l_ler_rec.effective_end_date then
9988                --
9989                  l_result_type_cd := 'DISPLAY';
9990               else
9991                  l_result_type_cd := 'NO DISPLAY';
9992               end if;
9993                 --
9994               l_copy_entity_result_id := null;
9995               l_object_version_number := null;
9996 
9997               -- To store effective_start_date of organization
9998               -- for Mapping - Bug 2958658
9999               --
10000               l_organization_start_date := null;
10001               if l_ler_rec.organization_id is not null then
10002                 open c_organization_start_date(l_ler_rec.organization_id);
10003                 fetch c_organization_start_date into l_organization_start_date;
10004                 close c_organization_start_date;
10005               end if;
10006 
10007               --
10008               -- pabodla : MAPPING DATA : Store the mapping column information.
10009               --
10010 
10011               l_mapping_name := null;
10012               l_mapping_id   := null;
10013               --
10014               -- Get the defined balance name to display on mapping page.
10015               --
10016               open c_get_mapping_name6(l_ler_rec.organization_id,
10017                                        NVL(l_organization_start_date,p_effective_date));
10018               fetch c_get_mapping_name6 into l_mapping_name;
10019               close c_get_mapping_name6;
10020               --
10021               l_mapping_id   := l_ler_rec.organization_id;
10022               --
10023               --To set user friendly labels on the mapping page
10024               --
10025               l_mapping_column_name1 := null;
10026               l_mapping_column_name2 :=null;
10027               BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
10028                                                                l_mapping_column_name1,
10029                                                                l_mapping_column_name2,
10030                                                                p_copy_entity_txn_id);
10031               --
10032               hr_utility.set_location('l_mapping_id '||l_mapping_id,100);
10033               hr_utility.set_location('l_mapping_name '||l_mapping_name,100);
10034 
10035               ben_copy_entity_results_api.create_copy_entity_results(
10036                 p_copy_entity_result_id          => l_copy_entity_result_id,
10037                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
10038                 p_result_type_cd                 => l_result_type_cd,
10039                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
10040                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
10041                 p_number_of_copies               => l_number_of_copies,
10042                 p_table_route_id                 => l_table_route_id,
10043 		P_TABLE_ALIAS                    => 'LER1',
10044                 p_information1     => l_ler_rec.lgl_enty_rt_id,
10045                 p_information2     => l_ler_rec.EFFECTIVE_START_DATE,
10046                 p_information3     => l_ler_rec.EFFECTIVE_END_DATE,
10047                 p_information4     => l_ler_rec.business_group_id,
10048                 p_information5     => l_information5 , -- 9999 put name for h-grid
10049 
10050             p_information11     => l_ler_rec.excld_flag,
10051             p_information111     => l_ler_rec.ler1_attribute1,
10052             p_information120     => l_ler_rec.ler1_attribute10,
10053             p_information121     => l_ler_rec.ler1_attribute11,
10054             p_information122     => l_ler_rec.ler1_attribute12,
10055             p_information123     => l_ler_rec.ler1_attribute13,
10056             p_information124     => l_ler_rec.ler1_attribute14,
10057             p_information125     => l_ler_rec.ler1_attribute15,
10058             p_information126     => l_ler_rec.ler1_attribute16,
10059             p_information127     => l_ler_rec.ler1_attribute17,
10060             p_information128     => l_ler_rec.ler1_attribute18,
10061             p_information129     => l_ler_rec.ler1_attribute19,
10062             p_information112     => l_ler_rec.ler1_attribute2,
10063             p_information130     => l_ler_rec.ler1_attribute20,
10064             p_information131     => l_ler_rec.ler1_attribute21,
10065             p_information132     => l_ler_rec.ler1_attribute22,
10066             p_information133     => l_ler_rec.ler1_attribute23,
10067             p_information134     => l_ler_rec.ler1_attribute24,
10068             p_information135     => l_ler_rec.ler1_attribute25,
10069             p_information136     => l_ler_rec.ler1_attribute26,
10070             p_information137     => l_ler_rec.ler1_attribute27,
10071             p_information138     => l_ler_rec.ler1_attribute28,
10072             p_information139     => l_ler_rec.ler1_attribute29,
10073             p_information113     => l_ler_rec.ler1_attribute3,
10074             p_information140     => l_ler_rec.ler1_attribute30,
10075             p_information114     => l_ler_rec.ler1_attribute4,
10076             p_information115     => l_ler_rec.ler1_attribute5,
10077             p_information116     => l_ler_rec.ler1_attribute6,
10078             p_information117     => l_ler_rec.ler1_attribute7,
10079             p_information118     => l_ler_rec.ler1_attribute8,
10080             p_information119     => l_ler_rec.ler1_attribute9,
10081             p_information110     => l_ler_rec.ler1_attribute_category,
10082             p_information257     => l_ler_rec.ordr_num,
10083             p_information252     => l_ler_rec.organization_id,
10084             -- Data for MAPPING columns.
10085             p_information173    => l_mapping_name,
10086             p_information174    => l_mapping_id,
10087             p_information181    => l_mapping_column_name1,
10088             p_information182    => l_mapping_column_name2,
10089             -- END other product Mapping columns.
10090             p_information262     => l_ler_rec.vrbl_rt_prfl_id,
10091             p_information166     => l_organization_start_date,
10092             p_information265     => l_ler_rec.object_version_number,
10093            --
10094 
10095                 p_object_version_number          => l_object_version_number,
10096                 p_effective_date                 => p_effective_date       );
10097                 --
10098 
10099                 if l_out_ler_result_id is null then
10100                   l_out_ler_result_id := l_copy_entity_result_id;
10101                 end if;
10102 
10103                 if l_result_type_cd = 'DISPLAY' then
10104                    l_out_ler_result_id := l_copy_entity_result_id ;
10105                 end if;
10106                 --
10107              end loop;
10108              --
10109            end loop;
10110          hr_utility.set_location('END OF BEN_LGL_ENTY_RT_F ',100);
10111         ---------------------------------------------------------------
10112         -- END OF BEN_LGL_ENTY_RT_F ----------------------
10113         ---------------------------------------------------------------
10114          ---------------------------------------------------------------
10115          -- START OF BEN_LOA_RSN_RT_F ----------------------
10116          ---------------------------------------------------------------
10117          --
10118          hr_utility.set_location('START OF BEN_LOA_RSN_RT_F ',100);
10119          for l_parent_rec  in c_lar_from_parent(l_VRBL_RT_PRFL_ID) loop
10120             --
10121             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
10122 
10123             --
10124             l_loa_rsn_rt_id := l_parent_rec.loa_rsn_rt_id ;
10125             --
10126             hr_utility.set_location('l_loa_rsn_rt_id '||l_loa_rsn_rt_id,100);
10127             for l_lar_rec in c_lar(l_parent_rec.loa_rsn_rt_id,l_mirror_src_entity_result_id,'LAR') loop
10128               --
10129               l_table_route_id := null ;
10130               open ben_plan_design_program_module.g_table_route('LAR');
10131               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
10132               close ben_plan_design_program_module.g_table_route ;
10133               --
10134               l_information5  := ben_plan_design_program_module.get_absence_type_name(l_lar_rec.absence_attendance_type_id)
10135                                  || ben_plan_design_program_module.get_exclude_message(l_lar_rec.excld_flag);
10136                                  --'Intersection';
10137               --
10138               if p_effective_date between l_lar_rec.effective_start_date
10139                  and l_lar_rec.effective_end_date then
10140                --
10141                  l_result_type_cd := 'DISPLAY';
10142               else
10143                  l_result_type_cd := 'NO DISPLAY';
10144               end if;
10145                 --
10146               l_copy_entity_result_id := null;
10147               l_object_version_number := null;
10148 
10149               -- To store effective_start_date of absence_type
10150               -- and absence_reason for Mapping - Bug 2958658
10151               --
10152               l_absence_type_start_date := null;
10153               if l_lar_rec.absence_attendance_type_id is not null then
10154                 open c_absence_type_start_date(l_lar_rec.absence_attendance_type_id);
10155                 fetch c_absence_type_start_date into l_absence_type_start_date;
10156                 close c_absence_type_start_date;
10157               end if;
10158 
10159 --PADMAJA
10160               --
10161               -- pabodla : MAPPING DATA : Store the mapping column information.
10162               --
10163               l_mapping_name := null;
10164               l_mapping_id   := null;
10165               l_mapping_name1:= null;
10166               l_mapping_id1  := null;
10167               --
10168               -- Get the absence attendance name to display on mapping page.
10169               --
10170               -- 9999 needs review
10171               open c_get_mapping_name7(l_lar_rec.absence_attendance_type_id,
10172                                        NVL(l_absence_type_start_date,p_effective_date));
10173               fetch c_get_mapping_name7 into l_mapping_name;
10174               close c_get_mapping_name7;
10175               --
10176               l_mapping_id   := l_lar_rec.absence_attendance_type_id;
10177               --
10178 
10179               open c_get_mapping_name8(l_lar_rec.absence_attendance_type_id,
10180                                        l_lar_rec.abs_attendance_reason_id,
10181                                        NVL(l_absence_type_start_date,p_effective_date));
10182               fetch c_get_mapping_name8 into l_mapping_name1;
10183               close c_get_mapping_name8;
10184               --
10185               l_mapping_id1   := l_lar_rec.abs_attendance_reason_id;
10186               --
10187               --To set user friendly labels on the mapping page
10188               --
10189               l_mapping_column_name1 := null;
10190               l_mapping_column_name2 :=null;
10191               BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
10192                                                                l_mapping_column_name1,
10193                                                                l_mapping_column_name2,
10194                                                                p_copy_entity_txn_id);
10195               --
10196               hr_utility.set_location('l_mapping_id '||l_mapping_id,100);
10197               hr_utility.set_location('l_mapping_name '||l_mapping_name,100);
10198               hr_utility.set_location('l_mapping_id1 '||l_mapping_id1,100);
10199               hr_utility.set_location('l_mapping_name1 '||l_mapping_name1,100);
10200               --
10201 
10202               ben_copy_entity_results_api.create_copy_entity_results(
10203                 p_copy_entity_result_id          => l_copy_entity_result_id,
10204                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
10205                 p_result_type_cd                 => l_result_type_cd,
10206                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
10207                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
10208                 p_number_of_copies               => l_number_of_copies,
10209                 p_table_route_id                 => l_table_route_id,
10210 		P_TABLE_ALIAS                    => 'LAR',
10211                 p_information1     => l_lar_rec.loa_rsn_rt_id,
10212                 p_information2     => l_lar_rec.EFFECTIVE_START_DATE,
10213                 p_information3     => l_lar_rec.EFFECTIVE_END_DATE,
10214                 p_information4     => l_lar_rec.business_group_id,
10215                 p_information5     => l_information5 , -- 9999 put name for h-grid
10216 
10217             -- Data for MAPPING columns.
10218             p_information173    => l_mapping_name,
10219             p_information174    => l_mapping_id,
10220             p_information181    => l_mapping_column_name1,
10221             p_information182    => l_mapping_column_name2,
10222             -- END other product Mapping columns.
10223             -- Data for MAPPING columns.
10224             p_information177    => l_mapping_name1,
10225             p_information178    => l_mapping_id1,
10226             -- END other product Mapping columns.
10227             p_information11     => l_lar_rec.excld_flag,
10228             p_information111     => l_lar_rec.lar_attribute1,
10229             p_information120     => l_lar_rec.lar_attribute10,
10230             p_information121     => l_lar_rec.lar_attribute11,
10231             p_information122     => l_lar_rec.lar_attribute12,
10232             p_information123     => l_lar_rec.lar_attribute13,
10233             p_information124     => l_lar_rec.lar_attribute14,
10234             p_information125     => l_lar_rec.lar_attribute15,
10235             p_information126     => l_lar_rec.lar_attribute16,
10236             p_information127     => l_lar_rec.lar_attribute17,
10237             p_information128     => l_lar_rec.lar_attribute18,
10238             p_information129     => l_lar_rec.lar_attribute19,
10239             p_information112     => l_lar_rec.lar_attribute2,
10240             p_information130     => l_lar_rec.lar_attribute20,
10241             p_information131     => l_lar_rec.lar_attribute21,
10242             p_information132     => l_lar_rec.lar_attribute22,
10243             p_information133     => l_lar_rec.lar_attribute23,
10244             p_information134     => l_lar_rec.lar_attribute24,
10245             p_information135     => l_lar_rec.lar_attribute25,
10246             p_information136     => l_lar_rec.lar_attribute26,
10247             p_information137     => l_lar_rec.lar_attribute27,
10248             p_information138     => l_lar_rec.lar_attribute28,
10249             p_information139     => l_lar_rec.lar_attribute29,
10250             p_information113     => l_lar_rec.lar_attribute3,
10251             p_information140     => l_lar_rec.lar_attribute30,
10252             p_information114     => l_lar_rec.lar_attribute4,
10253             p_information115     => l_lar_rec.lar_attribute5,
10254             p_information116     => l_lar_rec.lar_attribute6,
10255             p_information117     => l_lar_rec.lar_attribute7,
10256             p_information118     => l_lar_rec.lar_attribute8,
10257             p_information119     => l_lar_rec.lar_attribute9,
10258             p_information110     => l_lar_rec.lar_attribute_category,
10259             p_information12     => l_lar_rec.loa_rsn_cd,
10260             p_information260     => l_lar_rec.ordr_num,
10261             p_information262     => l_lar_rec.vrbl_rt_prfl_id,
10262             p_information166     => l_absence_type_start_date,
10263             p_information306     => l_absence_type_start_date,
10264             p_information265     => l_lar_rec.object_version_number,
10265            --
10266 
10267                 p_object_version_number          => l_object_version_number,
10268                 p_effective_date                 => p_effective_date       );
10269                 --
10270 
10271                 if l_out_lar_result_id is null then
10272                   l_out_lar_result_id := l_copy_entity_result_id;
10273                 end if;
10274 
10275                 if l_result_type_cd = 'DISPLAY' then
10276                    l_out_lar_result_id := l_copy_entity_result_id ;
10277                 end if;
10278                 --
10279              end loop;
10280              --
10281            end loop;
10282          hr_utility.set_location('END OF BEN_LOA_RSN_RT_F ',100);
10283         ---------------------------------------------------------------
10284         -- END OF BEN_LOA_RSN_RT_F ----------------------
10285         ---------------------------------------------------------------
10286          ---------------------------------------------------------------
10287          -- START OF BEN_LOS_RT_F ----------------------
10288          ---------------------------------------------------------------
10289          --
10290          for l_parent_rec  in c_lsr_from_parent(l_VRBL_RT_PRFL_ID) loop
10291             --
10292             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
10293 
10294             --
10295             l_los_rt_id := l_parent_rec.los_rt_id ;
10296             --
10297             for l_lsr_rec in c_lsr(l_parent_rec.los_rt_id,l_mirror_src_entity_result_id,'LSR') loop
10298               --
10299               l_table_route_id := null ;
10300               open ben_plan_design_program_module.g_table_route('LSR');
10301                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
10302               close ben_plan_design_program_module.g_table_route ;
10303               --
10304               l_information5  := ben_plan_design_program_module.get_los_fctr_name(l_lsr_rec.los_fctr_id)
10305                                  || ben_plan_design_program_module.get_exclude_message(l_lsr_rec.excld_flag);
10306                                  --'Intersection';
10307               --
10308               if p_effective_date between l_lsr_rec.effective_start_date
10309                  and l_lsr_rec.effective_end_date then
10310                --
10311                  l_result_type_cd := 'DISPLAY';
10312               else
10313                  l_result_type_cd := 'NO DISPLAY';
10314               end if;
10315                 --
10316               l_copy_entity_result_id := null;
10317               l_object_version_number := null;
10318               ben_copy_entity_results_api.create_copy_entity_results(
10319                 p_copy_entity_result_id          => l_copy_entity_result_id,
10320                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
10321                 p_result_type_cd                 => l_result_type_cd,
10322                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
10323                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
10324                 p_number_of_copies               => l_number_of_copies,
10325                 p_table_route_id                 => l_table_route_id,
10326 		P_TABLE_ALIAS                    => 'LSR',
10327                 p_information1     => l_lsr_rec.los_rt_id,
10328                 p_information2     => l_lsr_rec.EFFECTIVE_START_DATE,
10329                 p_information3     => l_lsr_rec.EFFECTIVE_END_DATE,
10330                 p_information4     => l_lsr_rec.business_group_id,
10331                 p_information5     => l_information5 , -- 9999 put name for h-grid
10332             p_information11     => l_lsr_rec.excld_flag,
10333             p_information243     => l_lsr_rec.los_fctr_id,
10334             p_information111     => l_lsr_rec.lsr_attribute1,
10335             p_information120     => l_lsr_rec.lsr_attribute10,
10336             p_information121     => l_lsr_rec.lsr_attribute11,
10337             p_information122     => l_lsr_rec.lsr_attribute12,
10338             p_information123     => l_lsr_rec.lsr_attribute13,
10339             p_information124     => l_lsr_rec.lsr_attribute14,
10340             p_information125     => l_lsr_rec.lsr_attribute15,
10341             p_information126     => l_lsr_rec.lsr_attribute16,
10342             p_information127     => l_lsr_rec.lsr_attribute17,
10343             p_information128     => l_lsr_rec.lsr_attribute18,
10344             p_information129     => l_lsr_rec.lsr_attribute19,
10345             p_information112     => l_lsr_rec.lsr_attribute2,
10346             p_information130     => l_lsr_rec.lsr_attribute20,
10347             p_information131     => l_lsr_rec.lsr_attribute21,
10348             p_information132     => l_lsr_rec.lsr_attribute22,
10349             p_information133     => l_lsr_rec.lsr_attribute23,
10350             p_information134     => l_lsr_rec.lsr_attribute24,
10351             p_information135     => l_lsr_rec.lsr_attribute25,
10352             p_information136     => l_lsr_rec.lsr_attribute26,
10353             p_information137     => l_lsr_rec.lsr_attribute27,
10354             p_information138     => l_lsr_rec.lsr_attribute28,
10355             p_information139     => l_lsr_rec.lsr_attribute29,
10356             p_information113     => l_lsr_rec.lsr_attribute3,
10357             p_information140     => l_lsr_rec.lsr_attribute30,
10358             p_information114     => l_lsr_rec.lsr_attribute4,
10359             p_information115     => l_lsr_rec.lsr_attribute5,
10360             p_information116     => l_lsr_rec.lsr_attribute6,
10361             p_information117     => l_lsr_rec.lsr_attribute7,
10362             p_information118     => l_lsr_rec.lsr_attribute8,
10363             p_information119     => l_lsr_rec.lsr_attribute9,
10364             p_information110     => l_lsr_rec.lsr_attribute_category,
10365             p_information260     => l_lsr_rec.ordr_num,
10366             p_information262     => l_lsr_rec.vrbl_rt_prfl_id,
10367             p_information265     => l_lsr_rec.object_version_number,
10368            --
10369 
10370                 p_object_version_number          => l_object_version_number,
10371                 p_effective_date                 => p_effective_date       );
10372                 --
10373 
10374                 if l_out_lsr_result_id is null then
10375                   l_out_lsr_result_id := l_copy_entity_result_id;
10376                 end if;
10377 
10378                 if l_result_type_cd = 'DISPLAY' then
10379                    l_out_lsr_result_id := l_copy_entity_result_id ;
10380                 end if;
10381                 --
10382              end loop;
10383              --
10384             for l_lsr_rec in c_lsr_drp(l_parent_rec.los_rt_id,l_mirror_src_entity_result_id,'LSR') loop
10385             hr_utility.set_location('l_parent_rec.los_rt_id '||l_parent_rec.los_rt_id,100);
10386                create_drpar_results
10387                  (
10388                    p_validate                      => p_validate
10389                   ,p_copy_entity_result_id         => l_out_lsr_result_id
10390                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
10391                   ,p_comp_lvl_fctr_id              => null
10392                   ,p_hrs_wkd_in_perd_fctr_id       => null
10393                   ,p_los_fctr_id                   => l_lsr_rec.los_fctr_id
10394                   ,p_pct_fl_tm_fctr_id             => null
10395                   ,p_age_fctr_id                   => null
10396                   ,p_cmbn_age_los_fctr_id          => null
10397                   ,p_business_group_id             => p_business_group_id
10398                   ,p_number_of_copies              => p_number_of_copies
10399                   ,p_object_version_number         => l_object_version_number
10400                   ,p_effective_date                => p_effective_date
10401                  );
10402              end loop;
10403            end loop;
10404         ---------------------------------------------------------------
10405         -- END OF BEN_LOS_RT_F ----------------------
10406         ---------------------------------------------------------------
10407         ---------------------------------------------------------------
10408         -- START OF BEN_LVG_RSN_RT_F ----------------------
10409         ---------------------------------------------------------------
10410           --
10411           for l_parent_rec  in c_lrn_from_parent(l_VRBL_RT_PRFL_ID) loop
10412              --
10413              l_mirror_src_entity_result_id := l_out_vpf_result_id ;
10414              --
10415              l_lvg_rsn_rt_id := l_parent_rec.lvg_rsn_rt_id ;
10416              --
10417              for l_lrn_rec in c_lrn(l_parent_rec.lvg_rsn_rt_id,l_mirror_src_entity_result_id,'LRN') loop
10418                --
10419                l_table_route_id := null ;
10420                open ben_plan_design_program_module.g_table_route('LRN');
10421                  fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
10422                close ben_plan_design_program_module.g_table_route ;
10423                --
10424                l_information5  := hr_general.decode_lookup('LEAV_REAS',l_lrn_rec.lvg_rsn_cd)
10425                                   || ben_plan_design_program_module.get_exclude_message(l_lrn_rec.excld_flag);
10426                --
10427                if p_effective_date between l_lrn_rec.effective_start_date
10428                   and l_lrn_rec.effective_end_date then
10429                 --
10430                   l_result_type_cd := 'DISPLAY';
10431                else
10432                   l_result_type_cd := 'NO DISPLAY';
10433                end if;
10434                  --
10435                l_copy_entity_result_id := null;
10436                l_object_version_number := null;
10437                ben_copy_entity_results_api.create_copy_entity_results(
10438                  p_copy_entity_result_id           => l_copy_entity_result_id,
10439                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
10440                  p_result_type_cd                 => l_result_type_cd,
10441                  p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
10442                  p_parent_entity_result_id      => l_mirror_src_entity_result_id,
10443                  p_number_of_copies               => l_number_of_copies,
10444                  p_table_route_id                 => l_table_route_id,
10445 		 P_TABLE_ALIAS                    => 'LRN',
10446                  p_information1     => l_lrn_rec.lvg_rsn_rt_id,
10447                  p_information2     => l_lrn_rec.EFFECTIVE_START_DATE,
10448                  p_information3     => l_lrn_rec.EFFECTIVE_END_DATE,
10449                  p_information4     => l_lrn_rec.business_group_id,
10450                  p_information5     => l_information5 , -- 9999 put name for h-grid
10451 
10452             p_information12     => l_lrn_rec.excld_flag,
10453             p_information111     => l_lrn_rec.lrn_attribute1,
10454             p_information120     => l_lrn_rec.lrn_attribute10,
10455             p_information121     => l_lrn_rec.lrn_attribute11,
10456             p_information122     => l_lrn_rec.lrn_attribute12,
10457             p_information123     => l_lrn_rec.lrn_attribute13,
10458             p_information124     => l_lrn_rec.lrn_attribute14,
10459             p_information125     => l_lrn_rec.lrn_attribute15,
10460             p_information126     => l_lrn_rec.lrn_attribute16,
10461             p_information127     => l_lrn_rec.lrn_attribute17,
10462             p_information128     => l_lrn_rec.lrn_attribute18,
10463             p_information129     => l_lrn_rec.lrn_attribute19,
10464             p_information112     => l_lrn_rec.lrn_attribute2,
10465             p_information130     => l_lrn_rec.lrn_attribute20,
10466             p_information131     => l_lrn_rec.lrn_attribute21,
10467             p_information132     => l_lrn_rec.lrn_attribute22,
10468             p_information133     => l_lrn_rec.lrn_attribute23,
10469             p_information134     => l_lrn_rec.lrn_attribute24,
10470             p_information135     => l_lrn_rec.lrn_attribute25,
10471             p_information136     => l_lrn_rec.lrn_attribute26,
10472             p_information137     => l_lrn_rec.lrn_attribute27,
10473             p_information138     => l_lrn_rec.lrn_attribute28,
10474             p_information139     => l_lrn_rec.lrn_attribute29,
10475             p_information113     => l_lrn_rec.lrn_attribute3,
10476             p_information140     => l_lrn_rec.lrn_attribute30,
10477             p_information114     => l_lrn_rec.lrn_attribute4,
10478             p_information115     => l_lrn_rec.lrn_attribute5,
10479             p_information116     => l_lrn_rec.lrn_attribute6,
10480             p_information117     => l_lrn_rec.lrn_attribute7,
10481             p_information118     => l_lrn_rec.lrn_attribute8,
10482             p_information119     => l_lrn_rec.lrn_attribute9,
10483             p_information110     => l_lrn_rec.lrn_attribute_category,
10484             p_information11     => l_lrn_rec.lvg_rsn_cd,
10485             p_information257     => l_lrn_rec.ordr_num,
10486             p_information262     => l_lrn_rec.vrbl_rt_prfl_id,
10487             p_information265     => l_lrn_rec.object_version_number,
10488            --
10489 
10490                  p_object_version_number          => l_object_version_number,
10491                  p_effective_date                 => p_effective_date       );
10492                  --
10493 
10494                  if l_out_lrn_result_id is null then
10495                    l_out_lrn_result_id := l_copy_entity_result_id;
10496                  end if;
10497 
10498                  if l_result_type_cd = 'DISPLAY' then
10499                     l_out_lrn_result_id := l_copy_entity_result_id ;
10500                  end if;
10501                  --
10502               end loop;
10503               --
10504             end loop;
10505          ---------------------------------------------------------------
10506          -- END OF BEN_LVG_RSN_RT_F ----------------------
10507          ---------------------------------------------------------------
10508          ---------------------------------------------------------------
10509          -- START OF BEN_ORG_UNIT_RT_F ----------------------
10510          ---------------------------------------------------------------
10511          --
10512          hr_utility.set_location('START OF BEN_ORG_UNIT_RT_F',100);
10513          for l_parent_rec  in c_our_from_parent(l_VRBL_RT_PRFL_ID) loop
10514             --
10515             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
10516 
10517             --
10518             l_org_unit_rt_id := l_parent_rec.org_unit_rt_id ;
10519             --
10520             hr_utility.set_location('l_org_unit_rt_id '||l_org_unit_rt_id,100);
10521             for l_our_rec in c_our(l_parent_rec.org_unit_rt_id,l_mirror_src_entity_result_id,'OUR') loop
10522               --
10523               l_table_route_id := null ;
10524               open ben_plan_design_program_module.g_table_route('OUR');
10525                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
10526               close ben_plan_design_program_module.g_table_route ;
10527               --
10528               l_information5  := ben_plan_design_program_module.get_organization_name(l_our_rec.organization_id)
10529                                  || ben_plan_design_program_module.get_exclude_message(l_our_rec.excld_flag);
10530                                  --'Intersection';
10531               --
10532               if p_effective_date between l_our_rec.effective_start_date
10533                  and l_our_rec.effective_end_date then
10534                --
10535                  l_result_type_cd := 'DISPLAY';
10536               else
10537                  l_result_type_cd := 'NO DISPLAY';
10538               end if;
10539 
10540               -- To store effective_start_date of organization
10541               -- for Mapping - Bug 2958658
10542               --
10543               l_organization_start_date := null;
10544               if l_our_rec.organization_id is not null then
10545                 open c_organization_start_date(l_our_rec.organization_id);
10546                 fetch c_organization_start_date into l_organization_start_date;
10547                 close c_organization_start_date;
10548               end if;
10549 
10550               --
10551               -- pabodla : MAPPING DATA : Store the mapping column information.
10552               --
10553 
10554               l_mapping_name := null;
10555               l_mapping_id   := null;
10556               --
10557               -- Get the defined balance name to display on mapping page.
10558               --
10559               open c_get_mapping_name9(l_our_rec.organization_id,
10560                                        NVL(l_organization_start_date,p_effective_date));
10561               fetch c_get_mapping_name9 into l_mapping_name;
10562               close c_get_mapping_name9;
10563               --
10564               l_mapping_id   := l_our_rec.organization_id;
10565               --
10566               --To set user friendly labels on the mapping page
10567               --
10568               l_mapping_column_name1 := null;
10569               l_mapping_column_name2 :=null;
10570               BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
10571                                                                l_mapping_column_name1,
10572                                                                l_mapping_column_name2,
10573                                                                p_copy_entity_txn_id);
10574               --
10575 
10576               l_copy_entity_result_id := null;
10577               l_object_version_number := null;
10578               ben_copy_entity_results_api.create_copy_entity_results(
10579                 p_copy_entity_result_id          => l_copy_entity_result_id,
10580                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
10581                 p_result_type_cd                 => l_result_type_cd,
10582                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
10583                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
10584                 p_number_of_copies               => l_number_of_copies,
10585                 p_table_route_id                 => l_table_route_id,
10586 		P_TABLE_ALIAS                    => 'OUR',
10587                 p_information1     => l_our_rec.org_unit_rt_id,
10588                 p_information2     => l_our_rec.EFFECTIVE_START_DATE,
10589                 p_information3     => l_our_rec.EFFECTIVE_END_DATE,
10590                 p_information4     => l_our_rec.business_group_id,
10591                 p_information5     => l_information5 , -- 9999 put name for h-grid
10592 
10593             p_information11     => l_our_rec.excld_flag,
10594             p_information260     => l_our_rec.ordr_num,
10595             p_information252     => l_our_rec.organization_id,
10596             -- Data for MAPPING columns.
10597             p_information173    => l_mapping_name,
10598             p_information174    => l_mapping_id,
10599             p_information181    => l_mapping_column_name1,
10600             p_information182    => l_mapping_column_name2,
10601             -- END other product Mapping columns.
10602             p_information111     => l_our_rec.our_attribute1,
10603             p_information120     => l_our_rec.our_attribute10,
10604             p_information121     => l_our_rec.our_attribute11,
10605             p_information122     => l_our_rec.our_attribute12,
10606             p_information123     => l_our_rec.our_attribute13,
10607             p_information124     => l_our_rec.our_attribute14,
10608             p_information125     => l_our_rec.our_attribute15,
10609             p_information126     => l_our_rec.our_attribute16,
10610             p_information127     => l_our_rec.our_attribute17,
10611             p_information128     => l_our_rec.our_attribute18,
10612             p_information129     => l_our_rec.our_attribute19,
10613             p_information112     => l_our_rec.our_attribute2,
10614             p_information130     => l_our_rec.our_attribute20,
10615             p_information131     => l_our_rec.our_attribute21,
10616             p_information132     => l_our_rec.our_attribute22,
10617             p_information133     => l_our_rec.our_attribute23,
10618             p_information134     => l_our_rec.our_attribute24,
10619             p_information135     => l_our_rec.our_attribute25,
10620             p_information136     => l_our_rec.our_attribute26,
10621             p_information137     => l_our_rec.our_attribute27,
10622             p_information138     => l_our_rec.our_attribute28,
10623             p_information139     => l_our_rec.our_attribute29,
10624             p_information113     => l_our_rec.our_attribute3,
10625             p_information140     => l_our_rec.our_attribute30,
10626             p_information114     => l_our_rec.our_attribute4,
10627             p_information115     => l_our_rec.our_attribute5,
10628             p_information116     => l_our_rec.our_attribute6,
10629             p_information117     => l_our_rec.our_attribute7,
10630             p_information118     => l_our_rec.our_attribute8,
10631             p_information119     => l_our_rec.our_attribute9,
10632             p_information110     => l_our_rec.our_attribute_category,
10633             p_information262     => l_our_rec.vrbl_rt_prfl_id,
10634             p_information166     => l_organization_start_date,
10635             p_information265     => l_our_rec.object_version_number,
10636            --
10637 
10638                 p_object_version_number          => l_object_version_number,
10639                 p_effective_date                 => p_effective_date       );
10640                 --
10641 
10642                 if l_out_our_result_id is null then
10643                   l_out_our_result_id := l_copy_entity_result_id;
10644                 end if;
10645 
10646                 if l_result_type_cd = 'DISPLAY' then
10647                    l_out_our_result_id := l_copy_entity_result_id ;
10648                 end if;
10649                 --
10650              end loop;
10651              --
10652            end loop;
10653          hr_utility.set_location('END OF BEN_ORG_UNIT_RT_F',100);
10654         ---------------------------------------------------------------
10655         -- END OF BEN_ORG_UNIT_RT_F ----------------------
10656         ---------------------------------------------------------------
10657          ---------------------------------------------------------------
10658          -- START OF BEN_PCT_FL_TM_RT_F ----------------------
10659          ---------------------------------------------------------------
10660          --
10661          for l_parent_rec  in c_pfr_from_parent(l_VRBL_RT_PRFL_ID) loop
10662             --
10663             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
10664 
10665             --
10666             l_pct_fl_tm_rt_id := l_parent_rec.pct_fl_tm_rt_id ;
10667             --
10668             for l_pfr_rec in c_pfr(l_parent_rec.pct_fl_tm_rt_id,l_mirror_src_entity_result_id,'PFR') loop
10669               --
10670               l_table_route_id := null ;
10671               open ben_plan_design_program_module.g_table_route('PFR');
10672               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
10673               close ben_plan_design_program_module.g_table_route ;
10674               --
10675               l_information5  := ben_plan_design_program_module.get_pct_fl_tm_fctr_name(l_pfr_rec.pct_fl_tm_fctr_id)
10676                                  || ben_plan_design_program_module.get_exclude_message(l_pfr_rec.excld_flag);
10677                                  --'Intersection';
10678               --
10679               if p_effective_date between l_pfr_rec.effective_start_date
10680                  and l_pfr_rec.effective_end_date then
10681                --
10682                  l_result_type_cd := 'DISPLAY';
10683               else
10684                  l_result_type_cd := 'NO DISPLAY';
10685               end if;
10686                 --
10687               l_copy_entity_result_id := null;
10688               l_object_version_number := null;
10689               ben_copy_entity_results_api.create_copy_entity_results(
10690                 p_copy_entity_result_id          => l_copy_entity_result_id,
10691                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
10692                 p_result_type_cd                 => l_result_type_cd,
10693                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
10694                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
10695                 p_number_of_copies               => l_number_of_copies,
10696                 p_table_route_id                 => l_table_route_id,
10697 		P_TABLE_ALIAS                    => 'PFR',
10698                 p_information1     => l_pfr_rec.pct_fl_tm_rt_id,
10699                 p_information2     => l_pfr_rec.EFFECTIVE_START_DATE,
10700                 p_information3     => l_pfr_rec.EFFECTIVE_END_DATE,
10701                 p_information4     => l_pfr_rec.business_group_id,
10702                 p_information5     => l_information5 , -- 9999 put name for h-grid
10703 
10704             p_information11     => l_pfr_rec.excld_flag,
10705             p_information257     => l_pfr_rec.ordr_num,
10706             p_information233     => l_pfr_rec.pct_fl_tm_fctr_id,
10707             p_information111     => l_pfr_rec.pfr_attribute1,
10708             p_information120     => l_pfr_rec.pfr_attribute10,
10709             p_information121     => l_pfr_rec.pfr_attribute11,
10710             p_information122     => l_pfr_rec.pfr_attribute12,
10711             p_information123     => l_pfr_rec.pfr_attribute13,
10712             p_information124     => l_pfr_rec.pfr_attribute14,
10713             p_information125     => l_pfr_rec.pfr_attribute15,
10714             p_information126     => l_pfr_rec.pfr_attribute16,
10715             p_information127     => l_pfr_rec.pfr_attribute17,
10716             p_information128     => l_pfr_rec.pfr_attribute18,
10717             p_information129     => l_pfr_rec.pfr_attribute19,
10718             p_information112     => l_pfr_rec.pfr_attribute2,
10719             p_information130     => l_pfr_rec.pfr_attribute20,
10720             p_information131     => l_pfr_rec.pfr_attribute21,
10721             p_information132     => l_pfr_rec.pfr_attribute22,
10722             p_information133     => l_pfr_rec.pfr_attribute23,
10723             p_information134     => l_pfr_rec.pfr_attribute24,
10724             p_information135     => l_pfr_rec.pfr_attribute25,
10725             p_information136     => l_pfr_rec.pfr_attribute26,
10726             p_information137     => l_pfr_rec.pfr_attribute27,
10727             p_information138     => l_pfr_rec.pfr_attribute28,
10728             p_information139     => l_pfr_rec.pfr_attribute29,
10729             p_information113     => l_pfr_rec.pfr_attribute3,
10730             p_information140     => l_pfr_rec.pfr_attribute30,
10731             p_information114     => l_pfr_rec.pfr_attribute4,
10732             p_information115     => l_pfr_rec.pfr_attribute5,
10733             p_information116     => l_pfr_rec.pfr_attribute6,
10734             p_information117     => l_pfr_rec.pfr_attribute7,
10735             p_information118     => l_pfr_rec.pfr_attribute8,
10736             p_information119     => l_pfr_rec.pfr_attribute9,
10737             p_information110     => l_pfr_rec.pfr_attribute_category,
10738             p_information262     => l_pfr_rec.vrbl_rt_prfl_id,
10739             p_information265     => l_pfr_rec.object_version_number,
10740            --
10741 
10742                 p_object_version_number          => l_object_version_number,
10743                 p_effective_date                 => p_effective_date       );
10744                 --
10745 
10746                 if l_out_pfr_result_id is null then
10747                   l_out_pfr_result_id := l_copy_entity_result_id;
10748                 end if;
10749 
10750                 if l_result_type_cd = 'DISPLAY' then
10751                    l_out_pfr_result_id := l_copy_entity_result_id ;
10752                 end if;
10753                 --
10754              end loop;
10755              --
10756             for l_pfr_rec in c_pfr_drp(l_parent_rec.pct_fl_tm_rt_id,l_mirror_src_entity_result_id,'PFR') loop
10757                create_drpar_results
10758                  (
10759                    p_validate                      => p_validate
10760                   ,p_copy_entity_result_id         => l_out_pfr_result_id
10761                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
10762                   ,p_comp_lvl_fctr_id              => null
10763                   ,p_hrs_wkd_in_perd_fctr_id       => null
10764                   ,p_los_fctr_id                   => null
10765                   ,p_pct_fl_tm_fctr_id             => l_pfr_rec.pct_fl_tm_fctr_id
10766                   ,p_age_fctr_id                   => null
10767                   ,p_cmbn_age_los_fctr_id          => null
10768                   ,p_business_group_id             => p_business_group_id
10769                   ,p_number_of_copies              => p_number_of_copies
10770                   ,p_object_version_number         => l_object_version_number
10771                   ,p_effective_date                => p_effective_date
10772                  );
10773              end loop;
10774            end loop;
10775         ---------------------------------------------------------------
10776         -- END OF BEN_PCT_FL_TM_RT_F ----------------------
10777         ---------------------------------------------------------------
10778          ---------------------------------------------------------------
10779          -- START OF BEN_PER_TYP_RT_F ----------------------
10780          ---------------------------------------------------------------
10781          --
10782          hr_utility.set_location('START OF BEN_PER_TYP_RT_F ',100);
10783          for l_parent_rec  in c_ptr_from_parent(l_VRBL_RT_PRFL_ID) loop
10784             --
10785             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
10786 
10787             --
10788             l_per_typ_rt_id := l_parent_rec.per_typ_rt_id ;
10789             --
10790             hr_utility.set_location('l_per_typ_rt_id '||l_per_typ_rt_id,100);
10791             for l_ptr_rec in c_ptr(l_parent_rec.per_typ_rt_id,l_mirror_src_entity_result_id,'PTR') loop
10792               --
10793               l_table_route_id := null ;
10794               open ben_plan_design_program_module.g_table_route('PTR');
10795                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
10796               close ben_plan_design_program_module.g_table_route ;
10797               --
10798               l_information5  := ben_plan_design_program_module.get_person_type_name(l_ptr_rec.person_type_id)
10799                                  || ben_plan_design_program_module.get_exclude_message(l_ptr_rec.excld_flag);
10800                                  --'Intersection';
10801               --
10802               if p_effective_date between l_ptr_rec.effective_start_date
10803                  and l_ptr_rec.effective_end_date then
10804                --
10805                  l_result_type_cd := 'DISPLAY';
10806               else
10807                  l_result_type_cd := 'NO DISPLAY';
10808               end if;
10809                 --
10810               l_copy_entity_result_id := null;
10811               l_object_version_number := null;
10812 --PADMAJA
10813               --
10814               -- pabodla : MAPPING DATA : Store the mapping column information.
10815               --
10816               l_mapping_name := null;
10817               l_mapping_id   := null;
10818               --
10819               -- Get the person_type name to display on mapping page.
10820               --
10821               open c_get_person_type_name(l_ptr_rec.person_type_id);
10822               fetch c_get_person_type_name into l_mapping_name;
10823               close c_get_person_type_name;
10824               --
10825               l_mapping_id   := l_ptr_rec.person_type_id;
10826               --
10827               --To set user friendly labels on the mapping page
10828               --
10829               l_mapping_column_name1 := null;
10830               l_mapping_column_name2 :=null;
10831               BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
10832                                                                l_mapping_column_name1,
10833                                                                l_mapping_column_name2,
10834                                                                p_copy_entity_txn_id);
10835               --
10836 
10837               hr_utility.set_location('l_parent_rec.per_typ_rt_id '||l_parent_rec.per_typ_rt_id,100);
10838               ben_copy_entity_results_api.create_copy_entity_results(
10839                 p_copy_entity_result_id          => l_copy_entity_result_id,
10840                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
10841                 p_result_type_cd                 => l_result_type_cd,
10842                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
10843                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
10844                 p_number_of_copies               => l_number_of_copies,
10845                 p_table_route_id                 => l_table_route_id,
10846 		P_TABLE_ALIAS                    => 'PTR',
10847                 p_information1     => l_ptr_rec.per_typ_rt_id,
10848                 p_information2     => l_ptr_rec.EFFECTIVE_START_DATE,
10849                 p_information3     => l_ptr_rec.EFFECTIVE_END_DATE,
10850                 p_information4     => l_ptr_rec.business_group_id,
10851                 p_information5     => l_information5 , -- 9999 put name for h-grid
10852 
10853             p_information11     => l_ptr_rec.excld_flag,
10854             p_information257     => l_ptr_rec.ordr_num,
10855             p_information12     => l_ptr_rec.per_typ_cd,
10856             -- Data for MAPPING columns.
10857             p_information173    => l_mapping_name,
10858             p_information174    => l_mapping_id,
10859             p_information181    => l_mapping_column_name1,
10860             p_information182    => l_mapping_column_name2,
10861             -- END other product Mapping columns.
10862             p_information111     => l_ptr_rec.ptr_attribute1,
10863             p_information120     => l_ptr_rec.ptr_attribute10,
10864             p_information121     => l_ptr_rec.ptr_attribute11,
10865             p_information122     => l_ptr_rec.ptr_attribute12,
10866             p_information123     => l_ptr_rec.ptr_attribute13,
10867             p_information124     => l_ptr_rec.ptr_attribute14,
10868             p_information125     => l_ptr_rec.ptr_attribute15,
10869             p_information126     => l_ptr_rec.ptr_attribute16,
10870             p_information127     => l_ptr_rec.ptr_attribute17,
10871             p_information128     => l_ptr_rec.ptr_attribute18,
10872             p_information129     => l_ptr_rec.ptr_attribute19,
10873             p_information112     => l_ptr_rec.ptr_attribute2,
10874             p_information130     => l_ptr_rec.ptr_attribute20,
10875             p_information131     => l_ptr_rec.ptr_attribute21,
10876             p_information132     => l_ptr_rec.ptr_attribute22,
10877             p_information133     => l_ptr_rec.ptr_attribute23,
10878             p_information134     => l_ptr_rec.ptr_attribute24,
10879             p_information135     => l_ptr_rec.ptr_attribute25,
10880             p_information136     => l_ptr_rec.ptr_attribute26,
10881             p_information137     => l_ptr_rec.ptr_attribute27,
10882             p_information138     => l_ptr_rec.ptr_attribute28,
10883             p_information139     => l_ptr_rec.ptr_attribute29,
10884             p_information113     => l_ptr_rec.ptr_attribute3,
10885             p_information140     => l_ptr_rec.ptr_attribute30,
10886             p_information114     => l_ptr_rec.ptr_attribute4,
10887             p_information115     => l_ptr_rec.ptr_attribute5,
10888             p_information116     => l_ptr_rec.ptr_attribute6,
10889             p_information117     => l_ptr_rec.ptr_attribute7,
10890             p_information118     => l_ptr_rec.ptr_attribute8,
10891             p_information119     => l_ptr_rec.ptr_attribute9,
10892             p_information110     => l_ptr_rec.ptr_attribute_category,
10893             p_information262     => l_ptr_rec.vrbl_rt_prfl_id,
10894             p_information166     => NULL, -- No ESD for Person Type
10895             p_information265     => l_ptr_rec.object_version_number,
10896            --
10897 
10898                 p_object_version_number          => l_object_version_number,
10899                 p_effective_date                 => p_effective_date       );
10900                 --
10901 
10902                 if l_out_ptr_result_id is null then
10903                   l_out_ptr_result_id := l_copy_entity_result_id;
10904                 end if;
10905 
10906                 if l_result_type_cd = 'DISPLAY' then
10907                    l_out_ptr_result_id := l_copy_entity_result_id ;
10908                 end if;
10909                 --
10910              end loop;
10911              --
10912            end loop;
10913          hr_utility.set_location('END OF BEN_PER_TYP_RT_F ',100);
10914         ---------------------------------------------------------------
10915         -- END OF BEN_PER_TYP_RT_F ----------------------
10916         ---------------------------------------------------------------
10917          ---------------------------------------------------------------
10918          -- START OF BEN_POE_RT_F ----------------------
10919          ---------------------------------------------------------------
10920          --
10921          for l_parent_rec  in c_prt_from_parent(l_VRBL_RT_PRFL_ID) loop
10922             --
10923             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
10924 
10925             --
10926             l_poe_rt_id := l_parent_rec.poe_rt_id ;
10927             --
10928             for l_prt_rec in c_prt(l_parent_rec.poe_rt_id,l_mirror_src_entity_result_id,'PRT') loop
10929               --
10930               l_table_route_id := null ;
10931               open ben_plan_design_program_module.g_table_route('PRT');
10932               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
10933               close ben_plan_design_program_module.g_table_route ;
10934               --
10935               l_information5  := l_prt_rec.mn_poe_num ||' - '|| l_prt_rec.mx_poe_num ||
10936                                  ' ' || hr_general.decode_lookup('BEN_NNMNTRY_UOM',l_prt_rec.poe_nnmntry_uom);
10937                                  --'Intersection';
10938               --
10939               if p_effective_date between l_prt_rec.effective_start_date
10940                  and l_prt_rec.effective_end_date then
10941                --
10942                  l_result_type_cd := 'DISPLAY';
10943               else
10944                  l_result_type_cd := 'NO DISPLAY';
10945               end if;
10946                 --
10947               l_copy_entity_result_id := null;
10948               l_object_version_number := null;
10949               ben_copy_entity_results_api.create_copy_entity_results(
10950                 p_copy_entity_result_id          => l_copy_entity_result_id,
10951                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
10952                 p_result_type_cd                 => l_result_type_cd,
10953                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
10954                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
10955                 p_number_of_copies               => l_number_of_copies,
10956                 p_table_route_id                 => l_table_route_id,
10957 		P_TABLE_ALIAS                    => 'PRT',
10958                 p_information1     => l_prt_rec.poe_rt_id,
10959                 p_information2     => l_prt_rec.EFFECTIVE_START_DATE,
10960                 p_information3     => l_prt_rec.EFFECTIVE_END_DATE,
10961                 p_information4     => l_prt_rec.business_group_id,
10962                 p_information5     => l_information5 , -- 9999 put name for h-grid
10963 
10964             p_information15     => l_prt_rec.cbr_dsblty_apls_flag,
10965             p_information260     => l_prt_rec.mn_poe_num,
10966             p_information261     => l_prt_rec.mx_poe_num,
10967             p_information13     => l_prt_rec.no_mn_poe_flag,
10968             p_information14     => l_prt_rec.no_mx_poe_flag,
10969             p_information12     => l_prt_rec.poe_nnmntry_uom,
10970             p_information111     => l_prt_rec.prt_attribute1,
10971             p_information120     => l_prt_rec.prt_attribute10,
10972             p_information121     => l_prt_rec.prt_attribute11,
10973             p_information122     => l_prt_rec.prt_attribute12,
10974             p_information123     => l_prt_rec.prt_attribute13,
10975             p_information124     => l_prt_rec.prt_attribute14,
10976             p_information125     => l_prt_rec.prt_attribute15,
10977             p_information126     => l_prt_rec.prt_attribute16,
10978             p_information127     => l_prt_rec.prt_attribute17,
10979             p_information128     => l_prt_rec.prt_attribute18,
10980             p_information129     => l_prt_rec.prt_attribute19,
10981             p_information112     => l_prt_rec.prt_attribute2,
10982             p_information130     => l_prt_rec.prt_attribute20,
10983             p_information131     => l_prt_rec.prt_attribute21,
10984             p_information132     => l_prt_rec.prt_attribute22,
10985             p_information133     => l_prt_rec.prt_attribute23,
10986             p_information134     => l_prt_rec.prt_attribute24,
10987             p_information135     => l_prt_rec.prt_attribute25,
10988             p_information136     => l_prt_rec.prt_attribute26,
10989             p_information137     => l_prt_rec.prt_attribute27,
10990             p_information138     => l_prt_rec.prt_attribute28,
10991             p_information139     => l_prt_rec.prt_attribute29,
10992             p_information113     => l_prt_rec.prt_attribute3,
10993             p_information140     => l_prt_rec.prt_attribute30,
10994             p_information114     => l_prt_rec.prt_attribute4,
10995             p_information115     => l_prt_rec.prt_attribute5,
10996             p_information116     => l_prt_rec.prt_attribute6,
10997             p_information117     => l_prt_rec.prt_attribute7,
10998             p_information118     => l_prt_rec.prt_attribute8,
10999             p_information119     => l_prt_rec.prt_attribute9,
11000             p_information110     => l_prt_rec.prt_attribute_category,
11001             p_information11     => l_prt_rec.rndg_cd,
11002             p_information263     => l_prt_rec.rndg_rl,
11003             p_information262     => l_prt_rec.vrbl_rt_prfl_id,
11004             p_information265     => l_prt_rec.object_version_number,
11005            --
11006 
11007                 p_object_version_number          => l_object_version_number,
11008                 p_effective_date                 => p_effective_date       );
11009                 --
11010 
11011                 if l_out_prt_result_id is null then
11012                   l_out_prt_result_id := l_copy_entity_result_id;
11013                 end if;
11014 
11015                 if l_result_type_cd = 'DISPLAY' then
11016                    l_out_prt_result_id := l_copy_entity_result_id ;
11017                 end if;
11018                 --
11019 
11020                 -- Copy Fast Formulas If they are attached to any column --
11021                 ---------------------------------------------------------------
11022                 -- RNDG_RL  -----------------
11023                 ---------------------------------------------------------------
11024 
11025                 if l_prt_rec.rndg_rl is not null then
11026                     --
11027                     ben_plan_design_program_module.create_formula_result
11028                     (
11029                      p_validate                       =>  0
11030                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
11031                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
11032                     ,p_formula_id                     =>  l_prt_rec.rndg_rl
11033                     ,p_business_group_id              =>  l_prt_rec.business_group_id
11034                     ,p_number_of_copies               =>  l_number_of_copies
11035                     ,p_object_version_number          =>  l_object_version_number
11036                     ,p_effective_date                 =>  p_effective_date
11037                     );
11038 
11039                     --
11040                 end if;
11041 
11042              end loop;
11043              --
11044            end loop;
11045         ---------------------------------------------------------------
11046         -- END OF BEN_POE_RT_F ----------------------
11047         ---------------------------------------------------------------
11048          ---------------------------------------------------------------
11049          -- START OF BEN_PPL_GRP_RT_F ----------------------
11050          ---------------------------------------------------------------
11051          --
11052          for l_parent_rec  in c_pgr_from_parent(l_VRBL_RT_PRFL_ID) loop
11053             --
11054             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
11055 
11056             --
11057             l_ppl_grp_rt_id := l_parent_rec.ppl_grp_rt_id ;
11058             --
11059             for l_pgr_rec in c_pgr(l_parent_rec.ppl_grp_rt_id,l_mirror_src_entity_result_id,'PGR') loop
11060               --
11061               l_table_route_id := null ;
11062               open ben_plan_design_program_module.g_table_route('PGR');
11063               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11064               close ben_plan_design_program_module.g_table_route ;
11065               --
11066               l_information5  := ben_plan_design_program_module.get_people_group_name(l_pgr_rec.people_group_id)
11067                                  || ben_plan_design_program_module.get_exclude_message(l_pgr_rec.excld_flag);
11068                                  --'Intersection';
11069               --
11070               if p_effective_date between l_pgr_rec.effective_start_date
11071                  and l_pgr_rec.effective_end_date then
11072                --
11073                  l_result_type_cd := 'DISPLAY';
11074               else
11075                  l_result_type_cd := 'NO DISPLAY';
11076               end if;
11077                 --
11078               l_copy_entity_result_id := null;
11079               l_object_version_number := null;
11080               ben_copy_entity_results_api.create_copy_entity_results(
11081                 p_copy_entity_result_id          => l_copy_entity_result_id,
11082                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
11083                 p_result_type_cd                 => l_result_type_cd,
11084                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
11085                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
11086                 p_number_of_copies               => l_number_of_copies,
11087                 p_table_route_id                 => l_table_route_id,
11088 		P_TABLE_ALIAS                    => 'PGR',
11089                 p_information1     => l_pgr_rec.ppl_grp_rt_id,
11090                 p_information2     => l_pgr_rec.EFFECTIVE_START_DATE,
11091                 p_information3     => l_pgr_rec.EFFECTIVE_END_DATE,
11092                 p_information4     => l_pgr_rec.business_group_id,
11093                 p_information5     => l_information5 , -- 9999 put name for h-grid
11094 
11095             p_information11     => l_pgr_rec.excld_flag,
11096             p_information261     => l_pgr_rec.ordr_num,
11097             p_information257     => l_pgr_rec.people_group_id,
11098             p_information111     => l_pgr_rec.pgr_attribute1,
11099             p_information120     => l_pgr_rec.pgr_attribute10,
11100             p_information121     => l_pgr_rec.pgr_attribute11,
11101             p_information122     => l_pgr_rec.pgr_attribute12,
11102             p_information123     => l_pgr_rec.pgr_attribute13,
11103             p_information124     => l_pgr_rec.pgr_attribute14,
11104             p_information125     => l_pgr_rec.pgr_attribute15,
11105             p_information126     => l_pgr_rec.pgr_attribute16,
11106             p_information127     => l_pgr_rec.pgr_attribute17,
11107             p_information128     => l_pgr_rec.pgr_attribute18,
11108             p_information129     => l_pgr_rec.pgr_attribute19,
11109             p_information112     => l_pgr_rec.pgr_attribute2,
11110             p_information130     => l_pgr_rec.pgr_attribute20,
11111             p_information131     => l_pgr_rec.pgr_attribute21,
11112             p_information132     => l_pgr_rec.pgr_attribute22,
11113             p_information133     => l_pgr_rec.pgr_attribute23,
11114             p_information134     => l_pgr_rec.pgr_attribute24,
11115             p_information135     => l_pgr_rec.pgr_attribute25,
11116             p_information136     => l_pgr_rec.pgr_attribute26,
11117             p_information137     => l_pgr_rec.pgr_attribute27,
11118             p_information138     => l_pgr_rec.pgr_attribute28,
11119             p_information139     => l_pgr_rec.pgr_attribute29,
11120             p_information113     => l_pgr_rec.pgr_attribute3,
11121             p_information140     => l_pgr_rec.pgr_attribute30,
11122             p_information114     => l_pgr_rec.pgr_attribute4,
11123             p_information115     => l_pgr_rec.pgr_attribute5,
11124             p_information116     => l_pgr_rec.pgr_attribute6,
11125             p_information117     => l_pgr_rec.pgr_attribute7,
11126             p_information118     => l_pgr_rec.pgr_attribute8,
11127             p_information119     => l_pgr_rec.pgr_attribute9,
11128             p_information110     => l_pgr_rec.pgr_attribute_category,
11129             p_information262     => l_pgr_rec.vrbl_rt_prfl_id,
11130             p_information265     => l_pgr_rec.object_version_number,
11131            --
11132 
11133                 p_object_version_number          => l_object_version_number,
11134                 p_effective_date                 => p_effective_date       );
11135                 --
11136 
11137                 if l_out_pgr_result_id is null then
11138                   l_out_pgr_result_id := l_copy_entity_result_id;
11139                 end if;
11140 
11141                 if l_result_type_cd = 'DISPLAY' then
11142                    l_out_pgr_result_id := l_copy_entity_result_id ;
11143                 end if;
11144                 --
11145              end loop;
11146              --
11147            end loop;
11148         ---------------------------------------------------------------
11149         -- END OF BEN_PPL_GRP_RT_F ----------------------
11150         ---------------------------------------------------------------
11151          ---------------------------------------------------------------
11152          -- START OF BEN_PSTL_ZIP_RT_F ----------------------
11153          ---------------------------------------------------------------
11154          --
11155          for l_parent_rec  in c_pzr_from_parent(l_VRBL_RT_PRFL_ID) loop
11156             --
11157             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
11158 
11159             --
11160             l_pstl_zip_rt_id := l_parent_rec.pstl_zip_rt_id ;
11161             --
11162             for l_pzr_rec in c_pzr(l_parent_rec.pstl_zip_rt_id,l_mirror_src_entity_result_id,'PZR') loop
11163               --
11164               l_table_route_id := null ;
11165               open ben_plan_design_program_module.g_table_route('PZR');
11166               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11167               close ben_plan_design_program_module.g_table_route ;
11168               --
11169               l_information5  := ben_plan_design_program_module.get_pstl_zip_rng_name(l_pzr_rec.pstl_zip_rng_id
11170                                                                                     ,p_effective_date)
11171                                  || ben_plan_design_program_module.get_exclude_message(l_pzr_rec.excld_flag);
11172                                  --'Intersection';
11173               --
11174               if p_effective_date between l_pzr_rec.effective_start_date
11175                  and l_pzr_rec.effective_end_date then
11176                --
11177                  l_result_type_cd := 'DISPLAY';
11178               else
11179                  l_result_type_cd := 'NO DISPLAY';
11180               end if;
11181                 --
11182               l_copy_entity_result_id := null;
11183               l_object_version_number := null;
11184               ben_copy_entity_results_api.create_copy_entity_results(
11185                 p_copy_entity_result_id          => l_copy_entity_result_id,
11186                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
11187                 p_result_type_cd                 => l_result_type_cd,
11188                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
11189                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
11190                 p_number_of_copies               => l_number_of_copies,
11191                 p_table_route_id                 => l_table_route_id,
11192 		P_TABLE_ALIAS                    => 'PZR',
11193                 p_information1     => l_pzr_rec.pstl_zip_rt_id,
11194                 p_information2     => l_pzr_rec.EFFECTIVE_START_DATE,
11195                 p_information3     => l_pzr_rec.EFFECTIVE_END_DATE,
11196                 p_information4     => l_pzr_rec.business_group_id,
11197                 p_information5     => l_information5 , -- 9999 put name for h-grid
11198 
11199             p_information11     => l_pzr_rec.excld_flag,
11200             p_information260     => l_pzr_rec.ordr_num,
11201             p_information245     => l_pzr_rec.pstl_zip_rng_id,
11202             p_information111     => l_pzr_rec.pzr_attribute1,
11203             p_information120     => l_pzr_rec.pzr_attribute10,
11204             p_information121     => l_pzr_rec.pzr_attribute11,
11205             p_information122     => l_pzr_rec.pzr_attribute12,
11206             p_information123     => l_pzr_rec.pzr_attribute13,
11207             p_information124     => l_pzr_rec.pzr_attribute14,
11208             p_information125     => l_pzr_rec.pzr_attribute15,
11209             p_information126     => l_pzr_rec.pzr_attribute16,
11210             p_information127     => l_pzr_rec.pzr_attribute17,
11211             p_information128     => l_pzr_rec.pzr_attribute18,
11212             p_information129     => l_pzr_rec.pzr_attribute19,
11213             p_information112     => l_pzr_rec.pzr_attribute2,
11214             p_information130     => l_pzr_rec.pzr_attribute20,
11215             p_information131     => l_pzr_rec.pzr_attribute21,
11216             p_information132     => l_pzr_rec.pzr_attribute22,
11217             p_information133     => l_pzr_rec.pzr_attribute23,
11218             p_information134     => l_pzr_rec.pzr_attribute24,
11219             p_information135     => l_pzr_rec.pzr_attribute25,
11220             p_information136     => l_pzr_rec.pzr_attribute26,
11221             p_information137     => l_pzr_rec.pzr_attribute27,
11222             p_information138     => l_pzr_rec.pzr_attribute28,
11223             p_information139     => l_pzr_rec.pzr_attribute29,
11224             p_information113     => l_pzr_rec.pzr_attribute3,
11225             p_information140     => l_pzr_rec.pzr_attribute30,
11226             p_information114     => l_pzr_rec.pzr_attribute4,
11227             p_information115     => l_pzr_rec.pzr_attribute5,
11228             p_information116     => l_pzr_rec.pzr_attribute6,
11229             p_information117     => l_pzr_rec.pzr_attribute7,
11230             p_information118     => l_pzr_rec.pzr_attribute8,
11231             p_information119     => l_pzr_rec.pzr_attribute9,
11232             p_information110     => l_pzr_rec.pzr_attribute_category,
11233             p_information262     => l_pzr_rec.vrbl_rt_prfl_id,
11234             p_information265     => l_pzr_rec.object_version_number,
11235            --
11236 
11237                 p_object_version_number          => l_object_version_number,
11238                 p_effective_date                 => p_effective_date       );
11239                 --
11240 
11241                 if l_out_pzr_result_id is null then
11242                   l_out_pzr_result_id := l_copy_entity_result_id;
11243                 end if;
11244 
11245                 if l_result_type_cd = 'DISPLAY' then
11246                    l_out_pzr_result_id := l_copy_entity_result_id ;
11247                 end if;
11248                 --
11249              end loop;
11250              --
11251               for l_pzr_rec in c_pzr_pstl(l_parent_rec.pstl_zip_rt_id,l_mirror_src_entity_result_id,'PZR') loop
11252                  create_postal_results
11253                    (
11254                     p_validate                    => p_validate
11255                    ,p_copy_entity_result_id       => l_out_pzr_result_id
11256                    ,p_copy_entity_txn_id          => p_copy_entity_txn_id
11257                    ,p_pstl_zip_rng_id             => l_pzr_rec.pstl_zip_rng_id
11258                    ,p_business_group_id           => p_business_group_id
11259                    ,p_number_of_copies           => p_number_of_copies
11260                    ,p_object_version_number       => l_object_version_number
11261                    ,p_effective_date              => p_effective_date
11262                    ) ;
11263               end loop;
11264            end loop;
11265         ---------------------------------------------------------------
11266         -- END OF BEN_PSTL_ZIP_RT_F ----------------------
11267         ---------------------------------------------------------------
11268          ---------------------------------------------------------------
11269          -- START OF BEN_PYRL_RT_F ----------------------
11270          ---------------------------------------------------------------
11271          --
11272          hr_utility.set_location('START OF BEN_PYRL_RT_F',100);
11273          for l_parent_rec  in c_pr__from_parent(l_VRBL_RT_PRFL_ID) loop
11274             --
11275             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
11276 
11277             --
11278             l_pyrl_rt_id := l_parent_rec.pyrl_rt_id ;
11279             --
11280             hr_utility.set_location('l_pyrl_rt_id '||l_pyrl_rt_id,100);
11281             for l_pr__rec in c_pr_(l_parent_rec.pyrl_rt_id,l_mirror_src_entity_result_id,'PR_') loop
11282               --
11283               l_table_route_id := null ;
11284               open ben_plan_design_program_module.g_table_route('PR_');
11285                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11286               close ben_plan_design_program_module.g_table_route ;
11287               --
11288               l_information5  := ben_plan_design_program_module.get_payroll_name(l_pr__rec.payroll_id
11289                                                                                  ,p_effective_date)
11290                                  || ben_plan_design_program_module.get_exclude_message(l_pr__rec.excld_flag);
11291                                  --'Intersection';
11292               --
11293               if p_effective_date between l_pr__rec.effective_start_date
11294                  and l_pr__rec.effective_end_date then
11295                --
11296                  l_result_type_cd := 'DISPLAY';
11297               else
11298                  l_result_type_cd := 'NO DISPLAY';
11299               end if;
11300 
11301               -- To store effective_start_date of payroll
11302               -- for Mapping - Bug 2958658
11303               --
11304               l_payroll_start_date := null;
11305               if l_pr__rec.payroll_id is not null then
11306                 open c_payroll_start_date(l_pr__rec.payroll_id);
11307                 fetch c_payroll_start_date into l_payroll_start_date;
11308                 close c_payroll_start_date;
11309               end if;
11310 
11311               --
11312               -- pabodla : MAPPING DATA : Store the mapping column information.
11313               --
11314 
11315               l_mapping_name := null;
11316               l_mapping_id   := null;
11317               --
11318               -- Get the payroll name to display on mapping page.
11319               --
11320               open c_get_mapping_name12(l_pr__rec.payroll_id,
11321                                         NVL(l_payroll_start_date,p_effective_date));
11322               fetch c_get_mapping_name12 into l_mapping_name;
11323               close c_get_mapping_name12;
11324               --
11325               l_mapping_id   := l_pr__rec.payroll_id;
11326               --
11327               --To set user friendly labels on the mapping page
11328               --
11329               l_mapping_column_name1 := null;
11330               l_mapping_column_name2 :=null;
11331               BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
11332                                                                l_mapping_column_name1,
11333                                                                l_mapping_column_name2,
11334                                                                p_copy_entity_txn_id);
11335               --
11336 
11337               l_copy_entity_result_id := null;
11338               l_object_version_number := null;
11339               hr_utility.set_location('l_parent_rec.pyrl_rt_id '||l_parent_rec.pyrl_rt_id,100);
11340               ben_copy_entity_results_api.create_copy_entity_results(
11341                 p_copy_entity_result_id          => l_copy_entity_result_id,
11342                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
11343                 p_result_type_cd                 => l_result_type_cd,
11344                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
11345                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
11346                 p_number_of_copies               => l_number_of_copies,
11347                 p_table_route_id                 => l_table_route_id,
11348 		P_TABLE_ALIAS                    => 'PR_',
11349                 p_information1     => l_pr__rec.pyrl_rt_id,
11350                 p_information2     => l_pr__rec.EFFECTIVE_START_DATE,
11351                 p_information3     => l_pr__rec.EFFECTIVE_END_DATE,
11352                 p_information4     => l_pr__rec.business_group_id,
11353                 p_information5     => l_information5 , -- 9999 put name for h-grid
11354 
11355             p_information11     => l_pr__rec.excld_flag,
11356             p_information260     => l_pr__rec.ordr_num,
11357             -- Data for MAPPING columns.
11358             p_information173    => l_mapping_name,
11359             p_information174    => l_mapping_id,
11360             p_information181    => l_mapping_column_name1,
11361             p_information182    => l_mapping_column_name2,
11362             -- END other product Mapping columns.
11363             p_information111     => l_pr__rec.pr_attribute1,
11364             p_information120     => l_pr__rec.pr_attribute10,
11365             p_information121     => l_pr__rec.pr_attribute11,
11366             p_information122     => l_pr__rec.pr_attribute12,
11367             p_information123     => l_pr__rec.pr_attribute13,
11368             p_information124     => l_pr__rec.pr_attribute14,
11369             p_information125     => l_pr__rec.pr_attribute15,
11370             p_information126     => l_pr__rec.pr_attribute16,
11371             p_information127     => l_pr__rec.pr_attribute17,
11372             p_information128     => l_pr__rec.pr_attribute18,
11373             p_information129     => l_pr__rec.pr_attribute19,
11374             p_information112     => l_pr__rec.pr_attribute2,
11375             p_information130     => l_pr__rec.pr_attribute20,
11376             p_information131     => l_pr__rec.pr_attribute21,
11377             p_information132     => l_pr__rec.pr_attribute22,
11378             p_information133     => l_pr__rec.pr_attribute23,
11379             p_information134     => l_pr__rec.pr_attribute24,
11380             p_information135     => l_pr__rec.pr_attribute25,
11381             p_information136     => l_pr__rec.pr_attribute26,
11382             p_information137     => l_pr__rec.pr_attribute27,
11383             p_information138     => l_pr__rec.pr_attribute28,
11384             p_information139     => l_pr__rec.pr_attribute29,
11385             p_information113     => l_pr__rec.pr_attribute3,
11386             p_information140     => l_pr__rec.pr_attribute30,
11387             p_information114     => l_pr__rec.pr_attribute4,
11388             p_information115     => l_pr__rec.pr_attribute5,
11389             p_information116     => l_pr__rec.pr_attribute6,
11390             p_information117     => l_pr__rec.pr_attribute7,
11391             p_information118     => l_pr__rec.pr_attribute8,
11392             p_information119     => l_pr__rec.pr_attribute9,
11393             p_information110     => l_pr__rec.pr_attribute_category,
11394             p_information262     => l_pr__rec.vrbl_rt_prfl_id,
11395             p_information166     => l_payroll_start_date,
11396             p_information265     => l_pr__rec.object_version_number,
11397            --
11398 
11399                 p_object_version_number          => l_object_version_number,
11400                 p_effective_date                 => p_effective_date       );
11401                 --
11402 
11403                 if l_out_pr__result_id is null then
11404                  l_out_pr__result_id := l_copy_entity_result_id;
11405                 end if;
11406 
11407                 if l_result_type_cd = 'DISPLAY' then
11408                    l_out_pr__result_id := l_copy_entity_result_id ;
11409                 end if;
11410                 --
11411              end loop;
11412              --
11413            end loop;
11414          hr_utility.set_location('END OF BEN_PYRL_RT_F',100);
11415         ---------------------------------------------------------------
11416         -- END OF BEN_PYRL_RT_F ----------------------
11417         ---------------------------------------------------------------
11418          ---------------------------------------------------------------
11419          -- START OF BEN_PY_BSS_RT_F ----------------------
11420          ---------------------------------------------------------------
11421          --
11422          hr_utility.set_location('START OF BEN_PY_BSS_RT_F ',100);
11423          for l_parent_rec  in c_pbr_from_parent(l_VRBL_RT_PRFL_ID) loop
11424             --
11425             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
11426 
11427             --
11428             l_py_bss_rt_id := l_parent_rec.py_bss_rt_id ;
11429             --
11430             hr_utility.set_location('l_py_bss_rt_id '||l_py_bss_rt_id,100);
11431             for l_pbr_rec in c_pbr(l_parent_rec.py_bss_rt_id,l_mirror_src_entity_result_id,'PBR') loop
11432               --
11433               l_table_route_id := null ;
11434               open ben_plan_design_program_module.g_table_route('PBR');
11435               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11436               close ben_plan_design_program_module.g_table_route ;
11437               --
11438               l_information5  := ben_plan_design_program_module.get_pay_basis_name(l_pbr_rec.pay_basis_id)
11439                                  || ben_plan_design_program_module.get_exclude_message(l_pbr_rec.excld_flag);
11440                                  --'Intersection';
11441               --
11442               if p_effective_date between l_pbr_rec.effective_start_date
11443                  and l_pbr_rec.effective_end_date then
11444                --
11445                  l_result_type_cd := 'DISPLAY';
11446               else
11447                  l_result_type_cd := 'NO DISPLAY';
11448               end if;
11449 --PADMAJA
11450               --
11451               -- pabodla : MAPPING DATA : Store the mapping column information.
11452               --
11453 
11454               l_mapping_name := null;
11455               l_mapping_id   := null;
11456               --
11457               -- Get the pay_basis name to display on mapping page.
11458               --
11459               open c_get_mapping_name13(l_pbr_rec.pay_basis_id);
11460               fetch c_get_mapping_name13 into l_mapping_name;
11461               close c_get_mapping_name13;
11462               --
11463               l_mapping_id   := l_pbr_rec.pay_basis_id;
11464               --
11465               --To set user friendly labels on the mapping page
11466               --
11467               l_mapping_column_name1 := null;
11468               l_mapping_column_name2 :=null;
11469               BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
11470                                                                l_mapping_column_name1,
11471                                                                l_mapping_column_name2,
11472                                                                p_copy_entity_txn_id);
11473               --
11474               hr_utility.set_location('l_mapping_name '||l_mapping_name,100);
11475               hr_utility.set_location('l_mapping_id '||l_mapping_id,100);
11476               --
11477               l_copy_entity_result_id := null;
11478               l_object_version_number := null;
11479               ben_copy_entity_results_api.create_copy_entity_results(
11480                 p_copy_entity_result_id          => l_copy_entity_result_id,
11481                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
11482                 p_result_type_cd                 => l_result_type_cd,
11483                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
11484                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
11485                 p_number_of_copies               => l_number_of_copies,
11486                 p_table_route_id                 => l_table_route_id,
11487 		P_TABLE_ALIAS                    => 'PBR',
11488                 p_information1     => l_pbr_rec.py_bss_rt_id,
11489                 p_information2     => l_pbr_rec.EFFECTIVE_START_DATE,
11490                 p_information3     => l_pbr_rec.EFFECTIVE_END_DATE,
11491                 p_information4     => l_pbr_rec.business_group_id,
11492                 p_information5     => l_information5 , -- 9999 put name for h-grid
11493 
11494             p_information11     => l_pbr_rec.excld_flag,
11495             p_information257     => l_pbr_rec.ordr_num,
11496             -- Data for MAPPING columns.
11497             p_information173    => l_mapping_name,
11498             p_information174    => l_mapping_id,
11499             p_information181    => l_mapping_column_name1,
11500             p_information182    => l_mapping_column_name2,
11501             -- END other product Mapping columns.
11502             p_information111     => l_pbr_rec.pbr_attribute1,
11503             p_information120     => l_pbr_rec.pbr_attribute10,
11504             p_information121     => l_pbr_rec.pbr_attribute11,
11505             p_information122     => l_pbr_rec.pbr_attribute12,
11506             p_information123     => l_pbr_rec.pbr_attribute13,
11507             p_information124     => l_pbr_rec.pbr_attribute14,
11508             p_information125     => l_pbr_rec.pbr_attribute15,
11509             p_information126     => l_pbr_rec.pbr_attribute16,
11510             p_information127     => l_pbr_rec.pbr_attribute17,
11511             p_information128     => l_pbr_rec.pbr_attribute18,
11512             p_information129     => l_pbr_rec.pbr_attribute19,
11513             p_information112     => l_pbr_rec.pbr_attribute2,
11514             p_information130     => l_pbr_rec.pbr_attribute20,
11515             p_information131     => l_pbr_rec.pbr_attribute21,
11516             p_information132     => l_pbr_rec.pbr_attribute22,
11517             p_information133     => l_pbr_rec.pbr_attribute23,
11518             p_information134     => l_pbr_rec.pbr_attribute24,
11519             p_information135     => l_pbr_rec.pbr_attribute25,
11520             p_information136     => l_pbr_rec.pbr_attribute26,
11521             p_information137     => l_pbr_rec.pbr_attribute27,
11522             p_information138     => l_pbr_rec.pbr_attribute28,
11523             p_information139     => l_pbr_rec.pbr_attribute29,
11524             p_information113     => l_pbr_rec.pbr_attribute3,
11525             p_information140     => l_pbr_rec.pbr_attribute30,
11526             p_information114     => l_pbr_rec.pbr_attribute4,
11527             p_information115     => l_pbr_rec.pbr_attribute5,
11528             p_information116     => l_pbr_rec.pbr_attribute6,
11529             p_information117     => l_pbr_rec.pbr_attribute7,
11530             p_information118     => l_pbr_rec.pbr_attribute8,
11531             p_information119     => l_pbr_rec.pbr_attribute9,
11532             p_information110     => l_pbr_rec.pbr_attribute_category,
11533             p_information262     => l_pbr_rec.vrbl_rt_prfl_id,
11534             p_information166     => NULL,  -- No ESD for Pay Basis
11535             p_information265     => l_pbr_rec.object_version_number,
11536            --
11537 
11538                 p_object_version_number          => l_object_version_number,
11539                 p_effective_date                 => p_effective_date       );
11540                 --
11541 
11542                 if l_out_pbr_result_id is null then
11543                   l_out_pbr_result_id := l_copy_entity_result_id;
11544                 end if;
11545 
11546                 if l_result_type_cd = 'DISPLAY' then
11547                    l_out_pbr_result_id := l_copy_entity_result_id ;
11548                 end if;
11549                 --
11550              end loop;
11551              --
11552            end loop;
11553          hr_utility.set_location('END OF BEN_PY_BSS_RT_F ',100);
11554         ---------------------------------------------------------------
11555         -- END OF BEN_PY_BSS_RT_F ----------------------
11556         ---------------------------------------------------------------
11557          ---------------------------------------------------------------
11558          -- START OF BEN_SCHEDD_HRS_RT_F ----------------------
11559          ---------------------------------------------------------------
11560          --
11561          for l_parent_rec  in c_shr_from_parent(l_VRBL_RT_PRFL_ID) loop
11562             --
11563             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
11564 
11565             --
11566             l_schedd_hrs_rt_id := l_parent_rec.schedd_hrs_rt_id ;
11567             --
11568             for l_shr_rec in c_shr(l_parent_rec.schedd_hrs_rt_id,l_mirror_src_entity_result_id,'SHR') loop
11569               --
11570               l_table_route_id := null ;
11571               open ben_plan_design_program_module.g_table_route('SHR');
11572                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11573               close ben_plan_design_program_module.g_table_route ;
11574               --
11575               l_information5  := l_shr_rec.hrs_num ||' - ' || l_shr_rec.max_hrs_num ||' '||
11576                                  hr_general.decode_lookup('FREQUENCY',l_shr_rec.freq_cd)
11577                                  || ben_plan_design_program_module.get_exclude_message(l_shr_rec.excld_flag); --'Intersection';
11578               --
11579               if p_effective_date between l_shr_rec.effective_start_date
11580                  and l_shr_rec.effective_end_date then
11581                --
11582                  l_result_type_cd := 'DISPLAY';
11583               else
11584                  l_result_type_cd := 'NO DISPLAY';
11585               end if;
11586                 --
11587               l_copy_entity_result_id := null;
11588               l_object_version_number := null;
11589               ben_copy_entity_results_api.create_copy_entity_results(
11590                 p_copy_entity_result_id          => l_copy_entity_result_id,
11591                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
11592                 p_result_type_cd                 => l_result_type_cd,
11593                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
11594                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
11595                 p_number_of_copies               => l_number_of_copies,
11596                 p_table_route_id                 => l_table_route_id,
11597 		P_TABLE_ALIAS                    => 'SHR',
11598                 p_information1     => l_shr_rec.schedd_hrs_rt_id,
11599                 p_information2     => l_shr_rec.EFFECTIVE_START_DATE,
11600                 p_information3     => l_shr_rec.EFFECTIVE_END_DATE,
11601                 p_information4     => l_shr_rec.business_group_id,
11602                 p_information5     => l_information5 , -- 9999 put name for h-grid
11603 
11604             p_information12     => l_shr_rec.determination_cd,
11605             p_information259     => l_shr_rec.determination_rl,
11606             p_information13     => l_shr_rec.excld_flag,
11607             p_information14     => l_shr_rec.freq_cd,
11608             p_information288     => l_shr_rec.hrs_num,
11609             p_information287     => l_shr_rec.max_hrs_num,
11610             p_information260     => l_shr_rec.ordr_num,
11611             p_information11     => l_shr_rec.rounding_cd,
11612             p_information257     => l_shr_rec.rounding_rl,
11613             p_information258     => l_shr_rec.schedd_hrs_rl,
11614             p_information111     => l_shr_rec.shr_attribute1,
11615             p_information120     => l_shr_rec.shr_attribute10,
11616             p_information121     => l_shr_rec.shr_attribute11,
11617             p_information122     => l_shr_rec.shr_attribute12,
11618             p_information123     => l_shr_rec.shr_attribute13,
11619             p_information124     => l_shr_rec.shr_attribute14,
11620             p_information125     => l_shr_rec.shr_attribute15,
11621             p_information126     => l_shr_rec.shr_attribute16,
11622             p_information127     => l_shr_rec.shr_attribute17,
11623             p_information128     => l_shr_rec.shr_attribute18,
11624             p_information129     => l_shr_rec.shr_attribute19,
11625             p_information112     => l_shr_rec.shr_attribute2,
11626             p_information130     => l_shr_rec.shr_attribute20,
11627             p_information131     => l_shr_rec.shr_attribute21,
11628             p_information132     => l_shr_rec.shr_attribute22,
11629             p_information133     => l_shr_rec.shr_attribute23,
11630             p_information134     => l_shr_rec.shr_attribute24,
11631             p_information135     => l_shr_rec.shr_attribute25,
11632             p_information136     => l_shr_rec.shr_attribute26,
11633             p_information137     => l_shr_rec.shr_attribute27,
11634             p_information138     => l_shr_rec.shr_attribute28,
11635             p_information139     => l_shr_rec.shr_attribute29,
11636             p_information113     => l_shr_rec.shr_attribute3,
11637             p_information140     => l_shr_rec.shr_attribute30,
11638             p_information114     => l_shr_rec.shr_attribute4,
11639             p_information115     => l_shr_rec.shr_attribute5,
11640             p_information116     => l_shr_rec.shr_attribute6,
11641             p_information117     => l_shr_rec.shr_attribute7,
11642             p_information118     => l_shr_rec.shr_attribute8,
11643             p_information119     => l_shr_rec.shr_attribute9,
11644             p_information110     => l_shr_rec.shr_attribute_category,
11645             p_information262     => l_shr_rec.vrbl_rt_prfl_id,
11646             p_information265     => l_shr_rec.object_version_number,
11647            --
11648 
11649                 p_object_version_number          => l_object_version_number,
11650                 p_effective_date                 => p_effective_date       );
11651                 --
11652 
11653                 if l_out_shr_result_id is null then
11654                   l_out_shr_result_id := l_copy_entity_result_id;
11655                 end if;
11656 
11657                 if l_result_type_cd = 'DISPLAY' then
11658                    l_out_shr_result_id := l_copy_entity_result_id ;
11659                 end if;
11660                 --
11661 
11662                ---------------------------------------------------------------
11663                -- DETERMINATION_RL --
11664                ---------------------------------------------------------------
11665                --
11666                if l_shr_rec.determination_rl is not null then
11667                                     --
11668                                     ben_plan_design_program_module.create_formula_result
11669                                     (
11670                                      p_validate                       =>  0
11671                                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
11672                                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
11673                                     ,p_formula_id                     =>  l_shr_rec.determination_rl
11674                                     ,p_business_group_id              =>  l_shr_rec.business_group_id
11675                                     ,p_number_of_copies               =>  l_number_of_copies
11676                                     ,p_object_version_number          =>  l_object_version_number
11677                                     ,p_effective_date                 =>  p_effective_date
11678                                     );
11679 
11680                                     --
11681                end if;
11682                --
11683 
11684                ---------------------------------------------------------------
11685                -- ROUNDING_RL --
11686                ---------------------------------------------------------------
11687                --
11688                if l_shr_rec.rounding_rl is not null then
11689                                     --
11690                                     ben_plan_design_program_module.create_formula_result
11691                                     (
11692                                      p_validate                       =>  0
11693                                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
11694                                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
11695                                     ,p_formula_id                     =>  l_shr_rec.rounding_rl
11696                                     ,p_business_group_id              =>  l_shr_rec.business_group_id
11697                                     ,p_number_of_copies               =>  l_number_of_copies
11698                                     ,p_object_version_number          =>  l_object_version_number
11699                                     ,p_effective_date                 =>  p_effective_date
11700                                     );
11701 
11702                                     --
11703                end if;
11704                ---------------------------------------------------------------
11705                -- SCHEDD_HRS_RL --
11706                ---------------------------------------------------------------
11707                --
11708                if l_shr_rec.schedd_hrs_rl is not null then
11709                                     --
11710                                     ben_plan_design_program_module.create_formula_result
11711                                     (
11712                                      p_validate                       =>  0
11713                                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
11714                                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
11715                                     ,p_formula_id                     =>  l_shr_rec.schedd_hrs_rl
11716                                     ,p_business_group_id              =>  l_shr_rec.business_group_id
11717                                     ,p_number_of_copies               =>  l_number_of_copies
11718                                     ,p_object_version_number          =>  l_object_version_number
11719                                     ,p_effective_date                 =>  p_effective_date
11720                                     );
11721 
11722                                     --
11723                end if;
11724              end loop;
11725              --
11726            end loop;
11727         ---------------------------------------------------------------
11728         -- END OF BEN_SCHEDD_HRS_RT_F ----------------------
11729         ---------------------------------------------------------------
11730          ---------------------------------------------------------------
11731          -- START OF BEN_SVC_AREA_RT_F ----------------------
11732          ---------------------------------------------------------------
11733          --
11734          for l_parent_rec  in c_sar_from_parent(l_VRBL_RT_PRFL_ID) loop
11735             --
11736             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
11737             --
11738             l_svc_area_rt_id := l_parent_rec.svc_area_rt_id ;
11739             --
11740             for l_sar_rec in c_sar(l_parent_rec.svc_area_rt_id,l_mirror_src_entity_result_id,'SAR') loop
11741               --
11742               l_table_route_id := null ;
11743               open ben_plan_design_program_module.g_table_route('SAR');
11744                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11745               close ben_plan_design_program_module.g_table_route ;
11746               --
11747               l_information5  := ben_plan_design_program_module.get_svc_area_name(l_sar_rec.svc_area_id
11748                                                                                   ,p_effective_date)
11749                                  || ben_plan_design_program_module.get_exclude_message(l_sar_rec.excld_flag);
11750                                  --'Intersection';
11751               --
11752               if p_effective_date between l_sar_rec.effective_start_date
11753                  and l_sar_rec.effective_end_date then
11754                --
11755                  l_result_type_cd := 'DISPLAY';
11756               else
11757                  l_result_type_cd := 'NO DISPLAY';
11758               end if;
11759                 --
11760               l_copy_entity_result_id := null;
11761               l_object_version_number := null;
11762               ben_copy_entity_results_api.create_copy_entity_results(
11763                 p_copy_entity_result_id          => l_copy_entity_result_id,
11764                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
11765                 p_result_type_cd                 => l_result_type_cd,
11766                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
11767                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
11768                 p_number_of_copies               => l_number_of_copies,
11769                 p_table_route_id                 => l_table_route_id,
11770 		P_TABLE_ALIAS                    => 'SAR',
11771                 p_information1     => l_sar_rec.svc_area_rt_id,
11772                 p_information2     => l_sar_rec.EFFECTIVE_START_DATE,
11773                 p_information3     => l_sar_rec.EFFECTIVE_END_DATE,
11774                 p_information4     => l_sar_rec.business_group_id,
11775                 p_information5     => l_information5 , -- 9999 put name for h-grid
11776 
11777             p_information11     => l_sar_rec.excld_flag,
11778             p_information259     => l_sar_rec.ordr_num,
11779             p_information111     => l_sar_rec.sar_attribute1,
11780             p_information120     => l_sar_rec.sar_attribute10,
11781             p_information121     => l_sar_rec.sar_attribute11,
11782             p_information122     => l_sar_rec.sar_attribute12,
11783             p_information123     => l_sar_rec.sar_attribute13,
11784             p_information124     => l_sar_rec.sar_attribute14,
11785             p_information125     => l_sar_rec.sar_attribute15,
11786             p_information126     => l_sar_rec.sar_attribute16,
11787             p_information127     => l_sar_rec.sar_attribute17,
11788             p_information128     => l_sar_rec.sar_attribute18,
11789             p_information129     => l_sar_rec.sar_attribute19,
11790             p_information112     => l_sar_rec.sar_attribute2,
11791             p_information130     => l_sar_rec.sar_attribute20,
11792             p_information131     => l_sar_rec.sar_attribute21,
11793             p_information132     => l_sar_rec.sar_attribute22,
11794             p_information133     => l_sar_rec.sar_attribute23,
11795             p_information134     => l_sar_rec.sar_attribute24,
11796             p_information135     => l_sar_rec.sar_attribute25,
11797             p_information136     => l_sar_rec.sar_attribute26,
11798             p_information137     => l_sar_rec.sar_attribute27,
11799             p_information138     => l_sar_rec.sar_attribute28,
11800             p_information139     => l_sar_rec.sar_attribute29,
11801             p_information113     => l_sar_rec.sar_attribute3,
11802             p_information140     => l_sar_rec.sar_attribute30,
11803             p_information114     => l_sar_rec.sar_attribute4,
11804             p_information115     => l_sar_rec.sar_attribute5,
11805             p_information116     => l_sar_rec.sar_attribute6,
11806             p_information117     => l_sar_rec.sar_attribute7,
11807             p_information118     => l_sar_rec.sar_attribute8,
11808             p_information119     => l_sar_rec.sar_attribute9,
11809             p_information110     => l_sar_rec.sar_attribute_category,
11810             p_information241     => l_sar_rec.svc_area_id,
11811             p_information262     => l_sar_rec.vrbl_rt_prfl_id,
11812             p_information265     => l_sar_rec.object_version_number,
11813            --
11814 
11815                 p_object_version_number          => l_object_version_number,
11816                 p_effective_date                 => p_effective_date       );
11817                 --
11818 
11819                 if l_out_sar_result_id is null then
11820                   l_out_sar_result_id := l_copy_entity_result_id;
11821                 end if;
11822 
11823                 if l_result_type_cd = 'DISPLAY' then
11824                    l_out_sar_result_id := l_copy_entity_result_id ;
11825                 end if;
11826                 --
11827              end loop;
11828              --
11829              for l_sar_rec in c_sar_srv(l_parent_rec.svc_area_rt_id,l_mirror_src_entity_result_id,'SAR') loop
11830                    ben_pd_rate_and_cvg_module.create_service_results
11831                       (
11832                        p_validate                => p_validate
11833                       ,p_copy_entity_result_id   => l_out_sar_result_id
11834                       ,p_copy_entity_txn_id      => p_copy_entity_txn_id
11835                       ,p_svc_area_id             => l_sar_rec.svc_area_id
11836                       ,p_business_group_id       => p_business_group_id
11837                       ,p_number_of_copies        => p_number_of_copies
11838                       ,p_object_version_number   => l_object_version_number
11839                       ,p_effective_date          => p_effective_date
11840                       );
11841              end loop;
11842            end loop;
11843         ---------------------------------------------------------------
11844         -- END OF BEN_SVC_AREA_RT_F ----------------------
11845         ---------------------------------------------------------------
11846          ---------------------------------------------------------------
11847          -- START OF BEN_TBCO_USE_RT_F ----------------------
11848          ---------------------------------------------------------------
11849          --
11850          for l_parent_rec  in c_tur_from_parent(l_VRBL_RT_PRFL_ID) loop
11851             --
11852             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
11853 
11854             --
11855             l_tbco_use_rt_id := l_parent_rec.tbco_use_rt_id ;
11856             --
11857             for l_tur_rec in c_tur(l_parent_rec.tbco_use_rt_id,l_mirror_src_entity_result_id,'TUR') loop
11858               --
11859               l_table_route_id := null ;
11860               open ben_plan_design_program_module.g_table_route('TUR');
11861               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11862               close ben_plan_design_program_module.g_table_route ;
11863               --
11864               l_information5  := hr_general.decode_lookup('TOBACCO_USER',l_tur_rec.uses_tbco_flag)
11865                                  || ben_plan_design_program_module.get_exclude_message(l_tur_rec.excld_flag);
11866                                  --Intersection';
11867               --
11868               if p_effective_date between l_tur_rec.effective_start_date
11869                  and l_tur_rec.effective_end_date then
11870                --
11871                  l_result_type_cd := 'DISPLAY';
11872               else
11873                  l_result_type_cd := 'NO DISPLAY';
11874               end if;
11875                 --
11876               l_copy_entity_result_id := null;
11877               l_object_version_number := null;
11878               ben_copy_entity_results_api.create_copy_entity_results(
11879                 p_copy_entity_result_id          => l_copy_entity_result_id,
11880                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
11881                 p_result_type_cd                 => l_result_type_cd,
11882                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
11883                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
11884                 p_number_of_copies               => l_number_of_copies,
11885                 p_table_route_id                 => l_table_route_id,
11886 		P_TABLE_ALIAS                    => 'TUR',
11887                 p_information1     => l_tur_rec.tbco_use_rt_id,
11888                 p_information2     => l_tur_rec.EFFECTIVE_START_DATE,
11889                 p_information3     => l_tur_rec.EFFECTIVE_END_DATE,
11890                 p_information4     => l_tur_rec.business_group_id,
11891                 p_information5     => l_information5 , -- 9999 put name for h-grid
11892 
11893             p_information11     => l_tur_rec.excld_flag,
11894             p_information257     => l_tur_rec.ordr_num,
11895             p_information111     => l_tur_rec.tur_attribute1,
11896             p_information120     => l_tur_rec.tur_attribute10,
11897             p_information121     => l_tur_rec.tur_attribute11,
11898             p_information122     => l_tur_rec.tur_attribute12,
11899             p_information123     => l_tur_rec.tur_attribute13,
11900             p_information124     => l_tur_rec.tur_attribute14,
11901             p_information125     => l_tur_rec.tur_attribute15,
11902             p_information126     => l_tur_rec.tur_attribute16,
11903             p_information127     => l_tur_rec.tur_attribute17,
11904             p_information128     => l_tur_rec.tur_attribute18,
11905             p_information129     => l_tur_rec.tur_attribute19,
11906             p_information112     => l_tur_rec.tur_attribute2,
11907             p_information130     => l_tur_rec.tur_attribute20,
11908             p_information131     => l_tur_rec.tur_attribute21,
11909             p_information132     => l_tur_rec.tur_attribute22,
11910             p_information133     => l_tur_rec.tur_attribute23,
11911             p_information134     => l_tur_rec.tur_attribute24,
11912             p_information135     => l_tur_rec.tur_attribute25,
11913             p_information136     => l_tur_rec.tur_attribute26,
11914             p_information137     => l_tur_rec.tur_attribute27,
11915             p_information138     => l_tur_rec.tur_attribute28,
11916             p_information139     => l_tur_rec.tur_attribute29,
11917             p_information113     => l_tur_rec.tur_attribute3,
11918             p_information140     => l_tur_rec.tur_attribute30,
11919             p_information114     => l_tur_rec.tur_attribute4,
11920             p_information115     => l_tur_rec.tur_attribute5,
11921             p_information116     => l_tur_rec.tur_attribute6,
11922             p_information117     => l_tur_rec.tur_attribute7,
11923             p_information118     => l_tur_rec.tur_attribute8,
11924             p_information119     => l_tur_rec.tur_attribute9,
11925             p_information110     => l_tur_rec.tur_attribute_category,
11926             p_information12     => l_tur_rec.uses_tbco_flag,
11927             p_information262     => l_tur_rec.vrbl_rt_prfl_id,
11928             p_information265     => l_tur_rec.object_version_number,
11929            --
11930 
11931                 p_object_version_number          => l_object_version_number,
11932                 p_effective_date                 => p_effective_date       );
11933                 --
11934 
11935                 if l_out_tur_result_id is null then
11936                   l_out_tur_result_id := l_copy_entity_result_id;
11937                 end if;
11938 
11939                 if l_result_type_cd = 'DISPLAY' then
11940                    l_out_tur_result_id := l_copy_entity_result_id ;
11941                 end if;
11942                 --
11943              end loop;
11944              --
11945            end loop;
11946         ---------------------------------------------------------------
11947         -- END OF BEN_TBCO_USE_RT_F ----------------------
11948         ---------------------------------------------------------------
11949          ---------------------------------------------------------------
11950          -- START OF BEN_TTL_CVG_VOL_RT_F ----------------------
11951          ---------------------------------------------------------------
11952          --
11953          for l_parent_rec  in c_tcv_from_parent(l_VRBL_RT_PRFL_ID) loop
11954             --
11955             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
11956 
11957             --
11958             l_ttl_cvg_vol_rt_id := l_parent_rec.ttl_cvg_vol_rt_id ;
11959             --
11960             for l_tcv_rec in c_tcv(l_parent_rec.ttl_cvg_vol_rt_id,l_mirror_src_entity_result_id,'TCV') loop
11961               --
11962               l_table_route_id := null ;
11963               open ben_plan_design_program_module.g_table_route('TCV');
11964               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11965               close ben_plan_design_program_module.g_table_route ;
11966               --
11967               l_information5  := l_tcv_rec.mn_cvg_vol_amt || ' - ' ||l_tcv_rec.mx_cvg_vol_amt
11968                                  || ben_plan_design_program_module.get_exclude_message(l_tcv_rec.excld_flag);
11969                                 --'Intersection';
11970               --
11971               if p_effective_date between l_tcv_rec.effective_start_date
11972                  and l_tcv_rec.effective_end_date then
11973                --
11974                  l_result_type_cd := 'DISPLAY';
11975               else
11976                  l_result_type_cd := 'NO DISPLAY';
11977               end if;
11978                 --
11979               l_copy_entity_result_id := null;
11980               l_object_version_number := null;
11981               ben_copy_entity_results_api.create_copy_entity_results(
11982                 p_copy_entity_result_id          => l_copy_entity_result_id,
11983                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
11984                 p_result_type_cd                 => l_result_type_cd,
11985                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
11986                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
11987                 p_number_of_copies               => l_number_of_copies,
11988                 p_table_route_id                 => l_table_route_id,
11989 		P_TABLE_ALIAS                    => 'TCV',
11990                 p_information1     => l_tcv_rec.ttl_cvg_vol_rt_id,
11991                 p_information2     => l_tcv_rec.EFFECTIVE_START_DATE,
11992                 p_information3     => l_tcv_rec.EFFECTIVE_END_DATE,
11993                 p_information4     => l_tcv_rec.business_group_id,
11994                 p_information5     => l_information5 , -- 9999 put name for h-grid
11995 
11996             p_information14     => l_tcv_rec.cvg_vol_det_cd,
11997             p_information261     => l_tcv_rec.cvg_vol_det_rl,
11998             p_information11     => l_tcv_rec.excld_flag,
11999             p_information293     => l_tcv_rec.mn_cvg_vol_amt,
12000             p_information294     => l_tcv_rec.mx_cvg_vol_amt,
12001             p_information12     => l_tcv_rec.no_mn_cvg_vol_amt_apls_flag,
12002             p_information13     => l_tcv_rec.no_mx_cvg_vol_amt_apls_flag,
12003             p_information260     => l_tcv_rec.ordr_num,
12004             p_information111     => l_tcv_rec.tcv_attribute1,
12005             p_information120     => l_tcv_rec.tcv_attribute10,
12006             p_information121     => l_tcv_rec.tcv_attribute11,
12007             p_information122     => l_tcv_rec.tcv_attribute12,
12008             p_information123     => l_tcv_rec.tcv_attribute13,
12009             p_information124     => l_tcv_rec.tcv_attribute14,
12010             p_information125     => l_tcv_rec.tcv_attribute15,
12011             p_information126     => l_tcv_rec.tcv_attribute16,
12012             p_information127     => l_tcv_rec.tcv_attribute17,
12013             p_information128     => l_tcv_rec.tcv_attribute18,
12014             p_information129     => l_tcv_rec.tcv_attribute19,
12015             p_information112     => l_tcv_rec.tcv_attribute2,
12016             p_information130     => l_tcv_rec.tcv_attribute20,
12017             p_information131     => l_tcv_rec.tcv_attribute21,
12018             p_information132     => l_tcv_rec.tcv_attribute22,
12019             p_information133     => l_tcv_rec.tcv_attribute23,
12020             p_information134     => l_tcv_rec.tcv_attribute24,
12021             p_information135     => l_tcv_rec.tcv_attribute25,
12022             p_information136     => l_tcv_rec.tcv_attribute26,
12023             p_information137     => l_tcv_rec.tcv_attribute27,
12024             p_information138     => l_tcv_rec.tcv_attribute28,
12025             p_information139     => l_tcv_rec.tcv_attribute29,
12026             p_information113     => l_tcv_rec.tcv_attribute3,
12027             p_information140     => l_tcv_rec.tcv_attribute30,
12028             p_information114     => l_tcv_rec.tcv_attribute4,
12029             p_information115     => l_tcv_rec.tcv_attribute5,
12030             p_information116     => l_tcv_rec.tcv_attribute6,
12031             p_information117     => l_tcv_rec.tcv_attribute7,
12032             p_information118     => l_tcv_rec.tcv_attribute8,
12033             p_information119     => l_tcv_rec.tcv_attribute9,
12034             p_information110     => l_tcv_rec.tcv_attribute_category,
12035             p_information262     => l_tcv_rec.vrbl_rt_prfl_id,
12036             p_information265     => l_tcv_rec.object_version_number,
12037            --
12038 
12039                 p_object_version_number          => l_object_version_number,
12040                 p_effective_date                 => p_effective_date       );
12041                 --
12042 
12043                 if l_out_tcv_result_id is null then
12044                   l_out_tcv_result_id := l_copy_entity_result_id;
12045                 end if;
12046 
12047                 if l_result_type_cd = 'DISPLAY' then
12048                    l_out_tcv_result_id := l_copy_entity_result_id ;
12049                 end if;
12050                 --
12051                 -- Copy Fast Formulas if any are attached to any column --
12052 
12053                 ---------------------------------------------------------------
12054                 -- CVG_VOL_DET_RL -----------------
12055                 ---------------------------------------------------------------
12056 
12057                 if l_tcv_rec.cvg_vol_det_rl is not null then
12058                     --
12059                     ben_plan_design_program_module.create_formula_result
12060                     (
12061                      p_validate                       =>  0
12062                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
12063                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
12064                     ,p_formula_id                     =>  l_tcv_rec.cvg_vol_det_rl
12065                     ,p_business_group_id              =>  l_tcv_rec.business_group_id
12066                     ,p_number_of_copies               =>  l_number_of_copies
12067                     ,p_object_version_number          =>  l_object_version_number
12068                     ,p_effective_date                 =>  p_effective_date
12069                     );
12070 
12071                     --
12072                 end if;
12073              end loop;
12074              --
12075            end loop;
12076         ---------------------------------------------------------------
12077         -- END OF BEN_TTL_CVG_VOL_RT_F ----------------------
12078         ---------------------------------------------------------------
12079          ---------------------------------------------------------------
12080          -- START OF BEN_TTL_PRTT_RT_F ----------------------
12081          ---------------------------------------------------------------
12082          --
12083          for l_parent_rec  in c_ttp_from_parent(l_VRBL_RT_PRFL_ID) loop
12084             --
12085             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
12086 
12087             --
12088             l_ttl_prtt_rt_id := l_parent_rec.ttl_prtt_rt_id ;
12089             --
12090             for l_ttp_rec in c_ttp(l_parent_rec.ttl_prtt_rt_id,l_mirror_src_entity_result_id,'TTP') loop
12091               --
12092               l_table_route_id := null ;
12093               open ben_plan_design_program_module.g_table_route('TTP');
12094               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
12095               close ben_plan_design_program_module.g_table_route ;
12096               --
12097               l_information5  := l_ttp_rec.mn_prtt_num ||' - '||l_ttp_rec.mx_prtt_num
12098                                  || ben_plan_design_program_module.get_exclude_message(l_ttp_rec.excld_flag);
12099                                  --'Intersection';
12100               --
12101               if p_effective_date between l_ttp_rec.effective_start_date
12102                  and l_ttp_rec.effective_end_date then
12103                --
12104                  l_result_type_cd := 'DISPLAY';
12105               else
12106                  l_result_type_cd := 'NO DISPLAY';
12107               end if;
12108                 --
12109               l_copy_entity_result_id := null;
12110               l_object_version_number := null;
12111               ben_copy_entity_results_api.create_copy_entity_results(
12112                 p_copy_entity_result_id          => l_copy_entity_result_id,
12113                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
12114                 p_result_type_cd                 => l_result_type_cd,
12115                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
12116                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
12117                 p_number_of_copies               => l_number_of_copies,
12118                 p_table_route_id                 => l_table_route_id,
12119 		P_TABLE_ALIAS                    => 'TTP',
12120                 p_information1     => l_ttp_rec.ttl_prtt_rt_id,
12121                 p_information2     => l_ttp_rec.EFFECTIVE_START_DATE,
12122                 p_information3     => l_ttp_rec.EFFECTIVE_END_DATE,
12123                 p_information4     => l_ttp_rec.business_group_id,
12124                 p_information5     => l_information5 , -- 9999 put name for h-grid
12125 
12126             p_information11     => l_ttp_rec.excld_flag,
12127             p_information261     => l_ttp_rec.mn_prtt_num,
12128             p_information263     => l_ttp_rec.mx_prtt_num,
12129             p_information12     => l_ttp_rec.no_mn_prtt_num_apls_flag,
12130             p_information13     => l_ttp_rec.no_mx_prtt_num_apls_flag,
12131             p_information260     => l_ttp_rec.ordr_num,
12132             p_information14     => l_ttp_rec.prtt_det_cd,
12133             p_information264     => l_ttp_rec.prtt_det_rl,
12134             p_information111     => l_ttp_rec.ttp_attribute1,
12135             p_information120     => l_ttp_rec.ttp_attribute10,
12136             p_information121     => l_ttp_rec.ttp_attribute11,
12137             p_information122     => l_ttp_rec.ttp_attribute12,
12138             p_information123     => l_ttp_rec.ttp_attribute13,
12139             p_information124     => l_ttp_rec.ttp_attribute14,
12140             p_information125     => l_ttp_rec.ttp_attribute15,
12141             p_information126     => l_ttp_rec.ttp_attribute16,
12142             p_information127     => l_ttp_rec.ttp_attribute17,
12143             p_information128     => l_ttp_rec.ttp_attribute18,
12144             p_information129     => l_ttp_rec.ttp_attribute19,
12145             p_information112     => l_ttp_rec.ttp_attribute2,
12146             p_information130     => l_ttp_rec.ttp_attribute20,
12147             p_information131     => l_ttp_rec.ttp_attribute21,
12148             p_information132     => l_ttp_rec.ttp_attribute22,
12149             p_information133     => l_ttp_rec.ttp_attribute23,
12150             p_information134     => l_ttp_rec.ttp_attribute24,
12151             p_information135     => l_ttp_rec.ttp_attribute25,
12152             p_information136     => l_ttp_rec.ttp_attribute26,
12153             p_information137     => l_ttp_rec.ttp_attribute27,
12154             p_information138     => l_ttp_rec.ttp_attribute28,
12155             p_information139     => l_ttp_rec.ttp_attribute29,
12156             p_information113     => l_ttp_rec.ttp_attribute3,
12157             p_information140     => l_ttp_rec.ttp_attribute30,
12158             p_information114     => l_ttp_rec.ttp_attribute4,
12159             p_information115     => l_ttp_rec.ttp_attribute5,
12160             p_information116     => l_ttp_rec.ttp_attribute6,
12161             p_information117     => l_ttp_rec.ttp_attribute7,
12162             p_information118     => l_ttp_rec.ttp_attribute8,
12163             p_information119     => l_ttp_rec.ttp_attribute9,
12164             p_information110     => l_ttp_rec.ttp_attribute_category,
12165             p_information262     => l_ttp_rec.vrbl_rt_prfl_id,
12166             p_information265     => l_ttp_rec.object_version_number,
12167            --
12168 
12169                 p_object_version_number          => l_object_version_number,
12170                 p_effective_date                 => p_effective_date       );
12171                 --
12172 
12173                 if l_out_ttp_result_id is null then
12174                   l_out_ttp_result_id := l_copy_entity_result_id;
12175                 end if;
12176 
12177                 if l_result_type_cd = 'DISPLAY' then
12178                    l_out_ttp_result_id := l_copy_entity_result_id ;
12179                 end if;
12180                 --
12181 
12182                 -- Copy Fast Formulas if they are attached to any column --
12183                 ---------------------------------------------------------------
12184                 -- PRTT_DET_RL -----------------
12185                 ---------------------------------------------------------------
12186 
12187                 if l_ttp_rec.prtt_det_rl is not null then
12188                     --
12189                     ben_plan_design_program_module.create_formula_result
12190                     (
12191                      p_validate                       =>  0
12192                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
12193                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
12194                     ,p_formula_id                     =>  l_ttp_rec.prtt_det_rl
12195                     ,p_business_group_id              =>  l_ttp_rec.business_group_id
12196                     ,p_number_of_copies               =>  l_number_of_copies
12197                     ,p_object_version_number          =>  l_object_version_number
12198                     ,p_effective_date                 =>  p_effective_date
12199                     );
12200 
12201                     --
12202                 end if;
12203              end loop;
12204              --
12205            end loop;
12206         ---------------------------------------------------------------
12207         -- END OF BEN_TTL_PRTT_RT_F ----------------------
12208         ---------------------------------------------------------------
12209          ---------------------------------------------------------------
12210          -- START OF BEN_VRBL_MTCHG_RT_F ----------------------
12211          ---------------------------------------------------------------
12212          --
12213          for l_parent_rec  in c_vmr_from_parent(l_VRBL_RT_PRFL_ID) loop
12214             --
12215             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
12216 
12217             --
12218             l_vrbl_mtchg_rt_id := l_parent_rec.vrbl_mtchg_rt_id ;
12219             --
12220             for l_vmr_rec in c_vmr(l_parent_rec.vrbl_mtchg_rt_id,l_mirror_src_entity_result_id,'VMR') loop
12221               --
12222               l_table_route_id := null ;
12223               open ben_plan_design_program_module.g_table_route('VMR');
12224               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
12225               close ben_plan_design_program_module.g_table_route ;
12226               --
12227               l_information5  := l_vmr_rec.from_pct_val ||' - '|| l_vmr_rec.to_pct_val; --'Intersection';
12228               --
12229               if p_effective_date between l_vmr_rec.effective_start_date
12230                  and l_vmr_rec.effective_end_date then
12231                --
12232                  l_result_type_cd := 'DISPLAY';
12233               else
12234                  l_result_type_cd := 'NO DISPLAY';
12235               end if;
12236                 --
12237               l_copy_entity_result_id := null;
12238               l_object_version_number := null;
12239               ben_copy_entity_results_api.create_copy_entity_results(
12240                 p_copy_entity_result_id          => l_copy_entity_result_id,
12241                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
12242                 p_result_type_cd                 => l_result_type_cd,
12243                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
12244                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
12245                 p_number_of_copies               => l_number_of_copies,
12246                 p_table_route_id                 => l_table_route_id,
12247 		P_TABLE_ALIAS                    => 'VMR',
12248                 p_information1     => l_vmr_rec.vrbl_mtchg_rt_id,
12249                 p_information2     => l_vmr_rec.EFFECTIVE_START_DATE,
12250                 p_information3     => l_vmr_rec.EFFECTIVE_END_DATE,
12251                 p_information4     => l_vmr_rec.business_group_id,
12252                 p_information5     => l_information5 , -- 9999 put name for h-grid
12253 
12254             p_information12     => l_vmr_rec.cntnu_mtch_aftr_max_rl_flag,
12255             p_information287     => l_vmr_rec.from_pct_val,
12256             p_information295     => l_vmr_rec.mn_mtch_amt,
12257             p_information261     => l_vmr_rec.mtchg_rt_calc_rl,
12258             p_information294     => l_vmr_rec.mx_amt_of_py_num,
12259             p_information293     => l_vmr_rec.mx_mtch_amt,
12260             p_information289     => l_vmr_rec.mx_pct_of_py_num,
12261             p_information14     => l_vmr_rec.no_mx_amt_of_py_num_flag,
12262             p_information11     => l_vmr_rec.no_mx_mtch_amt_flag,
12263             p_information13     => l_vmr_rec.no_mx_pct_of_py_num_flag,
12264             p_information257     => l_vmr_rec.ordr_num,
12265             p_information290     => l_vmr_rec.pct_val,
12266             p_information288     => l_vmr_rec.to_pct_val,
12267             p_information111     => l_vmr_rec.vmr_attribute1,
12268             p_information120     => l_vmr_rec.vmr_attribute10,
12269             p_information121     => l_vmr_rec.vmr_attribute11,
12270             p_information122     => l_vmr_rec.vmr_attribute12,
12271             p_information123     => l_vmr_rec.vmr_attribute13,
12272             p_information124     => l_vmr_rec.vmr_attribute14,
12273             p_information125     => l_vmr_rec.vmr_attribute15,
12274             p_information126     => l_vmr_rec.vmr_attribute16,
12275             p_information127     => l_vmr_rec.vmr_attribute17,
12276             p_information128     => l_vmr_rec.vmr_attribute18,
12277             p_information129     => l_vmr_rec.vmr_attribute19,
12278             p_information112     => l_vmr_rec.vmr_attribute2,
12279             p_information130     => l_vmr_rec.vmr_attribute20,
12280             p_information131     => l_vmr_rec.vmr_attribute21,
12281             p_information132     => l_vmr_rec.vmr_attribute22,
12282             p_information133     => l_vmr_rec.vmr_attribute23,
12283             p_information134     => l_vmr_rec.vmr_attribute24,
12284             p_information135     => l_vmr_rec.vmr_attribute25,
12285             p_information136     => l_vmr_rec.vmr_attribute26,
12286             p_information137     => l_vmr_rec.vmr_attribute27,
12287             p_information138     => l_vmr_rec.vmr_attribute28,
12288             p_information139     => l_vmr_rec.vmr_attribute29,
12289             p_information113     => l_vmr_rec.vmr_attribute3,
12290             p_information140     => l_vmr_rec.vmr_attribute30,
12291             p_information114     => l_vmr_rec.vmr_attribute4,
12292             p_information115     => l_vmr_rec.vmr_attribute5,
12293             p_information116     => l_vmr_rec.vmr_attribute6,
12294             p_information117     => l_vmr_rec.vmr_attribute7,
12295             p_information118     => l_vmr_rec.vmr_attribute8,
12296             p_information119     => l_vmr_rec.vmr_attribute9,
12297             p_information110     => l_vmr_rec.vmr_attribute_category,
12298             p_information262     => l_vmr_rec.vrbl_rt_prfl_id,
12299             p_information265     => l_vmr_rec.object_version_number,
12300            --
12301 
12302                 p_object_version_number          => l_object_version_number,
12303                 p_effective_date                 => p_effective_date       );
12304                 --
12305 
12306                 if l_out_vmr_result_id is null then
12307                   l_out_vmr_result_id := l_copy_entity_result_id;
12308                 end if;
12309 
12310                 if l_result_type_cd = 'DISPLAY' then
12311                    l_out_vmr_result_id := l_copy_entity_result_id ;
12312                 end if;
12313                 --
12314 
12315                 -- Copy Fast Formulas if any are attached to any column --
12316                 ---------------------------------------------------------------
12317                 -- MTCHG_RT_CALC_RL -----------------
12318                 ---------------------------------------------------------------
12319 
12320                 if l_vmr_rec.mtchg_rt_calc_rl is not null then
12321                     --
12322                     ben_plan_design_program_module.create_formula_result
12323                     (
12324                      p_validate                       =>  0
12325                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
12326                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
12327                     ,p_formula_id                     =>  l_vmr_rec.mtchg_rt_calc_rl
12328                     ,p_business_group_id              =>  l_vmr_rec.business_group_id
12329                     ,p_number_of_copies               =>  l_number_of_copies
12330                     ,p_object_version_number          =>  l_object_version_number
12331                     ,p_effective_date                 =>  p_effective_date
12332                     );
12333 
12334                     --
12335                 end if;
12336              end loop;
12337              --
12338            end loop;
12339         ---------------------------------------------------------------
12340         -- END OF BEN_VRBL_MTCHG_RT_F ----------------------
12341         ---------------------------------------------------------------
12342          ---------------------------------------------------------------
12343          -- START OF BEN_VRBL_RT_PRFL_RL_F ----------------------
12344          ---------------------------------------------------------------
12345          --
12346          for l_parent_rec  in c_vpr_from_parent(l_VRBL_RT_PRFL_ID) loop
12347             --
12348             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
12349 
12350             --
12351             l_vrbl_rt_prfl_rl_id := l_parent_rec.vrbl_rt_prfl_rl_id ;
12352             --
12353             for l_vpr_rec in c_vpr(l_parent_rec.vrbl_rt_prfl_rl_id,l_mirror_src_entity_result_id,'VPR') loop
12354               --
12355               l_table_route_id := null ;
12356               open ben_plan_design_program_module.g_table_route('VPR');
12357                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
12358               close ben_plan_design_program_module.g_table_route ;
12359               --
12360               l_information5  := ben_plan_design_program_module.get_formula_name(l_vpr_rec.formula_id,p_effective_date);
12361                                   --'Intersection';
12362               --
12363               if p_effective_date between l_vpr_rec.effective_start_date
12364                  and l_vpr_rec.effective_end_date then
12365                --
12366                  l_result_type_cd := 'DISPLAY';
12367               else
12368                  l_result_type_cd := 'NO DISPLAY';
12369               end if;
12370                 --
12371               l_copy_entity_result_id := null;
12372               l_object_version_number := null;
12373               ben_copy_entity_results_api.create_copy_entity_results(
12374                 p_copy_entity_result_id          => l_copy_entity_result_id,
12375                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
12376                 p_result_type_cd                 => l_result_type_cd,
12377                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
12378                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
12379                 p_number_of_copies               => l_number_of_copies,
12380                 p_table_route_id                 => l_table_route_id,
12381 		P_TABLE_ALIAS                    => 'VPR',
12382                 p_information1     => l_vpr_rec.vrbl_rt_prfl_rl_id,
12383                 p_information2     => l_vpr_rec.EFFECTIVE_START_DATE,
12384                 p_information3     => l_vpr_rec.EFFECTIVE_END_DATE,
12385                 p_information4     => l_vpr_rec.business_group_id,
12386                 p_information5     => l_information5 , -- 9999 put name for h-grid
12387 
12388             p_information11     => l_vpr_rec.drvbl_fctr_apls_flag,
12389             p_information251     => l_vpr_rec.formula_id,
12390             p_information260     => l_vpr_rec.ordr_to_aply_num,
12391             p_information111     => l_vpr_rec.vpr_attribute1,
12392             p_information120     => l_vpr_rec.vpr_attribute10,
12393             p_information121     => l_vpr_rec.vpr_attribute11,
12394             p_information122     => l_vpr_rec.vpr_attribute12,
12395             p_information123     => l_vpr_rec.vpr_attribute13,
12396             p_information124     => l_vpr_rec.vpr_attribute14,
12397             p_information125     => l_vpr_rec.vpr_attribute15,
12398             p_information126     => l_vpr_rec.vpr_attribute16,
12399             p_information127     => l_vpr_rec.vpr_attribute17,
12400             p_information128     => l_vpr_rec.vpr_attribute18,
12401             p_information129     => l_vpr_rec.vpr_attribute19,
12402             p_information112     => l_vpr_rec.vpr_attribute2,
12403             p_information130     => l_vpr_rec.vpr_attribute20,
12404             p_information131     => l_vpr_rec.vpr_attribute21,
12405             p_information132     => l_vpr_rec.vpr_attribute22,
12406             p_information133     => l_vpr_rec.vpr_attribute23,
12407             p_information134     => l_vpr_rec.vpr_attribute24,
12408             p_information135     => l_vpr_rec.vpr_attribute25,
12409             p_information136     => l_vpr_rec.vpr_attribute26,
12410             p_information137     => l_vpr_rec.vpr_attribute27,
12411             p_information138     => l_vpr_rec.vpr_attribute28,
12412             p_information139     => l_vpr_rec.vpr_attribute29,
12413             p_information113     => l_vpr_rec.vpr_attribute3,
12414             p_information140     => l_vpr_rec.vpr_attribute30,
12415             p_information114     => l_vpr_rec.vpr_attribute4,
12416             p_information115     => l_vpr_rec.vpr_attribute5,
12417             p_information116     => l_vpr_rec.vpr_attribute6,
12418             p_information117     => l_vpr_rec.vpr_attribute7,
12419             p_information118     => l_vpr_rec.vpr_attribute8,
12420             p_information119     => l_vpr_rec.vpr_attribute9,
12421             p_information110     => l_vpr_rec.vpr_attribute_category,
12422             p_information262     => l_vpr_rec.vrbl_rt_prfl_id,
12423             p_information265     => l_vpr_rec.object_version_number,
12424            --
12425 
12426                 p_object_version_number          => l_object_version_number,
12427                 p_effective_date                 => p_effective_date       );
12428                 --
12429 
12430                 if l_out_vpr_result_id is null then
12431                   l_out_vpr_result_id := l_copy_entity_result_id;
12432                 end if;
12433 
12434                 if l_result_type_cd = 'DISPLAY' then
12435                    l_out_vpr_result_id := l_copy_entity_result_id ;
12436                 end if;
12437                 --
12438 
12439                 -- Copy Fast Formulas if any are attached to any column --
12440                 ---------------------------------------------------------------
12441                 -- FORMULA_ID -----------------
12442                 ---------------------------------------------------------------
12443 
12444                 if l_vpr_rec.formula_id is not null then
12445                     --
12446                     ben_plan_design_program_module.create_formula_result
12447                     (
12448                      p_validate                       =>  0
12449                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
12450                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
12451                     ,p_formula_id                     =>  l_vpr_rec.formula_id
12452                     ,p_business_group_id              =>  l_vpr_rec.business_group_id
12453                     ,p_number_of_copies               =>  l_number_of_copies
12454                     ,p_object_version_number          =>  l_object_version_number
12455                     ,p_effective_date                 =>  p_effective_date
12456                     );
12457                     --
12458                 end if;
12459 
12460              end loop;
12461              --
12462            end loop;
12463         ---------------------------------------------------------------
12464         -- END OF BEN_VRBL_RT_PRFL_RL_F ----------------------
12465         ---------------------------------------------------------------
12466          ---------------------------------------------------------------
12467          -- START OF BEN_WK_LOC_RT_F ----------------------
12468          ---------------------------------------------------------------
12469          --
12470          for l_parent_rec  in c_wlr_from_parent(l_VRBL_RT_PRFL_ID) loop
12471             --
12472             l_mirror_src_entity_result_id := l_out_vpf_result_id ;
12473 
12474             --
12475             l_wk_loc_rt_id := l_parent_rec.wk_loc_rt_id ;
12476             --
12477             for l_wlr_rec in c_wlr(l_parent_rec.wk_loc_rt_id,l_mirror_src_entity_result_id,'WLR') loop
12478               --
12479               l_table_route_id := null ;
12480               open ben_plan_design_program_module.g_table_route('WLR');
12481               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
12482               close ben_plan_design_program_module.g_table_route ;
12483               --
12484               l_information5  := ben_plan_design_program_module.get_location_name(l_wlr_rec.location_id)
12485                                  || ben_plan_design_program_module.get_exclude_message(l_wlr_rec.excld_flag);
12486                                  -- 'Intersection';
12487               --
12488               if p_effective_date between l_wlr_rec.effective_start_date
12489                  and l_wlr_rec.effective_end_date then
12490                --
12491                  l_result_type_cd := 'DISPLAY';
12492               else
12493                  l_result_type_cd := 'NO DISPLAY';
12494               end if;
12495                 --
12496               l_copy_entity_result_id := null;
12497               l_object_version_number := null;
12498 
12499               -- To store effective_start_date of location
12500               -- for Mapping - Bug 2958658
12501               --
12502               l_location_inactive_date := null;
12503               if l_wlr_rec.location_id is not null then
12504                 open c_location_inactive_date(l_wlr_rec.location_id);
12505                 fetch c_location_inactive_date into l_location_inactive_date;
12506                 close c_location_inactive_date;
12507               end if;
12508 
12509               --
12510               -- pabodla : MAPPING DATA : Store the mapping column information.
12511               --
12512 
12513               l_mapping_name := null;
12514               l_mapping_id   := null;
12515               --
12516               -- Get the location name to display on mapping page.
12517               --
12518               open c_get_mapping_name10(l_wlr_rec.location_id,
12519                                         NVL(l_location_inactive_date,p_effective_date));
12520               fetch c_get_mapping_name10 into l_mapping_name;
12521               close c_get_mapping_name10;
12522               --
12523               l_mapping_id   := l_wlr_rec.location_id;
12524               --
12525               --To set user friendly labels on the mapping page
12526               --
12527               l_mapping_column_name1 := null;
12528               l_mapping_column_name2 :=null;
12529               BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
12530                                                                l_mapping_column_name1,
12531                                                                l_mapping_column_name2,
12532                                                                p_copy_entity_txn_id);
12533               --
12534 
12535               ben_copy_entity_results_api.create_copy_entity_results(
12536                 p_copy_entity_result_id          => l_copy_entity_result_id,
12537                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
12538                 p_result_type_cd                 => l_result_type_cd,
12539                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
12540                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
12541                 p_number_of_copies               => l_number_of_copies,
12542                 p_table_route_id                 => l_table_route_id,
12543 		P_TABLE_ALIAS                    => 'WLR',
12544                 p_information1     => l_wlr_rec.wk_loc_rt_id,
12545                 p_information2     => l_wlr_rec.EFFECTIVE_START_DATE,
12546                 p_information3     => l_wlr_rec.EFFECTIVE_END_DATE,
12547                 p_information4     => l_wlr_rec.business_group_id,
12548                 p_information5     => l_information5 , -- 9999 put name for h-grid
12549 
12550             p_information11     => l_wlr_rec.excld_flag,
12551             -- Data for MAPPING columns.
12552             p_information173    => l_mapping_name,
12553             p_information174    => l_mapping_id,
12554             p_information181    => l_mapping_column_name1,
12555             p_information182    => l_mapping_column_name2,
12556             -- END other product Mapping columns.
12557             p_information260     => l_wlr_rec.ordr_num,
12558             p_information262     => l_wlr_rec.vrbl_rt_prfl_id,
12559             p_information111     => l_wlr_rec.wlr_attribute1,
12560             p_information120     => l_wlr_rec.wlr_attribute10,
12561             p_information121     => l_wlr_rec.wlr_attribute11,
12562             p_information122     => l_wlr_rec.wlr_attribute12,
12563             p_information123     => l_wlr_rec.wlr_attribute13,
12564             p_information124     => l_wlr_rec.wlr_attribute14,
12565             p_information125     => l_wlr_rec.wlr_attribute15,
12566             p_information126     => l_wlr_rec.wlr_attribute16,
12567             p_information127     => l_wlr_rec.wlr_attribute17,
12568             p_information128     => l_wlr_rec.wlr_attribute18,
12569             p_information129     => l_wlr_rec.wlr_attribute19,
12570             p_information112     => l_wlr_rec.wlr_attribute2,
12571             p_information130     => l_wlr_rec.wlr_attribute20,
12572             p_information131     => l_wlr_rec.wlr_attribute21,
12573             p_information132     => l_wlr_rec.wlr_attribute22,
12574             p_information133     => l_wlr_rec.wlr_attribute23,
12575             p_information134     => l_wlr_rec.wlr_attribute24,
12576             p_information135     => l_wlr_rec.wlr_attribute25,
12577             p_information136     => l_wlr_rec.wlr_attribute26,
12578             p_information137     => l_wlr_rec.wlr_attribute27,
12579             p_information138     => l_wlr_rec.wlr_attribute28,
12580             p_information139     => l_wlr_rec.wlr_attribute29,
12581             p_information113     => l_wlr_rec.wlr_attribute3,
12582             p_information140     => l_wlr_rec.wlr_attribute30,
12583             p_information114     => l_wlr_rec.wlr_attribute4,
12584             p_information115     => l_wlr_rec.wlr_attribute5,
12585             p_information116     => l_wlr_rec.wlr_attribute6,
12586             p_information117     => l_wlr_rec.wlr_attribute7,
12587             p_information118     => l_wlr_rec.wlr_attribute8,
12588             p_information119     => l_wlr_rec.wlr_attribute9,
12589             p_information110     => l_wlr_rec.wlr_attribute_category,
12590             p_information166     => l_location_inactive_date,
12591             p_information265     => l_wlr_rec.object_version_number,
12592            --
12593 
12594                 p_object_version_number          => l_object_version_number,
12595                 p_effective_date                 => p_effective_date       );
12596                 --
12597 
12598                 if l_out_wlr_result_id is null then
12599                   l_out_wlr_result_id := l_copy_entity_result_id;
12600                 end if;
12601 
12602                 if l_result_type_cd = 'DISPLAY' then
12603                    l_out_wlr_result_id := l_copy_entity_result_id ;
12604                 end if;
12605                 --
12606              end loop;
12607              --
12608            end loop;
12609         ---------------------------------------------------------------
12610         -- END OF BEN_WK_LOC_RT_F ----------------------
12611         ---------------------------------------------------------------
12612         ---------------------------------------------------------------
12613         -- START OF BEN_COMPTNCY_RT_F ----------------------
12614         ---------------------------------------------------------------
12615         --
12616         hr_utility.set_location('START OF BEN_COMPTNCY_RT_F',100);
12617         for l_parent_rec  in c_cty_from_parent(l_VRBL_RT_PRFL_ID) loop
12618            --
12619            l_mirror_src_entity_result_id := l_out_vpf_result_id ;
12620 
12621            --
12622            l_comptncy_rt_id := l_parent_rec.comptncy_rt_id ;
12623            --
12624            for l_cty_rec in c_cty(l_parent_rec.comptncy_rt_id,l_mirror_src_entity_result_id,'CTY') loop
12625              --
12626              l_table_route_id := null ;
12627              open ben_plan_design_program_module.g_table_route('CTY');
12628              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
12629              close ben_plan_design_program_module.g_table_route ;
12630              --
12631              l_information5  := ben_plan_design_program_module.get_competence_rating_name
12632                                 (l_cty_rec.competence_id
12633                                 ,l_cty_rec.rating_level_id)
12634                                 || ben_plan_design_program_module.get_exclude_message(l_cty_rec.excld_flag);
12635                                 -- 'Intersection';
12636              --
12637              if p_effective_date between l_cty_rec.effective_start_date
12638                 and l_cty_rec.effective_end_date then
12639               --
12640                 l_result_type_cd := 'DISPLAY';
12641              else
12642                 l_result_type_cd := 'NO DISPLAY';
12643              end if;
12644              --
12645 
12646              -- To store effective_start_date of competence
12647              -- for Mapping - Bug 2958658
12648              --
12649              l_competence_start_date := null;
12650              if l_cty_rec.competence_id is not null then
12651                open c_competence_start_date(l_cty_rec.competence_id);
12652                fetch c_competence_start_date into l_competence_start_date;
12653                close c_competence_start_date;
12654              end if;
12655 
12656              --
12657              -- pabodla : MAPPING DATA : Store the mapping column information.
12658              --
12659              l_mapping_name := null;
12660              l_mapping_id   := null;
12661              l_mapping_name1:= null;
12662              l_mapping_id1  := null;
12663              --
12664              -- Get the competence and Rating name to display on mapping page.
12665              --
12666              -- 9999 needs review
12667              open c_get_mapping_name16(l_cty_rec.competence_id,
12668                                        NVL(l_competence_start_date,p_effective_date));
12669              fetch c_get_mapping_name16 into l_mapping_name;
12670              close c_get_mapping_name16;
12671              --
12672              l_mapping_id   := l_cty_rec.competence_id;
12673              --
12674              open c_get_mapping_name17(l_cty_rec.rating_level_id,
12675                                        p_business_group_id);
12676              fetch c_get_mapping_name17 into l_mapping_name1;
12677              close c_get_mapping_name17;
12678              --
12679              l_mapping_id1   := l_cty_rec.rating_level_id;
12680               --
12681               --To set user friendly labels on the mapping page
12682               --
12683               l_mapping_column_name1 := null;
12684               l_mapping_column_name2 :=null;
12685               BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
12686                                                                l_mapping_column_name1,
12687                                                                l_mapping_column_name2,
12688                                                                p_copy_entity_txn_id);
12689               --
12690              hr_utility.set_location('l_mapping_id '||l_mapping_id,100);
12691              hr_utility.set_location('l_mapping_name '||l_mapping_name,100);
12692              hr_utility.set_location('l_mapping_id1 '||l_mapping_id1,100);
12693              hr_utility.set_location('l_mapping_name1 '||l_mapping_name1,100);
12694              --
12695 
12696              l_copy_entity_result_id := null;
12697              l_object_version_number := null;
12698              ben_copy_entity_results_api.create_copy_entity_results(
12699                p_copy_entity_result_id          => l_copy_entity_result_id,
12700                p_copy_entity_txn_id             => p_copy_entity_txn_id,
12701                p_result_type_cd                 => l_result_type_cd,
12702                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
12703                p_parent_entity_result_id        => l_mirror_src_entity_result_id,
12704                p_number_of_copies               => l_number_of_copies,
12705                p_table_route_id                 => l_table_route_id,
12706 	       P_TABLE_ALIAS                    => 'CTY',
12707                p_information1     => l_cty_rec.comptncy_rt_id,
12708                p_information2     => l_cty_rec.EFFECTIVE_START_DATE,
12709                p_information3     => l_cty_rec.EFFECTIVE_END_DATE,
12710                p_information4     => l_cty_rec.business_group_id,
12711                p_information5     => l_information5 , -- 9999 put name for h-grid
12712             -- Data for MAPPING columns.
12713             p_information173    => l_mapping_name,
12714             p_information174    => l_mapping_id,
12715             p_information181    => l_mapping_column_name1,
12716             p_information182    => l_mapping_column_name2,
12717             -- END other product Mapping columns.
12718             p_information111     => l_cty_rec.cty_attribute1,
12719             p_information120     => l_cty_rec.cty_attribute10,
12720             p_information121     => l_cty_rec.cty_attribute11,
12721             p_information122     => l_cty_rec.cty_attribute12,
12722             p_information123     => l_cty_rec.cty_attribute13,
12723             p_information124     => l_cty_rec.cty_attribute14,
12724             p_information125     => l_cty_rec.cty_attribute15,
12725             p_information126     => l_cty_rec.cty_attribute16,
12726             p_information127     => l_cty_rec.cty_attribute17,
12727             p_information128     => l_cty_rec.cty_attribute18,
12728             p_information129     => l_cty_rec.cty_attribute19,
12729             p_information112     => l_cty_rec.cty_attribute2,
12730             p_information130     => l_cty_rec.cty_attribute20,
12731             p_information131     => l_cty_rec.cty_attribute21,
12732             p_information132     => l_cty_rec.cty_attribute22,
12733             p_information133     => l_cty_rec.cty_attribute23,
12734             p_information134     => l_cty_rec.cty_attribute24,
12735             p_information135     => l_cty_rec.cty_attribute25,
12736             p_information136     => l_cty_rec.cty_attribute26,
12737             p_information137     => l_cty_rec.cty_attribute27,
12738             p_information138     => l_cty_rec.cty_attribute28,
12739             p_information139     => l_cty_rec.cty_attribute29,
12740             p_information113     => l_cty_rec.cty_attribute3,
12741             p_information140     => l_cty_rec.cty_attribute30,
12742             p_information114     => l_cty_rec.cty_attribute4,
12743             p_information115     => l_cty_rec.cty_attribute5,
12744             p_information116     => l_cty_rec.cty_attribute6,
12745             p_information117     => l_cty_rec.cty_attribute7,
12746             p_information118     => l_cty_rec.cty_attribute8,
12747             p_information119     => l_cty_rec.cty_attribute9,
12748             p_information110     => l_cty_rec.cty_attribute_category,
12749             p_information11     => l_cty_rec.excld_flag,
12750             p_information260     => l_cty_rec.ordr_num,
12751             -- Data for MAPPING columns.
12752             p_information177    => l_mapping_name1,
12753             p_information178    => l_mapping_id1,
12754             -- END other product Mapping columns.
12755             p_information262     => l_cty_rec.vrbl_rt_prfl_id,
12756             p_information166     => l_competence_start_date,
12757             p_information306     => NULL,  -- No ESD for Rating Level
12758             p_information265    => l_cty_rec.object_version_number,
12759            --
12760 
12761                p_object_version_number          => l_object_version_number,
12762                p_effective_date                 => p_effective_date       );
12763                --
12764 
12765                if l_out_cty_result_id is null then
12766                  l_out_cty_result_id := l_copy_entity_result_id;
12767                end if;
12768 
12769                if l_result_type_cd = 'DISPLAY' then
12770                   l_out_cty_result_id := l_copy_entity_result_id ;
12771                end if;
12772                --
12773             end loop;
12774             --
12775           end loop;
12776        hr_utility.set_location('END  OF BEN_COMPTNCY_RT_F',100);
12777        ---------------------------------------------------------------
12778        -- END OF BEN_COMPTNCY_RT_F ----------------------
12779        ---------------------------------------------------------------
12780        ---------------------------------------------------------------
12781        -- START OF BEN_JOB_RT_F ----------------------
12782        ---------------------------------------------------------------
12783        --
12784        hr_utility.set_location('START OF BEN_JOB_RT_F',100);
12785        for l_parent_rec  in c_jrt_from_parent(l_VRBL_RT_PRFL_ID) loop
12786           --
12787           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
12788 
12789           --
12790           l_job_rt_id := l_parent_rec.job_rt_id ;
12791           --
12792           for l_jrt_rec in c_jrt(l_parent_rec.job_rt_id,l_mirror_src_entity_result_id,'JRT') loop
12793             --
12794             l_table_route_id := null ;
12795             open ben_plan_design_program_module.g_table_route('JRT');
12796             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
12797             close ben_plan_design_program_module.g_table_route ;
12798             --
12799             l_information5  := ben_plan_design_program_module.get_job_name(l_jrt_rec.job_id)
12800                                || ben_plan_design_program_module.get_exclude_message(l_jrt_rec.excld_flag);
12801                                --'Intersection';
12802             --
12803             if p_effective_date between l_jrt_rec.effective_start_date
12804                and l_jrt_rec.effective_end_date then
12805              --
12806                l_result_type_cd := 'DISPLAY';
12807             else
12808                l_result_type_cd := 'NO DISPLAY';
12809             end if;
12810               --
12811 
12812             -- To store effective_start_date of job
12813             -- for Mapping - Bug 2958658
12814             --
12815             l_job_start_date := null;
12816             if l_jrt_rec.job_id is not null then
12817               open c_job_start_date(l_jrt_rec.job_id);
12818               fetch c_job_start_date into l_job_start_date;
12819               close c_job_start_date;
12820             end if;
12821 
12822             --
12823             l_mapping_name := null;
12824             l_mapping_id   := null;
12825             --
12826             -- Get the Job name to display on mapping page.
12827             --
12828             open c_get_mapping_name11(l_jrt_rec.job_id,
12829                                       NVL(l_job_start_date,p_effective_date));
12830             fetch c_get_mapping_name11 into l_mapping_name;
12831             close c_get_mapping_name11;
12832             --
12833             l_mapping_id   := l_jrt_rec.job_id;
12834             --
12835             --To set user friendly labels on the mapping page
12836             --
12837             l_mapping_column_name1 := null;
12838             l_mapping_column_name2 :=null;
12839             BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
12840                                                              l_mapping_column_name1,
12841                                                              l_mapping_column_name2,
12842                                                              p_copy_entity_txn_id);
12843             --
12844             hr_utility.set_location('l_mapping_name '||l_mapping_name,100);
12845             hr_utility.set_location('l_mapping_id '||l_mapping_id,100);
12846             --
12847 
12848             l_copy_entity_result_id := null;
12849             l_object_version_number := null;
12850             ben_copy_entity_results_api.create_copy_entity_results(
12851               p_copy_entity_result_id          => l_copy_entity_result_id,
12852               p_copy_entity_txn_id             => p_copy_entity_txn_id,
12853               p_result_type_cd                 => l_result_type_cd,
12854               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
12855               p_parent_entity_result_id        => l_mirror_src_entity_result_id,
12856               p_number_of_copies               => l_number_of_copies,
12857               p_table_route_id                 => l_table_route_id,
12858 	      P_TABLE_ALIAS                    => 'JRT',
12859               p_information1     => l_jrt_rec.job_rt_id,
12860               p_information2     => l_jrt_rec.EFFECTIVE_START_DATE,
12861               p_information3     => l_jrt_rec.EFFECTIVE_END_DATE,
12862               p_information4     => l_jrt_rec.business_group_id,
12863               p_information5     => l_information5 , -- 9999 put name for h-grid
12864 
12865             p_information11     => l_jrt_rec.excld_flag,
12866             -- Data for MAPPING columns.
12867             p_information173    => l_mapping_name,
12868             p_information174    => l_mapping_id,
12869             p_information181    => l_mapping_column_name1,
12870             p_information182    => l_mapping_column_name2,
12871             -- END other product Mapping columns.
12872             p_information226     => l_jrt_rec.job_id,
12873             p_information111     => l_jrt_rec.jrt_attribute1,
12874             p_information120     => l_jrt_rec.jrt_attribute10,
12875             p_information121     => l_jrt_rec.jrt_attribute11,
12876             p_information122     => l_jrt_rec.jrt_attribute12,
12877             p_information123     => l_jrt_rec.jrt_attribute13,
12878             p_information124     => l_jrt_rec.jrt_attribute14,
12879             p_information125     => l_jrt_rec.jrt_attribute15,
12880             p_information126     => l_jrt_rec.jrt_attribute16,
12881             p_information127     => l_jrt_rec.jrt_attribute17,
12882             p_information128     => l_jrt_rec.jrt_attribute18,
12883             p_information129     => l_jrt_rec.jrt_attribute19,
12884             p_information112     => l_jrt_rec.jrt_attribute2,
12885             p_information130     => l_jrt_rec.jrt_attribute20,
12886             p_information131     => l_jrt_rec.jrt_attribute21,
12887             p_information132     => l_jrt_rec.jrt_attribute22,
12888             p_information133     => l_jrt_rec.jrt_attribute23,
12889             p_information134     => l_jrt_rec.jrt_attribute24,
12890             p_information135     => l_jrt_rec.jrt_attribute25,
12891             p_information136     => l_jrt_rec.jrt_attribute26,
12892             p_information137     => l_jrt_rec.jrt_attribute27,
12893             p_information138     => l_jrt_rec.jrt_attribute28,
12894             p_information139     => l_jrt_rec.jrt_attribute29,
12895             p_information113     => l_jrt_rec.jrt_attribute3,
12896             p_information140     => l_jrt_rec.jrt_attribute30,
12897             p_information114     => l_jrt_rec.jrt_attribute4,
12898             p_information115     => l_jrt_rec.jrt_attribute5,
12899             p_information116     => l_jrt_rec.jrt_attribute6,
12900             p_information117     => l_jrt_rec.jrt_attribute7,
12901             p_information118     => l_jrt_rec.jrt_attribute8,
12902             p_information119     => l_jrt_rec.jrt_attribute9,
12903             p_information110     => l_jrt_rec.jrt_attribute_category,
12904             p_information257     => l_jrt_rec.ordr_num,
12905             p_information262     => l_jrt_rec.vrbl_rt_prfl_id,
12906             p_information166     => l_job_start_date,
12907             p_information265     => l_jrt_rec.object_version_number,
12908 
12909               p_object_version_number          => l_object_version_number,
12910               p_effective_date                 => p_effective_date       );
12911               --
12912 
12913               if l_out_jrt_result_id is null then
12914                 l_out_jrt_result_id := l_copy_entity_result_id;
12915               end if;
12916 
12917               if l_result_type_cd = 'DISPLAY' then
12918                  l_out_jrt_result_id := l_copy_entity_result_id ;
12919               end if;
12920               --
12921            end loop;
12922            --
12923          end loop;
12924        hr_utility.set_location('END OF BEN_JOB_RT_F',100);
12925       ---------------------------------------------------------------
12926       -- END OF BEN_JOB_RT_F ----------------------
12927       ---------------------------------------------------------------
12928 
12929       ---------------------------------------------------------------
12930       -- START OF BEN_PSTN_RT_F ----------------------
12931       ---------------------------------------------------------------
12932       --
12933       hr_utility.set_location('START OF BEN_PSTN_RT_F ',100);
12934       for l_parent_rec  in c_pst_from_parent(l_VRBL_RT_PRFL_ID) loop
12935          --
12936          l_mirror_src_entity_result_id := l_out_vpf_result_id ;
12937 
12938          --
12939          l_pstn_rt_id := l_parent_rec.pstn_rt_id ;
12940          --
12941          for l_pst_rec in c_pst(l_parent_rec.pstn_rt_id,l_mirror_src_entity_result_id,'PST') loop
12942            --
12943            l_table_route_id := null ;
12944            open ben_plan_design_program_module.g_table_route('PST');
12945            fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
12946            close ben_plan_design_program_module.g_table_route ;
12947            --
12948            l_information5  := ben_plan_design_program_module.get_position_name(l_pst_rec.position_id)
12949                               || ben_plan_design_program_module.get_exclude_message(l_pst_rec.excld_flag);
12950                               --'Intersection';
12951            --
12952            if p_effective_date between l_pst_rec.effective_start_date
12953               and l_pst_rec.effective_end_date then
12954             --
12955               l_result_type_cd := 'DISPLAY';
12956            else
12957               l_result_type_cd := 'NO DISPLAY';
12958            end if;
12959              --
12960            --
12961            -- pabodla : MAPPING DATA : Store the mapping column information.
12962            --
12963 
12964            l_mapping_name := null;
12965            l_mapping_id   := null;
12966            --
12967            -- Get the position name to display on mapping page.
12968            --
12969            open c_get_mapping_name14(l_pst_rec.position_id);
12970            fetch c_get_mapping_name14 into l_mapping_name;
12971            close c_get_mapping_name14;
12972            --
12973            l_mapping_id   := l_pst_rec.position_id;
12974            --
12975            --To set user friendly labels on the mapping page
12976            --
12977            l_mapping_column_name1 := null;
12978            l_mapping_column_name2 :=null;
12979            BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
12980                                                             l_mapping_column_name1,
12981                                                             l_mapping_column_name2,
12982                                                             p_copy_entity_txn_id);
12983            --
12984            hr_utility.set_location('l_mapping_id '||l_mapping_id,100);
12985            hr_utility.set_location('l_mapping_name '||l_mapping_name,100);
12986 
12987            -- To store effective_start_date of position
12988            -- for Mapping - Bug 2958658
12989            --
12990            l_position_start_date := null;
12991            if l_pst_rec.position_id is not null then
12992              open c_position_start_date(l_pst_rec.position_id);
12993              fetch c_position_start_date into l_position_start_date;
12994              close c_position_start_date;
12995            end if;
12996 
12997            l_copy_entity_result_id := null;
12998            l_object_version_number := null;
12999            ben_copy_entity_results_api.create_copy_entity_results(
13000              p_copy_entity_result_id          => l_copy_entity_result_id,
13001              p_copy_entity_txn_id             => p_copy_entity_txn_id,
13002              p_result_type_cd                 => l_result_type_cd,
13003              p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
13004              p_parent_entity_result_id        => l_mirror_src_entity_result_id,
13005              p_number_of_copies               => l_number_of_copies,
13006              p_table_route_id                 => l_table_route_id,
13007 	     P_TABLE_ALIAS                    => 'PST',
13008              p_information1     => l_pst_rec.pstn_rt_id,
13009              p_information2     => l_pst_rec.EFFECTIVE_START_DATE,
13010              p_information3     => l_pst_rec.EFFECTIVE_END_DATE,
13011              p_information4     => l_pst_rec.business_group_id,
13012              p_information5     => l_information5 , -- 9999 put name for h-grid
13013 
13014             p_information11     => l_pst_rec.excld_flag,
13015             p_information257     => l_pst_rec.ordr_num,
13016             -- Data for MAPPING columns.
13017             p_information173    => l_mapping_name,
13018             p_information174    => l_mapping_id,
13019             p_information181    => l_mapping_column_name1,
13020             p_information182    => l_mapping_column_name2,
13021             -- END other product Mapping columns.
13022             p_information111     => l_pst_rec.pst_attribute1,
13023             p_information120     => l_pst_rec.pst_attribute10,
13024             p_information121     => l_pst_rec.pst_attribute11,
13025             p_information122     => l_pst_rec.pst_attribute12,
13026             p_information123     => l_pst_rec.pst_attribute13,
13027             p_information124     => l_pst_rec.pst_attribute14,
13028             p_information125     => l_pst_rec.pst_attribute15,
13029             p_information126     => l_pst_rec.pst_attribute16,
13030             p_information127     => l_pst_rec.pst_attribute17,
13031             p_information128     => l_pst_rec.pst_attribute18,
13032             p_information129     => l_pst_rec.pst_attribute19,
13033             p_information112     => l_pst_rec.pst_attribute2,
13034             p_information130     => l_pst_rec.pst_attribute20,
13035             p_information131     => l_pst_rec.pst_attribute21,
13036             p_information132     => l_pst_rec.pst_attribute22,
13037             p_information133     => l_pst_rec.pst_attribute23,
13038             p_information134     => l_pst_rec.pst_attribute24,
13039             p_information135     => l_pst_rec.pst_attribute25,
13040             p_information136     => l_pst_rec.pst_attribute26,
13041             p_information137     => l_pst_rec.pst_attribute27,
13042             p_information138     => l_pst_rec.pst_attribute28,
13043             p_information139     => l_pst_rec.pst_attribute29,
13044             p_information113     => l_pst_rec.pst_attribute3,
13045             p_information140     => l_pst_rec.pst_attribute30,
13046             p_information114     => l_pst_rec.pst_attribute4,
13047             p_information115     => l_pst_rec.pst_attribute5,
13048             p_information116     => l_pst_rec.pst_attribute6,
13049             p_information117     => l_pst_rec.pst_attribute7,
13050             p_information118     => l_pst_rec.pst_attribute8,
13051             p_information119     => l_pst_rec.pst_attribute9,
13052             p_information110     => l_pst_rec.pst_attribute_category,
13053             p_information262     => l_pst_rec.vrbl_rt_prfl_id,
13054             p_information166     => l_position_start_date,
13055             p_information265     => l_pst_rec.object_version_number,
13056            --
13057 
13058              p_object_version_number          => l_object_version_number,
13059              p_effective_date                 => p_effective_date       );
13060              --
13061 
13062             if l_out_pst_result_id is null then
13063               l_out_pst_result_id := l_copy_entity_result_id;
13064             end if;
13065 
13066             if l_result_type_cd = 'DISPLAY' then
13067                 l_out_pst_result_id := l_copy_entity_result_id ;
13068              end if;
13069              --
13070           end loop;
13071           --
13072         end loop;
13073       hr_utility.set_location('END OF BEN_PSTN_RT_F ',100);
13074      ---------------------------------------------------------------
13075      -- END OF BEN_PSTN_RT_F ----------------------
13076      ---------------------------------------------------------------
13077       ---------------------------------------------------------------
13078       -- START OF BEN_QUAL_TITL_RT_F ----------------------
13079       ---------------------------------------------------------------
13080       --
13081       hr_utility.set_location('START OF BEN_QUAL_TITL_RT_F ',100);
13082       for l_parent_rec  in c_qtr_from_parent(l_VRBL_RT_PRFL_ID) loop
13083          --
13084          l_mirror_src_entity_result_id := l_out_vpf_result_id ;
13085 
13086          --
13087          l_qual_titl_rt_id := l_parent_rec.qual_titl_rt_id ;
13088          --
13089          for l_qtr_rec in c_qtr(l_parent_rec.qual_titl_rt_id,l_mirror_src_entity_result_id,'QTR') loop
13090            --
13091            l_table_route_id := null ;
13092            open ben_plan_design_program_module.g_table_route('QTR');
13093            fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
13094            close ben_plan_design_program_module.g_table_route ;
13095            --
13096            l_information5  := ben_plan_design_program_module.get_qual_type_name(l_qtr_rec.qualification_type_id)
13097                               || ben_plan_design_program_module.get_exclude_message(l_qtr_rec.excld_flag);
13098                               --'Intersection';
13099            --
13100            if p_effective_date between l_qtr_rec.effective_start_date
13101               and l_qtr_rec.effective_end_date then
13102             --
13103               l_result_type_cd := 'DISPLAY';
13104            else
13105               l_result_type_cd := 'NO DISPLAY';
13106            end if;
13107              --
13108            --
13109            -- pabodla : MAPPING DATA : Store the mapping column information.
13110            --
13111 
13112            l_mapping_name := null;
13113            l_mapping_id   := null;
13114            --
13115            -- Get the qualification_type name to display on mapping page.
13116            --
13117            open c_get_mapping_name15(l_qtr_rec.qualification_type_id);
13118            fetch c_get_mapping_name15 into l_mapping_name;
13119            close c_get_mapping_name15;
13120            --
13121            l_mapping_id   := l_qtr_rec.qualification_type_id;
13122            --
13123            --To set user friendly labels on the mapping page
13124            --
13125            l_mapping_column_name1 := null;
13126            l_mapping_column_name2 :=null;
13127            BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
13128                                                             l_mapping_column_name1,
13129                                                             l_mapping_column_name2,
13130                                                             p_copy_entity_txn_id);
13131            --
13132            hr_utility.set_location('l_mapping_id '||l_mapping_id,100);
13133            hr_utility.set_location('l_mapping_name '||l_mapping_name,100);
13134            --
13135 
13136            l_copy_entity_result_id := null;
13137            l_object_version_number := null;
13138            ben_copy_entity_results_api.create_copy_entity_results(
13139              p_copy_entity_result_id          => l_copy_entity_result_id,
13140              p_copy_entity_txn_id             => p_copy_entity_txn_id,
13141              p_result_type_cd                 => l_result_type_cd,
13142              p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
13143              p_parent_entity_result_id        => l_mirror_src_entity_result_id,
13144              p_number_of_copies               => l_number_of_copies,
13145              p_table_route_id                 => l_table_route_id,
13146 	     P_TABLE_ALIAS                    => 'QTR',
13147              p_information1     => l_qtr_rec.qual_titl_rt_id,
13148              p_information2     => l_qtr_rec.EFFECTIVE_START_DATE,
13149              p_information3     => l_qtr_rec.EFFECTIVE_END_DATE,
13150              p_information4     => l_qtr_rec.business_group_id,
13151              p_information5     => l_information5 , -- 9999 put name for h-grid
13152 
13153             p_information11     => l_qtr_rec.excld_flag,
13154             p_information260     => l_qtr_rec.ordr_num,
13155             p_information111     => l_qtr_rec.qtr_attribute1,
13156             p_information120     => l_qtr_rec.qtr_attribute10,
13157             p_information121     => l_qtr_rec.qtr_attribute11,
13158             p_information122     => l_qtr_rec.qtr_attribute12,
13159             p_information123     => l_qtr_rec.qtr_attribute13,
13160             p_information124     => l_qtr_rec.qtr_attribute14,
13161             p_information125     => l_qtr_rec.qtr_attribute15,
13162             p_information126     => l_qtr_rec.qtr_attribute16,
13163             p_information127     => l_qtr_rec.qtr_attribute17,
13164             p_information128     => l_qtr_rec.qtr_attribute18,
13165             p_information129     => l_qtr_rec.qtr_attribute19,
13166             p_information112     => l_qtr_rec.qtr_attribute2,
13167             p_information130     => l_qtr_rec.qtr_attribute20,
13168             p_information131     => l_qtr_rec.qtr_attribute21,
13169             p_information132     => l_qtr_rec.qtr_attribute22,
13170             p_information133     => l_qtr_rec.qtr_attribute23,
13171             p_information134     => l_qtr_rec.qtr_attribute24,
13172             p_information135     => l_qtr_rec.qtr_attribute25,
13173             p_information136     => l_qtr_rec.qtr_attribute26,
13174             p_information137     => l_qtr_rec.qtr_attribute27,
13175             p_information138     => l_qtr_rec.qtr_attribute28,
13176             p_information139     => l_qtr_rec.qtr_attribute29,
13177             p_information113     => l_qtr_rec.qtr_attribute3,
13178             p_information140     => l_qtr_rec.qtr_attribute30,
13179             p_information114     => l_qtr_rec.qtr_attribute4,
13180             p_information115     => l_qtr_rec.qtr_attribute5,
13181             p_information116     => l_qtr_rec.qtr_attribute6,
13182             p_information117     => l_qtr_rec.qtr_attribute7,
13183             p_information118     => l_qtr_rec.qtr_attribute8,
13184             p_information119     => l_qtr_rec.qtr_attribute9,
13185             p_information110     => l_qtr_rec.qtr_attribute_category,
13186             -- Data for MAPPING columns.
13187             p_information173    => l_mapping_name,
13188             p_information174    => l_mapping_id,
13189             p_information181    => l_mapping_column_name1,
13190             p_information182    => l_mapping_column_name2,
13191             -- END other product Mapping columns.
13192             p_information141     => l_qtr_rec.title,
13193             p_information262     => l_qtr_rec.vrbl_rt_prfl_id,
13194             p_information166     => NULL,  -- No ESD for Qualification Type
13195             p_information265     => l_qtr_rec.object_version_number,
13196            --
13197 
13198              p_object_version_number          => l_object_version_number,
13199              p_effective_date                 => p_effective_date       );
13200              --
13201 
13202              if l_out_qtr_result_id is null then
13203                l_out_qtr_result_id := l_copy_entity_result_id;
13204              end if;
13205 
13206              if l_result_type_cd = 'DISPLAY' then
13207                 l_out_qtr_result_id := l_copy_entity_result_id ;
13208              end if;
13209              --
13210           end loop;
13211           --
13212         end loop;
13213       hr_utility.set_location('END OF BEN_QUAL_TITL_RT_F ',100);
13214      ---------------------------------------------------------------
13215      -- END OF BEN_QUAL_TITL_RT_F ----------------------
13216      ---------------------------------------------------------------
13217        ---------------------------------------------------------------
13218        -- START OF BEN_CBR_QUALD_BNF_RT_F ----------------------
13219        ---------------------------------------------------------------
13220        --
13221        for l_parent_rec  in c_cqr_from_parent(l_VRBL_RT_PRFL_ID) loop
13222           --
13223           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
13224           --
13225           l_cbr_quald_bnf_rt_id := l_parent_rec.cbr_quald_bnf_rt_id ;
13226           --
13227           for l_cqr_rec in c_cqr(l_parent_rec.cbr_quald_bnf_rt_id,l_mirror_src_entity_result_id,'CQR') loop
13228             --
13229             l_table_route_id := null ;
13230             open ben_plan_design_program_module.g_table_route('CQR');
13231               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
13232             close ben_plan_design_program_module.g_table_route ;
13233             --
13234             l_information5  := ben_plan_design_program_module.get_cbr_quald_bnf_name(l_cqr_rec.ptip_id
13235                                                                                     ,l_cqr_rec.pgm_id
13236                                                                                     ,p_effective_date);
13237                                --'Intersection';
13238             --
13239             if p_effective_date between l_cqr_rec.effective_start_date
13240                and l_cqr_rec.effective_end_date then
13241              --
13242                l_result_type_cd := 'DISPLAY';
13243             else
13244                l_result_type_cd := 'NO DISPLAY';
13245             end if;
13246               --
13247             l_copy_entity_result_id := null;
13248             l_object_version_number := null;
13249             ben_copy_entity_results_api.create_copy_entity_results(
13250               p_copy_entity_result_id           => l_copy_entity_result_id,
13251               p_copy_entity_txn_id             => p_copy_entity_txn_id,
13252               p_result_type_cd                 => l_result_type_cd,
13253               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
13254               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
13255               p_number_of_copies               => l_number_of_copies,
13256               p_table_route_id                 => l_table_route_id,
13257 	      P_TABLE_ALIAS                    => 'CQR',
13258               p_information1     => l_cqr_rec.cbr_quald_bnf_rt_id,
13259               p_information2     => l_cqr_rec.EFFECTIVE_START_DATE,
13260               p_information3     => l_cqr_rec.EFFECTIVE_END_DATE,
13261               p_information4     => l_cqr_rec.business_group_id,
13262               p_information5     => l_information5 , -- 9999 put name for h-grid
13263             p_information111     => l_cqr_rec.cqr_attribute1,
13264             p_information120     => l_cqr_rec.cqr_attribute10,
13265             p_information121     => l_cqr_rec.cqr_attribute11,
13266             p_information122     => l_cqr_rec.cqr_attribute12,
13267             p_information123     => l_cqr_rec.cqr_attribute13,
13268             p_information124     => l_cqr_rec.cqr_attribute14,
13269             p_information125     => l_cqr_rec.cqr_attribute15,
13270             p_information126     => l_cqr_rec.cqr_attribute16,
13271             p_information127     => l_cqr_rec.cqr_attribute17,
13272             p_information128     => l_cqr_rec.cqr_attribute18,
13273             p_information129     => l_cqr_rec.cqr_attribute19,
13274             p_information112     => l_cqr_rec.cqr_attribute2,
13275             p_information130     => l_cqr_rec.cqr_attribute20,
13276             p_information131     => l_cqr_rec.cqr_attribute21,
13277             p_information132     => l_cqr_rec.cqr_attribute22,
13278             p_information133     => l_cqr_rec.cqr_attribute23,
13279             p_information134     => l_cqr_rec.cqr_attribute24,
13280             p_information135     => l_cqr_rec.cqr_attribute25,
13281             p_information136     => l_cqr_rec.cqr_attribute26,
13282             p_information137     => l_cqr_rec.cqr_attribute27,
13283             p_information138     => l_cqr_rec.cqr_attribute28,
13284             p_information139     => l_cqr_rec.cqr_attribute29,
13285             p_information113     => l_cqr_rec.cqr_attribute3,
13286             p_information140     => l_cqr_rec.cqr_attribute30,
13287             p_information114     => l_cqr_rec.cqr_attribute4,
13288             p_information115     => l_cqr_rec.cqr_attribute5,
13289             p_information116     => l_cqr_rec.cqr_attribute6,
13290             p_information117     => l_cqr_rec.cqr_attribute7,
13291             p_information118     => l_cqr_rec.cqr_attribute8,
13292             p_information119     => l_cqr_rec.cqr_attribute9,
13293             p_information110     => l_cqr_rec.cqr_attribute_category,
13294             p_information257     => l_cqr_rec.ordr_num,
13295             p_information260     => l_cqr_rec.pgm_id,
13296             p_information259     => l_cqr_rec.ptip_id,
13297             p_information11     => l_cqr_rec.quald_bnf_flag,
13298             p_information262     => l_cqr_rec.vrbl_rt_prfl_id,
13299             p_information265     => l_cqr_rec.object_version_number,
13300 
13301               p_object_version_number          => l_object_version_number,
13302               p_effective_date                 => p_effective_date       );
13303               --
13304 
13305               if l_out_cqr_result_id is null then
13306                 l_out_cqr_result_id := l_copy_entity_result_id;
13307               end if;
13308 
13309               if l_result_type_cd = 'DISPLAY' then
13310                  l_out_cqr_result_id := l_copy_entity_result_id ;
13311               end if;
13312               --
13313            end loop;
13314            --
13315          end loop;
13316       ---------------------------------------------------------------
13317       -- END OF BEN_CBR_QUALD_BNF_RT_F ----------------------
13318       ---------------------------------------------------------------
13319        ---------------------------------------------------------------
13320        -- START OF BEN_CNTNG_PRTN_PRFL_RT_F ----------------------
13321        ---------------------------------------------------------------
13322        --
13323        for l_parent_rec  in c_cpn_from_parent(l_VRBL_RT_PRFL_ID) loop
13324           --
13325           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
13326           --
13327           l_cntng_prtn_prfl_rt_id := l_parent_rec.cntng_prtn_prfl_rt_id ;
13328           --
13329           for l_cpn_rec in c_cpn(l_parent_rec.cntng_prtn_prfl_rt_id,l_mirror_src_entity_result_id,'CPN') loop
13330             --
13331             l_table_route_id := null ;
13332             open ben_plan_design_program_module.g_table_route('CPN');
13333               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
13334             close ben_plan_design_program_module.g_table_route ;
13335             --
13336             l_information5  := l_cpn_rec.pymt_must_be_rcvd_num ||' '||
13337                                hr_general.decode_lookup('BEN_TM_UOM', l_cpn_rec.pymt_must_be_rcvd_uom);
13338                                --'Intersection';
13339 
13340             if p_effective_date between l_cpn_rec.effective_start_date
13341                and l_cpn_rec.effective_end_date then
13342              --
13343                l_result_type_cd := 'DISPLAY';
13344             else
13345                l_result_type_cd := 'NO DISPLAY';
13346             end if;
13347               --
13348             l_copy_entity_result_id := null;
13349             l_object_version_number := null;
13350             ben_copy_entity_results_api.create_copy_entity_results(
13351               p_copy_entity_result_id           => l_copy_entity_result_id,
13352               p_copy_entity_txn_id             => p_copy_entity_txn_id,
13353               p_result_type_cd                 => l_result_type_cd,
13354               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
13355               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
13356               p_number_of_copies               => l_number_of_copies,
13357               p_table_route_id                 => l_table_route_id,
13358 	      P_TABLE_ALIAS                    => 'CPN',
13359               p_information1     => l_cpn_rec.cntng_prtn_prfl_rt_id,
13360               p_information2     => l_cpn_rec.EFFECTIVE_START_DATE,
13361               p_information3     => l_cpn_rec.EFFECTIVE_END_DATE,
13362               p_information4     => l_cpn_rec.business_group_id,
13363               p_information5     => l_information5 , -- 9999 put name for h-grid
13364             p_information111     => l_cpn_rec.cpn_attribute1,
13365             p_information120     => l_cpn_rec.cpn_attribute10,
13366             p_information121     => l_cpn_rec.cpn_attribute11,
13367             p_information122     => l_cpn_rec.cpn_attribute12,
13368             p_information123     => l_cpn_rec.cpn_attribute13,
13369             p_information124     => l_cpn_rec.cpn_attribute14,
13370             p_information125     => l_cpn_rec.cpn_attribute15,
13371             p_information126     => l_cpn_rec.cpn_attribute16,
13372             p_information127     => l_cpn_rec.cpn_attribute17,
13373             p_information128     => l_cpn_rec.cpn_attribute18,
13374             p_information129     => l_cpn_rec.cpn_attribute19,
13375             p_information112     => l_cpn_rec.cpn_attribute2,
13376             p_information130     => l_cpn_rec.cpn_attribute20,
13377             p_information131     => l_cpn_rec.cpn_attribute21,
13378             p_information132     => l_cpn_rec.cpn_attribute22,
13379             p_information133     => l_cpn_rec.cpn_attribute23,
13380             p_information134     => l_cpn_rec.cpn_attribute24,
13381             p_information135     => l_cpn_rec.cpn_attribute25,
13382             p_information136     => l_cpn_rec.cpn_attribute26,
13383             p_information137     => l_cpn_rec.cpn_attribute27,
13384             p_information138     => l_cpn_rec.cpn_attribute28,
13385             p_information139     => l_cpn_rec.cpn_attribute29,
13386             p_information113     => l_cpn_rec.cpn_attribute3,
13387             p_information140     => l_cpn_rec.cpn_attribute30,
13388             p_information114     => l_cpn_rec.cpn_attribute4,
13389             p_information115     => l_cpn_rec.cpn_attribute5,
13390             p_information116     => l_cpn_rec.cpn_attribute6,
13391             p_information117     => l_cpn_rec.cpn_attribute7,
13392             p_information118     => l_cpn_rec.cpn_attribute8,
13393             p_information119     => l_cpn_rec.cpn_attribute9,
13394             p_information110     => l_cpn_rec.cpn_attribute_category,
13395             p_information170     => l_cpn_rec.name,
13396             p_information260     => l_cpn_rec.pymt_must_be_rcvd_num,
13397             p_information261     => l_cpn_rec.pymt_must_be_rcvd_rl,
13398             p_information11     => l_cpn_rec.pymt_must_be_rcvd_uom,
13399             p_information262     => l_cpn_rec.vrbl_rt_prfl_id,
13400             p_information265    => l_cpn_rec.object_version_number,
13401 
13402               p_object_version_number          => l_object_version_number,
13403               p_effective_date                 => p_effective_date       );
13404               --
13405 
13406               if l_out_cpn_result_id is null then
13407                 l_out_cpn_result_id := l_copy_entity_result_id;
13408               end if;
13409 
13410               if l_result_type_cd = 'DISPLAY' then
13411                  l_out_cpn_result_id := l_copy_entity_result_id ;
13412               end if;
13413               --
13414               -- Copy Fast Formulas if any are attached to any column --
13415               ---------------------------------------------------------------
13416               -- PYMT_MUST_BE_RCVD_RL -----------------
13417               ---------------------------------------------------------------
13418 
13419               if l_cpn_rec.pymt_must_be_rcvd_rl is not null then
13420                     --
13421                     ben_plan_design_program_module.create_formula_result
13422                     (
13423                      p_validate                       =>  0
13424                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
13425                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
13426                     ,p_formula_id                     =>  l_cpn_rec.pymt_must_be_rcvd_rl
13427                     ,p_business_group_id              =>  l_cpn_rec.business_group_id
13428                     ,p_number_of_copies               =>  l_number_of_copies
13429                     ,p_object_version_number          =>  l_object_version_number
13430                     ,p_effective_date                 =>  p_effective_date
13431                     );
13432 
13433                     --
13434               end if;
13435 
13436            end loop;
13437            --
13438          end loop;
13439       ---------------------------------------------------------------
13440       -- END OF BEN_CNTNG_PRTN_PRFL_RT_F ----------------------
13441       ---------------------------------------------------------------
13442        ---------------------------------------------------------------
13443        -- START OF BEN_DPNT_CVRD_OTHR_PL_RT_F ----------------------
13444        ---------------------------------------------------------------
13445        --
13446        for l_parent_rec  in c_dcl_from_parent(l_VRBL_RT_PRFL_ID) loop
13447           --
13448           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
13449           --
13450           l_dpnt_cvrd_othr_pl_rt_id := l_parent_rec.dpnt_cvrd_othr_pl_rt_id ;
13451           --
13452           for l_dcl_rec in c_dcl(l_parent_rec.dpnt_cvrd_othr_pl_rt_id,l_mirror_src_entity_result_id,'DCL') loop
13453             --
13454             l_table_route_id := null ;
13455             open ben_plan_design_program_module.g_table_route('DCL');
13456               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
13457             close ben_plan_design_program_module.g_table_route ;
13458             --
13459             l_information5  := ben_plan_design_program_module.get_pl_name(l_dcl_rec.pl_id,p_effective_date)
13460                                || ben_plan_design_program_module.get_exclude_message(l_dcl_rec.excld_flag);
13461                                --'Intersection';
13462             --
13463             if p_effective_date between l_dcl_rec.effective_start_date
13464                and l_dcl_rec.effective_end_date then
13465              --
13466                l_result_type_cd := 'DISPLAY';
13467             else
13468                l_result_type_cd := 'NO DISPLAY';
13469             end if;
13470               --
13471             l_copy_entity_result_id := null;
13472             l_object_version_number := null;
13473             ben_copy_entity_results_api.create_copy_entity_results(
13474               p_copy_entity_result_id           => l_copy_entity_result_id,
13475               p_copy_entity_txn_id             => p_copy_entity_txn_id,
13476               p_result_type_cd                 => l_result_type_cd,
13477               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
13478               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
13479               p_number_of_copies               => l_number_of_copies,
13480               p_table_route_id                 => l_table_route_id,
13481 	      P_TABLE_ALIAS                    => 'DCL',
13482               p_information1     => l_dcl_rec.dpnt_cvrd_othr_pl_rt_id,
13483               p_information2     => l_dcl_rec.EFFECTIVE_START_DATE,
13484               p_information3     => l_dcl_rec.EFFECTIVE_END_DATE,
13485               p_information4     => l_dcl_rec.business_group_id,
13486               p_information5     => l_information5 , -- 9999 put name for h-grid
13487             p_information12     => l_dcl_rec.cvg_det_dt_cd,
13488             p_information111     => l_dcl_rec.dcl_attribute1,
13489             p_information120     => l_dcl_rec.dcl_attribute10,
13490             p_information121     => l_dcl_rec.dcl_attribute11,
13491             p_information122     => l_dcl_rec.dcl_attribute12,
13492             p_information123     => l_dcl_rec.dcl_attribute13,
13493             p_information124     => l_dcl_rec.dcl_attribute14,
13494             p_information125     => l_dcl_rec.dcl_attribute15,
13495             p_information126     => l_dcl_rec.dcl_attribute16,
13496             p_information127     => l_dcl_rec.dcl_attribute17,
13497             p_information128     => l_dcl_rec.dcl_attribute18,
13498             p_information129     => l_dcl_rec.dcl_attribute19,
13499             p_information112     => l_dcl_rec.dcl_attribute2,
13500             p_information130     => l_dcl_rec.dcl_attribute20,
13501             p_information131     => l_dcl_rec.dcl_attribute21,
13502             p_information132     => l_dcl_rec.dcl_attribute22,
13503             p_information133     => l_dcl_rec.dcl_attribute23,
13504             p_information134     => l_dcl_rec.dcl_attribute24,
13505             p_information135     => l_dcl_rec.dcl_attribute25,
13506             p_information136     => l_dcl_rec.dcl_attribute26,
13507             p_information137     => l_dcl_rec.dcl_attribute27,
13508             p_information138     => l_dcl_rec.dcl_attribute28,
13509             p_information139     => l_dcl_rec.dcl_attribute29,
13510             p_information113     => l_dcl_rec.dcl_attribute3,
13511             p_information140     => l_dcl_rec.dcl_attribute30,
13512             p_information114     => l_dcl_rec.dcl_attribute4,
13513             p_information115     => l_dcl_rec.dcl_attribute5,
13514             p_information116     => l_dcl_rec.dcl_attribute6,
13515             p_information117     => l_dcl_rec.dcl_attribute7,
13516             p_information118     => l_dcl_rec.dcl_attribute8,
13517             p_information119     => l_dcl_rec.dcl_attribute9,
13518             p_information110     => l_dcl_rec.dcl_attribute_category,
13519             p_information11     => l_dcl_rec.excld_flag,
13520             p_information257     => l_dcl_rec.ordr_num,
13521             p_information261     => l_dcl_rec.pl_id,
13522             p_information262     => l_dcl_rec.vrbl_rt_prfl_id,
13523             p_information265     => l_dcl_rec.object_version_number,
13524 
13525               p_object_version_number          => l_object_version_number,
13526               p_effective_date                 => p_effective_date       );
13527               --
13528 
13529               if l_out_dcl_result_id is null then
13530                  l_out_dcl_result_id := l_copy_entity_result_id;
13531               end if;
13532 
13533               if l_result_type_cd = 'DISPLAY' then
13534                  l_out_dcl_result_id := l_copy_entity_result_id ;
13535               end if;
13536               --
13537            end loop;
13538            --
13539          end loop;
13540       ---------------------------------------------------------------
13541       -- END OF BEN_DPNT_CVRD_OTHR_PL_RT_F ----------------------
13542       ---------------------------------------------------------------
13543        ---------------------------------------------------------------
13544        -- START OF BEN_DPNT_CVRD_PLIP_RT_F ----------------------
13545        ---------------------------------------------------------------
13546        --
13547        for l_parent_rec  in c_dcp_from_parent(l_VRBL_RT_PRFL_ID) loop
13548           --
13549           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
13550           --
13551           l_dpnt_cvrd_plip_rt_id := l_parent_rec.dpnt_cvrd_plip_rt_id ;
13552           --
13553           for l_dcp_rec in c_dcp(l_parent_rec.dpnt_cvrd_plip_rt_id,l_mirror_src_entity_result_id,'DCP') loop
13554             --
13555             l_table_route_id := null ;
13556             open ben_plan_design_program_module.g_table_route('DCP');
13557               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
13558             close ben_plan_design_program_module.g_table_route ;
13559             --
13560             l_information5  := ben_plan_design_program_module.get_plip_name(l_dcp_rec.plip_id,p_effective_date)
13561                                || ben_plan_design_program_module.get_exclude_message(l_dcp_rec.excld_flag);
13562                                --'Intersection';
13563             --
13564             if p_effective_date between l_dcp_rec.effective_start_date
13565                and l_dcp_rec.effective_end_date then
13566              --
13567                l_result_type_cd := 'DISPLAY';
13568             else
13569                l_result_type_cd := 'NO DISPLAY';
13570             end if;
13571               --
13572             l_copy_entity_result_id := null;
13573             l_object_version_number := null;
13574             ben_copy_entity_results_api.create_copy_entity_results(
13575               p_copy_entity_result_id           => l_copy_entity_result_id,
13576               p_copy_entity_txn_id             => p_copy_entity_txn_id,
13577               p_result_type_cd                 => l_result_type_cd,
13578               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
13579               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
13580               p_number_of_copies               => l_number_of_copies,
13581               p_table_route_id                 => l_table_route_id,
13582 	      P_TABLE_ALIAS                    => 'DCP',
13583               p_information1     => l_dcp_rec.dpnt_cvrd_plip_rt_id,
13584               p_information2     => l_dcp_rec.EFFECTIVE_START_DATE,
13585               p_information3     => l_dcp_rec.EFFECTIVE_END_DATE,
13586               p_information4     => l_dcp_rec.business_group_id,
13587               p_information5     => l_information5 , -- 9999 put name for h-grid
13588             p_information111     => l_dcp_rec.dcp_attribute1,
13589             p_information120     => l_dcp_rec.dcp_attribute10,
13590             p_information121     => l_dcp_rec.dcp_attribute11,
13591             p_information122     => l_dcp_rec.dcp_attribute12,
13592             p_information123     => l_dcp_rec.dcp_attribute13,
13593             p_information124     => l_dcp_rec.dcp_attribute14,
13594             p_information125     => l_dcp_rec.dcp_attribute15,
13595             p_information126     => l_dcp_rec.dcp_attribute16,
13596             p_information127     => l_dcp_rec.dcp_attribute17,
13597             p_information128     => l_dcp_rec.dcp_attribute18,
13598             p_information129     => l_dcp_rec.dcp_attribute19,
13599             p_information112     => l_dcp_rec.dcp_attribute2,
13600             p_information130     => l_dcp_rec.dcp_attribute20,
13601             p_information131     => l_dcp_rec.dcp_attribute21,
13602             p_information132     => l_dcp_rec.dcp_attribute22,
13603             p_information133     => l_dcp_rec.dcp_attribute23,
13604             p_information134     => l_dcp_rec.dcp_attribute24,
13605             p_information135     => l_dcp_rec.dcp_attribute25,
13606             p_information136     => l_dcp_rec.dcp_attribute26,
13607             p_information137     => l_dcp_rec.dcp_attribute27,
13608             p_information138     => l_dcp_rec.dcp_attribute28,
13609             p_information139     => l_dcp_rec.dcp_attribute29,
13610             p_information113     => l_dcp_rec.dcp_attribute3,
13611             p_information140     => l_dcp_rec.dcp_attribute30,
13612             p_information114     => l_dcp_rec.dcp_attribute4,
13613             p_information115     => l_dcp_rec.dcp_attribute5,
13614             p_information116     => l_dcp_rec.dcp_attribute6,
13615             p_information117     => l_dcp_rec.dcp_attribute7,
13616             p_information118     => l_dcp_rec.dcp_attribute8,
13617             p_information119     => l_dcp_rec.dcp_attribute9,
13618             p_information110     => l_dcp_rec.dcp_attribute_category,
13619             p_information11     => l_dcp_rec.enrl_det_dt_cd,
13620             p_information12     => l_dcp_rec.excld_flag,
13621             p_information260     => l_dcp_rec.ordr_num,
13622             p_information256     => l_dcp_rec.plip_id,
13623             p_information262     => l_dcp_rec.vrbl_rt_prfl_id,
13624             p_information265     => l_dcp_rec.object_version_number,
13625            --
13626 
13627               p_object_version_number          => l_object_version_number,
13628               p_effective_date                 => p_effective_date       );
13629               --
13630 
13631               if l_out_dcp_result_id is null then
13632                 l_out_dcp_result_id := l_copy_entity_result_id;
13633               end if;
13634 
13635               if l_result_type_cd = 'DISPLAY' then
13636                  l_out_dcp_result_id := l_copy_entity_result_id ;
13637               end if;
13638               --
13639            end loop;
13640            --
13641          end loop;
13642       ---------------------------------------------------------------
13643       -- END OF BEN_DPNT_CVRD_PLIP_RT_F ----------------------
13644       ---------------------------------------------------------------
13645        ---------------------------------------------------------------
13646        -- START OF BEN_DPNT_CVRD_OTHR_PTIP_RT_F ----------------------
13647        ---------------------------------------------------------------
13648        --
13649        for l_parent_rec  in c_dco_from_parent(l_VRBL_RT_PRFL_ID) loop
13650           --
13651           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
13652           --
13653           l_dpnt_cvrd_othr_ptip_rt_id := l_parent_rec.dpnt_cvrd_othr_ptip_rt_id ;
13654           --
13655           for l_dco_rec in c_dco(l_parent_rec.dpnt_cvrd_othr_ptip_rt_id,l_mirror_src_entity_result_id,'DCO') loop
13656             --
13657             l_table_route_id := null ;
13658             open ben_plan_design_program_module.g_table_route('DCO');
13659               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
13660             close ben_plan_design_program_module.g_table_route ;
13661             --
13662             l_information5  := ben_plan_design_program_module.get_ptip_name(l_dco_rec.ptip_id,p_effective_date)
13663                                || ben_plan_design_program_module.get_exclude_message(l_dco_rec.excld_flag);
13664                                --'Intersection';
13665             --
13666             if p_effective_date between l_dco_rec.effective_start_date
13667                and l_dco_rec.effective_end_date then
13668              --
13669                l_result_type_cd := 'DISPLAY';
13670             else
13671                l_result_type_cd := 'NO DISPLAY';
13672             end if;
13673               --
13674             l_copy_entity_result_id := null;
13675             l_object_version_number := null;
13676             ben_copy_entity_results_api.create_copy_entity_results(
13677               p_copy_entity_result_id           => l_copy_entity_result_id,
13678               p_copy_entity_txn_id             => p_copy_entity_txn_id,
13679               p_result_type_cd                 => l_result_type_cd,
13680               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
13681               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
13682               p_number_of_copies               => l_number_of_copies,
13683               p_table_route_id                 => l_table_route_id,
13684 	      P_TABLE_ALIAS                    => 'DCO',
13685               p_information1     => l_dco_rec.dpnt_cvrd_othr_ptip_rt_id,
13686               p_information2     => l_dco_rec.EFFECTIVE_START_DATE,
13687               p_information3     => l_dco_rec.EFFECTIVE_END_DATE,
13688               p_information4     => l_dco_rec.business_group_id,
13689               p_information5     => l_information5 , -- 9999 put name for h-grid
13690             p_information111     => l_dco_rec.dco_attribute1,
13691             p_information120     => l_dco_rec.dco_attribute10,
13692             p_information121     => l_dco_rec.dco_attribute11,
13693             p_information122     => l_dco_rec.dco_attribute12,
13694             p_information123     => l_dco_rec.dco_attribute13,
13695             p_information124     => l_dco_rec.dco_attribute14,
13696             p_information125     => l_dco_rec.dco_attribute15,
13697             p_information126     => l_dco_rec.dco_attribute16,
13698             p_information127     => l_dco_rec.dco_attribute17,
13699             p_information128     => l_dco_rec.dco_attribute18,
13700             p_information129     => l_dco_rec.dco_attribute19,
13701             p_information112     => l_dco_rec.dco_attribute2,
13702             p_information130     => l_dco_rec.dco_attribute20,
13703             p_information131     => l_dco_rec.dco_attribute21,
13704             p_information132     => l_dco_rec.dco_attribute22,
13705             p_information133     => l_dco_rec.dco_attribute23,
13706             p_information134     => l_dco_rec.dco_attribute24,
13707             p_information135     => l_dco_rec.dco_attribute25,
13708             p_information136     => l_dco_rec.dco_attribute26,
13709             p_information137     => l_dco_rec.dco_attribute27,
13710             p_information138     => l_dco_rec.dco_attribute28,
13711             p_information139     => l_dco_rec.dco_attribute29,
13712             p_information113     => l_dco_rec.dco_attribute3,
13713             p_information140     => l_dco_rec.dco_attribute30,
13714             p_information114     => l_dco_rec.dco_attribute4,
13715             p_information115     => l_dco_rec.dco_attribute5,
13716             p_information116     => l_dco_rec.dco_attribute6,
13717             p_information117     => l_dco_rec.dco_attribute7,
13718             p_information118     => l_dco_rec.dco_attribute8,
13719             p_information119     => l_dco_rec.dco_attribute9,
13720             p_information110     => l_dco_rec.dco_attribute_category,
13721             p_information13     => l_dco_rec.enrl_det_dt_cd,
13722             p_information11     => l_dco_rec.excld_flag,
13723             p_information12     => l_dco_rec.only_pls_subj_cobra_flag,
13724             p_information261     => l_dco_rec.ordr_num,
13725             p_information259     => l_dco_rec.ptip_id,
13726             p_information262     => l_dco_rec.vrbl_rt_prfl_id,
13727             p_information265     => l_dco_rec.object_version_number,
13728 
13729               p_object_version_number          => l_object_version_number,
13730               p_effective_date                 => p_effective_date       );
13731               --
13732 
13733               if l_out_dco_result_id is null then
13734                 l_out_dco_result_id := l_copy_entity_result_id;
13735               end if;
13736 
13737               if l_result_type_cd = 'DISPLAY' then
13738                  l_out_dco_result_id := l_copy_entity_result_id ;
13739               end if;
13740               --
13741            end loop;
13742            --
13743          end loop;
13744       ---------------------------------------------------------------
13745       -- END OF BEN_DPNT_CVRD_OTHR_PTIP_RT_F ----------------------
13746       ---------------------------------------------------------------
13747        ---------------------------------------------------------------
13748        -- START OF BEN_DPNT_CVRD_OTHR_PGM_RT_F ----------------------
13749        ---------------------------------------------------------------
13750        --
13751        for l_parent_rec  in c_dop_from_parent(l_VRBL_RT_PRFL_ID) loop
13752           --
13753           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
13754           --
13755           l_dpnt_cvrd_othr_pgm_rt_id := l_parent_rec.dpnt_cvrd_othr_pgm_rt_id ;
13756           --
13757           for l_dop_rec in c_dop(l_parent_rec.dpnt_cvrd_othr_pgm_rt_id,l_mirror_src_entity_result_id,'DOP') loop
13758             --
13759             l_table_route_id := null ;
13760             open ben_plan_design_program_module.g_table_route('DOP');
13761               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
13762             close ben_plan_design_program_module.g_table_route ;
13763             --
13764             l_information5  := ben_plan_design_program_module.get_pgm_name(l_dop_rec.pgm_id,p_effective_date)
13765                                || ben_plan_design_program_module.get_exclude_message(l_dop_rec.excld_flag);
13766                                --'Intersection';
13767             --
13768             if p_effective_date between l_dop_rec.effective_start_date
13769                and l_dop_rec.effective_end_date then
13770              --
13771                l_result_type_cd := 'DISPLAY';
13772             else
13773                l_result_type_cd := 'NO DISPLAY';
13774             end if;
13775               --
13776             l_copy_entity_result_id := null;
13777             l_object_version_number := null;
13778             ben_copy_entity_results_api.create_copy_entity_results(
13779               p_copy_entity_result_id           => l_copy_entity_result_id,
13780               p_copy_entity_txn_id             => p_copy_entity_txn_id,
13781               p_result_type_cd                 => l_result_type_cd,
13782               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
13783               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
13784               p_number_of_copies               => l_number_of_copies,
13785               p_table_route_id                 => l_table_route_id,
13786 	      P_TABLE_ALIAS                    => 'DOP',
13787               p_information1     => l_dop_rec.dpnt_cvrd_othr_pgm_rt_id,
13788               p_information2     => l_dop_rec.EFFECTIVE_START_DATE,
13789               p_information3     => l_dop_rec.EFFECTIVE_END_DATE,
13790               p_information4     => l_dop_rec.business_group_id,
13791               p_information5     => l_information5 , -- 9999 put name for h-grid
13792             p_information111     => l_dop_rec.dop_attribute1,
13793             p_information120     => l_dop_rec.dop_attribute10,
13794             p_information121     => l_dop_rec.dop_attribute11,
13795             p_information122     => l_dop_rec.dop_attribute12,
13796             p_information123     => l_dop_rec.dop_attribute13,
13797             p_information124     => l_dop_rec.dop_attribute14,
13798             p_information125     => l_dop_rec.dop_attribute15,
13799             p_information126     => l_dop_rec.dop_attribute16,
13800             p_information127     => l_dop_rec.dop_attribute17,
13801             p_information128     => l_dop_rec.dop_attribute18,
13802             p_information129     => l_dop_rec.dop_attribute19,
13803             p_information112     => l_dop_rec.dop_attribute2,
13804             p_information130     => l_dop_rec.dop_attribute20,
13805             p_information131     => l_dop_rec.dop_attribute21,
13806             p_information132     => l_dop_rec.dop_attribute22,
13807             p_information133     => l_dop_rec.dop_attribute23,
13808             p_information134     => l_dop_rec.dop_attribute24,
13809             p_information135     => l_dop_rec.dop_attribute25,
13810             p_information136     => l_dop_rec.dop_attribute26,
13811             p_information137     => l_dop_rec.dop_attribute27,
13812             p_information138     => l_dop_rec.dop_attribute28,
13813             p_information139     => l_dop_rec.dop_attribute29,
13814             p_information113     => l_dop_rec.dop_attribute3,
13815             p_information140     => l_dop_rec.dop_attribute30,
13816             p_information114     => l_dop_rec.dop_attribute4,
13817             p_information115     => l_dop_rec.dop_attribute5,
13818             p_information116     => l_dop_rec.dop_attribute6,
13819             p_information117     => l_dop_rec.dop_attribute7,
13820             p_information118     => l_dop_rec.dop_attribute8,
13821             p_information119     => l_dop_rec.dop_attribute9,
13822             p_information110     => l_dop_rec.dop_attribute_category,
13823             p_information13     => l_dop_rec.enrl_det_dt_cd,
13824             p_information11     => l_dop_rec.excld_flag,
13825             p_information12     => l_dop_rec.only_pls_subj_cobra_flag,
13826             p_information261     => l_dop_rec.ordr_num,
13827             p_information260     => l_dop_rec.pgm_id,
13828             p_information262     => l_dop_rec.vrbl_rt_prfl_id,
13829             p_information265     => l_dop_rec.object_version_number,
13830            --
13831 
13832               p_object_version_number          => l_object_version_number,
13833               p_effective_date                 => p_effective_date       );
13834               --
13835 
13836               if l_out_dop_result_id is null then
13837                 l_out_dop_result_id := l_copy_entity_result_id;
13838               end if;
13839 
13840               if l_result_type_cd = 'DISPLAY' then
13841                  l_out_dop_result_id := l_copy_entity_result_id ;
13842               end if;
13843               --
13844            end loop;
13845            --
13846          end loop;
13847       ---------------------------------------------------------------
13848       -- END OF BEN_DPNT_CVRD_OTHR_PGM_RT_F ----------------------
13849       ---------------------------------------------------------------
13850        ---------------------------------------------------------------
13851        -- START OF BEN_PRTT_ANTHR_PL_RT_F ----------------------
13852        ---------------------------------------------------------------
13853        --
13854        for l_parent_rec  in c_pap_from_parent(l_VRBL_RT_PRFL_ID) loop
13855           --
13856           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
13857           --
13858           l_prtt_anthr_pl_rt_id := l_parent_rec.prtt_anthr_pl_rt_id ;
13859           --
13860           for l_pap_rec in c_pap(l_parent_rec.prtt_anthr_pl_rt_id,l_mirror_src_entity_result_id,'PAP') loop
13861             --
13862             l_table_route_id := null ;
13863             open ben_plan_design_program_module.g_table_route('PAP');
13864               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
13865             close ben_plan_design_program_module.g_table_route ;
13866             --
13867             l_information5  := ben_plan_design_program_module.get_pl_name(l_pap_rec.pl_id,p_effective_date)
13868                                || ben_plan_design_program_module.get_exclude_message(l_pap_rec.excld_flag);
13869                                --'Intersection';
13870             --
13871             if p_effective_date between l_pap_rec.effective_start_date
13872                and l_pap_rec.effective_end_date then
13873              --
13874                l_result_type_cd := 'DISPLAY';
13875             else
13876                l_result_type_cd := 'NO DISPLAY';
13877             end if;
13878               --
13879             l_copy_entity_result_id := null;
13880             l_object_version_number := null;
13881             ben_copy_entity_results_api.create_copy_entity_results(
13882               p_copy_entity_result_id           => l_copy_entity_result_id,
13883               p_copy_entity_txn_id             => p_copy_entity_txn_id,
13884               p_result_type_cd                 => l_result_type_cd,
13885               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
13886               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
13887               p_number_of_copies               => l_number_of_copies,
13888               p_table_route_id                 => l_table_route_id,
13889 	      P_TABLE_ALIAS                    => 'PAP',
13890               p_information1     => l_pap_rec.prtt_anthr_pl_rt_id,
13891               p_information2     => l_pap_rec.EFFECTIVE_START_DATE,
13892               p_information3     => l_pap_rec.EFFECTIVE_END_DATE,
13893               p_information4     => l_pap_rec.business_group_id,
13894               p_information5     => l_information5 , -- 9999 put name for h-grid
13895 
13896             p_information11     => l_pap_rec.excld_flag,
13897             p_information260     => l_pap_rec.ordr_num,
13898             p_information111     => l_pap_rec.pap_attribute1,
13899             p_information120     => l_pap_rec.pap_attribute10,
13900             p_information121     => l_pap_rec.pap_attribute11,
13901             p_information122     => l_pap_rec.pap_attribute12,
13902             p_information123     => l_pap_rec.pap_attribute13,
13903             p_information124     => l_pap_rec.pap_attribute14,
13904             p_information125     => l_pap_rec.pap_attribute15,
13905             p_information126     => l_pap_rec.pap_attribute16,
13906             p_information127     => l_pap_rec.pap_attribute17,
13907             p_information128     => l_pap_rec.pap_attribute18,
13908             p_information129     => l_pap_rec.pap_attribute19,
13909             p_information112     => l_pap_rec.pap_attribute2,
13910             p_information130     => l_pap_rec.pap_attribute20,
13911             p_information131     => l_pap_rec.pap_attribute21,
13912             p_information132     => l_pap_rec.pap_attribute22,
13913             p_information133     => l_pap_rec.pap_attribute23,
13914             p_information134     => l_pap_rec.pap_attribute24,
13915             p_information135     => l_pap_rec.pap_attribute25,
13916             p_information136     => l_pap_rec.pap_attribute26,
13917             p_information137     => l_pap_rec.pap_attribute27,
13918             p_information138     => l_pap_rec.pap_attribute28,
13919             p_information139     => l_pap_rec.pap_attribute29,
13920             p_information113     => l_pap_rec.pap_attribute3,
13921             p_information140     => l_pap_rec.pap_attribute30,
13922             p_information114     => l_pap_rec.pap_attribute4,
13923             p_information115     => l_pap_rec.pap_attribute5,
13924             p_information116     => l_pap_rec.pap_attribute6,
13925             p_information117     => l_pap_rec.pap_attribute7,
13926             p_information118     => l_pap_rec.pap_attribute8,
13927             p_information119     => l_pap_rec.pap_attribute9,
13928             p_information110     => l_pap_rec.pap_attribute_category,
13929             p_information261     => l_pap_rec.pl_id,
13930             p_information262     => l_pap_rec.vrbl_rt_prfl_id,
13931             p_information265     => l_pap_rec.object_version_number,
13932            --
13933 
13934               p_object_version_number          => l_object_version_number,
13935               p_effective_date                 => p_effective_date       );
13936               --
13937 
13938               if l_out_pap_result_id is null then
13939                 l_out_pap_result_id := l_copy_entity_result_id;
13940               end if;
13941 
13942               if l_result_type_cd = 'DISPLAY' then
13943                  l_out_pap_result_id := l_copy_entity_result_id ;
13944               end if;
13945               --
13946            end loop;
13947            --
13948          end loop;
13949       ---------------------------------------------------------------
13950       -- END OF BEN_PRTT_ANTHR_PL_RT_F ----------------------
13951       ---------------------------------------------------------------
13952        ---------------------------------------------------------------
13953        -- START OF BEN_ENRLD_ANTHR_OIPL_RT_F ----------------------
13954        ---------------------------------------------------------------
13955        --
13956        for l_parent_rec  in c_eao_from_parent(l_VRBL_RT_PRFL_ID) loop
13957           --
13958           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
13959           --
13960           l_enrld_anthr_oipl_rt_id := l_parent_rec.enrld_anthr_oipl_rt_id ;
13961           --
13962           for l_eao_rec in c_eao(l_parent_rec.enrld_anthr_oipl_rt_id,l_mirror_src_entity_result_id,'EAO') loop
13963             --
13964             l_table_route_id := null ;
13965             open ben_plan_design_program_module.g_table_route('EAO');
13966               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
13967             close ben_plan_design_program_module.g_table_route ;
13968             --
13969             l_information5  := ben_plan_design_program_module.get_oipl_name(l_eao_rec.oipl_id
13970                                                                            ,p_effective_date)
13971                                || ben_plan_design_program_module.get_exclude_message(l_eao_rec.excld_flag);
13972                                --'Intersection';
13973             --
13974             if p_effective_date between l_eao_rec.effective_start_date
13975                and l_eao_rec.effective_end_date then
13976              --
13977                l_result_type_cd := 'DISPLAY';
13978             else
13979                l_result_type_cd := 'NO DISPLAY';
13980             end if;
13981               --
13982             l_copy_entity_result_id := null;
13983             l_object_version_number := null;
13984             ben_copy_entity_results_api.create_copy_entity_results(
13985               p_copy_entity_result_id           => l_copy_entity_result_id,
13986               p_copy_entity_txn_id             => p_copy_entity_txn_id,
13987               p_result_type_cd                 => l_result_type_cd,
13988               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
13989               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
13990               p_number_of_copies               => l_number_of_copies,
13991               p_table_route_id                 => l_table_route_id,
13992 	      P_TABLE_ALIAS                    => 'EAO',
13993               p_information1     => l_eao_rec.enrld_anthr_oipl_rt_id,
13994               p_information2     => l_eao_rec.EFFECTIVE_START_DATE,
13995               p_information3     => l_eao_rec.EFFECTIVE_END_DATE,
13996               p_information4     => l_eao_rec.business_group_id,
13997               p_information5     => l_information5 , -- 9999 put name for h-grid
13998             p_information111     => l_eao_rec.eao_attribute1,
13999             p_information120     => l_eao_rec.eao_attribute10,
14000             p_information121     => l_eao_rec.eao_attribute11,
14001             p_information122     => l_eao_rec.eao_attribute12,
14002             p_information123     => l_eao_rec.eao_attribute13,
14003             p_information124     => l_eao_rec.eao_attribute14,
14004             p_information125     => l_eao_rec.eao_attribute15,
14005             p_information126     => l_eao_rec.eao_attribute16,
14006             p_information127     => l_eao_rec.eao_attribute17,
14007             p_information128     => l_eao_rec.eao_attribute18,
14008             p_information129     => l_eao_rec.eao_attribute19,
14009             p_information112     => l_eao_rec.eao_attribute2,
14010             p_information130     => l_eao_rec.eao_attribute20,
14011             p_information131     => l_eao_rec.eao_attribute21,
14012             p_information132     => l_eao_rec.eao_attribute22,
14013             p_information133     => l_eao_rec.eao_attribute23,
14014             p_information134     => l_eao_rec.eao_attribute24,
14015             p_information135     => l_eao_rec.eao_attribute25,
14016             p_information136     => l_eao_rec.eao_attribute26,
14017             p_information137     => l_eao_rec.eao_attribute27,
14018             p_information138     => l_eao_rec.eao_attribute28,
14019             p_information139     => l_eao_rec.eao_attribute29,
14020             p_information113     => l_eao_rec.eao_attribute3,
14021             p_information140     => l_eao_rec.eao_attribute30,
14022             p_information114     => l_eao_rec.eao_attribute4,
14023             p_information115     => l_eao_rec.eao_attribute5,
14024             p_information116     => l_eao_rec.eao_attribute6,
14025             p_information117     => l_eao_rec.eao_attribute7,
14026             p_information118     => l_eao_rec.eao_attribute8,
14027             p_information119     => l_eao_rec.eao_attribute9,
14028             p_information110     => l_eao_rec.eao_attribute_category,
14029             p_information12     => l_eao_rec.enrl_det_dt_cd,
14030             p_information11     => l_eao_rec.excld_flag,
14031             p_information258     => l_eao_rec.oipl_id,
14032             p_information261     => l_eao_rec.ordr_num,
14033             p_information262     => l_eao_rec.vrbl_rt_prfl_id,
14034             p_information265     => l_eao_rec.object_version_number,
14035            --
14036               p_object_version_number          => l_object_version_number,
14037               p_effective_date                 => p_effective_date       );
14038               --
14039 
14040               if l_out_eao_result_id is null then
14041                 l_out_eao_result_id := l_copy_entity_result_id;
14042               end if;
14043 
14044               if l_result_type_cd = 'DISPLAY' then
14045                  l_out_eao_result_id := l_copy_entity_result_id ;
14046               end if;
14047               --
14048            end loop;
14049            --
14050          end loop;
14051       ---------------------------------------------------------------
14052       -- END OF BEN_ENRLD_ANTHR_OIPL_RT_F ----------------------
14053       ---------------------------------------------------------------
14054        ---------------------------------------------------------------
14055        -- START OF BEN_ENRLD_ANTHR_PL_RT_F ----------------------
14056        ---------------------------------------------------------------
14057        --
14058        for l_parent_rec  in c_enl_from_parent(l_VRBL_RT_PRFL_ID) loop
14059           --
14060           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
14061           --
14062           l_enrld_anthr_pl_rt_id := l_parent_rec.enrld_anthr_pl_rt_id ;
14063           --
14064           for l_enl_rec in c_enl(l_parent_rec.enrld_anthr_pl_rt_id,l_mirror_src_entity_result_id,'ENL') loop
14065             --
14066             l_table_route_id := null ;
14067             open ben_plan_design_program_module.g_table_route('ENL');
14068               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
14069             close ben_plan_design_program_module.g_table_route ;
14070             --
14071             l_information5  := ben_plan_design_program_module.get_pl_name(l_enl_rec.pl_id
14072                                                                          ,p_effective_date)
14073                                || ben_plan_design_program_module.get_exclude_message(l_enl_rec.excld_flag);
14074                                --'Intersection';
14075             --
14076             if p_effective_date between l_enl_rec.effective_start_date
14077                and l_enl_rec.effective_end_date then
14078              --
14079                l_result_type_cd := 'DISPLAY';
14080             else
14081                l_result_type_cd := 'NO DISPLAY';
14082             end if;
14083               --
14084             l_copy_entity_result_id := null;
14085             l_object_version_number := null;
14086             ben_copy_entity_results_api.create_copy_entity_results(
14087               p_copy_entity_result_id           => l_copy_entity_result_id,
14088               p_copy_entity_txn_id             => p_copy_entity_txn_id,
14089               p_result_type_cd                 => l_result_type_cd,
14090               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
14091               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
14092               p_number_of_copies               => l_number_of_copies,
14093               p_table_route_id                 => l_table_route_id,
14094 	      P_TABLE_ALIAS                    => 'ENL',
14095               p_information1     => l_enl_rec.enrld_anthr_pl_rt_id,
14096               p_information2     => l_enl_rec.EFFECTIVE_START_DATE,
14097               p_information3     => l_enl_rec.EFFECTIVE_END_DATE,
14098               p_information4     => l_enl_rec.business_group_id,
14099               p_information5     => l_information5 , -- 9999 put name for h-grid
14100             p_information111     => l_enl_rec.enl_attribute1,
14101             p_information120     => l_enl_rec.enl_attribute10,
14102             p_information121     => l_enl_rec.enl_attribute11,
14103             p_information122     => l_enl_rec.enl_attribute12,
14104             p_information123     => l_enl_rec.enl_attribute13,
14105             p_information124     => l_enl_rec.enl_attribute14,
14106             p_information125     => l_enl_rec.enl_attribute15,
14107             p_information126     => l_enl_rec.enl_attribute16,
14108             p_information127     => l_enl_rec.enl_attribute17,
14109             p_information128     => l_enl_rec.enl_attribute18,
14110             p_information129     => l_enl_rec.enl_attribute19,
14111             p_information112     => l_enl_rec.enl_attribute2,
14112             p_information130     => l_enl_rec.enl_attribute20,
14113             p_information131     => l_enl_rec.enl_attribute21,
14114             p_information132     => l_enl_rec.enl_attribute22,
14115             p_information133     => l_enl_rec.enl_attribute23,
14116             p_information134     => l_enl_rec.enl_attribute24,
14117             p_information135     => l_enl_rec.enl_attribute25,
14118             p_information136     => l_enl_rec.enl_attribute26,
14119             p_information137     => l_enl_rec.enl_attribute27,
14120             p_information138     => l_enl_rec.enl_attribute28,
14121             p_information139     => l_enl_rec.enl_attribute29,
14122             p_information113     => l_enl_rec.enl_attribute3,
14123             p_information140     => l_enl_rec.enl_attribute30,
14124             p_information114     => l_enl_rec.enl_attribute4,
14125             p_information115     => l_enl_rec.enl_attribute5,
14126             p_information116     => l_enl_rec.enl_attribute6,
14127             p_information117     => l_enl_rec.enl_attribute7,
14128             p_information118     => l_enl_rec.enl_attribute8,
14129             p_information119     => l_enl_rec.enl_attribute9,
14130             p_information110     => l_enl_rec.enl_attribute_category,
14131             p_information12     => l_enl_rec.enrl_det_dt_cd,
14132             p_information11     => l_enl_rec.excld_flag,
14133             p_information260     => l_enl_rec.ordr_num,
14134             p_information261     => l_enl_rec.pl_id,
14135             p_information262     => l_enl_rec.vrbl_rt_prfl_id,
14136             p_information265     => l_enl_rec.object_version_number,
14137 
14138               p_object_version_number          => l_object_version_number,
14139               p_effective_date                 => p_effective_date       );
14140               --
14141 
14142               if l_out_enl_result_id is null then
14143                 l_out_enl_result_id := l_copy_entity_result_id;
14144               end if;
14145 
14146               if l_result_type_cd = 'DISPLAY' then
14147                  l_out_enl_result_id := l_copy_entity_result_id ;
14148               end if;
14149               --
14150            end loop;
14151            --
14152          end loop;
14153       ---------------------------------------------------------------
14154       -- END OF BEN_ENRLD_ANTHR_PL_RT_F ----------------------
14155       ---------------------------------------------------------------
14156        ---------------------------------------------------------------
14157        -- START OF BEN_ENRLD_ANTHR_PLIP_RT_F ----------------------
14158        ---------------------------------------------------------------
14159        --
14160        for l_parent_rec  in c_ear_from_parent(l_VRBL_RT_PRFL_ID) loop
14161           --
14162           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
14163           --
14164           l_enrld_anthr_plip_rt_id := l_parent_rec.enrld_anthr_plip_rt_id ;
14165           --
14166           for l_ear_rec in c_ear(l_parent_rec.enrld_anthr_plip_rt_id,l_mirror_src_entity_result_id,'EAR') loop
14167             --
14168             l_table_route_id := null ;
14169             open ben_plan_design_program_module.g_table_route('EAR');
14170               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
14171             close ben_plan_design_program_module.g_table_route ;
14172             --
14173             l_information5  := ben_plan_design_program_module.get_plip_name(l_ear_rec.plip_id,p_effective_date)
14174                                || ben_plan_design_program_module.get_exclude_message(l_ear_rec.excld_flag);
14175                                --'Intersection';
14176             --
14177             if p_effective_date between l_ear_rec.effective_start_date
14178                and l_ear_rec.effective_end_date then
14179              --
14180                l_result_type_cd := 'DISPLAY';
14181             else
14182                l_result_type_cd := 'NO DISPLAY';
14183             end if;
14184               --
14185             l_copy_entity_result_id := null;
14186             l_object_version_number := null;
14187             ben_copy_entity_results_api.create_copy_entity_results(
14188               p_copy_entity_result_id           => l_copy_entity_result_id,
14189               p_copy_entity_txn_id             => p_copy_entity_txn_id,
14190               p_result_type_cd                 => l_result_type_cd,
14191               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
14192               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
14193               p_number_of_copies               => l_number_of_copies,
14194               p_table_route_id                 => l_table_route_id,
14195 	      P_TABLE_ALIAS                    => 'EAR',
14196               p_information1     => l_ear_rec.enrld_anthr_plip_rt_id,
14197               p_information2     => l_ear_rec.EFFECTIVE_START_DATE,
14198               p_information3     => l_ear_rec.EFFECTIVE_END_DATE,
14199               p_information4     => l_ear_rec.business_group_id,
14200               p_information5     => l_information5 , -- 9999 put name for h-grid
14201             p_information111     => l_ear_rec.ear_attribute1,
14202             p_information120     => l_ear_rec.ear_attribute10,
14203             p_information121     => l_ear_rec.ear_attribute11,
14204             p_information122     => l_ear_rec.ear_attribute12,
14205             p_information123     => l_ear_rec.ear_attribute13,
14206             p_information124     => l_ear_rec.ear_attribute14,
14207             p_information125     => l_ear_rec.ear_attribute15,
14208             p_information126     => l_ear_rec.ear_attribute16,
14209             p_information127     => l_ear_rec.ear_attribute17,
14210             p_information128     => l_ear_rec.ear_attribute18,
14211             p_information129     => l_ear_rec.ear_attribute19,
14212             p_information112     => l_ear_rec.ear_attribute2,
14213             p_information130     => l_ear_rec.ear_attribute20,
14214             p_information131     => l_ear_rec.ear_attribute21,
14215             p_information132     => l_ear_rec.ear_attribute22,
14216             p_information133     => l_ear_rec.ear_attribute23,
14217             p_information134     => l_ear_rec.ear_attribute24,
14218             p_information135     => l_ear_rec.ear_attribute25,
14219             p_information136     => l_ear_rec.ear_attribute26,
14220             p_information137     => l_ear_rec.ear_attribute27,
14221             p_information138     => l_ear_rec.ear_attribute28,
14222             p_information139     => l_ear_rec.ear_attribute29,
14223             p_information113     => l_ear_rec.ear_attribute3,
14224             p_information140     => l_ear_rec.ear_attribute30,
14225             p_information114     => l_ear_rec.ear_attribute4,
14226             p_information115     => l_ear_rec.ear_attribute5,
14227             p_information116     => l_ear_rec.ear_attribute6,
14228             p_information117     => l_ear_rec.ear_attribute7,
14229             p_information118     => l_ear_rec.ear_attribute8,
14230             p_information119     => l_ear_rec.ear_attribute9,
14231             p_information110     => l_ear_rec.ear_attribute_category,
14232             p_information11     => l_ear_rec.enrl_det_dt_cd,
14233             p_information12     => l_ear_rec.excld_flag,
14234             p_information257     => l_ear_rec.ordr_num,
14235             p_information256     => l_ear_rec.plip_id,
14236             p_information262     => l_ear_rec.vrbl_rt_prfl_id,
14237             p_information265     => l_ear_rec.object_version_number,
14238            --
14239 
14240               p_object_version_number          => l_object_version_number,
14241               p_effective_date                 => p_effective_date       );
14242               --
14243 
14244               if l_out_ear_result_id is null then
14245                 l_out_ear_result_id := l_copy_entity_result_id;
14246               end if;
14247 
14248               if l_result_type_cd = 'DISPLAY' then
14249                  l_out_ear_result_id := l_copy_entity_result_id ;
14250               end if;
14251               --
14252            end loop;
14253            --
14254          end loop;
14255       ---------------------------------------------------------------
14256       -- END OF BEN_ENRLD_ANTHR_PLIP_RT_F ----------------------
14257       ---------------------------------------------------------------
14258        ---------------------------------------------------------------
14259        -- START OF BEN_ENRLD_ANTHR_PTIP_RT_F ----------------------
14260        ---------------------------------------------------------------
14261        --
14262        for l_parent_rec  in c_ent_from_parent(l_VRBL_RT_PRFL_ID) loop
14263           --
14264           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
14265           --
14266           l_enrld_anthr_ptip_rt_id := l_parent_rec.enrld_anthr_ptip_rt_id ;
14267           --
14268           for l_ent_rec in c_ent(l_parent_rec.enrld_anthr_ptip_rt_id,l_mirror_src_entity_result_id,'ENT') loop
14269             --
14270             l_table_route_id := null ;
14271             open ben_plan_design_program_module.g_table_route('ENT');
14272               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
14273             close ben_plan_design_program_module.g_table_route ;
14274             --
14275             l_information5  := ben_plan_design_program_module.get_ptip_name(l_ent_rec.ptip_id,p_effective_date)
14276                                || ben_plan_design_program_module.get_exclude_message(l_ent_rec.excld_flag);
14277                                --'Intersection';
14278             --
14279             if p_effective_date between l_ent_rec.effective_start_date
14280                and l_ent_rec.effective_end_date then
14281              --
14282                l_result_type_cd := 'DISPLAY';
14283             else
14284                l_result_type_cd := 'NO DISPLAY';
14285             end if;
14286               --
14287             l_copy_entity_result_id := null;
14288             l_object_version_number := null;
14289             ben_copy_entity_results_api.create_copy_entity_results(
14290               p_copy_entity_result_id           => l_copy_entity_result_id,
14291               p_copy_entity_txn_id             => p_copy_entity_txn_id,
14292               p_result_type_cd                 => l_result_type_cd,
14293               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
14294               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
14295               p_number_of_copies               => l_number_of_copies,
14296               p_table_route_id                 => l_table_route_id,
14297 	      P_TABLE_ALIAS                    => 'ENT',
14298               p_information1     => l_ent_rec.enrld_anthr_ptip_rt_id,
14299               p_information2     => l_ent_rec.EFFECTIVE_START_DATE,
14300               p_information3     => l_ent_rec.EFFECTIVE_END_DATE,
14301               p_information4     => l_ent_rec.business_group_id,
14302               p_information5     => l_information5 , -- 9999 put name for h-grid
14303             p_information11     => l_ent_rec.enrl_det_dt_cd,
14304             p_information111     => l_ent_rec.ent_attribute1,
14305             p_information120     => l_ent_rec.ent_attribute10,
14306             p_information121     => l_ent_rec.ent_attribute11,
14307             p_information122     => l_ent_rec.ent_attribute12,
14308             p_information123     => l_ent_rec.ent_attribute13,
14309             p_information124     => l_ent_rec.ent_attribute14,
14310             p_information125     => l_ent_rec.ent_attribute15,
14311             p_information126     => l_ent_rec.ent_attribute16,
14312             p_information127     => l_ent_rec.ent_attribute17,
14313             p_information128     => l_ent_rec.ent_attribute18,
14314             p_information129     => l_ent_rec.ent_attribute19,
14315             p_information112     => l_ent_rec.ent_attribute2,
14316             p_information130     => l_ent_rec.ent_attribute20,
14317             p_information131     => l_ent_rec.ent_attribute21,
14318             p_information132     => l_ent_rec.ent_attribute22,
14319             p_information133     => l_ent_rec.ent_attribute23,
14320             p_information134     => l_ent_rec.ent_attribute24,
14321             p_information135     => l_ent_rec.ent_attribute25,
14322             p_information136     => l_ent_rec.ent_attribute26,
14323             p_information137     => l_ent_rec.ent_attribute27,
14324             p_information138     => l_ent_rec.ent_attribute28,
14325             p_information139     => l_ent_rec.ent_attribute29,
14326             p_information113     => l_ent_rec.ent_attribute3,
14327             p_information140     => l_ent_rec.ent_attribute30,
14328             p_information114     => l_ent_rec.ent_attribute4,
14329             p_information115     => l_ent_rec.ent_attribute5,
14330             p_information116     => l_ent_rec.ent_attribute6,
14331             p_information117     => l_ent_rec.ent_attribute7,
14332             p_information118     => l_ent_rec.ent_attribute8,
14333             p_information119     => l_ent_rec.ent_attribute9,
14334             p_information110     => l_ent_rec.ent_attribute_category,
14335             p_information12     => l_ent_rec.excld_flag,
14336             p_information13     => l_ent_rec.only_pls_subj_cobra_flag,
14337             p_information261     => l_ent_rec.ordr_num,
14338             p_information259     => l_ent_rec.ptip_id,
14339             p_information262     => l_ent_rec.vrbl_rt_prfl_id,
14340             p_information265     => l_ent_rec.object_version_number,
14341 
14342               p_object_version_number          => l_object_version_number,
14343               p_effective_date                 => p_effective_date       );
14344               --
14345 
14346               if l_out_ent_result_id is null then
14347                 l_out_ent_result_id := l_copy_entity_result_id;
14348               end if;
14349 
14350               if l_result_type_cd = 'DISPLAY' then
14351                  l_out_ent_result_id := l_copy_entity_result_id ;
14352               end if;
14353               --
14354            end loop;
14355            --
14356          end loop;
14357       ---------------------------------------------------------------
14358       -- END OF BEN_ENRLD_ANTHR_PTIP_RT_F ----------------------
14359       ---------------------------------------------------------------
14360        ---------------------------------------------------------------
14361        -- START OF BEN_ENRLD_ANTHR_PGM_RT_F ----------------------
14362        ---------------------------------------------------------------
14363        --
14364        for l_parent_rec  in c_epm_from_parent(l_VRBL_RT_PRFL_ID) loop
14365           --
14366           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
14367           --
14368           l_enrld_anthr_pgm_rt_id := l_parent_rec.enrld_anthr_pgm_rt_id ;
14369           --
14370           for l_epm_rec in c_epm(l_parent_rec.enrld_anthr_pgm_rt_id,l_mirror_src_entity_result_id,'EPM') loop
14371             --
14372             l_table_route_id := null ;
14373             open ben_plan_design_program_module.g_table_route('EPM');
14374               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
14375             close ben_plan_design_program_module.g_table_route ;
14376             --
14377             l_information5  := ben_plan_design_program_module.get_pgm_name(l_epm_rec.pgm_id,p_effective_date)
14378                                || ben_plan_design_program_module.get_exclude_message(l_epm_rec.excld_flag);
14379                                --'Intersection';
14380             --
14381             if p_effective_date between l_epm_rec.effective_start_date
14382                and l_epm_rec.effective_end_date then
14383              --
14384                l_result_type_cd := 'DISPLAY';
14385             else
14386                l_result_type_cd := 'NO DISPLAY';
14387             end if;
14388               --
14389             l_copy_entity_result_id := null;
14390             l_object_version_number := null;
14391             ben_copy_entity_results_api.create_copy_entity_results(
14392               p_copy_entity_result_id           => l_copy_entity_result_id,
14393               p_copy_entity_txn_id             => p_copy_entity_txn_id,
14394               p_result_type_cd                 => l_result_type_cd,
14395               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
14396               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
14397               p_number_of_copies               => l_number_of_copies,
14398               p_table_route_id                 => l_table_route_id,
14399 	      P_TABLE_ALIAS                    => 'EPM',
14400               p_information1     => l_epm_rec.enrld_anthr_pgm_rt_id,
14401               p_information2     => l_epm_rec.EFFECTIVE_START_DATE,
14402               p_information3     => l_epm_rec.EFFECTIVE_END_DATE,
14403               p_information4     => l_epm_rec.business_group_id,
14404               p_information5     => l_information5 , -- 9999 put name for h-grid
14405             p_information12     => l_epm_rec.enrl_det_dt_cd,
14406             p_information111     => l_epm_rec.epm_attribute1,
14407             p_information120     => l_epm_rec.epm_attribute10,
14408             p_information121     => l_epm_rec.epm_attribute11,
14409             p_information122     => l_epm_rec.epm_attribute12,
14410             p_information123     => l_epm_rec.epm_attribute13,
14411             p_information124     => l_epm_rec.epm_attribute14,
14412             p_information125     => l_epm_rec.epm_attribute15,
14413             p_information126     => l_epm_rec.epm_attribute16,
14414             p_information127     => l_epm_rec.epm_attribute17,
14415             p_information128     => l_epm_rec.epm_attribute18,
14416             p_information129     => l_epm_rec.epm_attribute19,
14417             p_information112     => l_epm_rec.epm_attribute2,
14418             p_information130     => l_epm_rec.epm_attribute20,
14419             p_information131     => l_epm_rec.epm_attribute21,
14420             p_information132     => l_epm_rec.epm_attribute22,
14421             p_information133     => l_epm_rec.epm_attribute23,
14422             p_information134     => l_epm_rec.epm_attribute24,
14423             p_information135     => l_epm_rec.epm_attribute25,
14424             p_information136     => l_epm_rec.epm_attribute26,
14425             p_information137     => l_epm_rec.epm_attribute27,
14426             p_information138     => l_epm_rec.epm_attribute28,
14427             p_information139     => l_epm_rec.epm_attribute29,
14428             p_information113     => l_epm_rec.epm_attribute3,
14429             p_information140     => l_epm_rec.epm_attribute30,
14430             p_information114     => l_epm_rec.epm_attribute4,
14431             p_information115     => l_epm_rec.epm_attribute5,
14432             p_information116     => l_epm_rec.epm_attribute6,
14433             p_information117     => l_epm_rec.epm_attribute7,
14434             p_information118     => l_epm_rec.epm_attribute8,
14435             p_information119     => l_epm_rec.epm_attribute9,
14436             p_information110     => l_epm_rec.epm_attribute_category,
14437             p_information11     => l_epm_rec.excld_flag,
14438             p_information257     => l_epm_rec.ordr_num,
14439             p_information260     => l_epm_rec.pgm_id,
14440             p_information262     => l_epm_rec.vrbl_rt_prfl_id,
14441             p_information265     => l_epm_rec.object_version_number,
14442            --
14443 
14444               p_object_version_number          => l_object_version_number,
14445               p_effective_date                 => p_effective_date       );
14446               --
14447 
14448               if l_out_epm_result_id is null then
14449                 l_out_epm_result_id := l_copy_entity_result_id;
14450               end if;
14451 
14452               if l_result_type_cd = 'DISPLAY' then
14453                  l_out_epm_result_id := l_copy_entity_result_id ;
14454               end if;
14455               --
14456            end loop;
14457            --
14458          end loop;
14459       ---------------------------------------------------------------
14460       -- END OF BEN_ENRLD_ANTHR_PGM_RT_F ----------------------
14461       ---------------------------------------------------------------
14462        ---------------------------------------------------------------
14463        -- START OF BEN_NO_OTHR_CVG_RT_F ----------------------
14464        ---------------------------------------------------------------
14465        --
14466        for l_parent_rec  in c_noc_from_parent(l_VRBL_RT_PRFL_ID) loop
14467           --
14468           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
14469           --
14470           l_no_othr_cvg_rt_id := l_parent_rec.no_othr_cvg_rt_id ;
14471           --
14472           for l_noc_rec in c_noc(l_parent_rec.no_othr_cvg_rt_id,l_mirror_src_entity_result_id,'NOC') loop
14473             --
14474             l_table_route_id := null ;
14475             open ben_plan_design_program_module.g_table_route('NOC');
14476               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
14477             close ben_plan_design_program_module.g_table_route ;
14478             --
14479             l_information5  := hr_general.decode_lookup('YES_NO',l_noc_rec.coord_ben_no_cvg_flag);
14480                                --'Intersection';
14481             --
14482             if p_effective_date between l_noc_rec.effective_start_date
14483                and l_noc_rec.effective_end_date then
14484              --
14485                l_result_type_cd := 'DISPLAY';
14486             else
14487                l_result_type_cd := 'NO DISPLAY';
14488             end if;
14489               --
14490             l_copy_entity_result_id := null;
14491             l_object_version_number := null;
14492             ben_copy_entity_results_api.create_copy_entity_results(
14493               p_copy_entity_result_id           => l_copy_entity_result_id,
14494               p_copy_entity_txn_id             => p_copy_entity_txn_id,
14495               p_result_type_cd                 => l_result_type_cd,
14496               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
14497               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
14498               p_number_of_copies               => l_number_of_copies,
14499               p_table_route_id                 => l_table_route_id,
14500 	      P_TABLE_ALIAS                    => 'NOC',
14501               p_information1     => l_noc_rec.no_othr_cvg_rt_id,
14502               p_information2     => l_noc_rec.EFFECTIVE_START_DATE,
14503               p_information3     => l_noc_rec.EFFECTIVE_END_DATE,
14504               p_information4     => l_noc_rec.business_group_id,
14505               p_information5     => l_information5 , -- 9999 put name for h-grid
14506 
14507             p_information11     => l_noc_rec.coord_ben_no_cvg_flag,
14508             p_information111     => l_noc_rec.noc_attribute1,
14509             p_information120     => l_noc_rec.noc_attribute10,
14510             p_information121     => l_noc_rec.noc_attribute11,
14511             p_information122     => l_noc_rec.noc_attribute12,
14512             p_information123     => l_noc_rec.noc_attribute13,
14513             p_information124     => l_noc_rec.noc_attribute14,
14514             p_information125     => l_noc_rec.noc_attribute15,
14515             p_information126     => l_noc_rec.noc_attribute16,
14516             p_information127     => l_noc_rec.noc_attribute17,
14517             p_information128     => l_noc_rec.noc_attribute18,
14518             p_information129     => l_noc_rec.noc_attribute19,
14519             p_information112     => l_noc_rec.noc_attribute2,
14520             p_information130     => l_noc_rec.noc_attribute20,
14521             p_information131     => l_noc_rec.noc_attribute21,
14522             p_information132     => l_noc_rec.noc_attribute22,
14523             p_information133     => l_noc_rec.noc_attribute23,
14524             p_information134     => l_noc_rec.noc_attribute24,
14525             p_information135     => l_noc_rec.noc_attribute25,
14526             p_information136     => l_noc_rec.noc_attribute26,
14527             p_information137     => l_noc_rec.noc_attribute27,
14528             p_information138     => l_noc_rec.noc_attribute28,
14529             p_information139     => l_noc_rec.noc_attribute29,
14530             p_information113     => l_noc_rec.noc_attribute3,
14531             p_information140     => l_noc_rec.noc_attribute30,
14532             p_information114     => l_noc_rec.noc_attribute4,
14533             p_information115     => l_noc_rec.noc_attribute5,
14534             p_information116     => l_noc_rec.noc_attribute6,
14535             p_information117     => l_noc_rec.noc_attribute7,
14536             p_information118     => l_noc_rec.noc_attribute8,
14537             p_information119     => l_noc_rec.noc_attribute9,
14538             p_information110     => l_noc_rec.noc_attribute_category,
14539             p_information262     => l_noc_rec.vrbl_rt_prfl_id,
14540             p_information265     => l_noc_rec.object_version_number,
14541            --
14542 
14543               p_object_version_number          => l_object_version_number,
14544               p_effective_date                 => p_effective_date       );
14545               --
14546 
14547               if l_out_noc_result_id is null then
14548                 l_out_noc_result_id := l_copy_entity_result_id;
14549               end if;
14550 
14551               if l_result_type_cd = 'DISPLAY' then
14552                  l_out_noc_result_id := l_copy_entity_result_id ;
14553               end if;
14554               --
14555            end loop;
14556            --
14557          end loop;
14558       ---------------------------------------------------------------
14559       -- END OF BEN_NO_OTHR_CVG_RT_F ----------------------
14560       ---------------------------------------------------------------
14561      ---------------------------------------------------------------
14562      -- START OF BEN_OPTD_MDCR_RT_F ----------------------
14563      ---------------------------------------------------------------
14564      --
14565      for l_parent_rec  in c_omr_from_parent(l_VRBL_RT_PRFL_ID) loop
14566         --
14567         l_mirror_src_entity_result_id := l_out_vpf_result_id ;
14568         --
14569         l_optd_mdcr_rt_id := l_parent_rec.optd_mdcr_rt_id ;
14570         --
14571         for l_omr_rec in c_omr(l_parent_rec.optd_mdcr_rt_id,l_mirror_src_entity_result_id,'OMR') loop
14572           --
14573           l_table_route_id := null ;
14574           open ben_plan_design_program_module.g_table_route('OMR');
14575             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
14576           close ben_plan_design_program_module.g_table_route ;
14577           --
14578           l_information5  := hr_general.decode_lookup('YES_NO',l_omr_rec.optd_mdcr_flag)
14579                              || ben_plan_design_program_module.get_exclude_message(l_omr_rec.exlcd_flag);
14580           --
14581           if p_effective_date between l_omr_rec.effective_start_date
14582              and l_omr_rec.effective_end_date then
14583            --
14584              l_result_type_cd := 'DISPLAY';
14585           else
14586              l_result_type_cd := 'NO DISPLAY';
14587           end if;
14588             --
14589           l_copy_entity_result_id := null;
14590           l_object_version_number := null;
14591           ben_copy_entity_results_api.create_copy_entity_results(
14592             p_copy_entity_result_id           => l_copy_entity_result_id,
14593             p_copy_entity_txn_id             => p_copy_entity_txn_id,
14594             p_result_type_cd                 => l_result_type_cd,
14595             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
14596             p_parent_entity_result_id      => l_mirror_src_entity_result_id,
14597             p_number_of_copies               => l_number_of_copies,
14598             p_table_route_id                 => l_table_route_id,
14599 	    P_TABLE_ALIAS                    => 'OMR',
14600             p_information1     => l_omr_rec.optd_mdcr_rt_id,
14601             p_information2     => l_omr_rec.EFFECTIVE_START_DATE,
14602             p_information3     => l_omr_rec.EFFECTIVE_END_DATE,
14603             p_information4     => l_omr_rec.business_group_id,
14604             p_information5     => l_information5 , -- 9999 put name for h-grid
14605 
14606             p_information12     => l_omr_rec.exlcd_flag,
14607             p_information111     => l_omr_rec.omr_attribute1,
14608             p_information120     => l_omr_rec.omr_attribute10,
14609             p_information121     => l_omr_rec.omr_attribute11,
14610             p_information122     => l_omr_rec.omr_attribute12,
14611             p_information123     => l_omr_rec.omr_attribute13,
14612             p_information124     => l_omr_rec.omr_attribute14,
14613             p_information125     => l_omr_rec.omr_attribute15,
14614             p_information126     => l_omr_rec.omr_attribute16,
14615             p_information127     => l_omr_rec.omr_attribute17,
14616             p_information128     => l_omr_rec.omr_attribute18,
14617             p_information129     => l_omr_rec.omr_attribute19,
14618             p_information112     => l_omr_rec.omr_attribute2,
14619             p_information130     => l_omr_rec.omr_attribute20,
14620             p_information131     => l_omr_rec.omr_attribute21,
14621             p_information132     => l_omr_rec.omr_attribute22,
14622             p_information133     => l_omr_rec.omr_attribute23,
14623             p_information134     => l_omr_rec.omr_attribute24,
14624             p_information135     => l_omr_rec.omr_attribute25,
14625             p_information136     => l_omr_rec.omr_attribute26,
14626             p_information137     => l_omr_rec.omr_attribute27,
14627             p_information138     => l_omr_rec.omr_attribute28,
14628             p_information139     => l_omr_rec.omr_attribute29,
14629             p_information113     => l_omr_rec.omr_attribute3,
14630             p_information140     => l_omr_rec.omr_attribute30,
14631             p_information114     => l_omr_rec.omr_attribute4,
14632             p_information115     => l_omr_rec.omr_attribute5,
14633             p_information116     => l_omr_rec.omr_attribute6,
14634             p_information117     => l_omr_rec.omr_attribute7,
14635             p_information118     => l_omr_rec.omr_attribute8,
14636             p_information119     => l_omr_rec.omr_attribute9,
14637             p_information110     => l_omr_rec.omr_attribute_category,
14638             p_information11     => l_omr_rec.optd_mdcr_flag,
14639             p_information262     => l_omr_rec.vrbl_rt_prfl_id,
14640             p_information265     => l_omr_rec.object_version_number,
14641            --
14642 
14643             p_object_version_number          => l_object_version_number,
14644             p_effective_date                 => p_effective_date       );
14645             --
14646 
14647             if l_out_omr_result_id is null then
14648               l_out_omr_result_id := l_copy_entity_result_id;
14649             end if;
14650 
14651             if l_result_type_cd = 'DISPLAY' then
14652                l_out_omr_result_id := l_copy_entity_result_id ;
14653             end if;
14654             --
14655          end loop;
14656          --
14657        end loop;
14658     ---------------------------------------------------------------
14659     -- END OF BEN_OPTD_MDCR_RT_F ----------------------
14660     ---------------------------------------------------------------
14661        ---------------------------------------------------------------
14662        -- START OF BEN_DPNT_OTHR_PTIP_RT_F ----------------------
14663        ---------------------------------------------------------------
14664        --
14665        for l_parent_rec  in c_dot_from_parent(l_VRBL_RT_PRFL_ID) loop
14666           --
14667           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
14668           --
14669           l_dpnt_othr_ptip_rt_id := l_parent_rec.dpnt_othr_ptip_rt_id ;
14670           --
14671           for l_dot_rec in c_dot(l_parent_rec.dpnt_othr_ptip_rt_id,l_mirror_src_entity_result_id,'DOT') loop
14672             --
14673             l_table_route_id := null ;
14674             open ben_plan_design_program_module.g_table_route('DOT');
14675               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
14676             close ben_plan_design_program_module.g_table_route ;
14677             --
14678             l_information5  := ben_plan_design_program_module.get_ptip_name(l_dot_rec.ptip_id,p_effective_date)
14679                                || ben_plan_design_program_module.get_exclude_message(l_dot_rec.excld_flag);
14680             --
14681             if p_effective_date between l_dot_rec.effective_start_date
14682                and l_dot_rec.effective_end_date then
14683              --
14684                l_result_type_cd := 'DISPLAY';
14685             else
14686                l_result_type_cd := 'NO DISPLAY';
14687             end if;
14688               --
14689             l_copy_entity_result_id := null;
14690             l_object_version_number := null;
14691             ben_copy_entity_results_api.create_copy_entity_results(
14692               p_copy_entity_result_id           => l_copy_entity_result_id,
14693               p_copy_entity_txn_id             => p_copy_entity_txn_id,
14694               p_result_type_cd                 => l_result_type_cd,
14695               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
14696               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
14697               p_number_of_copies               => l_number_of_copies,
14698               p_table_route_id                 => l_table_route_id,
14699 	      P_TABLE_ALIAS                    => 'DOT',
14700               p_information1     => l_dot_rec.dpnt_othr_ptip_rt_id,
14701               p_information2     => l_dot_rec.EFFECTIVE_START_DATE,
14702               p_information3     => l_dot_rec.EFFECTIVE_END_DATE,
14703               p_information4     => l_dot_rec.business_group_id,
14704               p_information5     => l_information5 , -- 9999 put name for h-grid
14705             p_information111     => l_dot_rec.dot_attribute1,
14706             p_information120     => l_dot_rec.dot_attribute10,
14707             p_information121     => l_dot_rec.dot_attribute11,
14708             p_information122     => l_dot_rec.dot_attribute12,
14709             p_information123     => l_dot_rec.dot_attribute13,
14710             p_information124     => l_dot_rec.dot_attribute14,
14711             p_information125     => l_dot_rec.dot_attribute15,
14712             p_information126     => l_dot_rec.dot_attribute16,
14713             p_information127     => l_dot_rec.dot_attribute17,
14714             p_information128     => l_dot_rec.dot_attribute18,
14715             p_information129     => l_dot_rec.dot_attribute19,
14716             p_information112     => l_dot_rec.dot_attribute2,
14717             p_information130     => l_dot_rec.dot_attribute20,
14718             p_information131     => l_dot_rec.dot_attribute21,
14719             p_information132     => l_dot_rec.dot_attribute22,
14720             p_information133     => l_dot_rec.dot_attribute23,
14721             p_information134     => l_dot_rec.dot_attribute24,
14722             p_information135     => l_dot_rec.dot_attribute25,
14723             p_information136     => l_dot_rec.dot_attribute26,
14724             p_information137     => l_dot_rec.dot_attribute27,
14725             p_information138     => l_dot_rec.dot_attribute28,
14726             p_information139     => l_dot_rec.dot_attribute29,
14727             p_information113     => l_dot_rec.dot_attribute3,
14728             p_information140     => l_dot_rec.dot_attribute30,
14729             p_information114     => l_dot_rec.dot_attribute4,
14730             p_information115     => l_dot_rec.dot_attribute5,
14731             p_information116     => l_dot_rec.dot_attribute6,
14732             p_information117     => l_dot_rec.dot_attribute7,
14733             p_information118     => l_dot_rec.dot_attribute8,
14734             p_information119     => l_dot_rec.dot_attribute9,
14735             p_information110     => l_dot_rec.dot_attribute_category,
14736             p_information11     => l_dot_rec.excld_flag,
14737             p_information261     => l_dot_rec.ordr_num,
14738             p_information259     => l_dot_rec.ptip_id,
14739             p_information262     => l_dot_rec.vrbl_rt_prfl_id,
14740             p_information265     => l_dot_rec.object_version_number,
14741            --
14742 
14743               p_object_version_number          => l_object_version_number,
14744               p_effective_date                 => p_effective_date       );
14745               --
14746 
14747               if l_out_dot_result_id is null then
14748                 l_out_dot_result_id := l_copy_entity_result_id;
14749               end if;
14750 
14751               if l_result_type_cd = 'DISPLAY' then
14752                  l_out_dot_result_id := l_copy_entity_result_id ;
14753               end if;
14754               --
14755            end loop;
14756            --
14757          end loop;
14758       ---------------------------------------------------------------
14759       -- END OF BEN_DPNT_OTHR_PTIP_RT_F ----------------------
14760       ---------------------------------------------------------------
14761        ---------------------------------------------------------------
14762        -- START OF BEN_PERF_RTNG_RT_F ----------------------
14763        ---------------------------------------------------------------
14764        --
14765        for l_parent_rec  in c_prr_from_parent(l_VRBL_RT_PRFL_ID) loop
14766           --
14767           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
14768           --
14769           l_perf_rtng_rt_id := l_parent_rec.perf_rtng_rt_id ;
14770           --
14771           for l_prr_rec in c_prr(l_parent_rec.perf_rtng_rt_id,l_mirror_src_entity_result_id,'PRR') loop
14772             --
14773             l_table_route_id := null ;
14774             open ben_plan_design_program_module.g_table_route('PRR');
14775               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
14776             close ben_plan_design_program_module.g_table_route ;
14777             --
14778             l_information5  := hr_general.decode_lookup('EMP_INTERVIEW_TYPE',l_prr_rec.event_type)
14779                                ||' - '||hr_general.decode_lookup('PERFORMANCE_RATING',l_prr_rec.perf_rtng_cd)
14780                                || ben_plan_design_program_module.get_exclude_message(l_prr_rec.excld_flag);
14781                                  --'Intersection';
14782             --
14783             if p_effective_date between l_prr_rec.effective_start_date
14784                and l_prr_rec.effective_end_date then
14785              --
14786                l_result_type_cd := 'DISPLAY';
14787             else
14788                l_result_type_cd := 'NO DISPLAY';
14789             end if;
14790               --
14791             l_copy_entity_result_id := null;
14792             l_object_version_number := null;
14793             ben_copy_entity_results_api.create_copy_entity_results(
14794               p_copy_entity_result_id           => l_copy_entity_result_id,
14795               p_copy_entity_txn_id             => p_copy_entity_txn_id,
14796               p_result_type_cd                 => l_result_type_cd,
14797               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
14798               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
14799               p_number_of_copies               => l_number_of_copies,
14800               p_table_route_id                 => l_table_route_id,
14801 	      P_TABLE_ALIAS                    => 'PRR',
14802               p_information1     => l_prr_rec.perf_rtng_rt_id,
14803               p_information2     => l_prr_rec.EFFECTIVE_START_DATE,
14804               p_information3     => l_prr_rec.EFFECTIVE_END_DATE,
14805               p_information4     => l_prr_rec.business_group_id,
14806               p_information5     => l_information5 , -- 9999 put name for h-grid
14807 
14808             p_information13     => l_prr_rec.event_type,
14809             p_information11     => l_prr_rec.excld_flag,
14810             p_information257     => l_prr_rec.ordr_num,
14811             p_information12     => l_prr_rec.perf_rtng_cd,
14812             p_information111     => l_prr_rec.prr_attribute1,
14813             p_information120     => l_prr_rec.prr_attribute10,
14814             p_information121     => l_prr_rec.prr_attribute11,
14815             p_information122     => l_prr_rec.prr_attribute12,
14816             p_information123     => l_prr_rec.prr_attribute13,
14817             p_information124     => l_prr_rec.prr_attribute14,
14818             p_information125     => l_prr_rec.prr_attribute15,
14819             p_information126     => l_prr_rec.prr_attribute16,
14820             p_information127     => l_prr_rec.prr_attribute17,
14821             p_information128     => l_prr_rec.prr_attribute18,
14822             p_information129     => l_prr_rec.prr_attribute19,
14823             p_information112     => l_prr_rec.prr_attribute2,
14824             p_information130     => l_prr_rec.prr_attribute20,
14825             p_information131     => l_prr_rec.prr_attribute21,
14826             p_information132     => l_prr_rec.prr_attribute22,
14827             p_information133     => l_prr_rec.prr_attribute23,
14828             p_information134     => l_prr_rec.prr_attribute24,
14829             p_information135     => l_prr_rec.prr_attribute25,
14830             p_information136     => l_prr_rec.prr_attribute26,
14831             p_information137     => l_prr_rec.prr_attribute27,
14832             p_information138     => l_prr_rec.prr_attribute28,
14833             p_information139     => l_prr_rec.prr_attribute29,
14834             p_information113     => l_prr_rec.prr_attribute3,
14835             p_information140     => l_prr_rec.prr_attribute30,
14836             p_information114     => l_prr_rec.prr_attribute4,
14837             p_information115     => l_prr_rec.prr_attribute5,
14838             p_information116     => l_prr_rec.prr_attribute6,
14839             p_information117     => l_prr_rec.prr_attribute7,
14840             p_information118     => l_prr_rec.prr_attribute8,
14841             p_information119     => l_prr_rec.prr_attribute9,
14842             p_information110     => l_prr_rec.prr_attribute_category,
14843             p_information262     => l_prr_rec.vrbl_rt_prfl_id,
14844             p_information265     => l_prr_rec.object_version_number,
14845            --
14846 
14847               p_object_version_number          => l_object_version_number,
14848               p_effective_date                 => p_effective_date       );
14849               --
14850 
14851               if l_out_prr_result_id is null then
14852                 l_out_prr_result_id := l_copy_entity_result_id;
14853               end if;
14854 
14855               if l_result_type_cd = 'DISPLAY' then
14856                  l_out_prr_result_id := l_copy_entity_result_id ;
14857               end if;
14858               --
14859            end loop;
14860            --
14861          end loop;
14862       ---------------------------------------------------------------
14863       -- END OF BEN_PERF_RTNG_RT_F ----------------------
14864       ---------------------------------------------------------------
14865        ---------------------------------------------------------------
14866        -- START OF BEN_QUA_IN_GR_RT_F ----------------------
14867        ---------------------------------------------------------------
14868        --
14869        for l_parent_rec  in c_qig_from_parent(l_VRBL_RT_PRFL_ID) loop
14870           --
14871           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
14872           --
14873           l_qua_in_gr_rt_id := l_parent_rec.qua_in_gr_rt_id ;
14874           --
14875           for l_qig_rec in c_qig(l_parent_rec.qua_in_gr_rt_id,l_mirror_src_entity_result_id,'QIG') loop
14876             --
14877             l_table_route_id := null ;
14878             open ben_plan_design_program_module.g_table_route('QIG');
14879               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
14880             close ben_plan_design_program_module.g_table_route ;
14881             --
14882             l_information5  := hr_general.decode_lookup('BEN_CWB_QUAR_IN_GRD',l_qig_rec.quar_in_grade_cd)
14883                                || ben_plan_design_program_module.get_exclude_message(l_qig_rec.excld_flag);
14884                                -- 'Intersection';
14885             --
14886             if p_effective_date between l_qig_rec.effective_start_date
14887                and l_qig_rec.effective_end_date then
14888              --
14889                l_result_type_cd := 'DISPLAY';
14890             else
14891                l_result_type_cd := 'NO DISPLAY';
14892             end if;
14893               --
14894             l_copy_entity_result_id := null;
14895             l_object_version_number := null;
14896             ben_copy_entity_results_api.create_copy_entity_results(
14897               p_copy_entity_result_id           => l_copy_entity_result_id,
14898               p_copy_entity_txn_id             => p_copy_entity_txn_id,
14899               p_result_type_cd                 => l_result_type_cd,
14900               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
14901               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
14902               p_number_of_copies               => l_number_of_copies,
14903               p_table_route_id                 => l_table_route_id,
14904 	      P_TABLE_ALIAS                    => 'QIG',
14905               p_information1     => l_qig_rec.qua_in_gr_rt_id,
14906               p_information2     => l_qig_rec.EFFECTIVE_START_DATE,
14907               p_information3     => l_qig_rec.EFFECTIVE_END_DATE,
14908               p_information4     => l_qig_rec.business_group_id,
14909               p_information5     => l_information5 , -- 9999 put name for h-grid
14910 
14911             p_information12     => l_qig_rec.excld_flag,
14912             p_information257     => l_qig_rec.ordr_num,
14913             p_information111     => l_qig_rec.qig_attribute1,
14914             p_information120     => l_qig_rec.qig_attribute10,
14915             p_information121     => l_qig_rec.qig_attribute11,
14916             p_information122     => l_qig_rec.qig_attribute12,
14917             p_information123     => l_qig_rec.qig_attribute13,
14918             p_information124     => l_qig_rec.qig_attribute14,
14919             p_information125     => l_qig_rec.qig_attribute15,
14920             p_information126     => l_qig_rec.qig_attribute16,
14921             p_information127     => l_qig_rec.qig_attribute17,
14922             p_information128     => l_qig_rec.qig_attribute18,
14923             p_information129     => l_qig_rec.qig_attribute19,
14924             p_information112     => l_qig_rec.qig_attribute2,
14925             p_information130     => l_qig_rec.qig_attribute20,
14926             p_information131     => l_qig_rec.qig_attribute21,
14927             p_information132     => l_qig_rec.qig_attribute22,
14928             p_information133     => l_qig_rec.qig_attribute23,
14929             p_information134     => l_qig_rec.qig_attribute24,
14930             p_information135     => l_qig_rec.qig_attribute25,
14931             p_information136     => l_qig_rec.qig_attribute26,
14932             p_information137     => l_qig_rec.qig_attribute27,
14933             p_information138     => l_qig_rec.qig_attribute28,
14934             p_information139     => l_qig_rec.qig_attribute29,
14935             p_information113     => l_qig_rec.qig_attribute3,
14936             p_information140     => l_qig_rec.qig_attribute30,
14937             p_information114     => l_qig_rec.qig_attribute4,
14938             p_information115     => l_qig_rec.qig_attribute5,
14939             p_information116     => l_qig_rec.qig_attribute6,
14940             p_information117     => l_qig_rec.qig_attribute7,
14941             p_information118     => l_qig_rec.qig_attribute8,
14942             p_information119     => l_qig_rec.qig_attribute9,
14943             p_information110     => l_qig_rec.qig_attribute_category,
14944             p_information11     => l_qig_rec.quar_in_grade_cd,
14945             p_information262     => l_qig_rec.vrbl_rt_prfl_id,
14946             p_information265     => l_qig_rec.object_version_number,
14947            --
14948 
14949               p_object_version_number          => l_object_version_number,
14950               p_effective_date                 => p_effective_date       );
14951               --
14952 
14953               if l_out_qig_result_id is null then
14954                 l_out_qig_result_id := l_copy_entity_result_id;
14955               end if;
14956 
14957               if l_result_type_cd = 'DISPLAY' then
14958                  l_out_qig_result_id := l_copy_entity_result_id ;
14959               end if;
14960               --
14961            end loop;
14962            --
14963          end loop;
14964       ---------------------------------------------------------------
14965       -- END OF BEN_QUA_IN_GR_RT_F ----------------------
14966       ---------------------------------------------------------------
14967        ---------------------------------------------------------------
14968        -- START OF BEN_OTHR_PTIP_RT_F ----------------------
14969        ---------------------------------------------------------------
14970        --
14971        for l_parent_rec  in c_opr_from_parent(l_VRBL_RT_PRFL_ID) loop
14972           --
14973           l_mirror_src_entity_result_id := l_out_vpf_result_id ;
14974           --
14975           l_othr_ptip_rt_id := l_parent_rec.othr_ptip_rt_id ;
14976           --
14977           for l_opr_rec in c_opr(l_parent_rec.othr_ptip_rt_id,l_mirror_src_entity_result_id,'OPR') loop
14978             --
14979             l_table_route_id := null ;
14980             open ben_plan_design_program_module.g_table_route('OPR');
14981               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
14982             close ben_plan_design_program_module.g_table_route ;
14983             --
14984             l_information5  := ben_plan_design_program_module.get_ptip_name(l_opr_rec.ptip_id,p_effective_date)
14985                                || ben_plan_design_program_module.get_exclude_message(l_opr_rec.excld_flag);
14986                                --'Intersection';
14987             --
14988             if p_effective_date between l_opr_rec.effective_start_date
14989                and l_opr_rec.effective_end_date then
14990              --
14991                l_result_type_cd := 'DISPLAY';
14992             else
14993                l_result_type_cd := 'NO DISPLAY';
14994             end if;
14995               --
14996             l_copy_entity_result_id := null;
14997             l_object_version_number := null;
14998             ben_copy_entity_results_api.create_copy_entity_results(
14999               p_copy_entity_result_id           => l_copy_entity_result_id,
15000               p_copy_entity_txn_id             => p_copy_entity_txn_id,
15001               p_result_type_cd                 => l_result_type_cd,
15002               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
15003               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
15004               p_number_of_copies               => l_number_of_copies,
15005               p_table_route_id                 => l_table_route_id,
15006 	      P_TABLE_ALIAS                    => 'OPR',
15007               p_information1     => l_opr_rec.othr_ptip_rt_id,
15008               p_information2     => l_opr_rec.EFFECTIVE_START_DATE,
15009               p_information3     => l_opr_rec.EFFECTIVE_END_DATE,
15010               p_information4     => l_opr_rec.business_group_id,
15011               p_information5     => l_information5 , -- 9999 put name for h-grid
15012 
15013             p_information11     => l_opr_rec.excld_flag,
15014             p_information12     => l_opr_rec.only_pls_subj_cobra_flag,
15015             p_information111     => l_opr_rec.opr_attribute1,
15016             p_information120     => l_opr_rec.opr_attribute10,
15017             p_information121     => l_opr_rec.opr_attribute11,
15018             p_information122     => l_opr_rec.opr_attribute12,
15019             p_information123     => l_opr_rec.opr_attribute13,
15020             p_information124     => l_opr_rec.opr_attribute14,
15021             p_information125     => l_opr_rec.opr_attribute15,
15022             p_information126     => l_opr_rec.opr_attribute16,
15023             p_information127     => l_opr_rec.opr_attribute17,
15024             p_information128     => l_opr_rec.opr_attribute18,
15025             p_information129     => l_opr_rec.opr_attribute19,
15026             p_information112     => l_opr_rec.opr_attribute2,
15027             p_information130     => l_opr_rec.opr_attribute20,
15028             p_information131     => l_opr_rec.opr_attribute21,
15029             p_information132     => l_opr_rec.opr_attribute22,
15030             p_information133     => l_opr_rec.opr_attribute23,
15031             p_information134     => l_opr_rec.opr_attribute24,
15032             p_information135     => l_opr_rec.opr_attribute25,
15033             p_information136     => l_opr_rec.opr_attribute26,
15034             p_information137     => l_opr_rec.opr_attribute27,
15035             p_information138     => l_opr_rec.opr_attribute28,
15036             p_information139     => l_opr_rec.opr_attribute29,
15037             p_information113     => l_opr_rec.opr_attribute3,
15038             p_information140     => l_opr_rec.opr_attribute30,
15039             p_information114     => l_opr_rec.opr_attribute4,
15040             p_information115     => l_opr_rec.opr_attribute5,
15041             p_information116     => l_opr_rec.opr_attribute6,
15042             p_information117     => l_opr_rec.opr_attribute7,
15043             p_information118     => l_opr_rec.opr_attribute8,
15044             p_information119     => l_opr_rec.opr_attribute9,
15045             p_information110     => l_opr_rec.opr_attribute_category,
15046             p_information257     => l_opr_rec.ordr_num,
15047             p_information259     => l_opr_rec.ptip_id,
15048             p_information262     => l_opr_rec.vrbl_rt_prfl_id,
15049             p_information265     => l_opr_rec.object_version_number,
15050            --
15051 
15052               p_object_version_number          => l_object_version_number,
15053               p_effective_date                 => p_effective_date       );
15054               --
15055 
15056               if l_out_opr_result_id is null then
15057                  l_out_opr_result_id := l_copy_entity_result_id;
15058                end if;
15059 
15060               if l_result_type_cd = 'DISPLAY' then
15061                  l_out_opr_result_id := l_copy_entity_result_id ;
15062               end if;
15063               --
15064            end loop;
15065            --
15066          end loop;
15067       ---------------------------------------------------------------
15068       -- END OF BEN_OTHR_PTIP_RT_F ----------------------
15069       ---------------------------------------------------------------
15070      ---------------------------------------------------------------
15071      -- END OF BEN_VRBL_RT_PRFL_F ----------------------
15072      ---------------------------------------------------------------
15073          hr_utility.set_location(' end create_vapro_results  ',100);
15074    end create_vapro_results;
15075   --
15076   procedure create_bnft_pool_results
15077   (
15078    p_validate                       in  number     default 0 -- false
15079   ,p_copy_entity_result_id          in  number    -- Source Elpro
15080   ,p_copy_entity_txn_id             in  number    default null
15081   ,p_pgm_id                         in  number    default null
15082   ,p_ptip_id                        in  number    default null
15083   ,p_plip_id                        in  number    default null
15084   ,p_oiplip_id                      in  number    default null
15085   ,p_cmbn_plip_id                   in  number    default null
15086   ,p_cmbn_ptip_id                   in  number    default null
15087   ,p_cmbn_ptip_opt_id               in  number    default null
15088   ,p_business_group_id              in  number    default null
15089   ,p_number_of_copies               in  number    default 0
15090   ,p_object_version_number          out nocopy number
15091   ,p_effective_date                 in  date
15092   ,p_parent_entity_result_id        in  number
15093   ) is
15094     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
15095     l_proc varchar2(72) := g_package||'create_rate_results';
15096     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
15097     --
15098     cursor c_parent_result(c_parent_pk_id number,
15099                         c_parent_table_name varchar2,
15100                         c_copy_entity_txn_id number) is
15101      select copy_entity_result_id mirror_src_entity_result_id
15102      from ben_copy_entity_results cpe,
15103         pqh_table_route trt
15104      where cpe.information1= c_parent_pk_id
15105      and   cpe.result_type_cd = 'DISPLAY'
15106      and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
15107      and   cpe.table_route_id = trt.table_route_id
15108      and   trt.from_clause = 'OAB'
15109      and   trt.where_clause = upper(c_parent_table_name) ;
15110      ---
15111      -- Bug : 3752407 : Global cursor g_table_route will now be used
15112      -- Cursor to get table_route_id
15113      --
15114      -- cursor c_table_route(c_parent_table_alias varchar2) is
15115      -- select table_route_id
15116      -- from pqh_table_route trt
15117      -- where trt.table_alias = c_parent_table_alias;
15118      -- trt.from_clause = 'OAB'
15119      -- and   trt.where_clause = upper(c_parent_table_name) ;
15120      ---
15121      l_mirror_src_entity_result_id    number(15);
15122      l_table_route_id               number(15);
15123      l_result_type_cd               varchar2(30);
15124      l_information5                 ben_copy_entity_results.information5%type;
15125      l_number_of_copies             number(15);
15126    ---------------------------------------------------------------
15127    -- START OF BEN_BNFT_PRVDR_POOL_F ----------------------
15128    ---------------------------------------------------------------
15129    cursor c_bpp_from_parent( c_pgm_id number,c_ptip_id number,c_plip_id number, c_oiplip_id number,
15130                             c_cmbn_plip_id number, c_cmbn_ptip_id number,
15131                             c_cmbn_ptip_opt_id number ) is
15132    select  bnft_prvdr_pool_id
15133    from BEN_BNFT_PRVDR_POOL_F
15134    where  (c_pgm_id is not null     and c_pgm_id           = pgm_id
15135            and ptip_id is null      and plip_id is null
15136            and oiplip_id is null    and cmbn_plip_id is null
15137            and cmbn_ptip_id is null and cmbn_ptip_opt_id is null
15138            ) or
15139           (c_ptip_id          is not null and c_ptip_id          = ptip_id) or
15140           (c_plip_id          is not null and c_plip_id          = plip_id) or
15141           (c_oiplip_id        is not null and c_oiplip_id        = oiplip_id) or
15142           (c_cmbn_plip_id     is not null and c_cmbn_plip_id     = cmbn_plip_id) or
15143           (c_cmbn_ptip_id     is not null and c_cmbn_ptip_id     = cmbn_ptip_id) or
15144           (c_cmbn_ptip_opt_id is not null and c_cmbn_ptip_opt_id = cmbn_ptip_opt_id ) ;
15145    --
15146    cursor c_bpp(c_bnft_prvdr_pool_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
15147    select  bpp.*
15148    from BEN_BNFT_PRVDR_POOL_F bpp
15149    where  bpp.bnft_prvdr_pool_id = c_bnft_prvdr_pool_id
15150      --and bpp.business_group_id = p_business_group_id
15151      and not exists (
15152          select /* */ null
15153          from ben_copy_entity_results cpe
15154               -- pqh_table_route trt
15155          where copy_entity_txn_id = p_copy_entity_txn_id
15156          -- and trt.table_route_id = cpe.table_route_id
15157          and ( -- c_mirror_src_entity_result_id is null or
15158                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
15159          -- and trt.where_clause = 'BEN_BNFT_PRVDR_POOL_F'
15160          and cpe.table_alias = c_table_alias
15161          and information1 = c_bnft_prvdr_pool_id
15162          -- and information4 = bpp.business_group_id
15163            and information2 = bpp.effective_start_date
15164            and information3 = bpp.effective_end_date);
15165     l_bnft_prvdr_pool_id                 number(15);
15166     l_out_bpp_result_id   number(15);
15167    ---------------------------------------------------------------
15168    -- END OF BEN_BNFT_PRVDR_POOL_F ----------------------
15169    ---------------------------------------------------------------
15170    ---------------------------------------------------------------
15171    -- START OF BEN_APLCN_TO_BNFT_POOL_F ----------------------
15172    ---------------------------------------------------------------
15173    cursor c_abp_from_parent(c_BNFT_PRVDR_POOL_ID number) is
15174    select  aplcn_to_bnft_pool_id
15175    from BEN_APLCN_TO_BNFT_POOL_F
15176    where  BNFT_PRVDR_POOL_ID = c_BNFT_PRVDR_POOL_ID ;
15177    --
15178    cursor c_abp(c_aplcn_to_bnft_pool_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
15179    select  abp.*
15180    from BEN_APLCN_TO_BNFT_POOL_F abp
15181    where  abp.aplcn_to_bnft_pool_id = c_aplcn_to_bnft_pool_id
15182      --and abp.business_group_id = p_business_group_id
15183      and not exists (
15184          select /* */ null
15185          from ben_copy_entity_results cpe
15186               -- pqh_table_route trt
15187          where copy_entity_txn_id = p_copy_entity_txn_id
15188          -- and trt.table_route_id = cpe.table_route_id
15189          and ( -- c_mirror_src_entity_result_id is null or
15190                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
15191          -- and trt.where_clause = 'BEN_APLCN_TO_BNFT_POOL_F'
15192          and cpe.table_alias = c_table_alias
15193          and information1 = c_aplcn_to_bnft_pool_id
15194          -- and information4 = abp.business_group_id
15195            and information2 = abp.effective_start_date
15196            and information3 = abp.effective_end_date);
15197     l_aplcn_to_bnft_pool_id                 number(15);
15198     l_out_abp_result_id   number(15);
15199    ---------------------------------------------------------------
15200    -- END OF BEN_APLCN_TO_BNFT_POOL_F ----------------------
15201    ---------------------------------------------------------------
15202    ---------------------------------------------------------------
15203    -- START OF BEN_BNFT_POOL_RLOVR_RQMT_F ----------------------
15204    ---------------------------------------------------------------
15205    cursor c_bpr_from_parent(c_BNFT_PRVDR_POOL_ID number) is
15206    select  bnft_pool_rlovr_rqmt_id
15207    from BEN_BNFT_POOL_RLOVR_RQMT_F
15208    where  BNFT_PRVDR_POOL_ID = c_BNFT_PRVDR_POOL_ID ;
15209    --
15210    cursor c_bpr(c_bnft_pool_rlovr_rqmt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
15211    select  bpr.*
15212    from BEN_BNFT_POOL_RLOVR_RQMT_F bpr
15213    where  bpr.bnft_pool_rlovr_rqmt_id = c_bnft_pool_rlovr_rqmt_id
15214      --and bpr.business_group_id = p_business_group_id
15215      and not exists (
15216          select /* */ null
15217          from ben_copy_entity_results cpe
15218               -- pqh_table_route trt
15219          where copy_entity_txn_id = p_copy_entity_txn_id
15220          -- and trt.table_route_id = cpe.table_route_id
15221          and ( -- c_mirror_src_entity_result_id is null or
15222                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
15223          -- and trt.where_clause = 'BEN_BNFT_POOL_RLOVR_RQMT_F'
15224          and cpe.table_alias = c_table_alias
15225          and information1 = c_bnft_pool_rlovr_rqmt_id
15226          -- and information4 = bpr.business_group_id
15227            and information2 = bpr.effective_start_date
15228            and information3 = bpr.effective_end_date);
15229     l_bnft_pool_rlovr_rqmt_id                 number(15);
15230     l_out_bpr_result_id   number(15);
15231    ---------------------------------------------------------------
15232    -- END OF BEN_BNFT_POOL_RLOVR_RQMT_F ----------------------
15233    ---------------------------------------------------------------
15234  begin
15235    l_number_of_copies := p_number_of_copies ;
15236    --
15237      ---------------------------------------------------------------
15238      -- START OF BEN_BNFT_PRVDR_POOL_F ----------------------
15239      ---------------------------------------------------------------
15240      --
15241      for l_parent_rec  in c_bpp_from_parent(p_pgm_id,p_ptip_id,p_plip_id,
15242                             p_oiplip_id,p_cmbn_plip_id,p_cmbn_ptip_id,p_cmbn_ptip_opt_id) loop
15243       --
15244       l_mirror_src_entity_result_id := p_copy_entity_result_id ;
15245 
15246       --
15247       l_bnft_prvdr_pool_id := l_parent_rec.bnft_prvdr_pool_id ;
15248       --
15249       for l_bpp_rec in c_bpp(l_parent_rec.bnft_prvdr_pool_id,l_mirror_src_entity_result_id,'BPP') loop
15250       --
15251 
15252           l_table_route_id := null ;
15253           open ben_plan_design_program_module.g_table_route('BPP');
15254           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
15255           close ben_plan_design_program_module.g_table_route ;
15256           --
15257           l_information5  := l_bpp_rec.name; --'Intersection';
15258           --
15259           if p_effective_date between l_bpp_rec.effective_start_date
15260              and l_bpp_rec.effective_end_date then
15261            --
15262              l_result_type_cd := 'DISPLAY';
15263           else
15264              l_result_type_cd := 'NO DISPLAY';
15265           end if;
15266             --
15267           l_copy_entity_result_id := null;
15268           l_object_version_number := null;
15269           ben_copy_entity_results_api.create_copy_entity_results(
15270             p_copy_entity_result_id          => l_copy_entity_result_id,
15271             p_copy_entity_txn_id             => p_copy_entity_txn_id,
15272             p_result_type_cd                 => l_result_type_cd,
15273             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
15274             p_parent_entity_result_id        => p_parent_entity_result_id,
15275             p_number_of_copies               => l_number_of_copies,
15276             p_table_route_id                 => l_table_route_id,
15277 	    P_TABLE_ALIAS                    => 'BPP',
15278             p_information1     => l_bpp_rec.bnft_prvdr_pool_id,
15279             p_information2     => l_bpp_rec.EFFECTIVE_START_DATE,
15280             p_information3     => l_bpp_rec.EFFECTIVE_END_DATE,
15281             p_information4     => l_bpp_rec.business_group_id,
15282             p_information5     => l_information5 , -- 9999 put name for h-grid
15283 
15284             p_information16     => l_bpp_rec.alws_ngtv_crs_flag,
15285             p_information25     => l_bpp_rec.auto_alct_excs_flag,
15286             p_information111     => l_bpp_rec.bpp_attribute1,
15287             p_information120     => l_bpp_rec.bpp_attribute10,
15288             p_information121     => l_bpp_rec.bpp_attribute11,
15289             p_information122     => l_bpp_rec.bpp_attribute12,
15290             p_information123     => l_bpp_rec.bpp_attribute13,
15291             p_information124     => l_bpp_rec.bpp_attribute14,
15292             p_information125     => l_bpp_rec.bpp_attribute15,
15293             p_information126     => l_bpp_rec.bpp_attribute16,
15294             p_information127     => l_bpp_rec.bpp_attribute17,
15295             p_information128     => l_bpp_rec.bpp_attribute18,
15296             p_information129     => l_bpp_rec.bpp_attribute19,
15297             p_information112     => l_bpp_rec.bpp_attribute2,
15298             p_information130     => l_bpp_rec.bpp_attribute20,
15299             p_information131     => l_bpp_rec.bpp_attribute21,
15300             p_information132     => l_bpp_rec.bpp_attribute22,
15301             p_information133     => l_bpp_rec.bpp_attribute23,
15302             p_information134     => l_bpp_rec.bpp_attribute24,
15303             p_information135     => l_bpp_rec.bpp_attribute25,
15304             p_information136     => l_bpp_rec.bpp_attribute26,
15305             p_information137     => l_bpp_rec.bpp_attribute27,
15306             p_information138     => l_bpp_rec.bpp_attribute28,
15307             p_information139     => l_bpp_rec.bpp_attribute29,
15308             p_information113     => l_bpp_rec.bpp_attribute3,
15309             p_information140     => l_bpp_rec.bpp_attribute30,
15310             p_information114     => l_bpp_rec.bpp_attribute4,
15311             p_information115     => l_bpp_rec.bpp_attribute5,
15312             p_information116     => l_bpp_rec.bpp_attribute6,
15313             p_information117     => l_bpp_rec.bpp_attribute7,
15314             p_information118     => l_bpp_rec.bpp_attribute8,
15315             p_information119     => l_bpp_rec.bpp_attribute9,
15316             p_information110     => l_bpp_rec.bpp_attribute_category,
15317             p_information239     => l_bpp_rec.cmbn_plip_id,
15318             p_information236     => l_bpp_rec.cmbn_ptip_id,
15319             p_information249     => l_bpp_rec.cmbn_ptip_opt_id,
15320             p_information254     => l_bpp_rec.comp_lvl_fctr_id,
15321             p_information13     => l_bpp_rec.dflt_excs_trtmt_cd,
15322             p_information262     => l_bpp_rec.dflt_excs_trtmt_rl,
15323             p_information19     => l_bpp_rec.excs_alwys_fftd_flag,
15324             p_information15     => l_bpp_rec.excs_trtmt_cd,
15325             p_information263     => l_bpp_rec.mn_dstrbl_pct_num,
15326             p_information293     => l_bpp_rec.mn_dstrbl_val,
15327             p_information296     => l_bpp_rec.mx_dfcit_pct_comp_num,
15328             p_information295     => l_bpp_rec.mx_dfcit_pct_pool_crs_num,
15329             p_information264     => l_bpp_rec.mx_dstrbl_pct_num,
15330             p_information294     => l_bpp_rec.mx_dstrbl_val,
15331             p_information170     => l_bpp_rec.name,
15332             p_information21     => l_bpp_rec.no_mn_dstrbl_pct_flag,
15333             p_information22     => l_bpp_rec.no_mn_dstrbl_val_flag,
15334             p_information23     => l_bpp_rec.no_mx_dstrbl_pct_flag,
15335             p_information24     => l_bpp_rec.no_mx_dstrbl_val_flag,
15336             p_information227     => l_bpp_rec.oiplip_id,
15337             p_information11     => l_bpp_rec.pct_rndg_cd,
15338             p_information266     => l_bpp_rec.pct_rndg_rl,
15339             p_information260     => l_bpp_rec.pgm_id,
15340             p_information18     => l_bpp_rec.pgm_pool_flag,
15341             p_information256     => l_bpp_rec.plip_id,
15342             p_information259     => l_bpp_rec.ptip_id,
15343             p_information14     => l_bpp_rec.rlovr_rstrcn_cd,
15344             p_information20     => l_bpp_rec.use_for_pgm_pool_flag,
15345             p_information17     => l_bpp_rec.uses_net_crs_mthd_flag,
15346             p_information12     => l_bpp_rec.val_rndg_cd,
15347             p_information267     => l_bpp_rec.val_rndg_rl,
15348             p_information265    => l_bpp_rec.object_version_number,
15349 
15350             p_object_version_number          => l_object_version_number,
15351             p_effective_date                 => p_effective_date       );
15352             --
15353 
15354             if l_out_bpp_result_id is null then
15355               l_out_bpp_result_id := l_copy_entity_result_id;
15356             end if;
15357 
15358             if l_result_type_cd = 'DISPLAY' then
15359                l_out_bpp_result_id := l_copy_entity_result_id ;
15360             end if;
15361             --
15362 
15363             if l_bpp_rec.comp_lvl_fctr_id is not null then
15364               --
15365               create_drpar_results
15366                  (
15367                    p_validate                      => p_validate
15368                   ,p_copy_entity_result_id         => l_copy_entity_result_id
15369                   ,p_copy_entity_txn_id            => p_copy_entity_txn_id
15370                   ,p_comp_lvl_fctr_id              => l_bpp_rec.comp_lvl_fctr_id
15371                   ,p_hrs_wkd_in_perd_fctr_id       => null
15372                   ,p_los_fctr_id                   => null
15373                   ,p_pct_fl_tm_fctr_id             => null
15374                   ,p_age_fctr_id                   => null
15375                   ,p_cmbn_age_los_fctr_id          => null
15376                   ,p_business_group_id             => p_business_group_id
15377                   ,p_number_of_copies              => p_number_of_copies
15378                   ,p_object_version_number         => l_object_version_number
15379                   ,p_effective_date                => p_effective_date
15380                  );
15381               --
15382             end if;
15383 
15384 
15385            -- If there are any Fast formulas attached to any columns copy the formulas
15386            -- also
15387 
15388            ---------------------------------------------------------------
15389                      -- DFLT_EXCS_TRTMT_RL --
15390                      ---------------------------------------------------------------
15391                      --
15392                      if l_bpp_rec.dflt_excs_trtmt_rl is not null then
15393                             --
15394                             ben_plan_design_program_module.create_formula_result
15395                             (
15396                              p_validate                       =>  0
15397                             ,p_copy_entity_result_id          =>  l_copy_entity_result_id
15398                             ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
15399                             ,p_formula_id                     =>  l_bpp_rec.dflt_excs_trtmt_rl
15400                             ,p_business_group_id              =>  l_bpp_rec.business_group_id
15401                             ,p_number_of_copies               =>  l_number_of_copies
15402                             ,p_object_version_number          =>  l_object_version_number
15403                             ,p_effective_date                 =>  p_effective_date
15404                             );
15405 
15406                             --
15407                      end if;
15408            --
15409 
15410            ---------------------------------------------------------------
15411                      -- PCT_RNDG_RL --
15412                      ---------------------------------------------------------------
15413                      --
15414                      if l_bpp_rec.pct_rndg_rl is not null then
15415                             --
15416                             ben_plan_design_program_module.create_formula_result
15417                             (
15418                              p_validate                       =>  0
15419                             ,p_copy_entity_result_id          =>  l_copy_entity_result_id
15420                             ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
15421                             ,p_formula_id                     =>  l_bpp_rec.pct_rndg_rl
15422                             ,p_business_group_id              =>  l_bpp_rec.business_group_id
15423                             ,p_number_of_copies               =>  l_number_of_copies
15424                             ,p_object_version_number          =>  l_object_version_number
15425                             ,p_effective_date                 =>  p_effective_date
15426                             );
15427 
15428                             --
15429                      end if;
15430            --
15431 
15432            ---------------------------------------------------------------
15433                      -- VAL_RNDG_RL --
15434                      ---------------------------------------------------------------
15435                      --
15436                      if l_bpp_rec.val_rndg_rl is not null then
15437                             --
15438                             ben_plan_design_program_module.create_formula_result
15439                             (
15440                              p_validate                       =>  0
15441                             ,p_copy_entity_result_id          =>  l_copy_entity_result_id
15442                             ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
15443                             ,p_formula_id                     =>  l_bpp_rec.val_rndg_rl
15444                             ,p_business_group_id              =>  l_bpp_rec.business_group_id
15445                             ,p_number_of_copies               =>  l_number_of_copies
15446                             ,p_object_version_number          =>  l_object_version_number
15447                             ,p_effective_date                 =>  p_effective_date
15448                             );
15449 
15450                             --
15451                      end if;
15452            --
15453       end loop;
15454          --
15455         ---------------------------------------------------------------
15456         -- START OF BEN_APLCN_TO_BNFT_POOL_F ----------------------
15457         ---------------------------------------------------------------
15458         --
15459         for l_parent_rec  in c_abp_from_parent(l_BNFT_PRVDR_POOL_ID) loop
15460            --
15461            l_mirror_src_entity_result_id := l_out_bpp_result_id ;
15462 
15463            --
15464            l_aplcn_to_bnft_pool_id := l_parent_rec.aplcn_to_bnft_pool_id ;
15465            --
15466            for l_abp_rec in c_abp(l_parent_rec.aplcn_to_bnft_pool_id,l_mirror_src_entity_result_id,'ABP') loop
15467              --
15468              l_table_route_id := null ;
15469              open ben_plan_design_program_module.g_table_route('ABP');
15470              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
15471              close ben_plan_design_program_module.g_table_route ;
15472              --
15473              l_information5  := ben_plan_design_program_module.get_acty_base_rt_name(l_abp_rec.acty_base_rt_id
15474                                                                                      ,p_effective_date); --'Intersection';
15475              --
15476              if p_effective_date between l_abp_rec.effective_start_date
15477                 and l_abp_rec.effective_end_date then
15478               --
15479                 l_result_type_cd := 'DISPLAY';
15480              else
15481                 l_result_type_cd := 'NO DISPLAY';
15482              end if;
15483                --
15484              l_copy_entity_result_id := null;
15485              l_object_version_number := null;
15486              ben_copy_entity_results_api.create_copy_entity_results(
15487                p_copy_entity_result_id          => l_copy_entity_result_id,
15488                p_copy_entity_txn_id             => p_copy_entity_txn_id,
15489                p_result_type_cd                 => l_result_type_cd,
15490                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
15491                p_parent_entity_result_id        => l_mirror_src_entity_result_id,
15492                p_number_of_copies               => l_number_of_copies,
15493                p_table_route_id                 => l_table_route_id,
15494 	       P_TABLE_ALIAS                    => 'ABP',
15495                p_information1     => l_abp_rec.aplcn_to_bnft_pool_id,
15496                p_information2     => l_abp_rec.EFFECTIVE_START_DATE,
15497                p_information3     => l_abp_rec.EFFECTIVE_END_DATE,
15498                p_information4     => l_abp_rec.business_group_id,
15499                p_information5     => l_information5 , -- 9999 put name for h-grid
15500             p_information111     => l_abp_rec.abp_attribute1,
15501             p_information120     => l_abp_rec.abp_attribute10,
15502             p_information121     => l_abp_rec.abp_attribute11,
15503             p_information122     => l_abp_rec.abp_attribute12,
15504             p_information123     => l_abp_rec.abp_attribute13,
15505             p_information124     => l_abp_rec.abp_attribute14,
15506             p_information125     => l_abp_rec.abp_attribute15,
15507             p_information126     => l_abp_rec.abp_attribute16,
15508             p_information127     => l_abp_rec.abp_attribute17,
15509             p_information128     => l_abp_rec.abp_attribute18,
15510             p_information129     => l_abp_rec.abp_attribute19,
15511             p_information112     => l_abp_rec.abp_attribute2,
15512             p_information130     => l_abp_rec.abp_attribute20,
15513             p_information131     => l_abp_rec.abp_attribute21,
15514             p_information132     => l_abp_rec.abp_attribute22,
15515             p_information133     => l_abp_rec.abp_attribute23,
15516             p_information134     => l_abp_rec.abp_attribute24,
15517             p_information135     => l_abp_rec.abp_attribute25,
15518             p_information136     => l_abp_rec.abp_attribute26,
15519             p_information137     => l_abp_rec.abp_attribute27,
15520             p_information138     => l_abp_rec.abp_attribute28,
15521             p_information139     => l_abp_rec.abp_attribute29,
15522             p_information113     => l_abp_rec.abp_attribute3,
15523             p_information140     => l_abp_rec.abp_attribute30,
15524             p_information114     => l_abp_rec.abp_attribute4,
15525             p_information115     => l_abp_rec.abp_attribute5,
15526             p_information116     => l_abp_rec.abp_attribute6,
15527             p_information117     => l_abp_rec.abp_attribute7,
15528             p_information118     => l_abp_rec.abp_attribute8,
15529             p_information119     => l_abp_rec.abp_attribute9,
15530             p_information110     => l_abp_rec.abp_attribute_category,
15531             p_information253     => l_abp_rec.acty_base_rt_id,
15532             p_information235     => l_abp_rec.bnft_prvdr_pool_id,
15533             p_information265     => l_abp_rec.object_version_number,
15534                p_object_version_number          => l_object_version_number,
15535                p_effective_date                 => p_effective_date       );
15536                --
15537 
15538                if l_out_abp_result_id is null then
15539                  l_out_abp_result_id := l_copy_entity_result_id;
15540                end if;
15541 
15542                if l_result_type_cd = 'DISPLAY' then
15543                   l_out_abp_result_id := l_copy_entity_result_id ;
15544                end if;
15545                --
15546             end loop;
15547             --
15548           end loop;
15549        ---------------------------------------------------------------
15550        -- END OF BEN_APLCN_TO_BNFT_POOL_F ----------------------
15551        ---------------------------------------------------------------
15552         ---------------------------------------------------------------
15553         -- START OF BEN_BNFT_POOL_RLOVR_RQMT_F ----------------------
15554         ---------------------------------------------------------------
15555         --
15556         for l_parent_rec  in c_bpr_from_parent(l_BNFT_PRVDR_POOL_ID) loop
15557            --
15558            l_mirror_src_entity_result_id := l_out_bpp_result_id ;
15559 
15560            --
15561            l_bnft_pool_rlovr_rqmt_id := l_parent_rec.bnft_pool_rlovr_rqmt_id ;
15562            --
15563            for l_bpr_rec in c_bpr(l_parent_rec.bnft_pool_rlovr_rqmt_id,l_mirror_src_entity_result_id,'BPR1') loop
15564              --
15565              l_table_route_id := null ;
15566              open ben_plan_design_program_module.g_table_route('BPR1');
15567              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
15568              close ben_plan_design_program_module.g_table_route ;
15569              --
15570              l_information5  := ben_plan_design_program_module.get_acty_base_rt_name(l_bpr_rec.acty_base_rt_id
15571                                                                                      ,p_effective_date); --'Intersection';
15572              --
15573              if p_effective_date between l_bpr_rec.effective_start_date
15574                 and l_bpr_rec.effective_end_date then
15575               --
15576                 l_result_type_cd := 'DISPLAY';
15577              else
15578                 l_result_type_cd := 'NO DISPLAY';
15579              end if;
15580                --
15581              l_copy_entity_result_id := null;
15582              l_object_version_number := null;
15583              ben_copy_entity_results_api.create_copy_entity_results(
15584                p_copy_entity_result_id          => l_copy_entity_result_id,
15585                p_copy_entity_txn_id             => p_copy_entity_txn_id,
15586                p_result_type_cd                 => l_result_type_cd,
15587                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
15588                p_parent_entity_result_id        => l_mirror_src_entity_result_id,
15589                p_number_of_copies               => l_number_of_copies,
15590                p_table_route_id                 => l_table_route_id,
15591 	       P_TABLE_ALIAS                    => 'BPR1',
15592                p_information1     => l_bpr_rec.bnft_pool_rlovr_rqmt_id,
15593                p_information2     => l_bpr_rec.EFFECTIVE_START_DATE,
15594                p_information3     => l_bpr_rec.EFFECTIVE_END_DATE,
15595                p_information4     => l_bpr_rec.business_group_id,
15596                p_information5     => l_information5 , -- 9999 put name for h-grid
15597 
15598             p_information253     => l_bpr_rec.acty_base_rt_id,
15599             p_information235     => l_bpr_rec.bnft_prvdr_pool_id,
15600             p_information111     => l_bpr_rec.bpr_attribute1,
15601             p_information120     => l_bpr_rec.bpr_attribute10,
15602             p_information121     => l_bpr_rec.bpr_attribute11,
15603             p_information122     => l_bpr_rec.bpr_attribute12,
15604             p_information123     => l_bpr_rec.bpr_attribute13,
15605             p_information124     => l_bpr_rec.bpr_attribute14,
15606             p_information125     => l_bpr_rec.bpr_attribute15,
15607             p_information126     => l_bpr_rec.bpr_attribute16,
15608             p_information127     => l_bpr_rec.bpr_attribute17,
15609             p_information128     => l_bpr_rec.bpr_attribute18,
15610             p_information129     => l_bpr_rec.bpr_attribute19,
15611             p_information112     => l_bpr_rec.bpr_attribute2,
15612             p_information130     => l_bpr_rec.bpr_attribute20,
15613             p_information131     => l_bpr_rec.bpr_attribute21,
15614             p_information132     => l_bpr_rec.bpr_attribute22,
15615             p_information133     => l_bpr_rec.bpr_attribute23,
15616             p_information134     => l_bpr_rec.bpr_attribute24,
15617             p_information135     => l_bpr_rec.bpr_attribute25,
15618             p_information136     => l_bpr_rec.bpr_attribute26,
15619             p_information137     => l_bpr_rec.bpr_attribute27,
15620             p_information138     => l_bpr_rec.bpr_attribute28,
15621             p_information139     => l_bpr_rec.bpr_attribute29,
15622             p_information113     => l_bpr_rec.bpr_attribute3,
15623             p_information140     => l_bpr_rec.bpr_attribute30,
15624             p_information114     => l_bpr_rec.bpr_attribute4,
15625             p_information115     => l_bpr_rec.bpr_attribute5,
15626             p_information116     => l_bpr_rec.bpr_attribute6,
15627             p_information117     => l_bpr_rec.bpr_attribute7,
15628             p_information118     => l_bpr_rec.bpr_attribute8,
15629             p_information119     => l_bpr_rec.bpr_attribute9,
15630             p_information110     => l_bpr_rec.bpr_attribute_category,
15631             p_information11     => l_bpr_rec.crs_rlovr_procg_cd,
15632             p_information258     => l_bpr_rec.mn_rlovr_pct_num,
15633             p_information293     => l_bpr_rec.mn_rlovr_val,
15634             p_information261     => l_bpr_rec.mx_pct_ttl_crs_cn_roll_num,
15635             p_information270     => l_bpr_rec.mx_rchd_dflt_ordr_num,
15636             p_information259     => l_bpr_rec.mx_rlovr_pct_num,
15637             p_information294     => l_bpr_rec.mx_rlovr_val,
15638             p_information12     => l_bpr_rec.no_mn_rlovr_pct_dfnd_flag,
15639             p_information14     => l_bpr_rec.no_mn_rlovr_val_dfnd_flag,
15640             p_information13     => l_bpr_rec.no_mx_rlovr_pct_dfnd_flag,
15641             p_information15     => l_bpr_rec.no_mx_rlovr_val_dfnd_flag,
15642             p_information257     => l_bpr_rec.pct_rlovr_incrmt_num,
15643             p_information17     => l_bpr_rec.pct_rndg_cd,
15644             p_information263     => l_bpr_rec.pct_rndg_rl,
15645             p_information260     => l_bpr_rec.prtt_elig_rlovr_rl,
15646             p_information268     => l_bpr_rec.rlovr_val_incrmt_num,
15647             p_information269     => l_bpr_rec.rlovr_val_rl,
15648             p_information16     => l_bpr_rec.val_rndg_cd,
15649             p_information262     => l_bpr_rec.val_rndg_rl,
15650             p_information265    => l_bpr_rec.object_version_number,
15651 
15652                p_object_version_number          => l_object_version_number,
15653                p_effective_date                 => p_effective_date       );
15654                --
15655 
15656                if l_out_bpr_result_id is null then
15657                  l_out_bpr_result_id := l_copy_entity_result_id;
15658                end if;
15659 
15660                if l_result_type_cd = 'DISPLAY' then
15661                   l_out_bpr_result_id := l_copy_entity_result_id ;
15662                end if;
15663                --
15664 
15665                -- If a Fast formula exists for any columns the copy Fast Formula Data also
15666 
15667                ---------------------------------------------------------------
15668                              -- PCT_RNDG_RL --
15669                              ---------------------------------------------------------------
15670                              --
15671                              if l_bpr_rec.pct_rndg_rl is not null then
15672                                     --
15673                                     ben_plan_design_program_module.create_formula_result
15674                                     (
15675                                      p_validate                       =>  0
15676                                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
15677                                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
15678                                     ,p_formula_id                     =>  l_bpr_rec.pct_rndg_rl
15679                                     ,p_business_group_id              =>  l_bpr_rec.business_group_id
15680                                     ,p_number_of_copies               =>  l_number_of_copies
15681                                     ,p_object_version_number          =>  l_object_version_number
15682                                     ,p_effective_date                 =>  p_effective_date
15683                                     );
15684 
15685                                     --
15686                              end if;
15687                --
15688 
15689                ---------------------------------------------------------------
15690                              -- PRTT_ELIG_RLOVR_RL --
15691                              ---------------------------------------------------------------
15692                              --
15693                              if l_bpr_rec.prtt_elig_rlovr_rl is not null then
15694                                     --
15695                                     ben_plan_design_program_module.create_formula_result
15696                                     (
15697                                      p_validate                       =>  0
15698                                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
15699                                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
15700                                     ,p_formula_id                     =>  l_bpr_rec.prtt_elig_rlovr_rl
15701                                     ,p_business_group_id              =>  l_bpr_rec.business_group_id
15702                                     ,p_number_of_copies               =>  l_number_of_copies
15703                                     ,p_object_version_number          =>  l_object_version_number
15704                                     ,p_effective_date                 =>  p_effective_date
15705                                     );
15706 
15707                                     --
15708                              end if;
15709                              --
15710 
15711                ---------------------------------------------------------------
15712                              -- RLOVR_VAL_RL --
15713                              ---------------------------------------------------------------
15714                              --
15715                              if l_bpr_rec.rlovr_val_rl is not null then
15716                                     --
15717                                     ben_plan_design_program_module.create_formula_result
15718                                     (
15719                                      p_validate                       =>  0
15720                                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
15721                                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
15722                                     ,p_formula_id                     =>  l_bpr_rec.rlovr_val_rl
15723                                     ,p_business_group_id              =>  l_bpr_rec.business_group_id
15724                                     ,p_number_of_copies               =>  l_number_of_copies
15725                                     ,p_object_version_number          =>  l_object_version_number
15726                                     ,p_effective_date                 =>  p_effective_date
15727                                     );
15728 
15729                                     --
15730                              end if;
15731                              --
15732                              ---------------------------------------------------------------
15733                              -- VAL_RNDG_RL --
15734                              ---------------------------------------------------------------
15735                              --
15736                              if l_bpr_rec.val_rndg_rl is not null then
15737                                     --
15738                                     ben_plan_design_program_module.create_formula_result
15739                                     (
15740                                      p_validate                       =>  0
15741                                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
15742                                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
15743                                     ,p_formula_id                     =>  l_bpr_rec.val_rndg_rl
15744                                     ,p_business_group_id              =>  l_bpr_rec.business_group_id
15745                                     ,p_number_of_copies               =>  l_number_of_copies
15746                                     ,p_object_version_number          =>  l_object_version_number
15747                                     ,p_effective_date                 =>  p_effective_date
15748                                     );
15749 
15750                                     --
15751                              end if;
15752                              --
15753 
15754             end loop;
15755             --
15756           end loop;
15757 
15758        ---------------------------------------------------------------
15759        -- END OF BEN_BNFT_POOL_RLOVR_RQMT_F ----------------------
15760        ---------------------------------------------------------------
15761        end loop;
15762     ---------------------------------------------------------------
15763     -- END OF BEN_BNFT_PRVDR_POOL_F ----------------------
15764     ---------------------------------------------------------------
15765    --
15766  end ;
15767  --
15768  procedure create_service_results
15769    (
15770     p_validate                       in  number     default 0 -- false
15771    ,p_copy_entity_result_id          in  number    -- Source Elpro
15772    ,p_copy_entity_txn_id             in  number    default null
15773    ,p_svc_area_id                    in  number
15774    ,p_business_group_id              in  number    default null
15775    ,p_number_of_copies               in  number    default 0
15776    ,p_object_version_number          out nocopy number
15777    ,p_effective_date                 in  date
15778    ) is
15779     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
15780     l_proc varchar2(72) := g_package||'create_rate_results';
15781     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
15782     --
15783     cursor c_parent_result(c_parent_pk_id number,
15784                         c_parent_table_name varchar2,
15785                         c_copy_entity_txn_id number) is
15786      select copy_entity_result_id mirror_src_entity_result_id
15787      from ben_copy_entity_results cpe,
15788         pqh_table_route trt
15789      where cpe.information1= c_parent_pk_id
15790      and   cpe.result_type_cd = 'DISPLAY'
15791      and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
15792      and   cpe.table_route_id = trt.table_route_id
15793      and   trt.from_clause = 'OAB'
15794      and   trt.where_clause = upper(c_parent_table_name) ;
15795      ---
15796      -- Bug : 3752407 : Global cursor g_table_route will now be used
15797      -- Cursor to get table_route_id
15798      --
15799      -- cursor c_table_route(c_parent_table_alias varchar2) is
15800      -- select table_route_id
15801      -- from pqh_table_route trt
15802      -- where trt.table_alias = c_parent_table_alias;
15803      -- trt.from_clause = 'OAB'
15804      -- and   trt.where_clause = upper(c_parent_table_name) ;
15805      ---
15806      l_mirror_src_entity_result_id    number(15);
15807      l_table_route_id               number(15);
15808      l_result_type_cd               varchar2(30);
15809      l_information5                 ben_copy_entity_results.information5%type;
15810      l_number_of_copies             number(15);
15811    ---------------------------------------------------------------
15812    -- START OF BEN_SVC_AREA_F ----------------------
15813    ---------------------------------------------------------------
15814    cursor c_sva(c_svc_area_id number,c_mirror_src_entity_result_id number,
15815                 c_table_alias varchar2 ) is
15816    select  sva.*
15817    from BEN_SVC_AREA_F sva
15818    where  sva.svc_area_id = c_svc_area_id
15819      --and sva.business_group_id = p_business_group_id
15820      and not exists (
15821          select /* */ null
15822          from ben_copy_entity_results cpe
15823               -- pqh_table_route trt
15824          where copy_entity_txn_id = p_copy_entity_txn_id
15825          -- and trt.table_route_id = cpe.table_route_id
15826          and ( -- c_mirror_src_entity_result_id is null or
15827                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
15828          -- and trt.where_clause = 'BEN_SVC_AREA_F'
15829          and cpe.table_alias = c_table_alias
15830          and information1 = c_svc_area_id
15831          -- and information4 = sva.business_group_id
15832            and information2 = sva.effective_start_date
15833            and information3 = sva.effective_end_date);
15834     l_svc_area_id                 number(15);
15835     l_out_sva_result_id   number(15);
15836    ---------------------------------------------------------------
15837    -- END OF BEN_SVC_AREA_F ----------------------
15838    ---------------------------------------------------------------
15839    ---------------------------------------------------------------
15840    -- START OF BEN_SVC_AREA_PSTL_ZIP_RNG_F ----------------------
15841    ---------------------------------------------------------------
15842    cursor c_saz_from_parent(c_SVC_AREA_ID number) is
15843    select distinct svc_area_pstl_zip_rng_id
15844    from BEN_SVC_AREA_PSTL_ZIP_RNG_F
15845    where  SVC_AREA_ID = c_SVC_AREA_ID ;
15846    --
15847    cursor c_saz(c_svc_area_pstl_zip_rng_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
15848    select  saz.*
15849    from BEN_SVC_AREA_PSTL_ZIP_RNG_F saz
15850    where  saz.svc_area_pstl_zip_rng_id = c_svc_area_pstl_zip_rng_id
15851      --and saz.business_group_id = p_business_group_id
15852      and not exists (
15853          select /* */ null
15854          from ben_copy_entity_results cpe
15855               -- pqh_table_route trt
15856          where copy_entity_txn_id = p_copy_entity_txn_id
15857          -- and trt.table_route_id = cpe.table_route_id
15858          and ( -- c_mirror_src_entity_result_id is null or
15859                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
15860          -- and trt.where_clause = 'BEN_SVC_AREA_PSTL_ZIP_RNG_F'
15861          and cpe.table_alias = c_table_alias
15862          and information1 = c_svc_area_pstl_zip_rng_id
15863          -- and information4 = saz.business_group_id
15864            and information2 = saz.effective_start_date
15865            and information3 = saz.effective_end_date);
15866     l_svc_area_pstl_zip_rng_id                 number(15);
15867     l_out_saz_result_id   number(15);
15868    --
15869    cursor c_saz_pstl(c_svc_area_pstl_zip_rng_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
15870    select distinct cpe.information245 pstl_zip_rng_id
15871          from ben_copy_entity_results cpe
15872               -- pqh_table_route trt
15873          where copy_entity_txn_id = p_copy_entity_txn_id
15874          -- and trt.table_route_id = cpe.table_route_id
15875          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
15876          -- and trt.where_clause = 'BEN_SVC_AREA_PSTL_ZIP_RNG_F'
15877          and cpe.table_alias = c_table_alias
15878          and information1 = c_svc_area_pstl_zip_rng_id
15879          -- and information4 = p_business_group_id
15880         ;
15881 
15882    ---------------------------------------------------------------
15883    -- END OF BEN_SVC_AREA_PSTL_ZIP_RNG_F ----------------------
15884    ---------------------------------------------------------------
15885 
15886     cursor c_object_exists(c_pk_id                number,
15887                           c_table_alias          varchar2) is
15888     select null
15889     from ben_copy_entity_results cpe
15890          -- pqh_table_route trt
15891     where copy_entity_txn_id = p_copy_entity_txn_id
15892     -- and trt.table_route_id = cpe.table_route_id
15893     and cpe.table_alias = c_table_alias
15894     and information1 = c_pk_id;
15895 
15896    l_dummy                     varchar2(1);
15897 
15898   begin
15899 
15900      if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
15901        open c_object_exists(p_svc_area_id,'SVA');
15902        fetch c_object_exists into l_dummy;
15903        if c_object_exists%found then
15904          close c_object_exists;
15905          return;
15906        end if;
15907        close c_object_exists;
15908      end if;
15909 
15910      l_number_of_copies := p_number_of_copies ;
15911      ---------------------------------------------------------------
15912      -- START OF BEN_SVC_AREA_F ----------------------
15913      ---------------------------------------------------------------
15914         --
15915         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
15916         --
15917         l_svc_area_id := p_svc_area_id ;
15918         --
15919         for l_sva_rec in c_sva(l_svc_area_id,l_mirror_src_entity_result_id,'SVA') loop
15920           --
15921           l_table_route_id := null ;
15922           open ben_plan_design_program_module.g_table_route('SVA');
15923           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
15924           close ben_plan_design_program_module.g_table_route ;
15925           --
15926           l_information5  := l_sva_rec.name; --'Intersection';
15927           --
15928           if p_effective_date between l_sva_rec.effective_start_date
15929              and l_sva_rec.effective_end_date then
15930            --
15931              l_result_type_cd := 'DISPLAY';
15932           else
15933              l_result_type_cd := 'NO DISPLAY';
15934           end if;
15935             --
15936           l_copy_entity_result_id := null;
15937           l_object_version_number := null;
15938           ben_copy_entity_results_api.create_copy_entity_results(
15939             p_copy_entity_result_id          => l_copy_entity_result_id,
15940             p_copy_entity_txn_id             => p_copy_entity_txn_id,
15941             p_result_type_cd                 => l_result_type_cd,
15942             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
15943             p_parent_entity_result_id        => l_mirror_src_entity_result_id,
15944             p_number_of_copies               => l_number_of_copies,
15945             p_table_route_id                 => l_table_route_id,
15946 	    P_TABLE_ALIAS                    => 'SVA',
15947             p_information1     => l_sva_rec.svc_area_id,
15948             p_information2     => l_sva_rec.EFFECTIVE_START_DATE,
15949             p_information3     => l_sva_rec.EFFECTIVE_END_DATE,
15950             p_information4     => l_sva_rec.business_group_id,
15951             p_information5     => l_information5 , -- 9999 put name for h-grid
15952 
15953             p_information170     => l_sva_rec.name,
15954             p_information141     => l_sva_rec.org_unit_prdct,
15955             p_information111     => l_sva_rec.sva_attribute1,
15956             p_information120     => l_sva_rec.sva_attribute10,
15957             p_information121     => l_sva_rec.sva_attribute11,
15958             p_information122     => l_sva_rec.sva_attribute12,
15959             p_information123     => l_sva_rec.sva_attribute13,
15960             p_information124     => l_sva_rec.sva_attribute14,
15961             p_information125     => l_sva_rec.sva_attribute15,
15962             p_information126     => l_sva_rec.sva_attribute16,
15963             p_information127     => l_sva_rec.sva_attribute17,
15964             p_information128     => l_sva_rec.sva_attribute18,
15965             p_information129     => l_sva_rec.sva_attribute19,
15966             p_information112     => l_sva_rec.sva_attribute2,
15967             p_information130     => l_sva_rec.sva_attribute20,
15968             p_information131     => l_sva_rec.sva_attribute21,
15969             p_information132     => l_sva_rec.sva_attribute22,
15970             p_information133     => l_sva_rec.sva_attribute23,
15971             p_information134     => l_sva_rec.sva_attribute24,
15972             p_information135     => l_sva_rec.sva_attribute25,
15973             p_information136     => l_sva_rec.sva_attribute26,
15974             p_information137     => l_sva_rec.sva_attribute27,
15975             p_information138     => l_sva_rec.sva_attribute28,
15976             p_information139     => l_sva_rec.sva_attribute29,
15977             p_information113     => l_sva_rec.sva_attribute3,
15978             p_information140     => l_sva_rec.sva_attribute30,
15979             p_information114     => l_sva_rec.sva_attribute4,
15980             p_information115     => l_sva_rec.sva_attribute5,
15981             p_information116     => l_sva_rec.sva_attribute6,
15982             p_information117     => l_sva_rec.sva_attribute7,
15983             p_information118     => l_sva_rec.sva_attribute8,
15984             p_information119     => l_sva_rec.sva_attribute9,
15985             p_information110     => l_sva_rec.sva_attribute_category,
15986             p_information265     => l_sva_rec.object_version_number,
15987            --
15988 
15989             p_object_version_number          => l_object_version_number,
15990             p_effective_date                 => p_effective_date       );
15991             --
15992 
15993             if l_out_sva_result_id is null then
15994               l_out_sva_result_id := l_copy_entity_result_id;
15995             end if;
15996 
15997             if l_result_type_cd = 'DISPLAY' then
15998                l_out_sva_result_id := l_copy_entity_result_id ;
15999             end if;
16000             --
16001          end loop;
16002          --
16003         ---------------------------------------------------------------
16004         -- START OF BEN_SVC_AREA_PSTL_ZIP_RNG_F ----------------------
16005         ---------------------------------------------------------------
16006         -- Bug - 4241267 - moved code outside of loop
16007         l_table_route_id := null ;
16008         open ben_plan_design_program_module.g_table_route('SAZ');
16009         fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
16010         close ben_plan_design_program_module.g_table_route ;
16011         --
16012 
16013         for l_parent_rec  in c_saz_from_parent(l_SVC_AREA_ID) loop
16014            --
16015            l_mirror_src_entity_result_id := l_out_sva_result_id ;
16016 
16017            --
16018            l_svc_area_pstl_zip_rng_id := l_parent_rec.svc_area_pstl_zip_rng_id ;
16019            --
16020            for l_saz_rec in c_saz(l_parent_rec.svc_area_pstl_zip_rng_id,l_mirror_src_entity_result_id,'SAZ') loop
16021              --
16022              l_information5  := ben_plan_design_program_module.get_pstl_zip_rng_name(l_saz_rec.pstl_zip_rng_id
16023                                                                                      ,p_effective_date); --'Intersection';
16024              --
16025              if p_effective_date between l_saz_rec.effective_start_date
16026                 and l_saz_rec.effective_end_date then
16027               --
16028                 l_result_type_cd := 'DISPLAY';
16029              else
16030                 l_result_type_cd := 'NO DISPLAY';
16031              end if;
16032                --
16033              l_copy_entity_result_id := null;
16034              l_object_version_number := null;
16035              ben_copy_entity_results_api.create_copy_entity_results(
16036                p_copy_entity_result_id          => l_copy_entity_result_id,
16037                p_copy_entity_txn_id             => p_copy_entity_txn_id,
16038                p_result_type_cd                 => l_result_type_cd,
16039                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
16040                p_parent_entity_result_id        => l_mirror_src_entity_result_id,
16041                p_number_of_copies               => l_number_of_copies,
16042                p_table_route_id                 => l_table_route_id,
16043 	       P_TABLE_ALIAS                    => 'SAZ',
16044                p_information1     => l_saz_rec.svc_area_pstl_zip_rng_id,
16045                p_information2     => l_saz_rec.EFFECTIVE_START_DATE,
16046                p_information3     => l_saz_rec.EFFECTIVE_END_DATE,
16047                p_information4     => l_saz_rec.business_group_id,
16048                p_information5     => l_information5 , -- 9999 put name for h-grid
16049 
16050             p_information245     => l_saz_rec.pstl_zip_rng_id,
16051             p_information111     => l_saz_rec.saz_attribute1,
16052             p_information120     => l_saz_rec.saz_attribute10,
16053             p_information121     => l_saz_rec.saz_attribute11,
16054             p_information122     => l_saz_rec.saz_attribute12,
16055             p_information123     => l_saz_rec.saz_attribute13,
16056             p_information124     => l_saz_rec.saz_attribute14,
16057             p_information125     => l_saz_rec.saz_attribute15,
16058             p_information126     => l_saz_rec.saz_attribute16,
16059             p_information127     => l_saz_rec.saz_attribute17,
16060             p_information128     => l_saz_rec.saz_attribute18,
16061             p_information129     => l_saz_rec.saz_attribute19,
16062             p_information112     => l_saz_rec.saz_attribute2,
16063             p_information130     => l_saz_rec.saz_attribute20,
16064             p_information131     => l_saz_rec.saz_attribute21,
16065             p_information132     => l_saz_rec.saz_attribute22,
16066             p_information133     => l_saz_rec.saz_attribute23,
16067             p_information134     => l_saz_rec.saz_attribute24,
16068             p_information135     => l_saz_rec.saz_attribute25,
16069             p_information136     => l_saz_rec.saz_attribute26,
16070             p_information137     => l_saz_rec.saz_attribute27,
16071             p_information138     => l_saz_rec.saz_attribute28,
16072             p_information139     => l_saz_rec.saz_attribute29,
16073             p_information113     => l_saz_rec.saz_attribute3,
16074             p_information140     => l_saz_rec.saz_attribute30,
16075             p_information114     => l_saz_rec.saz_attribute4,
16076             p_information115     => l_saz_rec.saz_attribute5,
16077             p_information116     => l_saz_rec.saz_attribute6,
16078             p_information117     => l_saz_rec.saz_attribute7,
16079             p_information118     => l_saz_rec.saz_attribute8,
16080             p_information119     => l_saz_rec.saz_attribute9,
16081             p_information110     => l_saz_rec.saz_attribute_category,
16082             p_information241     => l_saz_rec.svc_area_id,
16083             p_information265     => l_saz_rec.object_version_number,
16084            --
16085 
16086                p_object_version_number          => l_object_version_number,
16087                p_effective_date                 => p_effective_date       );
16088                --
16089 
16090                if l_out_saz_result_id is null then
16091                  l_out_saz_result_id := l_copy_entity_result_id;
16092                end if;
16093 
16094                if l_result_type_cd = 'DISPLAY' then
16095                   l_out_saz_result_id := l_copy_entity_result_id ;
16096                end if;
16097                --
16098             end loop;
16099             --
16100               for l_saz_rec in c_saz_pstl(l_parent_rec.svc_area_pstl_zip_rng_id,l_mirror_src_entity_result_id,'SAZ') loop
16101                  create_postal_results
16102                    (
16103                     p_validate                    => p_validate
16104                    ,p_copy_entity_result_id       => l_out_saz_result_id
16105                    ,p_copy_entity_txn_id          => p_copy_entity_txn_id
16106                    ,p_pstl_zip_rng_id             => l_saz_rec.pstl_zip_rng_id
16107                    ,p_business_group_id           => p_business_group_id
16108                    ,p_number_of_copies            => p_number_of_copies
16109                    ,p_object_version_number       => l_object_version_number
16110                    ,p_effective_date              => p_effective_date
16111                    ) ;
16112               end loop;
16113           end loop;
16114        ---------------------------------------------------------------
16115        -- END OF BEN_SVC_AREA_PSTL_ZIP_RNG_F ----------------------
16116        ---------------------------------------------------------------
16117     ---------------------------------------------------------------
16118     -- END OF BEN_SVC_AREA_F ----------------------
16119     ---------------------------------------------------------------
16120   end create_service_results ;
16121 --
16122 procedure create_postal_results
16123   (
16124    p_validate                       in  number     default 0 -- false
16125   ,p_copy_entity_result_id          in  number    -- Source Elpro
16126   ,p_copy_entity_txn_id             in  number    default null
16127   ,p_pstl_zip_rng_id                in  number
16128   ,p_business_group_id              in  number    default null
16129   ,p_number_of_copies               in  number    default 0
16130   ,p_object_version_number          out nocopy number
16131   ,p_effective_date                 in  date
16132   ) is
16133     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
16134     l_proc varchar2(72) := g_package||'create_rate_results';
16135     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
16136     --
16137     cursor c_parent_result(c_parent_pk_id number,
16138                         c_parent_table_name varchar2,
16139                         c_copy_entity_txn_id number) is
16140      select copy_entity_result_id mirror_src_entity_result_id
16141      from ben_copy_entity_results cpe,
16142         pqh_table_route trt
16143      where cpe.information1= c_parent_pk_id
16144      and   cpe.result_type_cd = 'DISPLAY'
16145      and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
16146      and   cpe.table_route_id = trt.table_route_id
16147      and   trt.from_clause = 'OAB'
16148      and   trt.where_clause = upper(c_parent_table_name) ;
16149      ---
16150      -- Bug : 3752407 : Global cursor g_table_route will now be used
16151      -- Cursor to get table_route_id
16152      --
16153      -- cursor c_table_route(c_parent_table_alias varchar2) is
16154      -- select table_route_id
16155      -- from pqh_table_route trt
16156      -- where trt.table_alias = c_parent_table_alias;
16157      -- trt.from_clause = 'OAB'
16158      -- and   trt.where_clause = upper(c_parent_table_name) ;
16159      ---
16160      l_mirror_src_entity_result_id    number(15);
16161      l_table_route_id               number(15);
16162      l_result_type_cd               varchar2(30);
16163      l_information5                 ben_copy_entity_results.information5%type;
16164      l_number_of_copies             number(15);
16165    ---------------------------------------------------------------
16166    -- START OF BEN_PSTL_ZIP_RNG_F ----------------------
16167    ---------------------------------------------------------------
16168    cursor c_rzr(c_pstl_zip_rng_id number,c_mirror_src_entity_result_id number,
16169                 c_table_alias varchar2 ) is
16170    select  rzr.*
16171    from BEN_PSTL_ZIP_RNG_F rzr
16172    where  rzr.pstl_zip_rng_id = c_pstl_zip_rng_id
16173      --and rzr.business_group_id = p_business_group_id
16174      and not exists (
16175          select /* */ null
16176          from ben_copy_entity_results cpe
16177               -- pqh_table_route trt
16178          where copy_entity_txn_id = p_copy_entity_txn_id
16179          -- and trt.table_route_id = cpe.table_route_id
16180          and ( -- c_mirror_src_entity_result_id is null or
16181                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
16182          -- and trt.where_clause = 'BEN_PSTL_ZIP_RNG_F'
16183          and cpe.table_alias = c_table_alias
16184          and information1 = c_pstl_zip_rng_id
16185          -- and information4 = rzr.business_group_id
16186            and information2 = rzr.effective_start_date
16187            and information3 = rzr.effective_end_date);
16188     l_pstl_zip_rng_id                 number(15);
16189     l_out_rzr_result_id   number(15);
16190    ---------------------------------------------------------------
16191    -- END OF BEN_PSTL_ZIP_RNG_F ----------------------
16192    ---------------------------------------------------------------
16193     cursor c_object_exists(c_pk_id                number,
16194                           c_table_alias          varchar2) is
16195     select null
16196     from ben_copy_entity_results cpe
16197          -- pqh_table_route trt
16198     where copy_entity_txn_id = p_copy_entity_txn_id
16199     -- and trt.table_route_id = cpe.table_route_id
16200     and cpe.table_alias = c_table_alias
16201     and information1 = c_pk_id;
16202 
16203    l_dummy                     varchar2(1);
16204 
16205  begin
16206 
16207      if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
16208        open c_object_exists(p_pstl_zip_rng_id,'RZR');
16209        fetch c_object_exists into l_dummy;
16210        if c_object_exists%found then
16211          close c_object_exists;
16212          return;
16213        end if;
16214        close c_object_exists;
16215      end if;
16216 
16217      l_number_of_copies := p_number_of_copies ;
16218      ---------------------------------------------------------------
16219      -- START OF BEN_PSTL_ZIP_RNG_F ----------------------
16220      ---------------------------------------------------------------
16221      -- bug 4241267 - moved code outside of loop
16222         l_table_route_id := null ;
16223         open ben_plan_design_program_module.g_table_route('RZR');
16224         fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
16225         close ben_plan_design_program_module.g_table_route ;
16226         --
16227         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
16228         --
16229         l_pstl_zip_rng_id := p_pstl_zip_rng_id ;
16230         --
16231         for l_rzr_rec in c_rzr(p_pstl_zip_rng_id,l_mirror_src_entity_result_id,'RZR') loop
16232           --
16233           l_information5  := l_rzr_rec.from_value ||' - '||l_rzr_rec.to_value; --'Intersection';
16234           --
16235           if p_effective_date between l_rzr_rec.effective_start_date
16236              and l_rzr_rec.effective_end_date then
16237            --
16238              l_result_type_cd := 'DISPLAY';
16239           else
16240              l_result_type_cd := 'NO DISPLAY';
16241           end if;
16242             --
16243           l_copy_entity_result_id := null;
16244           l_object_version_number := null;
16245           ben_copy_entity_results_api.create_copy_entity_results(
16246             p_copy_entity_result_id          => l_copy_entity_result_id,
16247             p_copy_entity_txn_id             => p_copy_entity_txn_id,
16248             p_result_type_cd                 => l_result_type_cd,
16249             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
16250             p_parent_entity_result_id        => l_mirror_src_entity_result_id,
16251             p_number_of_copies               => l_number_of_copies,
16252             p_table_route_id                 => l_table_route_id,
16253 	    P_TABLE_ALIAS                    => 'RZR',
16254             p_information1     => l_rzr_rec.pstl_zip_rng_id,
16255             p_information2     => l_rzr_rec.EFFECTIVE_START_DATE,
16256             p_information3     => l_rzr_rec.EFFECTIVE_END_DATE,
16257             p_information4     => l_rzr_rec.business_group_id,
16258             p_information5     => l_information5 , -- 9999 put name for h-grid
16259 
16260             p_information142     => l_rzr_rec.from_value,
16261             p_information111     => l_rzr_rec.rzr_attribute1,
16262             p_information120     => l_rzr_rec.rzr_attribute10,
16263             p_information121     => l_rzr_rec.rzr_attribute11,
16264             p_information122     => l_rzr_rec.rzr_attribute12,
16265             p_information123     => l_rzr_rec.rzr_attribute13,
16266             p_information124     => l_rzr_rec.rzr_attribute14,
16267             p_information125     => l_rzr_rec.rzr_attribute15,
16268             p_information126     => l_rzr_rec.rzr_attribute16,
16269             p_information127     => l_rzr_rec.rzr_attribute17,
16270             p_information128     => l_rzr_rec.rzr_attribute18,
16271             p_information129     => l_rzr_rec.rzr_attribute19,
16272             p_information112     => l_rzr_rec.rzr_attribute2,
16273             p_information130     => l_rzr_rec.rzr_attribute20,
16274             p_information131     => l_rzr_rec.rzr_attribute21,
16275             p_information132     => l_rzr_rec.rzr_attribute22,
16276             p_information133     => l_rzr_rec.rzr_attribute23,
16277             p_information134     => l_rzr_rec.rzr_attribute24,
16278             p_information135     => l_rzr_rec.rzr_attribute25,
16279             p_information136     => l_rzr_rec.rzr_attribute26,
16280             p_information137     => l_rzr_rec.rzr_attribute27,
16281             p_information138     => l_rzr_rec.rzr_attribute28,
16282             p_information139     => l_rzr_rec.rzr_attribute29,
16283             p_information113     => l_rzr_rec.rzr_attribute3,
16284             p_information140     => l_rzr_rec.rzr_attribute30,
16285             p_information114     => l_rzr_rec.rzr_attribute4,
16286             p_information115     => l_rzr_rec.rzr_attribute5,
16287             p_information116     => l_rzr_rec.rzr_attribute6,
16288             p_information117     => l_rzr_rec.rzr_attribute7,
16289             p_information118     => l_rzr_rec.rzr_attribute8,
16290             p_information119     => l_rzr_rec.rzr_attribute9,
16291             p_information110     => l_rzr_rec.rzr_attribute_category,
16292             p_information141     => l_rzr_rec.to_value,
16293             p_information265     => l_rzr_rec.object_version_number,
16294            --
16295 
16296             p_object_version_number          => l_object_version_number,
16297             p_effective_date                 => p_effective_date       );
16298             --
16299 
16300             if l_out_rzr_result_id is null then
16301               l_out_rzr_result_id := l_copy_entity_result_id;
16302             end if;
16303 
16304             if l_result_type_cd = 'DISPLAY' then
16305                l_out_rzr_result_id := l_copy_entity_result_id ;
16306             end if;
16307             --
16308          end loop;
16309          --
16310     ---------------------------------------------------------------
16311     -- END OF BEN_PSTL_ZIP_RNG_F ----------------------
16312     ---------------------------------------------------------------
16313  end create_postal_results ;
16314  --
16315  procedure create_bnft_bal_results
16316     (
16317      p_validate                       in  number     default 0 -- false
16318     ,p_copy_entity_result_id          in  number    -- Source Elpro
16319     ,p_copy_entity_txn_id             in  number    default null
16320     ,p_bnfts_bal_id                   in  number
16321     ,p_business_group_id              in  number    default null
16322     ,p_number_of_copies               in  number    default 0
16323     ,p_object_version_number          out nocopy number
16324     ,p_effective_date                 in  date
16325     ) is
16326     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
16327     l_proc varchar2(72) := g_package||'create_rate_results';
16328     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
16329     --
16330     cursor c_parent_result(c_parent_pk_id number,
16331                         c_parent_table_name varchar2,
16332                         c_copy_entity_txn_id number) is
16333      select copy_entity_result_id mirror_src_entity_result_id
16334      from ben_copy_entity_results cpe,
16335         pqh_table_route trt
16336      where cpe.information1= c_parent_pk_id
16337      and   cpe.result_type_cd = 'DISPLAY'
16338      and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
16339      and   cpe.table_route_id = trt.table_route_id
16340      and   trt.from_clause = 'OAB'
16341      and   trt.where_clause = upper(c_parent_table_name) ;
16342      ---
16343      -- Bug : 3752407 : Global cursor g_table_route will now be used
16344      -- Cursor to get table_route_id
16345      --
16346      -- cursor c_table_route(c_parent_table_alias varchar2) is
16347      -- select table_route_id
16348      -- from pqh_table_route trt
16349      -- where trt.table_alias = c_parent_table_alias;
16350      -- trt.from_clause = 'OAB'
16351      -- and   trt.where_clause = upper(c_parent_table_name) ;
16352      ---
16353      l_mirror_src_entity_result_id    number(15);
16354      l_table_route_id               number(15);
16355      l_result_type_cd               varchar2(30);
16356      l_information5                 ben_copy_entity_results.information5%type;
16357      l_number_of_copies             number(15);
16358    ---------------------------------------------------------------
16359    -- START OF BEN_BNFTS_BAL_F ----------------------
16360    ---------------------------------------------------------------
16361    cursor c_bnb(c_bnfts_bal_id number,c_mirror_src_entity_result_id number,
16362                 c_table_alias varchar2 ) is
16363    select  bnb.*
16364    from BEN_BNFTS_BAL_F bnb
16365    where  bnb.bnfts_bal_id = c_bnfts_bal_id
16366      --and bnb.business_group_id = p_business_group_id
16367      and not exists (
16368          select /* */ null
16369          from ben_copy_entity_results cpe
16370               -- pqh_table_route trt
16371          where copy_entity_txn_id = p_copy_entity_txn_id
16372          -- and trt.table_route_id = cpe.table_route_id
16373          and ( -- c_mirror_src_entity_result_id is null or
16374                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
16375          -- and trt.where_clause = 'BEN_BNFTS_BAL_F'
16376          and cpe.table_alias = c_table_alias
16377          and information1 = c_bnfts_bal_id
16378          -- and information4 = bnb.business_group_id
16379            and information2 = bnb.effective_start_date
16380            and information3 = bnb.effective_end_date);
16381     l_bnfts_bal_id                 number(15);
16382     l_out_bnb_result_id   number(15);
16383    ---------------------------------------------------------------
16384    -- END OF BEN_BNFTS_BAL_F ----------------------
16385    ---------------------------------------------------------------
16386       cursor c_object_exists(c_pk_id                number,
16387                              c_table_alias          varchar2) is
16388       select null
16389       from ben_copy_entity_results cpe
16390          -- pqh_table_route trt
16391       where copy_entity_txn_id = p_copy_entity_txn_id
16392       -- and trt.table_route_id = cpe.table_route_id
16393       and cpe.table_alias = c_table_alias
16394       and information1 = c_pk_id;
16395 
16396      l_dummy                     varchar2(1);
16397 
16398     begin
16399 
16400       if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
16401        open c_object_exists(p_bnfts_bal_id,'BNB');
16402        fetch c_object_exists into l_dummy;
16403        if c_object_exists%found then
16404          close c_object_exists;
16405          return;
16406        end if;
16407        close c_object_exists;
16408      end if;
16409 
16410       l_number_of_copies := p_number_of_copies ;
16411      ---------------------------------------------------------------
16412      -- START OF BEN_BNFTS_BAL_F ----------------------
16413      ---------------------------------------------------------------
16414         --
16415         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
16416         --
16417         l_bnfts_bal_id := p_bnfts_bal_id ;
16418         --
16419         for l_bnb_rec in c_bnb(p_bnfts_bal_id,l_mirror_src_entity_result_id,'BNB') loop
16420           --
16421           l_table_route_id := null ;
16422           open ben_plan_design_program_module.g_table_route('BNB');
16423           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
16424           close ben_plan_design_program_module.g_table_route ;
16425           --
16426           l_information5  := l_bnb_rec.name; --'Intersection';
16427           --
16428           if p_effective_date between l_bnb_rec.effective_start_date
16429              and l_bnb_rec.effective_end_date then
16430            --
16431              l_result_type_cd := 'DISPLAY';
16432           else
16433              l_result_type_cd := 'NO DISPLAY';
16434           end if;
16435             --
16436           l_copy_entity_result_id := null;
16437           l_object_version_number := null;
16438           ben_copy_entity_results_api.create_copy_entity_results(
16439             p_copy_entity_result_id          => l_copy_entity_result_id,
16440             p_copy_entity_txn_id             => p_copy_entity_txn_id,
16441             p_result_type_cd                 => l_result_type_cd,
16442             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
16443             p_parent_entity_result_id        => l_mirror_src_entity_result_id,
16444             p_number_of_copies               => l_number_of_copies,
16445             p_table_route_id                 => l_table_route_id,
16446 	    P_TABLE_ALIAS                    => 'BNB',
16447             p_information1     => l_bnb_rec.bnfts_bal_id,
16448             p_information2     => l_bnb_rec.EFFECTIVE_START_DATE,
16449             p_information3     => l_bnb_rec.EFFECTIVE_END_DATE,
16450             p_information4     => l_bnb_rec.business_group_id,
16451             p_information5     => l_information5 , -- 9999 put name for h-grid
16452             p_information111     => l_bnb_rec.bnb_attribute1,
16453             p_information120     => l_bnb_rec.bnb_attribute10,
16454             p_information121     => l_bnb_rec.bnb_attribute11,
16455             p_information122     => l_bnb_rec.bnb_attribute12,
16456             p_information123     => l_bnb_rec.bnb_attribute13,
16457             p_information124     => l_bnb_rec.bnb_attribute14,
16458             p_information125     => l_bnb_rec.bnb_attribute15,
16459             p_information126     => l_bnb_rec.bnb_attribute16,
16460             p_information127     => l_bnb_rec.bnb_attribute17,
16461             p_information128     => l_bnb_rec.bnb_attribute18,
16462             p_information129     => l_bnb_rec.bnb_attribute19,
16463             p_information112     => l_bnb_rec.bnb_attribute2,
16464             p_information130     => l_bnb_rec.bnb_attribute20,
16465             p_information131     => l_bnb_rec.bnb_attribute21,
16466             p_information132     => l_bnb_rec.bnb_attribute22,
16467             p_information133     => l_bnb_rec.bnb_attribute23,
16468             p_information134     => l_bnb_rec.bnb_attribute24,
16469             p_information135     => l_bnb_rec.bnb_attribute25,
16470             p_information136     => l_bnb_rec.bnb_attribute26,
16471             p_information137     => l_bnb_rec.bnb_attribute27,
16472             p_information138     => l_bnb_rec.bnb_attribute28,
16473             p_information139     => l_bnb_rec.bnb_attribute29,
16474             p_information113     => l_bnb_rec.bnb_attribute3,
16475             p_information140     => l_bnb_rec.bnb_attribute30,
16476             p_information114     => l_bnb_rec.bnb_attribute4,
16477             p_information115     => l_bnb_rec.bnb_attribute5,
16478             p_information116     => l_bnb_rec.bnb_attribute6,
16479             p_information117     => l_bnb_rec.bnb_attribute7,
16480             p_information118     => l_bnb_rec.bnb_attribute8,
16481             p_information119     => l_bnb_rec.bnb_attribute9,
16482             p_information110     => l_bnb_rec.bnb_attribute_category,
16483             p_information185     => l_bnb_rec.bnfts_bal_desc,
16484             p_information11     => l_bnb_rec.bnfts_bal_usg_cd,
16485             p_information170     => l_bnb_rec.name,
16486             p_information13     => l_bnb_rec.nnmntry_uom,
16487             p_information12     => l_bnb_rec.uom,
16488             p_information265    => l_bnb_rec.object_version_number,
16489 
16490             p_object_version_number          => l_object_version_number,
16491             p_effective_date                 => p_effective_date       );
16492             --
16493 
16494             if l_out_bnb_result_id is null then
16495               l_out_bnb_result_id := l_copy_entity_result_id;
16496             end if;
16497 
16498             if l_result_type_cd = 'DISPLAY' then
16499                l_out_bnb_result_id := l_copy_entity_result_id ;
16500             end if;
16501             --
16502          end loop;
16503          --
16504     ---------------------------------------------------------------
16505     -- END OF BEN_BNFTS_BAL_F ----------------------
16506     ---------------------------------------------------------------
16507     end create_bnft_bal_results ;
16508  --
16509  procedure create_bnft_group_results
16510     (
16511      p_validate                       in  number     default 0 -- false
16512     ,p_copy_entity_result_id          in  number    -- Source Elpro
16513     ,p_copy_entity_txn_id             in  number    default null
16514     ,p_benfts_grp_id                  in  number
16515     ,p_business_group_id              in  number    default null
16516     ,p_number_of_copies               in  number    default 0
16517     ,p_object_version_number          out nocopy number
16518     ,p_effective_date                 in  date
16519     ) is
16520     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
16521     l_proc varchar2(72) := g_package||'create_rate_results';
16522     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
16523     --
16524     cursor c_parent_result(c_parent_pk_id number,
16525                         c_parent_table_name varchar2,
16526                         c_copy_entity_txn_id number) is
16527      select copy_entity_result_id mirror_src_entity_result_id
16528      from ben_copy_entity_results cpe,
16529         pqh_table_route trt
16530      where cpe.information1= c_parent_pk_id
16531      and   cpe.result_type_cd = 'DISPLAY'
16532      and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
16533      and   cpe.table_route_id = trt.table_route_id
16534      and   trt.from_clause = 'OAB'
16535      and   trt.where_clause = upper(c_parent_table_name) ;
16536      ---
16537      -- Bug : 3752407 : Global cursor g_table_route will now be used
16538      -- Cursor to get table_route_id
16539      --
16540      -- cursor c_table_route(c_parent_table_alias varchar2) is
16541      -- select table_route_id
16542      -- from pqh_table_route trt
16543      -- where trt.table_alias = c_parent_table_alias;
16544      -- trt.from_clause = 'OAB'
16545      -- and   trt.where_clause = upper(c_parent_table_name) ;
16546      ---
16547      l_mirror_src_entity_result_id    number(15);
16548      l_table_route_id               number(15);
16549      l_result_type_cd               varchar2(30);
16550      l_information5                 ben_copy_entity_results.information5%type;
16551      l_number_of_copies             number(15);
16552    ---------------------------------------------------------------
16553    -- START OF BEN_BENFTS_GRP ----------------------
16554    ---------------------------------------------------------------
16555    cursor c_bng(c_benfts_grp_id number,c_mirror_src_entity_result_id number,
16556                 c_table_alias varchar2 ) is
16557    select  bng.*
16558    from BEN_BENFTS_GRP bng
16559    where  bng.benfts_grp_id = c_benfts_grp_id
16560      --and bng.business_group_id = p_business_group_id
16561      and not exists (
16562          select /* */ null
16563          from ben_copy_entity_results cpe
16564               -- pqh_table_route trt
16565          where copy_entity_txn_id = p_copy_entity_txn_id
16566          -- and trt.table_route_id = cpe.table_route_id
16567          and ( -- c_mirror_src_entity_result_id is null or
16568                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
16569          -- and trt.where_clause = 'BEN_BENFTS_GRP'
16570          and cpe.table_alias = c_table_alias
16571          and information1 = c_benfts_grp_id
16572          -- and information4 = bng.business_group_id
16573         );
16574     l_benfts_grp_id                 number(15);
16575     l_out_bng_result_id   number(15);
16576    ---------------------------------------------------------------
16577    -- END OF BEN_BENFTS_GRP ----------------------
16578    ---------------------------------------------------------------
16579       cursor c_object_exists(c_pk_id                number,
16580                           c_table_alias          varchar2) is
16581       select null
16582       from ben_copy_entity_results cpe
16583            -- pqh_table_route trt
16584       where copy_entity_txn_id = p_copy_entity_txn_id
16585       -- and trt.table_route_id = cpe.table_route_id
16586       and cpe.table_alias = c_table_alias
16587       and information1 = c_pk_id;
16588 
16589       l_dummy                     varchar2(1);
16590     begin
16591       if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
16592         open c_object_exists(p_benfts_grp_id,'BNG');
16593         fetch c_object_exists into l_dummy;
16594         if c_object_exists%found then
16595           close c_object_exists;
16596           return;
16597         end if;
16598         close c_object_exists;
16599       end if;
16600 
16601       l_number_of_copies := p_number_of_copies ;
16602      ---------------------------------------------------------------
16603      -- START OF BEN_BENFTS_GRP ----------------------
16604      ---------------------------------------------------------------
16605         --
16606         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
16607         --
16608         l_benfts_grp_id := p_benfts_grp_id ;
16609         --
16610         for l_bng_rec in c_bng(p_benfts_grp_id,l_mirror_src_entity_result_id,'BNG') loop
16611           --
16612           l_table_route_id := null ;
16613           open ben_plan_design_program_module.g_table_route('BNG');
16614           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
16615           close ben_plan_design_program_module.g_table_route ;
16616           --
16617           l_information5  := l_bng_rec.name; --'Intersection';
16618           --
16619           l_result_type_cd := 'DISPLAY';
16620             --
16621           l_copy_entity_result_id := null;
16622           l_object_version_number := null;
16623           ben_copy_entity_results_api.create_copy_entity_results(
16624             p_copy_entity_result_id          => l_copy_entity_result_id,
16625             p_copy_entity_txn_id             => p_copy_entity_txn_id,
16626             p_result_type_cd                 => l_result_type_cd,
16627             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
16628             p_parent_entity_result_id        => l_mirror_src_entity_result_id,
16629             p_number_of_copies               => l_number_of_copies,
16630             p_table_route_id                 => l_table_route_id,
16631 	    P_TABLE_ALIAS                    => 'BNG',
16632             p_information1     => l_bng_rec.benfts_grp_id,
16633             p_information2     => null,
16634             p_information3     => null,
16635             p_information4     => l_bng_rec.business_group_id,
16636             p_information5     => l_information5 , -- 9999 put name for h-grid
16637             p_information111     => l_bng_rec.bng_attribute1,
16638             p_information120     => l_bng_rec.bng_attribute10,
16639             p_information121     => l_bng_rec.bng_attribute11,
16640             p_information122     => l_bng_rec.bng_attribute12,
16641             p_information123     => l_bng_rec.bng_attribute13,
16642             p_information124     => l_bng_rec.bng_attribute14,
16643             p_information125     => l_bng_rec.bng_attribute15,
16644             p_information126     => l_bng_rec.bng_attribute16,
16645             p_information127     => l_bng_rec.bng_attribute17,
16646             p_information128     => l_bng_rec.bng_attribute18,
16647             p_information129     => l_bng_rec.bng_attribute19,
16648             p_information112     => l_bng_rec.bng_attribute2,
16649             p_information130     => l_bng_rec.bng_attribute20,
16650             p_information131     => l_bng_rec.bng_attribute21,
16651             p_information132     => l_bng_rec.bng_attribute22,
16652             p_information133     => l_bng_rec.bng_attribute23,
16653             p_information134     => l_bng_rec.bng_attribute24,
16654             p_information135     => l_bng_rec.bng_attribute25,
16655             p_information136     => l_bng_rec.bng_attribute26,
16656             p_information137     => l_bng_rec.bng_attribute27,
16657             p_information138     => l_bng_rec.bng_attribute28,
16658             p_information139     => l_bng_rec.bng_attribute29,
16659             p_information113     => l_bng_rec.bng_attribute3,
16660             p_information140     => l_bng_rec.bng_attribute30,
16661             p_information114     => l_bng_rec.bng_attribute4,
16662             p_information115     => l_bng_rec.bng_attribute5,
16663             p_information116     => l_bng_rec.bng_attribute6,
16664             p_information117     => l_bng_rec.bng_attribute7,
16665             p_information118     => l_bng_rec.bng_attribute8,
16666             p_information119     => l_bng_rec.bng_attribute9,
16667             p_information110     => l_bng_rec.bng_attribute_category,
16668             p_information185     => l_bng_rec.bng_desc,
16669             p_information170     => l_bng_rec.name,
16670             p_information265     => l_bng_rec.object_version_number,
16671 
16672             p_object_version_number          => l_object_version_number,
16673             p_effective_date                 => p_effective_date       );
16674             --
16675 
16676             if l_out_bng_result_id is null then
16677               l_out_bng_result_id := l_copy_entity_result_id;
16678             end if;
16679 
16680             if l_result_type_cd = 'DISPLAY' then
16681                l_out_bng_result_id := l_copy_entity_result_id ;
16682             end if;
16683             --
16684          end loop;
16685          --
16686     ---------------------------------------------------------------
16687     -- END OF BEN_BENFTS_GRP ----------------------
16688     ---------------------------------------------------------------
16689     end ;
16690 --
16691 procedure create_acrs_ptip_cvg_results
16692     (
16693      p_validate                       in  number     default 0 -- false
16694     ,p_copy_entity_result_id          in  number    -- Source Elpro
16695     ,p_copy_entity_txn_id             in  number    default null
16696     ,p_pgm_id                         in  number
16697     ,p_business_group_id              in  number    default null
16698     ,p_number_of_copies               in  number    default 0
16699     ,p_object_version_number          out nocopy number
16700     ,p_effective_date                 in  date
16701     ) is
16702     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
16703     l_proc varchar2(72) := g_package||'create_acrs_ptip_cvg_results';
16704     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
16705     --
16706     cursor c_parent_result(c_parent_pk_id number,
16707                         c_parent_table_name varchar2,
16708                         c_copy_entity_txn_id number) is
16709      select copy_entity_result_id mirror_src_entity_result_id
16710      from ben_copy_entity_results cpe,
16711         pqh_table_route trt
16712      where cpe.information1= c_parent_pk_id
16713      and   cpe.result_type_cd = 'DISPLAY'
16714      and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
16715      and   cpe.table_route_id = trt.table_route_id
16716      and   trt.from_clause = 'OAB'
16717      and   trt.where_clause = upper(c_parent_table_name) ;
16718      ---
16719      -- Bug : 3752407 : Global cursor g_table_route will now be used
16720      -- Cursor to get table_route_id
16721      --
16722      -- cursor c_table_route(c_parent_table_alias varchar2) is
16723      -- select table_route_id
16724      -- from pqh_table_route trt
16725      -- where trt.table_alias = c_parent_table_alias;
16726      -- trt.from_clause = 'OAB'
16727      -- and   trt.where_clause = upper(c_parent_table_name) ;
16728      ---
16729      l_mirror_src_entity_result_id    number(15);
16730      l_table_route_id               number(15);
16731      l_result_type_cd               varchar2(30);
16732      l_information5                 ben_copy_entity_results.information5%type;
16733      l_number_of_copies             number(15);
16734    ---------------------------------------------------------------
16735    -- START OF BEN_ACRS_PTIP_CVG_F----------------------
16736    ---------------------------------------------------------------
16737 
16738    cursor c_apc_from_parent(c_PGM_ID number) is
16739    select  DISTINCT acrs_ptip_cvg_id
16740    from BEN_ACRS_PTIP_CVG_F
16741    where  PGM_ID = c_PGM_ID;
16742 
16743    cursor c_apc(c_acrs_ptip_cvg_id number,c_mirror_src_entity_result_id number,
16744                 c_table_alias varchar2 ) is
16745    select  apc.*
16746    from BEN_ACRS_PTIP_CVG_F apc
16747    where  apc.acrs_ptip_cvg_id = c_acrs_ptip_cvg_id
16748      --and apc.business_group_id = p_business_group_id
16749      and not exists (
16750          select /* */ null
16751          from ben_copy_entity_results cpe
16752               -- pqh_table_route trt
16753          where copy_entity_txn_id = p_copy_entity_txn_id
16754          -- and trt.table_route_id = cpe.table_route_id
16755          and ( -- c_mirror_src_entity_result_id is null or
16756                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
16757          -- and trt.where_clause = 'BEN_ACRS_PTIP_CVG_F'
16758          and cpe.table_alias = c_table_alias
16759          and information1 = c_acrs_ptip_cvg_id
16760          -- and information4 = apc.business_group_id
16761         );
16762     l_acrs_ptip_cvg_id                 number(15);
16763     l_out_apc_result_id   number(15);
16764    ---------------------------------------------------------------
16765    -- END OF BEN_ACRS_PTIP_CVG_F----------------------
16766    ---------------------------------------------------------------
16767     begin
16768       l_number_of_copies := p_number_of_copies ;
16769      ---------------------------------------------------------------
16770      -- START OF BEN_ACRS_PTIP_CVG_F----------------------
16771      ---------------------------------------------------------------
16772 
16773       for l_parent_rec  in c_apc_from_parent(p_pgm_id) loop
16774         --
16775         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
16776         --
16777         l_acrs_ptip_cvg_id := l_parent_rec.acrs_ptip_cvg_id ;
16778         --
16779         for l_apc_rec in c_apc(l_parent_rec.acrs_ptip_cvg_id,l_mirror_src_entity_result_id,'ACP') loop
16780           --
16781           l_table_route_id := null ;
16782           open ben_plan_design_program_module.g_table_route('ACP');
16783           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
16784           close ben_plan_design_program_module.g_table_route ;
16785           --
16786           l_information5  := l_apc_rec.name; --'Intersection';
16787           --
16788           l_result_type_cd := 'DISPLAY';
16789             --
16790           l_copy_entity_result_id := null;
16791           l_object_version_number := null;
16792           ben_copy_entity_results_api.create_copy_entity_results(
16793             p_copy_entity_result_id          => l_copy_entity_result_id,
16794             p_copy_entity_txn_id             => p_copy_entity_txn_id,
16795             p_result_type_cd                 => l_result_type_cd,
16796             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
16797             p_parent_entity_result_id        => l_mirror_src_entity_result_id,
16798             p_number_of_copies               => l_number_of_copies,
16799             p_table_route_id                 => l_table_route_id,
16800 	    P_TABLE_ALIAS                    => 'ACP',
16801             p_information1     => l_apc_rec.acrs_ptip_cvg_id,
16802             p_information2     => l_apc_rec.EFFECTIVE_START_DATE,
16803             p_information3     => l_apc_rec.EFFECTIVE_END_DATE,
16804             p_information4     => l_apc_rec.business_group_id,
16805             p_information5     => l_information5 , -- 9999 put name for h-grid
16806             p_INFORMATION111     => l_apc_rec.APC_ATTRIBUTE1,
16807             p_INFORMATION120     => l_apc_rec.APC_ATTRIBUTE10,
16808             p_INFORMATION121     => l_apc_rec.APC_ATTRIBUTE11,
16809             p_INFORMATION122     => l_apc_rec.APC_ATTRIBUTE12,
16810             p_INFORMATION123     => l_apc_rec.APC_ATTRIBUTE13,
16811             p_INFORMATION124     => l_apc_rec.APC_ATTRIBUTE14,
16812             p_INFORMATION125     => l_apc_rec.APC_ATTRIBUTE15,
16813             p_INFORMATION126     => l_apc_rec.APC_ATTRIBUTE16,
16814             p_INFORMATION127     => l_apc_rec.APC_ATTRIBUTE17,
16815             p_INFORMATION128     => l_apc_rec.APC_ATTRIBUTE18,
16816             p_INFORMATION129     => l_apc_rec.APC_ATTRIBUTE19,
16817             p_INFORMATION112     => l_apc_rec.APC_ATTRIBUTE2,
16818             p_INFORMATION130     => l_apc_rec.APC_ATTRIBUTE20,
16819             p_INFORMATION131     => l_apc_rec.APC_ATTRIBUTE21,
16820             p_INFORMATION132     => l_apc_rec.APC_ATTRIBUTE22,
16821             p_INFORMATION133     => l_apc_rec.APC_ATTRIBUTE23,
16822             p_INFORMATION134     => l_apc_rec.APC_ATTRIBUTE24,
16823             p_INFORMATION135     => l_apc_rec.APC_ATTRIBUTE25,
16824             p_INFORMATION136     => l_apc_rec.APC_ATTRIBUTE26,
16825             p_INFORMATION137     => l_apc_rec.APC_ATTRIBUTE27,
16826             p_INFORMATION138     => l_apc_rec.APC_ATTRIBUTE28,
16827             p_INFORMATION139     => l_apc_rec.APC_ATTRIBUTE29,
16828             p_INFORMATION113     => l_apc_rec.APC_ATTRIBUTE3,
16829             p_INFORMATION140     => l_apc_rec.APC_ATTRIBUTE30,
16830             p_INFORMATION114     => l_apc_rec.APC_ATTRIBUTE4,
16831             p_INFORMATION115     => l_apc_rec.APC_ATTRIBUTE5,
16832             p_INFORMATION116     => l_apc_rec.APC_ATTRIBUTE6,
16833             p_INFORMATION117     => l_apc_rec.APC_ATTRIBUTE7,
16834             p_INFORMATION118     => l_apc_rec.APC_ATTRIBUTE8,
16835             p_INFORMATION119     => l_apc_rec.APC_ATTRIBUTE9,
16836             p_INFORMATION110     => l_apc_rec.APC_ATTRIBUTE_CATEGORY,
16837             p_INFORMATION294     => l_apc_rec.MN_CVG_ALWD_AMT,
16838             p_INFORMATION293     => l_apc_rec.MX_CVG_ALWD_AMT,
16839             p_INFORMATION170     => l_apc_rec.NAME,
16840             p_INFORMATION260     => l_apc_rec.PGM_ID,
16841             p_information265     => l_apc_rec.object_version_number,
16842 
16843             p_object_version_number          => l_object_version_number,
16844             p_effective_date                 => p_effective_date       );
16845             --
16846 
16847             if l_out_apc_result_id is null then
16848               l_out_apc_result_id := l_copy_entity_result_id;
16849             end if;
16850 
16851             if l_result_type_cd = 'DISPLAY' then
16852                l_out_apc_result_id := l_copy_entity_result_id ;
16853             end if;
16854             --
16855          end loop;
16856          --
16857        end loop;
16858        --
16859     ---------------------------------------------------------------
16860     -- END OF BEN_ACRS_PTIP_CVG_F----------------------
16861     ---------------------------------------------------------------
16862     end create_acrs_ptip_cvg_results;
16863 
16864 end ben_pd_rate_and_cvg_module;