DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PLAN_DESIGN_PROGRAM_MODULE

Source


1 Package Body ben_plan_design_program_module as
2 /* $Header: bepdcpgm.pkb 120.8.12020000.2 2012/07/03 13:04:10 amnaraya ship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  ben_plan_design_program_module.';
7 --
8 -- This procedure is used to create a row for each of the comp objects
9 -- selected by the end user on search page into
10 -- pqh_copy_entity_txn table.
11 -- This procedure should also copy all the child table data into
12 -- above table as well.
13 --
14 procedure create_program_result
15   (
16    p_validate                       in number        default 0 -- false
17   ,p_copy_entity_result_id          out nocopy number
18   ,p_copy_entity_txn_id             in  number
19   ,p_pgm_id                         in  number
20   ,p_business_group_id              in  number    default null
21   ,p_number_of_copies               in  number    default 0
22   ,p_object_version_number          out nocopy number
23   ,p_effective_date                 in date
24   ,p_no_dup_rslt                    in varchar2   default null
25   ) is
26   --
27   -- Declare cursors and local variables
28   --
29   l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
30   l_proc varchar2(72) := g_package||'create_program_result';
31   l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
32   l_pgm_id              number(15) default p_pgm_id ;
33   --
34   l_cv_result_type_cd   varchar2(30) :=  'DISPLAY' ;
35    --
36    -- Cursor to get mirror_src_entity_result_id
37    cursor c_parent_result(c_parent_pk_id number,
38                     -- c_parent_table_name varchar2,
39                     c_parent_table_alias varchar2,
40                     c_copy_entity_txn_id number) is
41    select copy_entity_result_id mirror_src_entity_result_id
42    from ben_copy_entity_results cpe
43 --    ,pqh_table_route trt
44    where cpe.information1= c_parent_pk_id
45    and   cpe.result_type_cd = l_cv_result_type_cd
46    and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
47 --   and   cpe.table_route_id = trt.table_route_id
48    -- and   trt.from_clause = 'OAB'
49    --and   trt.where_clause = upper(c_parent_table_name) ;
50    and   cpe.table_alias    = c_parent_table_alias ;
51    ---
52    --
53    -- Bug : 3752407 : Global cursor g_table_route will now be used
54    --
55    -- Cursor to get table_route_id
56    -- cursor c_table_route(c_parent_table_name varchar2) is
57    -- cursor c_table_route(c_parent_table_alias varchar2) is
58    -- select table_route_id
59    -- from pqh_table_route trt
60    -- where -- trt.from_clause = 'OAB'
61    -- and   trt.where_clause = upper(c_parent_table_name) ;
62    -- trt.table_alias = c_parent_table_alias ;
63    --
64    -- Bug : 3752407
65    --
66 
67   ---------------------------------------------------------------
68   -- START OF BEN_PGM_F ----------------------
69   ---------------------------------------------------------------
70 
71    cursor c_pgm_from_parent(c_PGM_ID number) is
72    select  distinct pgm_id
73    from BEN_PGM_F
74    where  PGM_ID = c_PGM_ID ;
75 
76    --
77    cursor c_pgm(c_pgm_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2 ) is
78    select  pgm.*
79    from BEN_PGM_F pgm
80    where  pgm.pgm_id = c_pgm_id
81    --and pgm.business_group_id = p_business_group_id
82    and not exists (
83      select /* */ null
84      from ben_copy_entity_results cpe
85 --ggnanagu          ,pqh_table_route trt
86      where copy_entity_txn_id = p_copy_entity_txn_id
87 --       and trt.table_route_id = cpe.table_route_id
88        and ( c_mirror_src_entity_result_id is null or
89              mirror_src_entity_result_id = c_mirror_src_entity_result_id )
90        and cpe.table_alias  = c_table_alias
91        and information1 = c_pgm_id
92        and information2 = pgm.effective_start_date
93        and information3 = pgm.effective_end_date
94      );
95      l_out_pgm_result_id number(15);
96   ---------------------------------------------------------------
97   -- END OF BEN_PGM_F ----------------------
98   ---------------------------------------------------------------
99   ---------------------------------------------------------------
100   -- START OF BEN_LER_CHG_DPNT_CVG_F ----------------------
101   ---------------------------------------------------------------
102    cursor c_ldc_from_parent(c_PGM_ID number) is
103    select distinct ler_chg_dpnt_cvg_id
104    from BEN_LER_CHG_DPNT_CVG_F
105    where  PGM_ID = c_PGM_ID ;
106    --
107    cursor c_ldc(c_ler_chg_dpnt_cvg_id number ,c_mirror_src_entity_result_id number,
108                                               c_table_alias varchar2 ) is
109    select  ldc.*
110    from BEN_LER_CHG_DPNT_CVG_F ldc
111    where  ldc.ler_chg_dpnt_cvg_id = c_ler_chg_dpnt_cvg_id
112    --and ldc.business_group_id = p_business_group_id
113    and not exists (
114      select /* */ null
115      from ben_copy_entity_results  cpe
116 --          ,pqh_table_route trt
117      where copy_entity_txn_id = p_copy_entity_txn_id
118 --       and trt.table_route_id = cpe.table_route_id
119        and mirror_src_entity_result_id = c_mirror_src_entity_result_id
120        and cpe.table_alias  = c_table_alias
121        and information1 = c_ler_chg_dpnt_cvg_id
122        and information2 = ldc.effective_start_date
123        and information3 = ldc.effective_end_date
124     );
125    l_ler_chg_dpnt_cvg_id              number(15);
126    --
127    cursor c_ldc_drp(c_ler_chg_dpnt_cvg_id number ,c_mirror_src_entity_result_id number,
128                     c_table_alias varchar2 ) is
129    select distinct cpe.information257 ler_id
130      from ben_copy_entity_results cpe
131 --          ,pqh_table_route trt
132      where copy_entity_txn_id = p_copy_entity_txn_id
133 --     and trt.table_route_id = cpe.table_route_id
134      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
135      and cpe.table_alias  = c_table_alias
136      and information1 = c_ler_chg_dpnt_cvg_id
137     ;
138     l_out_ldc_result_id number(15);
139 
140   ---------------------------------------------------------------
141   -- END OF BEN_LER_CHG_DPNT_CVG_F ----------------------
142   ---------------------------------------------------------------
143   ---------------------------------------------------------------
144   -- START OF BEN_LER_CHG_PGM_ENRT_F ----------------------
145   ---------------------------------------------------------------
146    cursor c_lge_from_parent(c_PGM_ID number) is
147    select distinct ler_chg_pgm_enrt_id
148    from BEN_LER_CHG_PGM_ENRT_F
149    where  PGM_ID = c_PGM_ID ;
150    --
151    cursor c_lge(c_ler_chg_pgm_enrt_id number ,c_mirror_src_entity_result_id number,
152                 c_table_alias varchar2 ) is
153    select  lge.*
154    from BEN_LER_CHG_PGM_ENRT_F lge
155    where  lge.ler_chg_pgm_enrt_id = c_ler_chg_pgm_enrt_id
156    --and lge.business_group_id = p_business_group_id
157    and not exists (
158      select /* */ null
159      from ben_copy_entity_results cpe
160 --          ,pqh_table_route trt
161      where copy_entity_txn_id = p_copy_entity_txn_id
162 --       and trt.table_route_id = cpe.table_route_id
163        and mirror_src_entity_result_id = c_mirror_src_entity_result_id
164        and cpe.table_alias  = c_table_alias
165        and information1 = c_ler_chg_pgm_enrt_id
166        and information2 = lge.effective_start_date
167        and information3 = lge.effective_end_date
168     );
169    l_ler_chg_pgm_enrt_id              number(15);
170    --
171    cursor c_lge_drp(c_ler_chg_pgm_enrt_id number ,c_mirror_src_entity_result_id number,
172                     c_table_alias varchar2 ) is
173    select distinct cpe.information257 ler_id
174      from ben_copy_entity_results cpe
175 --          ,pqh_table_route trt
176      where copy_entity_txn_id = p_copy_entity_txn_id
177 --     and trt.table_route_id = cpe.table_route_id
178      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
179      -- and trt.where_clause = 'BEN_LER_CHG_PGM_ENRT_F'
180      and cpe.table_alias = c_table_alias
181      and information1 = c_ler_chg_pgm_enrt_id
182      -- and information4 = p_business_group_id
183     ;
184     l_out_lge_result_id number(15);
185   ---------------------------------------------------------------
186   -- END OF BEN_LER_CHG_PGM_ENRT_F ----------------------
187   ---------------------------------------------------------------
188   ---------------------------------------------------------------
189   -- START OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
190   ---------------------------------------------------------------
191    cursor c_peo_from_parent(c_PGM_ID number) is
192    select  elig_to_prte_rsn_id
193    from BEN_ELIG_TO_PRTE_RSN_F
194    where  PGM_ID = c_PGM_ID ;
195    --
196    cursor c_peo(c_elig_to_prte_rsn_id number ,c_mirror_src_entity_result_id number,
197                 c_table_alias varchar2 ) is
198    select  peo.*
199    from BEN_ELIG_TO_PRTE_RSN_F peo
200    where  peo.elig_to_prte_rsn_id = c_elig_to_prte_rsn_id
201    --and peo.business_group_id = p_business_group_id
202    and not exists (
203      select /* */ null
204      from ben_copy_entity_results cpe
205      --     ,pqh_table_route trt
206      where copy_entity_txn_id = p_copy_entity_txn_id
207 --       and trt.table_route_id = cpe.table_route_id
208        and mirror_src_entity_result_id = c_mirror_src_entity_result_id
209        and cpe.table_alias  = c_table_alias
210        and information1 = c_elig_to_prte_rsn_id
211        and information2 = peo.effective_start_date
212        and information3 = peo.effective_end_date
213     );
214    l_elig_to_prte_rsn_id              number(15);
215    l_out_peo_result_id number(15);
216   ---------------------------------------------------------------
217   -- END OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
218   ---------------------------------------------------------------
219   ---------------------------------------------------------------
220   -- START OF BEN_PGM_DPNT_CVG_CTFN_F ----------------------
221   ---------------------------------------------------------------
222    cursor c_pgc_from_parent(c_PGM_ID number) is
223    select  pgm_dpnt_cvg_ctfn_id
224    from BEN_PGM_DPNT_CVG_CTFN_F
225    where  PGM_ID = c_PGM_ID ;
226    --
227    cursor c_pgc(c_pgm_dpnt_cvg_ctfn_id number ,c_mirror_src_entity_result_id number,
228                 c_table_alias varchar2) is
229    select  pgc.*
230    from BEN_PGM_DPNT_CVG_CTFN_F pgc
231    where  pgc.pgm_dpnt_cvg_ctfn_id = c_pgm_dpnt_cvg_ctfn_id
232    and not exists (
233      select /* */ null
234      from ben_copy_entity_results cpe
235      --     ,pqh_table_route trt
236      where copy_entity_txn_id = p_copy_entity_txn_id
237 --       and trt.table_route_id = cpe.table_route_id
238        and mirror_src_entity_result_id = c_mirror_src_entity_result_id
239        and cpe.table_alias  = c_table_alias
240        and information1 = c_pgm_dpnt_cvg_ctfn_id
241        and information2 = pgc.effective_start_date
242        and information3 = pgc.effective_end_date
243     );
244    l_pgm_dpnt_cvg_ctfn_id              number(15);
245    l_out_pgc_result_id number(15);
246   ---------------------------------------------------------------
247   -- END OF BEN_PGM_DPNT_CVG_CTFN_F ----------------------
248   ---------------------------------------------------------------
249   ---------------------------------------------------------------
250   -- START OF BEN_LER_CHG_DPNT_CVG_CTFN_F ----------------------
251   ---------------------------------------------------------------
252    cursor c_lcc_from_parent(c_LER_CHG_DPNT_CVG_ID number) is
253    select  ler_chg_dpnt_cvg_ctfn_id
254    from BEN_LER_CHG_DPNT_CVG_CTFN_F
255    where  LER_CHG_DPNT_CVG_ID = c_LER_CHG_DPNT_CVG_ID ;
256    --
257    cursor c_lcc(c_ler_chg_dpnt_cvg_ctfn_id number ,c_mirror_src_entity_result_id number,
258                 c_table_alias varchar2) is
259    select  lcc.*
260    from BEN_LER_CHG_DPNT_CVG_CTFN_F lcc
261    where  lcc.ler_chg_dpnt_cvg_ctfn_id = c_ler_chg_dpnt_cvg_ctfn_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 mirror_src_entity_result_id = c_mirror_src_entity_result_id
269        and cpe.table_alias  = c_table_alias
270        and information1 = c_ler_chg_dpnt_cvg_ctfn_id
271        and information2 = lcc.effective_start_date
272        and information3 = lcc.effective_end_date
273     );
274    l_ler_chg_dpnt_cvg_ctfn_id              number(15);
275    l_out_lcc_result_id number(15);
276   ---------------------------------------------------------------
277   -- END OF BEN_LER_CHG_DPNT_CVG_CTFN_F ----------------------
278   ---------------------------------------------------------------
279   ---------------------------------------------------------------
280   -- START OF BEN_PLIP_F ----------------------
281   ---------------------------------------------------------------
282    cursor c_cpp_from_parent(c_PGM_ID number) is
283    select distinct plip_id
284    from BEN_PLIP_F
285    where  PGM_ID = c_PGM_ID ;
286    --
287    cursor c_cpp(c_plip_id number ,c_mirror_src_entity_result_id number,
288                 c_table_alias varchar2) is
289    select  cpp.*
290    from BEN_PLIP_F cpp
291    where  cpp.plip_id = c_plip_id
292    and not exists (
293      select /* */ null
294      from ben_copy_entity_results cpe
295      --     ,pqh_table_route trt
296      where copy_entity_txn_id = p_copy_entity_txn_id
297 --       and trt.table_route_id = cpe.table_route_id
298        and cpe.table_alias  = c_table_alias
299        and information1 = c_plip_id
300        and information2 = cpp.effective_start_date
301        and information3 = cpp.effective_end_date
302     );
303    l_plip_id              number(15);
304    l_out_cpp_result_id number(15);
305   ---------------------------------------------------------------
306   -- END OF BEN_PLIP_F ----------------------
307   ---------------------------------------------------------------
308   ---------------------------------------------------------------
309   -- START OF BEN_PTIP_F ----------------------
310   ---------------------------------------------------------------
311    cursor c_ctp_from_parent(c_PGM_ID number) is
312    select  distinct ptip_id
313    from BEN_PTIP_F
314    where  PGM_ID = c_PGM_ID ;
315    --
316    cursor c_ctp(c_ptip_id number ,c_mirror_src_entity_result_id number,
317                 c_table_alias varchar2) is
318    select  ctp.*
319    from BEN_PTIP_F ctp
320    where  ctp.ptip_id = c_ptip_id
321    and not exists (
322      select /* */ null
323      from ben_copy_entity_results cpe
324      --     ,pqh_table_route trt
325      where copy_entity_txn_id = p_copy_entity_txn_id
326 --       and trt.table_route_id = cpe.table_route_id
327        and mirror_src_entity_result_id = c_mirror_src_entity_result_id
328        and cpe.table_alias  = c_table_alias
329        and information1 = c_ptip_id
330        and information2 = ctp.effective_start_date
331        and information3 = ctp.effective_end_date
332     );
333    l_ptip_id              number(15);
334    l_out_ctp_result_id number(15);
335    ---------------------------------------------------------------
336    -- END OF BEN_PTIP_F ----------------------
337    ---------------------------------------------------------------
338    ---------------------------------------------------------------
339    -- START OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
340    ---------------------------------------------------------------
341    cursor c_peo1_from_parent(c_PTIP_ID number) is
342    select  elig_to_prte_rsn_id
343    from BEN_ELIG_TO_PRTE_RSN_F
344    where  PTIP_ID = c_PTIP_ID ;
345    --
346    cursor c_peo1(c_elig_to_prte_rsn_id number,c_mirror_src_entity_result_id number,
347                  c_table_alias varchar2  ) is
348    select  peo.*
349    from BEN_ELIG_TO_PRTE_RSN_F peo
350    where  peo.elig_to_prte_rsn_id = c_elig_to_prte_rsn_id
351    and not exists (
352      select /* */ null
353      from ben_copy_entity_results cpe
354      --     ,pqh_table_route trt
355      where copy_entity_txn_id = p_copy_entity_txn_id
356 --     and trt.table_route_id = cpe.table_route_id
357      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
358      and cpe.table_alias  = c_table_alias
359      and information1 = c_elig_to_prte_rsn_id
360        and information2 = peo.effective_start_date
361        and information3 = peo.effective_end_date
362     );
363    l_elig_to_prte_rsn_id1   number(15);
364    l_out_peo1_result_id      number(15);
365    ---------------------------------------------------------------
366    -- END OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
367    ---------------------------------------------------------------
368    ---------------------------------------------------------------
369    -- START OF BEN_LER_CHG_DPNT_CVG_F ----------------------
370    ---------------------------------------------------------------
371    cursor c_ldc1_from_parent(c_PTIP_ID number) is
372    select distinct ler_chg_dpnt_cvg_id
373    from BEN_LER_CHG_DPNT_CVG_F
374    where  PTIP_ID = c_PTIP_ID ;
375    --
376    cursor c_ldc1(c_ler_chg_dpnt_cvg_id number,c_mirror_src_entity_result_id number ,
377                 c_table_alias varchar2) is
378    select  ldc.*
379    from BEN_LER_CHG_DPNT_CVG_F ldc
380    where  ldc.ler_chg_dpnt_cvg_id = c_ler_chg_dpnt_cvg_id
381    and not exists (
382      select /* */ null
383      from ben_copy_entity_results cpe
384      --     ,pqh_table_route trt
385      where copy_entity_txn_id = p_copy_entity_txn_id
386 --     and trt.table_route_id = cpe.table_route_id
387      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
388      and cpe.table_alias  = c_table_alias
389      and information1 = c_ler_chg_dpnt_cvg_id
390        and information2 = ldc.effective_start_date
391        and information3 = ldc.effective_end_date
392     );
393    --
394    cursor c_ldc1_drp(c_ler_chg_dpnt_cvg_id number ,c_mirror_src_entity_result_id number,
395                 c_table_alias varchar2) is
396    select distinct cpe.information257 ler_id
397      from ben_copy_entity_results cpe
398      --     ,pqh_table_route trt
399      where copy_entity_txn_id = p_copy_entity_txn_id
400 --     and trt.table_route_id = cpe.table_route_id
401      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
402      and cpe.table_alias  = c_table_alias
403      and information1 = c_ler_chg_dpnt_cvg_id
404     ;
405     l_out_ldc1_result_id number(15);
406     l_ler_chg_dpnt_cvg_id1 number(15);
407    ---------------------------------------------------------------
408    -- END OF BEN_LER_CHG_DPNT_CVG_F ----------------------
409    ---------------------------------------------------------------
410    ---------------------------------------------------------------
411    -- START OF BEN_LER_CHG_PTIP_ENRT_F ----------------------
412    ---------------------------------------------------------------
413    cursor c_lct1_from_parent(c_PTIP_ID number) is
414    select distinct ler_chg_ptip_enrt_id
415    from BEN_LER_CHG_PTIP_ENRT_F
416    where  PTIP_ID = c_PTIP_ID ;
417    --
418    cursor c_lct1(c_ler_chg_ptip_enrt_id number,c_mirror_src_entity_result_id number ,
419                 c_table_alias varchar2) is
420    select  lct.*
421    from BEN_LER_CHG_PTIP_ENRT_F lct
422    where  lct.ler_chg_ptip_enrt_id = c_ler_chg_ptip_enrt_id
423    and not exists (
424      select /* */ null
425      from ben_copy_entity_results cpe
426      --     ,pqh_table_route trt
427      where copy_entity_txn_id = p_copy_entity_txn_id
428 --     and trt.table_route_id = cpe.table_route_id
429      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
430      and cpe.table_alias  = c_table_alias
431      and information1 = c_ler_chg_ptip_enrt_id
432        and information2 = lct.effective_start_date
433        and information3 = lct.effective_end_date
434     );
435    l_ler_chg_ptip_enrt_id                 number(15);
436 
437    cursor c_lct1_drp(c_ler_chg_ptip_enrt_id number,c_mirror_src_entity_result_id number ,
438                 c_table_alias varchar2) is
439    select distinct cpe.information257 ler_id
440      from ben_copy_entity_results cpe
441 --          ,pqh_table_route trt
442      where copy_entity_txn_id = p_copy_entity_txn_id
443 --     and trt.table_route_id = cpe.table_route_id
444      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
445      and cpe.table_alias  = c_table_alias
446      and information1 = c_ler_chg_ptip_enrt_id
447     ;
448    l_out_lct_result_id number(15);
449    ---------------------------------------------------------------
450    -- END OF BEN_LER_CHG_PTIP_ENRT_F ----------------------
451    ---------------------------------------------------------------
452    ---------------------------------------------------------------
453    -- START OF BEN_PTIP_DPNT_CVG_CTFN_F ----------------------
454    ---------------------------------------------------------------
455    cursor c_pyd1_from_parent(c_PTIP_ID number) is
456    select  ptip_dpnt_cvg_ctfn_id
457    from BEN_PTIP_DPNT_CVG_CTFN_F
458    where  PTIP_ID = c_PTIP_ID ;
459    --
460    cursor c_pyd1(c_ptip_dpnt_cvg_ctfn_id number,c_mirror_src_entity_result_id number ,
461                 c_table_alias varchar2) is
462    select  pyd.*
463    from BEN_PTIP_DPNT_CVG_CTFN_F pyd
464    where  pyd.ptip_dpnt_cvg_ctfn_id = c_ptip_dpnt_cvg_ctfn_id
465    and not exists (
466      select /* */ null
467      from ben_copy_entity_results cpe
468      --     ,pqh_table_route trt
469      where copy_entity_txn_id = p_copy_entity_txn_id
470 --     and trt.table_route_id = cpe.table_route_id
471      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
472      and cpe.table_alias  = c_table_alias
473      and information1 = c_ptip_dpnt_cvg_ctfn_id
474        and information2 = pyd.effective_start_date
475        and information3 = pyd.effective_end_date
476     );
477    l_ptip_dpnt_cvg_ctfn_id                 number(15);
478    l_out_pyd_result_id   number(15);
479    ---------------------------------------------------------------
480    -- END OF BEN_PTIP_DPNT_CVG_CTFN_F ----------------------
481    ---------------------------------------------------------------
482    ---------------------------------------------------------------
483    -- START OF BEN_WV_PRTN_RSN_PTIP_F ----------------------
484    ---------------------------------------------------------------
485    cursor c_wpt1_from_parent(c_PTIP_ID number) is
486    select  wv_prtn_rsn_ptip_id
487    from BEN_WV_PRTN_RSN_PTIP_F
488    where  PTIP_ID = c_PTIP_ID ;
489    --
490    cursor c_wpt1(c_wv_prtn_rsn_ptip_id number,c_mirror_src_entity_result_id number ,
491                 c_table_alias varchar2) is
492    select  wpt.*
493    from BEN_WV_PRTN_RSN_PTIP_F wpt
494    where  wpt.wv_prtn_rsn_ptip_id = c_wv_prtn_rsn_ptip_id
495    and not exists (
496      select /* */ null
497      from ben_copy_entity_results cpe
498      --     ,pqh_table_route trt
499      where copy_entity_txn_id = p_copy_entity_txn_id
500 --     and trt.table_route_id = cpe.table_route_id
501      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
502      and cpe.table_alias  = c_table_alias
503      and information1 = c_wv_prtn_rsn_ptip_id
504        and information2 = wpt.effective_start_date
505        and information3 = wpt.effective_end_date
506     );
507    l_wv_prtn_rsn_ptip_id                 number(15);
508    l_out_wpt_result_id   number(15);
509    ---------------------------------------------------------------
510    -- END OF BEN_WV_PRTN_RSN_PTIP_F ----------------------
511    ---------------------------------------------------------------
512    ---------------------------------------------------------------
513    -- START OF BEN_WV_PRTN_RSN_CTFN_PTIP_F ----------------------
514    ---------------------------------------------------------------
515    cursor c_wct1_from_parent(c_WV_PRTN_RSN_PTIP_ID number) is
516    select  wv_prtn_rsn_ctfn_ptip_id
517    from BEN_WV_PRTN_RSN_CTFN_PTIP_F
518    where  WV_PRTN_RSN_PTIP_ID = c_WV_PRTN_RSN_PTIP_ID ;
519    --
520    cursor c_wct1(c_wv_prtn_rsn_ctfn_ptip_id number,c_mirror_src_entity_result_id number ,
521                 c_table_alias varchar2) is
522    select  wct.*
523    from BEN_WV_PRTN_RSN_CTFN_PTIP_F wct
524    where  wct.wv_prtn_rsn_ctfn_ptip_id = c_wv_prtn_rsn_ctfn_ptip_id
525    and not exists (
526      select /* */ null
527      from ben_copy_entity_results cpe
528      --     ,pqh_table_route trt
529      where copy_entity_txn_id = p_copy_entity_txn_id
530 --     and trt.table_route_id = cpe.table_route_id
531      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
532      and cpe.table_alias  = c_table_alias
533      and information1 = c_wv_prtn_rsn_ctfn_ptip_id
534        and information2 = wct.effective_start_date
535        and information3 = wct.effective_end_date
536     );
537    l_wv_prtn_rsn_ctfn_ptip_id                 number(15);
538    l_out_wct_result_id   number(15);
539    ---------------------------------------------------------------
540    -- END OF BEN_WV_PRTN_RSN_CTFN_PTIP_F ----------------------
541    ---------------------------------------------------------------
542    ---------------------------------------------------------------
543    -- START OF BEN_LER_CHG_DPNT_CVG_CTFN_F ----------------------
544    ---------------------------------------------------------------
545    cursor c_lcc1_from_parent(c_LER_CHG_DPNT_CVG_ID number) is
546    select  ler_chg_dpnt_cvg_ctfn_id
547    from BEN_LER_CHG_DPNT_CVG_CTFN_F
548    where  LER_CHG_DPNT_CVG_ID = c_LER_CHG_DPNT_CVG_ID ;
549    --
550    cursor c_lcc1(c_ler_chg_dpnt_cvg_ctfn_id number,c_mirror_src_entity_result_id number ,
551                 c_table_alias varchar2) is
552    select  lcc.*
553    from BEN_LER_CHG_DPNT_CVG_CTFN_F lcc
554    where  lcc.ler_chg_dpnt_cvg_ctfn_id = c_ler_chg_dpnt_cvg_ctfn_id
555    and not exists (
556      select /* */ null
557      from ben_copy_entity_results cpe
558           -- ,pqh_table_route trt
559      where copy_entity_txn_id = p_copy_entity_txn_id
560 --     and trt.table_route_id = cpe.table_route_id
561      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
562      and cpe.table_alias  = c_table_alias
563      and information1 = c_ler_chg_dpnt_cvg_ctfn_id
564        and information2 = lcc.effective_start_date
565        and information3 = lcc.effective_end_date
566     );
567 
568    l_ler_chg_dpnt_cvg_ctfn_id1 number;
569    l_out_lcc1_result_id   number(15);
570    ---------------------------------------------------------------
571    -- END OF BEN_LER_CHG_DPNT_CVG_CTFN_F ----------------------
572    ---------------------------------------------------------------
573    ---------------------------------------------------------------
574    -- START OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
575    ---------------------------------------------------------------
576    cursor c_peo2_from_parent(c_PLIP_ID number) is
577    select  elig_to_prte_rsn_id
578    from BEN_ELIG_TO_PRTE_RSN_F
579    where  PLIP_ID = c_PLIP_ID ;
580    --
581    cursor c_peo2(c_elig_to_prte_rsn_id number,c_mirror_src_entity_result_id number ,
582                 c_table_alias varchar2) is
583    select  peo.*
584    from BEN_ELIG_TO_PRTE_RSN_F peo
585    where  peo.elig_to_prte_rsn_id = c_elig_to_prte_rsn_id
586    and not exists (
587      select /* */ null
588      from ben_copy_entity_results cpe
589           -- ,pqh_table_route trt
590      where copy_entity_txn_id = p_copy_entity_txn_id
591 --     and trt.table_route_id = cpe.table_route_id
592      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
593      and cpe.table_alias  = c_table_alias
594      and information1 = c_elig_to_prte_rsn_id
595        and information2 = peo.effective_start_date
596        and information3 = peo.effective_end_date
597    );
598    l_elig_to_prte_rsn_id2   number(15);
599    l_out_peo2_result_id     number(15);
600    ---------------------------------------------------------------
601    -- END OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
602    ---------------------------------------------------------------
603    ---------------------------------------------------------------
604    -- START OF BEN_LER_BNFT_RSTRN_F ----------------------
605    ---------------------------------------------------------------
606    cursor c_lbr1_from_parent(c_PLIP_ID number) is
607    select  ler_bnft_rstrn_id
608    from BEN_LER_BNFT_RSTRN_F
609    where  PLIP_ID = c_PLIP_ID ;
610    --
611    cursor c_lbr1(c_ler_bnft_rstrn_id number,c_mirror_src_entity_result_id number ,
612                 c_table_alias varchar2) is
613    select  lbr.*
614    from BEN_LER_BNFT_RSTRN_F lbr
615    where  lbr.ler_bnft_rstrn_id = c_ler_bnft_rstrn_id
616    and not exists (
617      select /* */ null
618      from ben_copy_entity_results cpe
619           -- ,pqh_table_route trt
620      where copy_entity_txn_id = p_copy_entity_txn_id
621 --     and trt.table_route_id = cpe.table_route_id
622      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
623      and cpe.table_alias  = c_table_alias
624      and information1 = c_ler_bnft_rstrn_id
625      and information2 = lbr.effective_start_date
626      and information3 = lbr.effective_end_date
627    );
628    l_ler_bnft_rstrn_id                 number(15);
629    l_out_lbr_result_id   number(15);
630    ---------------------------------------------------------------
631    -- END OF BEN_LER_BNFT_RSTRN_F ----------------------
632    ---------------------------------------------------------------
633     ---------------------------------------------------------------
634    -- START OF BEN_LER_CHG_PLIP_ENRT_F ----------------------
635    ---------------------------------------------------------------
636    cursor c_lpr_from_parent(c_PLIP_ID number) is
637    select distinct ler_chg_plip_enrt_id
638    from BEN_LER_CHG_PLIP_ENRT_F
639    where  PLIP_ID = c_PLIP_ID ;
640    --
641    cursor c_lpr(c_ler_chg_plip_enrt_id number,c_mirror_src_entity_result_id number ,
642                 c_table_alias varchar2) is
643    select  lpr.*
644    from BEN_LER_CHG_PLIP_ENRT_F lpr
645    where  lpr.ler_chg_plip_enrt_id = c_ler_chg_plip_enrt_id
646      and not exists (
647          select /* */ null
648          from ben_copy_entity_results cpe
649               -- ,pqh_table_route trt
650          where copy_entity_txn_id = p_copy_entity_txn_id
651      --    and trt.table_route_id = cpe.table_route_id
652          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
653          and cpe.table_alias  = c_table_alias
654          and information1 = c_ler_chg_plip_enrt_id
655            and information2 = lpr.effective_start_date
656            and information3 = lpr.effective_end_date
657         );
658     l_ler_chg_plip_enrt_id                 number(15);
659     l_out_lpr_result_id   number(15);
660    --
661    cursor c_lpr_drp(c_ler_chg_plip_enrt_id number,c_mirror_src_entity_result_id number ,
662                 c_table_alias varchar2) is
663    select distinct cpe.information257 ler_id
664      from ben_copy_entity_results cpe
665           -- ,pqh_table_route trt
666      where copy_entity_txn_id = p_copy_entity_txn_id
667 --     and trt.table_route_id = cpe.table_route_id
668      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
669      and cpe.table_alias  = c_table_alias
670      and information1 = c_ler_chg_plip_enrt_id
671     ;
672    ---------------------------------------------------------------
673    -- END OF BEN_LER_CHG_PLIP_ENRT_F ----------------------
674    ---------------------------------------------------------------
675    ---------------------------------------------------------------
676    -- START OF BEN_CMBN_PLIP_F ----------------------
677    ---------------------------------------------------------------
678    cursor c_cpl1_from_parent(c_PGM_ID number) is
679    select distinct cp.cmbn_plip_id
680    from  ben_cmbn_plip_f cp
681    where cp.pgm_id = c_pgm_id;
682 
683    --
684    cursor c_cpl1(c_cmbn_plip_id number,c_mirror_src_entity_result_id number ,
685                 c_table_alias varchar2) is
686    select  cpl.*
687    from BEN_CMBN_PLIP_F cpl
688    where  cpl.cmbn_plip_id = c_cmbn_plip_id
689    and not exists (
690      select /* */ null
691      from ben_copy_entity_results cpe
692           -- ,pqh_table_route trt
693      where copy_entity_txn_id = p_copy_entity_txn_id
694 --     and trt.table_route_id = cpe.table_route_id
695      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
696      and cpe.table_alias  = c_table_alias
697      and information1 = c_cmbn_plip_id
698      and information2 = cpl.effective_start_date
699      and information3 = cpl.effective_end_date
700     );
701    l_cmbn_plip_id                 number(15);
702    l_out_cpl_result_id   number(15);
703    ---------------------------------------------------------------
704    -- END OF BEN_CMBN_PLIP_F ----------------------
705    ---------------------------------------------------------------
706    ---------------------------------------------------------------
707    -- START OF BEN_CMBN_PTIP_F ----------------------
708    ---------------------------------------------------------------
709    cursor c_cbp1_from_parent(c_PGM_ID number) is
710    select distinct cp.cmbn_ptip_id
711    from ben_cmbn_ptip_f cp
712    where cp.pgm_id = c_pgm_id;
713 
714    --
715    cursor c_cbp1(c_cmbn_ptip_id number,c_mirror_src_entity_result_id number ,
716                 c_table_alias varchar2) is
717    select  cbp.*
718    from BEN_CMBN_PTIP_F cbp
719    where  cbp.cmbn_ptip_id = c_cmbn_ptip_id
720    and not exists (
721      select /* */ null
722      from ben_copy_entity_results cpe
723           -- ,pqh_table_route trt
724      where copy_entity_txn_id = p_copy_entity_txn_id
725 --     and trt.table_route_id = cpe.table_route_id
726      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
727      and cpe.table_alias  = c_table_alias
728      and information1 = c_cmbn_ptip_id
729      and information2 = cbp.effective_start_date
730      and information3 = cbp.effective_end_date
731     );
732    l_cmbn_ptip_id                 number(15);
733    l_out_cbp_result_id   number(15);
734    ---------------------------------------------------------------
735    -- END OF BEN_CMBN_PTIP_F ----------------------
736    ---------------------------------------------------------------
737    ---------------------------------------------------------------
738    -- START OF BEN_CMBN_PTIP_OPT_F ----------------------
739    ---------------------------------------------------------------
740    cursor c_cpt1_from_parent(c_PGM_ID number) is
741    select distinct cp.cmbn_ptip_opt_id
742    from ben_cmbn_ptip_opt_f cp
743    where cp.pgm_id = c_pgm_id;
744    --
745    cursor c_cpt1(c_cmbn_ptip_opt_id number,c_mirror_src_entity_result_id number ,
746                 c_table_alias varchar2) is
747    select  cpt.*
748    from BEN_CMBN_PTIP_OPT_F cpt
749    where  cpt.cmbn_ptip_opt_id = c_cmbn_ptip_opt_id
750    and not exists (
751      select /* */ null
752      from ben_copy_entity_results cpe
753           -- ,pqh_table_route trt
754      where copy_entity_txn_id = p_copy_entity_txn_id
755 --     and trt.table_route_id = cpe.table_route_id
756      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
757      and cpe.table_alias  = c_table_alias
758      and information1 = c_cmbn_ptip_opt_id
759      and information2 = cpt.effective_start_date
760      and information3 = cpt.effective_end_date
761     );
762    l_cmbn_ptip_opt_id                 number(15);
763    l_out_cpt_result_id   number(15);
764    ---------------------------------------------------------------
765    -- END OF BEN_CMBN_PTIP_OPT_F ----------------------
766    ---------------------------------------------------------------
767    ---------------------------------------------------------------
768    -- START OF BEN_OIPLIP_F ----------------------
769    ---------------------------------------------------------------
770    cursor c_opp1_from_parent(c_PGM_ID number, c_table_alias varchar2 ) is
771    select oiplip.oiplip_id,cpe_oipl.copy_entity_result_id
772    from ben_oiplip_f oiplip,
773         ben_plip_f plip,
774         ben_copy_entity_results cpe_oipl,
775         ben_copy_entity_results cpe_pl,
776         ben_copy_entity_results cpe_plip
777         -- ,pqh_table_route trt
778    where plip.plip_id = oiplip.plip_id
779    and plip.pgm_id = c_pgm_id
780    and oiplip.oipl_id = cpe_oipl.information1
781 --   and cpe_oipl.table_route_id = trt.table_route_id
782    and cpe_oipl.table_alias  = c_table_alias
783    and cpe_oipl.copy_entity_txn_id = p_copy_entity_txn_id
784    and cpe_oipl.mirror_src_entity_result_id = cpe_pl.copy_entity_result_id
785    and cpe_oipl.copy_entity_txn_id = cpe_pl.copy_entity_txn_id
786    and cpe_pl.mirror_src_entity_result_id = cpe_plip.copy_entity_result_id
787    and cpe_pl.copy_entity_txn_id = cpe_plip.copy_entity_txn_id
788    and cpe_plip.information1 = oiplip.plip_id;
789 
790    --
791    cursor c_opp1(c_oiplip_id number,c_mirror_src_entity_result_id number ,
792                 c_table_alias varchar2) is
793    select  opp.*
794    from BEN_OIPLIP_F opp
795    where  opp.oiplip_id = c_oiplip_id
796    and not exists (
797      select /* */ null
798      from ben_copy_entity_results cpe
799           -- ,pqh_table_route trt
800      where copy_entity_txn_id = p_copy_entity_txn_id
801 --     and trt.table_route_id = cpe.table_route_id
802      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
803      and cpe.table_alias  = c_table_alias
804      and information1 = c_oiplip_id
805        and information2 = opp.effective_start_date
806        and information3 = opp.effective_end_date
807     );
808    l_oiplip_id                 number(15);
809    l_out_opp_result_id   number(15);
810    --------------------------------------------------------------
811    -- END OF BEN_OIPLIP_F ----------------------
812    ---------------------------------------------------------------
813    ---------------------------------------------------------------
814    -- START OF BEN_OPTIP_F ----------------------
815    ---------------------------------------------------------------
816    cursor c_otp1_from_parent(c_PGM_ID number,c_table_alias varchar2 ) is
817    select optip.optip_id,cpe.copy_entity_result_id
818    from ben_optip_f optip,
819         ben_ptip_f ptip,
820         ben_copy_entity_results cpe
821         -- ,pqh_table_route trt
822    where ptip.ptip_id = optip.ptip_id
823    and ptip.pgm_id = c_pgm_id
824    and optip.opt_id = cpe.information1
825 --   and cpe.table_route_id = trt.table_route_id
826    and cpe.table_alias  = c_table_alias
827    and cpe.copy_entity_txn_id = p_copy_entity_txn_id ;
828    --
829    cursor c_otp1(c_optip_id number,c_mirror_src_entity_result_id number ,
830                 c_table_alias varchar2) is
831    select  otp.*
832    from BEN_OPTIP_F otp
833    where  otp.optip_id = c_optip_id
834    and not exists (
835      select /* */ null
836      from ben_copy_entity_results cpe
837           -- ,pqh_table_route trt
838      where copy_entity_txn_id = p_copy_entity_txn_id
839   --   and trt.table_route_id = cpe.table_route_id
840      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
841      and cpe.table_alias  = c_table_alias
842      and information1 = c_optip_id
843        and information2 = otp.effective_start_date
844        and information3 = otp.effective_end_date
845     );
846    l_optip_id                 number(15);
847    l_out_otp_result_id   number(15);
848    ---------------------------------------------------------------
849    -- END OF BEN_OPTIP_F ----------------------
850    ---------------------------------------------------------------
851    ---------------------------------------------------------------
852    -- START OF BEN_PL_TYP_F ----------------------
853    ---------------------------------------------------------------
854    cursor c_ptp_from_parent(c_PTIP_ID number) is
855    select  distinct pl_typ_id
856    from BEN_PTIP_F
857    where  PTIP_ID = c_PTIP_ID ;
858    --
859    l_pl_typ_id                 number(15);
860    l_out_ptp_result_id         number(15);
861    ---------------------------------------------------------------
862    -- END OF BEN_PL_TYP_F ----------------------
863    ---------------------------------------------------------------
864    -- Added to Fetch Lookup Meaning for Program Type
865    cursor c_lookup_meaning(c_lookup_code in varchar2,c_lookup_type in varchar2) is
866    select hl.meaning
867    from   hr_lookups hl
868    where  hl.lookup_code = c_lookup_code
869    and    hl.lookup_type = c_lookup_type;
870 
871    l_program_type_meaning      hr_lookups.meaning%type;
872 
873    cursor c_object_exists(c_pk_id                number,
874                          c_table_alias          varchar2) is
875    select null
876    from ben_copy_entity_results cpe
877         -- ,pqh_table_route trt
878    where copy_entity_txn_id = p_copy_entity_txn_id
879 --   and trt.table_route_id = cpe.table_route_id
880    and cpe.table_alias = c_table_alias
881    and information1 = c_pk_id;
882 
883    l_dummy                        varchar2(1);
884 
885    l_table_route_id            number(15);
886    l_mirror_src_entity_result_id number(15);
887    l_result_type_cd            varchar2(30);
888    l_information5              ben_copy_entity_results.information5%type;
889    l_number_of_copies          number(15);
890    l_child_exists              boolean default false ;
891 
892    begin
893    --
894    --
895    l_number_of_copies := p_number_of_copies ;
896 
897    if p_no_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
898      ben_plan_design_program_module.g_pdw_allow_dup_rslt := ben_plan_design_program_module.g_pdw_no_dup_rslt;
899    else
900      ben_plan_design_program_module.g_pdw_allow_dup_rslt := NULL;
901    end if;
902 
903    if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
904      open c_object_exists(p_pgm_id,'PGM');
905      fetch c_object_exists into l_dummy;
906      if c_object_exists%found then
907        close c_object_exists;
908        return;
909      end if;
910      close c_object_exists;
911    end if;
912 
913    --
914    ---------------------------------------------------------------
915    -- START OF BEN_PGM_F ----------------------
916    ---------------------------------------------------------------
917     l_mirror_src_entity_result_id := null ;
918    --
919    for l_pgm_rec in c_pgm(p_pgm_id,l_mirror_src_entity_result_id,'PGM' ) loop
920    --
921     l_mirror_src_entity_result_id := null ;
922 
923     --
924     l_table_route_id := null ;
925     open g_table_route('PGM');
926       fetch g_table_route into l_table_route_id ;
927     close g_table_route ;
928     --
929     l_information5  := l_pgm_rec.name; --'Intersection';
930     --
931     l_pgm_id := l_pgm_rec.pgm_id ;
932     if p_effective_date between l_pgm_rec.effective_start_date
933        and l_pgm_rec.effective_end_date then
934        --
935        l_result_type_cd := 'DISPLAY';
936     else
937        l_result_type_cd := 'NO DISPLAY';
938     end if;
939     --
940     l_copy_entity_result_id := null;
941     l_object_version_number := null;
942 
943     -- Begin: Fetch Lookup Meaning for Program Type
944 
945     l_program_type_meaning := null ;
946     open c_lookup_meaning(l_pgm_rec.pgm_typ_cd,'BEN_PGM_TYP');
947     fetch c_lookup_meaning into l_program_type_meaning;
948     close c_lookup_meaning;
949 
950     -- End: Fetch Lookup Meaning for Program Type
951 
952     ben_copy_entity_results_api.create_copy_entity_results(
953         p_copy_entity_result_id           => l_copy_entity_result_id,
954         p_copy_entity_txn_id             => p_copy_entity_txn_id,
955         p_result_type_cd                 => l_result_type_cd,
956         p_mirror_src_entity_result_id    => null,
957         p_parent_entity_result_id        => null,
958         p_number_of_copies               => l_number_of_copies,
959         p_table_route_id                 => l_table_route_id,
960         p_table_alias                   => 'PGM',
961         p_information1     => l_pgm_rec.pgm_id,
962         p_information2     => l_pgm_rec.EFFECTIVE_START_DATE,
963         p_information3     => l_pgm_rec.EFFECTIVE_END_DATE,
964         p_information4     => l_pgm_rec.business_group_id,
965         p_information5     => l_information5 , -- 9999 put name for h-grid
966         p_information6     => l_program_type_meaning , -- Lookup Meaning for Program Type
967         p_information8     => 'PGM',
968             p_information41     => l_pgm_rec.acty_ref_perd_cd,
969             p_information36     => l_pgm_rec.alws_unrstrctd_enrt_flag,
970             p_information272     => l_pgm_rec.auto_enrt_mthd_rl,
971             p_information30     => l_pgm_rec.coord_cvg_for_all_pls_flg,
972             p_information257     => l_pgm_rec.dflt_element_type_id,
973             p_information258     => l_pgm_rec.dflt_input_value_id,
974             p_information13     => l_pgm_rec.dflt_pgm_flag,
975             p_information14     => l_pgm_rec.dflt_step_cd,
976             p_information259     => l_pgm_rec.dflt_step_rl,
977             p_information21     => l_pgm_rec.dpnt_adrs_rqd_flag,
978             p_information43     => l_pgm_rec.dpnt_cvg_end_dt_cd,
979             p_information269     => l_pgm_rec.dpnt_cvg_end_dt_rl,
980             p_information44     => l_pgm_rec.dpnt_cvg_strt_dt_cd,
981             p_information268     => l_pgm_rec.dpnt_cvg_strt_dt_rl,
982             p_information23     => l_pgm_rec.dpnt_dob_rqd_flag,
983             p_information40     => l_pgm_rec.dpnt_dsgn_cd,
984             p_information37     => l_pgm_rec.dpnt_dsgn_lvl_cd,
985             p_information31     => l_pgm_rec.dpnt_dsgn_no_ctfn_rqd_flag,
986             p_information25     => l_pgm_rec.dpnt_legv_id_rqd_flag,
987             p_information34     => l_pgm_rec.drvbl_fctr_apls_rts_flag,
988             p_information32     => l_pgm_rec.drvbl_fctr_dpnt_elig_flag,
989             p_information33     => l_pgm_rec.drvbl_fctr_prtn_elig_flag,
990             p_information26     => l_pgm_rec.elig_apls_flag,
991             p_information51     => l_pgm_rec.enrt_cd,
992             p_information42     => l_pgm_rec.enrt_cvg_end_dt_cd,
993             p_information266     => l_pgm_rec.enrt_cvg_end_dt_rl,
994             p_information45     => l_pgm_rec.enrt_cvg_strt_dt_cd,
995             p_information267     => l_pgm_rec.enrt_cvg_strt_dt_rl,
996             p_information46     => l_pgm_rec.enrt_info_rt_freq_cd,
997             p_information52     => l_pgm_rec.enrt_mthd_cd,
998             p_information273     => l_pgm_rec.enrt_rl,
999             p_information141     => l_pgm_rec.ivr_ident,
1000             p_information287     => l_pgm_rec.mx_dpnt_pct_prtt_lf_amt,
1001             p_information288     => l_pgm_rec.mx_sps_pct_prtt_lf_amt,
1002             p_information170     => l_pgm_rec.name,
1003             p_information20     => l_pgm_rec.per_cvrd_cd,
1004             p_information111     => l_pgm_rec.pgm_attribute1,
1005             p_information120     => l_pgm_rec.pgm_attribute10,
1006             p_information121     => l_pgm_rec.pgm_attribute11,
1007             p_information122     => l_pgm_rec.pgm_attribute12,
1008             p_information123     => l_pgm_rec.pgm_attribute13,
1009             p_information124     => l_pgm_rec.pgm_attribute14,
1010             p_information125     => l_pgm_rec.pgm_attribute15,
1011             p_information126     => l_pgm_rec.pgm_attribute16,
1012             p_information127     => l_pgm_rec.pgm_attribute17,
1013             p_information128     => l_pgm_rec.pgm_attribute18,
1014             p_information129     => l_pgm_rec.pgm_attribute19,
1015             p_information112     => l_pgm_rec.pgm_attribute2,
1016             p_information130     => l_pgm_rec.pgm_attribute20,
1017             p_information131     => l_pgm_rec.pgm_attribute21,
1018             p_information132     => l_pgm_rec.pgm_attribute22,
1019             p_information133     => l_pgm_rec.pgm_attribute23,
1020             p_information134     => l_pgm_rec.pgm_attribute24,
1021             p_information135     => l_pgm_rec.pgm_attribute25,
1022             p_information136     => l_pgm_rec.pgm_attribute26,
1023             p_information137     => l_pgm_rec.pgm_attribute27,
1024             p_information138     => l_pgm_rec.pgm_attribute28,
1025             p_information139     => l_pgm_rec.pgm_attribute29,
1026             p_information113     => l_pgm_rec.pgm_attribute3,
1027             p_information140     => l_pgm_rec.pgm_attribute30,
1028             p_information114     => l_pgm_rec.pgm_attribute4,
1029             p_information115     => l_pgm_rec.pgm_attribute5,
1030             p_information116     => l_pgm_rec.pgm_attribute6,
1031             p_information117     => l_pgm_rec.pgm_attribute7,
1032             p_information118     => l_pgm_rec.pgm_attribute8,
1033             p_information119     => l_pgm_rec.pgm_attribute9,
1034             p_information110     => l_pgm_rec.pgm_attribute_category,
1035             p_information219     => l_pgm_rec.pgm_desc,
1036             p_information49     => l_pgm_rec.pgm_grp_cd,
1037             p_information22     => l_pgm_rec.pgm_prvds_no_auto_enrt_flag,
1038             p_information24     => l_pgm_rec.pgm_prvds_no_dflt_enrt_flag,
1039             p_information38     => l_pgm_rec.pgm_stat_cd,
1040             p_information39     => l_pgm_rec.pgm_typ_cd,
1041             p_information50     => l_pgm_rec.pgm_uom,
1042             p_information29     => l_pgm_rec.pgm_use_all_asnts_elig_flag,
1043             p_information53     => l_pgm_rec.poe_lvl_cd,
1044             p_information28     => l_pgm_rec.prtn_elig_ovrid_alwd_flag,
1045             p_information48     => l_pgm_rec.rt_end_dt_cd,
1046             p_information271     => l_pgm_rec.rt_end_dt_rl,
1047             p_information47     => l_pgm_rec.rt_strt_dt_cd,
1048             p_information270     => l_pgm_rec.rt_strt_dt_rl,
1049             p_information15     => l_pgm_rec.scores_calc_mthd_cd,
1050             p_information261     => l_pgm_rec.scores_calc_rl,
1051             p_information11     => l_pgm_rec.short_code,
1052             p_information12     => l_pgm_rec.short_name,
1053             p_information35     => l_pgm_rec.trk_inelig_per_flag,
1054             p_information16     => l_pgm_rec.update_salary_cd,
1055             p_information185     => l_pgm_rec.url_ref_name,
1056             p_information17     => l_pgm_rec.use_multi_pay_rates_flag,
1057             p_information18     => l_pgm_rec.use_prog_points_flag,
1058             p_information19     => l_pgm_rec.use_scores_cd,
1059             p_information27     => l_pgm_rec.uses_all_asmts_for_rts_flag,
1060             p_information54     => l_pgm_rec.vrfy_fmly_mmbr_cd,
1061             p_information274     => l_pgm_rec.vrfy_fmly_mmbr_rl,
1062             -- GSP
1063             p_information69     => l_pgm_rec.use_variable_rates_flag,
1064             p_information70     => l_pgm_rec.salary_calc_mthd_cd,
1065             p_information72     => l_pgm_rec.gsp_allow_override_flag,
1066             p_information293    => l_pgm_rec.salary_calc_mthd_rl,
1067 
1068             p_INFORMATION196    => l_pgm_rec.SUSP_IF_DPNT_SSN_NT_PRV_CD,
1069             p_INFORMATION190    => l_pgm_rec.SUSP_IF_DPNT_DOB_NT_PRV_CD,
1070             p_INFORMATION191    => l_pgm_rec.SUSP_IF_DPNT_ADR_NT_PRV_CD,
1071             p_INFORMATION192    => l_pgm_rec.SUSP_IF_CTFN_NOT_DPNT_FLAG,
1072             p_INFORMATION193    => l_pgm_rec.DPNT_CTFN_DETERMINE_CD,
1073             p_information265    => l_pgm_rec.object_version_number,
1074            --
1075         p_object_version_number          => l_object_version_number,
1076         p_effective_date                 => p_effective_date       );
1077          --
1078 
1079          if l_out_pgm_result_id is null then
1080            l_out_pgm_result_id := l_copy_entity_result_id;
1081          end if;
1082 
1083          if l_result_type_cd = 'DISPLAY' then
1084            l_out_pgm_result_id := l_copy_entity_result_id ;
1085          end if;
1086 
1087          -- Copy Fast Formulas if any are attached to any column --
1088 
1089          ---------------------------------------------------------------
1090          -- SALARY_CALC_MTHD_RL -----------------
1091          ---------------------------------------------------------------
1092 
1093          if to_char(l_pgm_rec.salary_calc_mthd_rl) is not null then
1094                  --
1095                  ben_plan_design_program_module.create_formula_result
1096                  (
1097                   p_validate                       =>  0
1098                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1099                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1100                  ,p_formula_id                     =>  l_pgm_rec.salary_calc_mthd_rl
1101                  ,p_business_group_id              =>  l_pgm_rec.business_group_id
1102                  ,p_number_of_copies               =>  l_number_of_copies
1103                  ,p_object_version_number          =>  l_object_version_number
1104                  ,p_effective_date                 =>  p_effective_date
1105                  );
1106 
1107                  --
1108          end if;
1109 
1110          ---------------------------------------------------------------
1111          -- DFLT_STEP_RL -----------------
1112          ---------------------------------------------------------------
1113 
1114          if to_char(l_pgm_rec.Dflt_step_rl) is not null then
1115                  --
1116                  ben_plan_design_program_module.create_formula_result
1117                  (
1118                   p_validate                       =>  0
1119                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1120                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1121                  ,p_formula_id                     =>  l_pgm_rec.Dflt_step_rl
1122                  ,p_business_group_id              =>  l_pgm_rec.business_group_id
1123                  ,p_number_of_copies               =>  l_number_of_copies
1124                  ,p_object_version_number          =>  l_object_version_number
1125                  ,p_effective_date                 =>  p_effective_date
1126                  );
1127 
1128                  --
1129          end if;
1130 
1131          ---------------------------------------------------------------
1132          -- SCORES_CALC_RL -----------------
1133          ---------------------------------------------------------------
1134 
1135          if to_char(l_pgm_rec.Scores_calc_rl) is not null then
1136                  --
1137                  ben_plan_design_program_module.create_formula_result
1138                  (
1139                   p_validate                       =>  0
1140                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1141                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1142                  ,p_formula_id                     =>  l_pgm_rec.Scores_calc_rl
1143                  ,p_business_group_id              =>  l_pgm_rec.business_group_id
1144                  ,p_number_of_copies               =>  l_number_of_copies
1145                  ,p_object_version_number          =>  l_object_version_number
1146                  ,p_effective_date                 =>  p_effective_date
1147                  );
1148 
1149                  --
1150          end if;
1151 
1152          ---------------------------------------------------------------
1153          -- AUTO_ENRT_MTHD_RL -----------------
1154          ---------------------------------------------------------------
1155 
1156          if to_char(l_pgm_rec.auto_enrt_mthd_rl) is not null then
1157                  --
1158                  ben_plan_design_program_module.create_formula_result
1159                  (
1160                   p_validate                       =>  0
1161                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1162                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1163                  ,p_formula_id                     =>  l_pgm_rec.auto_enrt_mthd_rl
1164                  ,p_business_group_id              =>  l_pgm_rec.business_group_id
1165                  ,p_number_of_copies               =>  l_number_of_copies
1166                  ,p_object_version_number          =>  l_object_version_number
1167                  ,p_effective_date                 =>  p_effective_date
1168                  );
1169 
1170                  --
1171          end if;
1172 
1173          ---------------------------------------------------------------
1174          -- DPNT_CVG_END_DT_RL -----------------
1175          ---------------------------------------------------------------
1176 
1177           if to_char(l_pgm_rec.dpnt_cvg_end_dt_rl) is not null then
1178               --
1179               ben_plan_design_program_module.create_formula_result
1180               (
1181                p_validate                       =>  0
1182               ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1183               ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1184               ,p_formula_id                     =>  l_pgm_rec.dpnt_cvg_end_dt_rl
1185               ,p_business_group_id              =>  l_pgm_rec.business_group_id
1186               ,p_number_of_copies               =>  l_number_of_copies
1187               ,p_object_version_number          =>  l_object_version_number
1188               ,p_effective_date                 =>  p_effective_date
1189               );
1190 
1191               --
1192           end if;
1193 
1194           ---------------------------------------------------------------
1195           -- DPNT_CVG_STRT_DT_RL -----------------
1196           ---------------------------------------------------------------
1197 
1198           if to_char(l_pgm_rec.dpnt_cvg_strt_dt_rl) is not null then
1199                --
1200                ben_plan_design_program_module.create_formula_result
1201                 (
1202                  p_validate                       =>  0
1203                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1204                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1205                 ,p_formula_id                     =>  l_pgm_rec.dpnt_cvg_strt_dt_rl
1206                 ,p_business_group_id              =>  l_pgm_rec.business_group_id
1207                 ,p_number_of_copies               =>  l_number_of_copies
1208                 ,p_object_version_number          =>  l_object_version_number
1209                 ,p_effective_date                 =>  p_effective_date
1210                 );
1211 
1212                --
1213           end if;
1214 
1215           ---------------------------------------------------------------
1216           -- ENRT_CVG_END_DT_RL -----------------
1217           ---------------------------------------------------------------
1218 
1219           if to_char(l_pgm_rec.enrt_cvg_end_dt_rl) is not null then
1220              --
1221              ben_plan_design_program_module.create_formula_result
1222               (
1223                p_validate                       =>  0
1224               ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1225               ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1226               ,p_formula_id                     =>  l_pgm_rec.enrt_cvg_end_dt_rl
1227               ,p_business_group_id              =>  l_pgm_rec.business_group_id
1228               ,p_number_of_copies               =>  l_number_of_copies
1229               ,p_object_version_number          =>  l_object_version_number
1230               ,p_effective_date                 =>  p_effective_date
1231               );
1232 
1233              --
1234           end if;
1235 
1236           ---------------------------------------------------------------
1237           -- ENRT_CVG_STRT_DT_RL -----------------
1238           ---------------------------------------------------------------
1239 
1240           if to_char(l_pgm_rec.enrt_cvg_strt_dt_rl) is not null then
1241                 --
1242                 ben_plan_design_program_module.create_formula_result
1243                  (
1244                   p_validate                       =>  0
1245                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1246                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1247                  ,p_formula_id                     =>  l_pgm_rec.enrt_cvg_strt_dt_rl
1248                  ,p_business_group_id              =>  l_pgm_rec.business_group_id
1249                  ,p_number_of_copies               =>  l_number_of_copies
1250                  ,p_object_version_number          =>  l_object_version_number
1251                  ,p_effective_date                 =>  p_effective_date
1252                  );
1253 
1254                 --
1255           end if;
1256 
1257           ---------------------------------------------------------------
1258           -- ENRT_RL -----------------
1259           ---------------------------------------------------------------
1260 
1261           if to_char(l_pgm_rec.enrt_rl) is not null then
1262             --
1263             ben_plan_design_program_module.create_formula_result
1264              (
1265               p_validate                       =>  0
1266              ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1267              ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1268              ,p_formula_id                     =>  l_pgm_rec.enrt_rl
1269              ,p_business_group_id              =>  l_pgm_rec.business_group_id
1270              ,p_number_of_copies               =>  l_number_of_copies
1271              ,p_object_version_number          =>  l_object_version_number
1272              ,p_effective_date                 =>  p_effective_date
1273              );
1274 
1275             --
1276           end if;
1277 
1278           ---------------------------------------------------------------
1279           -- RT_END_DT_RL -----------------
1280           ---------------------------------------------------------------
1281 
1282           if to_char(l_pgm_rec.rt_end_dt_rl) is not null then
1283                 --
1284                 ben_plan_design_program_module.create_formula_result
1285                  (
1286                   p_validate                       =>  0
1287                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1288                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1289                  ,p_formula_id                     =>  l_pgm_rec.rt_end_dt_rl
1290                  ,p_business_group_id              =>  l_pgm_rec.business_group_id
1291                  ,p_number_of_copies               =>  l_number_of_copies
1292                  ,p_object_version_number          =>  l_object_version_number
1293                  ,p_effective_date                 =>  p_effective_date
1294                  );
1295 
1296                 --
1297           end if;
1298 
1299           ---------------------------------------------------------------
1300           -- RT_STRT_DT_RL -----------------
1301           ---------------------------------------------------------------
1302 
1303           if to_char(l_pgm_rec.rt_strt_dt_rl) is not null then
1304                   --
1305                   ben_plan_design_program_module.create_formula_result
1306                    (
1307                     p_validate                       =>  0
1308                    ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1309                    ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1310                    ,p_formula_id                     =>  l_pgm_rec.rt_strt_dt_rl
1311                    ,p_business_group_id              =>  l_pgm_rec.business_group_id
1312                    ,p_number_of_copies               =>  l_number_of_copies
1313                    ,p_object_version_number          =>  l_object_version_number
1314                    ,p_effective_date                 =>  p_effective_date
1315                    );
1316 
1317                   --
1318           end if;
1319 
1320          ---------------------------------------------------------------
1321          -- VRFY_FMLY_MMBR_RL -----------------
1322          ---------------------------------------------------------------
1323 
1324          if to_char(l_pgm_rec.vrfy_fmly_mmbr_rl) is not null then
1325               --
1326               ben_plan_design_program_module.create_formula_result
1327                (
1328                 p_validate                       =>  0
1329                ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1330                ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1331                ,p_formula_id                     =>  l_pgm_rec.vrfy_fmly_mmbr_rl
1332                ,p_business_group_id              =>  l_pgm_rec.business_group_id
1333                ,p_number_of_copies               =>  l_number_of_copies
1334                ,p_object_version_number          =>  l_object_version_number
1335                ,p_effective_date                 =>  p_effective_date
1336                );
1337 
1338               --
1339          end if;
1340 
1341  end loop;
1342   ---------------------------------------------------------------
1343   -- END OF BEN_PGM_F ----------------------
1344   ---------------------------------------------------------------
1345   --
1346 
1347   if p_number_of_copies = 1 then
1348 
1349       if l_out_pgm_result_id is null then
1350         --
1351         -- Program created earlier with number_copies as 0
1352         --
1353         open c_parent_result(p_pgm_id,'PGM',p_copy_entity_txn_id);
1354         fetch c_parent_result into l_out_pgm_result_id ;
1355         close c_parent_result;
1356       end if;
1357 
1358 
1359           -- ------------------------------------------------------------------------
1360           -- POPL Genenation call
1361           -- ------------------------------------------------------------------------
1362           l_mirror_src_entity_result_id := l_out_pgm_result_id;
1363 
1364           --
1365           ben_plan_design_plan_module.create_popl_result
1366             (
1367               p_validate                     => p_validate
1368              ,p_copy_entity_result_id        => l_mirror_src_entity_result_id
1369              ,p_copy_entity_txn_id           => p_copy_entity_txn_id
1370              ,p_pgm_id                       => p_pgm_id
1371              ,p_pl_id                        => null
1372              ,p_business_group_id            => p_business_group_id
1373              ,p_number_of_copies             => p_number_of_copies
1374              ,p_object_version_number        => l_object_version_number
1375              ,p_effective_date               => p_effective_date
1376              ,p_parent_entity_result_id      => l_mirror_src_entity_result_id
1377             );
1378           -- ------------------------------------------------------------------------
1379           -- Eligibility Profiles
1380           -- ------------------------------------------------------------------------
1381           ben_plan_design_elpro_module.create_elpro_results
1382             (
1383               p_validate                     => p_validate
1384              ,p_copy_entity_result_id        => l_mirror_src_entity_result_id
1385              ,p_copy_entity_txn_id           => p_copy_entity_txn_id
1386              ,p_pgm_id                       => p_pgm_id
1387              ,p_ptip_id                      => null
1388              ,p_plip_id                      => null
1389              ,p_pl_id                        => null
1390              ,p_oipl_id                      => null
1391              ,p_business_group_id            => p_business_group_id
1392              ,p_number_of_copies             => p_number_of_copies
1393              ,p_object_version_number        => l_object_version_number
1394              ,p_effective_date               => p_effective_date
1395              ,p_parent_entity_result_id      => l_mirror_src_entity_result_id
1396             );
1397           -- ------------------------------------------------------------------------
1398           -- Dependent Eligibility Profiles
1399           -- ------------------------------------------------------------------------
1400           ben_plan_design_elpro_module.create_dep_elpro_result
1401             (
1402               p_validate                   => p_validate
1403              ,p_copy_entity_result_id      => l_mirror_src_entity_result_id
1404              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
1405              ,p_pgm_id                     => p_pgm_id
1406              ,p_ptip_id                    => null
1407              ,p_pl_id                      => null
1408              ,p_business_group_id          => p_business_group_id
1409              ,p_number_of_copies           => p_number_of_copies
1410              ,p_object_version_number      => l_object_version_number
1411              ,p_effective_date             => p_effective_date
1412              ,p_parent_entity_result_id    => l_mirror_src_entity_result_id
1413             );
1414             -- ------------------------------------------------------------------------
1415             -- Standard Rates ,Flex Credits at Program level
1416             -- ------------------------------------------------------------------------
1417           ben_pd_rate_and_cvg_module.create_rate_results
1418             (
1419               p_validate                   =>p_validate
1420              ,p_copy_entity_result_id      =>l_mirror_src_entity_result_id
1421              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
1422              ,p_pgm_id                     => p_pgm_id
1423              ,p_ptip_id                    => null
1424              ,p_plip_id                    => null
1425              ,p_pl_id                      => null
1426              ,p_oiplip_id                  => null
1427              ,p_cmbn_plip_id               => null
1428              ,p_cmbn_ptip_id               => null
1429              ,p_cmbn_ptip_opt_id           => null
1430              ,p_business_group_id          => p_business_group_id
1431              ,p_number_of_copies           => p_number_of_copies
1432              ,p_object_version_number      => l_object_version_number
1433              ,p_effective_date             => p_effective_date
1434              ,p_parent_entity_result_id    => l_mirror_src_entity_result_id
1435              ) ;
1436             -- ------------------------------------------------------------------------
1437             -- Benefit Pools  Program Level
1438             -- ------------------------------------------------------------------------
1439           ben_pd_rate_and_cvg_module.create_bnft_pool_results
1440             (
1441               p_validate                   =>p_validate
1442              ,p_copy_entity_result_id      =>l_mirror_src_entity_result_id
1443              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
1444              ,p_pgm_id                     => p_pgm_id
1445              ,p_ptip_id                    => null
1446              ,p_plip_id                    => null
1447              ,p_oiplip_id                  => null
1448              ,p_cmbn_plip_id               => null
1449              ,p_cmbn_ptip_id               => null
1450              ,p_cmbn_ptip_opt_id           => null
1451              ,p_business_group_id          => p_business_group_id
1452              ,p_number_of_copies           => p_number_of_copies
1453              ,p_object_version_number      => l_object_version_number
1454              ,p_effective_date             => p_effective_date
1455              ,p_parent_entity_result_id    => l_mirror_src_entity_result_id
1456              ) ;
1457 
1458             -- ------------------------------------------------------------------------
1459             -- Coverage Across Plan Types
1460             -- ------------------------------------------------------------------------
1461             ben_pd_rate_and_cvg_module.create_acrs_ptip_cvg_results
1462             (
1463               p_validate                   =>p_validate
1464              ,p_copy_entity_result_id      =>l_mirror_src_entity_result_id
1465              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
1466              ,p_pgm_id                     => p_pgm_id
1467              ,p_business_group_id          => p_business_group_id
1468              ,p_number_of_copies           => p_number_of_copies
1469              ,p_object_version_number      => l_object_version_number
1470              ,p_effective_date             => p_effective_date
1471              ) ;
1472 
1473 
1474    ---------------------------------------------------------------
1475    -- START OF BEN_LER_CHG_DPNT_CVG_F ----------------------
1476    ---------------------------------------------------------------
1477    --
1478    for l_parent_rec  in c_ldc_from_parent(l_PGM_ID) loop
1479    --
1480     l_mirror_src_entity_result_id := l_out_pgm_result_id ;
1481 
1482     l_ler_chg_dpnt_cvg_id := l_parent_rec.ler_chg_dpnt_cvg_id ;
1483     --
1484     for l_ldc_rec in c_ldc(l_parent_rec.ler_chg_dpnt_cvg_id,l_mirror_src_entity_result_id,'LDC' ) loop
1485     --
1486     --
1487       l_table_route_id := null ;
1488       open g_table_route('LDC');
1489       fetch g_table_route into l_table_route_id ;
1490       close g_table_route ;
1491       --
1492       l_information5  := get_ler_name(l_ldc_rec.ler_id,p_effective_date); --'Intersection';
1493       --
1494 
1495       if p_effective_date between l_ldc_rec.effective_start_date
1496       and l_ldc_rec.effective_end_date then
1497        --
1498          l_result_type_cd := 'DISPLAY';
1499       else
1500          l_result_type_cd := 'NO DISPLAY';
1501       end if;
1502       --
1503       l_copy_entity_result_id := null;
1504       l_object_version_number := null;
1505       ben_copy_entity_results_api.create_copy_entity_results(
1506         p_copy_entity_result_id           => l_copy_entity_result_id,
1507         p_copy_entity_txn_id             => p_copy_entity_txn_id,
1508         p_result_type_cd                 => l_result_type_cd,
1509         p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
1510         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
1511         p_number_of_copies               => l_number_of_copies,
1512         p_table_route_id                 => l_table_route_id,
1513         p_table_alias                   => 'LDC',
1514         p_information1     => l_ldc_rec.ler_chg_dpnt_cvg_id,
1515         p_information2     => l_ldc_rec.EFFECTIVE_START_DATE,
1516         p_information3     => l_ldc_rec.EFFECTIVE_END_DATE,
1517         p_information4     => l_ldc_rec.business_group_id,
1518         p_information5     => l_information5 , -- 9999 put name for h-grid
1519             p_information11     => l_ldc_rec.add_rmv_cvg_cd,
1520             p_information12     => l_ldc_rec.cvg_eff_end_cd,
1521             p_information263     => l_ldc_rec.cvg_eff_end_rl,
1522             p_information13     => l_ldc_rec.cvg_eff_strt_cd,
1523             p_information262     => l_ldc_rec.cvg_eff_strt_rl,
1524             p_information111     => l_ldc_rec.ldc_attribute1,
1525             p_information120     => l_ldc_rec.ldc_attribute10,
1526             p_information121     => l_ldc_rec.ldc_attribute11,
1527             p_information122     => l_ldc_rec.ldc_attribute12,
1528             p_information123     => l_ldc_rec.ldc_attribute13,
1529             p_information124     => l_ldc_rec.ldc_attribute14,
1530             p_information125     => l_ldc_rec.ldc_attribute15,
1531             p_information126     => l_ldc_rec.ldc_attribute16,
1532             p_information127     => l_ldc_rec.ldc_attribute17,
1533             p_information128     => l_ldc_rec.ldc_attribute18,
1534             p_information129     => l_ldc_rec.ldc_attribute19,
1535             p_information112     => l_ldc_rec.ldc_attribute2,
1536             p_information130     => l_ldc_rec.ldc_attribute20,
1537             p_information131     => l_ldc_rec.ldc_attribute21,
1538             p_information132     => l_ldc_rec.ldc_attribute22,
1539             p_information133     => l_ldc_rec.ldc_attribute23,
1540             p_information134     => l_ldc_rec.ldc_attribute24,
1541             p_information135     => l_ldc_rec.ldc_attribute25,
1542             p_information136     => l_ldc_rec.ldc_attribute26,
1543             p_information137     => l_ldc_rec.ldc_attribute27,
1544             p_information138     => l_ldc_rec.ldc_attribute28,
1545             p_information139     => l_ldc_rec.ldc_attribute29,
1546             p_information113     => l_ldc_rec.ldc_attribute3,
1547             p_information140     => l_ldc_rec.ldc_attribute30,
1548             p_information114     => l_ldc_rec.ldc_attribute4,
1549             p_information115     => l_ldc_rec.ldc_attribute5,
1550             p_information116     => l_ldc_rec.ldc_attribute6,
1551             p_information117     => l_ldc_rec.ldc_attribute7,
1552             p_information118     => l_ldc_rec.ldc_attribute8,
1553             p_information119     => l_ldc_rec.ldc_attribute9,
1554             p_information110     => l_ldc_rec.ldc_attribute_category,
1555             p_information14     => l_ldc_rec.ler_chg_dpnt_cvg_cd,
1556             p_information258     => l_ldc_rec.ler_chg_dpnt_cvg_rl,
1557             p_information257     => l_ldc_rec.ler_id,
1558             p_information260     => l_ldc_rec.pgm_id,
1559             p_information261     => l_ldc_rec.pl_id,
1560             p_information259     => l_ldc_rec.ptip_id,
1561             p_information198     => l_ldc_rec.susp_if_ctfn_not_prvd_flag,
1562             p_information197     => l_ldc_rec.ctfn_determine_cd,
1563             p_information265     => l_ldc_rec.object_version_number,
1564             --
1565         p_object_version_number          => l_object_version_number,
1566         p_effective_date                 => p_effective_date       );
1567  --
1568 
1569         if l_out_ldc_result_id is null then
1570           l_out_ldc_result_id := l_copy_entity_result_id;
1571         end if;
1572 
1573         if l_result_type_cd = 'DISPLAY' then
1574            l_out_ldc_result_id := l_copy_entity_result_id ;
1575         end if;
1576         --
1577 
1578 
1579 --Start Bug 6162249
1580 	  if (l_ldc_rec.cvg_eff_end_rl is not null) then
1581 		   ben_plan_design_program_module.create_formula_result(
1582 				p_validate                       => p_validate
1583 				,p_copy_entity_result_id  => l_copy_entity_result_id
1584 				,p_copy_entity_txn_id      => p_copy_entity_txn_id
1585 				,p_formula_id                  =>  l_ldc_rec.cvg_eff_end_rl
1586 				,p_business_group_id        =>  l_ldc_rec.business_group_id
1587 				,p_number_of_copies         =>  l_number_of_copies
1588 				,p_object_version_number  => l_object_version_number
1589 				,p_effective_date             => p_effective_date);
1590 		end if;
1591 
1592 	  if (l_ldc_rec.cvg_eff_strt_rl is not null) then
1593 		   ben_plan_design_program_module.create_formula_result(
1594 				p_validate                       => p_validate
1595 				,p_copy_entity_result_id  => l_copy_entity_result_id
1596 				,p_copy_entity_txn_id      => p_copy_entity_txn_id
1597 				,p_formula_id                  =>  l_ldc_rec.cvg_eff_strt_rl
1598 				,p_business_group_id        =>  l_ldc_rec.business_group_id
1599 				,p_number_of_copies         =>  l_number_of_copies
1600 				,p_object_version_number  => l_object_version_number
1601 				,p_effective_date             => p_effective_date);
1602 		end if;
1603 
1604 	  if (l_ldc_rec.ler_chg_dpnt_cvg_rl is not null) then
1605 		   ben_plan_design_program_module.create_formula_result(
1606 				p_validate                       => p_validate
1607 				,p_copy_entity_result_id  => l_copy_entity_result_id
1608 				,p_copy_entity_txn_id      => p_copy_entity_txn_id
1609 				,p_formula_id                  =>  l_ldc_rec.ler_chg_dpnt_cvg_rl
1610 				,p_business_group_id        =>  l_ldc_rec.business_group_id
1611 				,p_number_of_copies         =>  l_number_of_copies
1612 				,p_object_version_number  => l_object_version_number
1613 				,p_effective_date             => p_effective_date);
1614 		end if;
1615 
1616 --End Bug 6162249
1617 
1618 
1619 
1620    end loop;
1621    --
1622    for l_ldc_rec in c_ldc_drp(l_parent_rec.ler_chg_dpnt_cvg_id,l_mirror_src_entity_result_id,'LDC' ) loop
1623     --
1624     ben_plan_design_plan_module.create_ler_result (
1625              p_validate                       => p_validate
1626             ,p_copy_entity_result_id          => l_out_ldc_result_id
1627             ,p_copy_entity_txn_id             => p_copy_entity_txn_id
1628             ,p_ler_id                         => l_ldc_rec.ler_id
1629             ,p_business_group_id              => p_business_group_id
1630             ,p_number_of_copies               => p_number_of_copies
1631             ,p_object_version_number          => l_object_version_number
1632             ,p_effective_date                 => p_effective_date
1633             );
1634     end loop ;
1635     ---------------------------------------------------------------
1636     -- START OF BEN_LER_CHG_DPNT_CVG_CTFN_F ----------------------
1637     ---------------------------------------------------------------
1638     --
1639     for l_parent_rec  in c_lcc_from_parent(l_LER_CHG_DPNT_CVG_ID) loop
1640     --
1641          l_mirror_src_entity_result_id := l_out_ldc_result_id ;
1642 
1643          l_ler_chg_dpnt_cvg_ctfn_id :=l_parent_rec.ler_chg_dpnt_cvg_ctfn_id ;
1644       --
1645       for l_lcc_rec in c_lcc(l_parent_rec.ler_chg_dpnt_cvg_ctfn_id,l_mirror_src_entity_result_id,'LCC' ) loop
1646       --
1647          --
1648          l_table_route_id := null ;
1649          open g_table_route('LCC');
1650            fetch g_table_route into l_table_route_id ;
1651          close g_table_route ;
1652          --
1653          l_information5  := hr_general.decode_lookup('BEN_DPNT_CVG_CTFN_TYP',l_lcc_rec.dpnt_cvg_ctfn_typ_cd); --'Intersection';
1654          --
1655 
1656          if p_effective_date between l_lcc_rec.effective_start_date
1657             and l_lcc_rec.effective_end_date then
1658             --
1659             l_result_type_cd := 'DISPLAY';
1660          else
1661             l_result_type_cd := 'NO DISPLAY';
1662          end if;
1663          --
1664          l_copy_entity_result_id := null;
1665          l_object_version_number := null;
1666          ben_copy_entity_results_api.create_copy_entity_results(
1667              p_copy_entity_result_id           => l_copy_entity_result_id,
1668              p_copy_entity_txn_id             => p_copy_entity_txn_id,
1669              p_result_type_cd                 => l_result_type_cd,
1670              p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
1671              p_parent_entity_result_id        => l_mirror_src_entity_result_id,
1672              p_number_of_copies               => l_number_of_copies,
1673              p_table_route_id                 => l_table_route_id,
1674              p_table_alias                   => 'LCC',
1675              p_information1     => l_lcc_rec.ler_chg_dpnt_cvg_ctfn_id,
1676              p_information2     => l_lcc_rec.EFFECTIVE_START_DATE,
1677              p_information3     => l_lcc_rec.EFFECTIVE_END_DATE,
1678              p_information4     => l_lcc_rec.business_group_id,
1679              p_information5     => l_information5 , -- 9999 put name for h-grid
1680             p_information261     => l_lcc_rec.ctfn_rqd_when_rl,
1681             p_information12     => l_lcc_rec.dpnt_cvg_ctfn_typ_cd,
1682             p_information13     => l_lcc_rec.lack_ctfn_sspnd_enrt_flag,
1683             p_information111     => l_lcc_rec.lcc_attribute1,
1684             p_information120     => l_lcc_rec.lcc_attribute10,
1685             p_information121     => l_lcc_rec.lcc_attribute11,
1686             p_information122     => l_lcc_rec.lcc_attribute12,
1687             p_information123     => l_lcc_rec.lcc_attribute13,
1688             p_information124     => l_lcc_rec.lcc_attribute14,
1689             p_information125     => l_lcc_rec.lcc_attribute15,
1690             p_information126     => l_lcc_rec.lcc_attribute16,
1691             p_information127     => l_lcc_rec.lcc_attribute17,
1692             p_information128     => l_lcc_rec.lcc_attribute18,
1693             p_information129     => l_lcc_rec.lcc_attribute19,
1694             p_information112     => l_lcc_rec.lcc_attribute2,
1695             p_information130     => l_lcc_rec.lcc_attribute20,
1696             p_information131     => l_lcc_rec.lcc_attribute21,
1697             p_information132     => l_lcc_rec.lcc_attribute22,
1698             p_information133     => l_lcc_rec.lcc_attribute23,
1699             p_information134     => l_lcc_rec.lcc_attribute24,
1700             p_information135     => l_lcc_rec.lcc_attribute25,
1701             p_information136     => l_lcc_rec.lcc_attribute26,
1702             p_information137     => l_lcc_rec.lcc_attribute27,
1703             p_information138     => l_lcc_rec.lcc_attribute28,
1704             p_information139     => l_lcc_rec.lcc_attribute29,
1705             p_information113     => l_lcc_rec.lcc_attribute3,
1706             p_information140     => l_lcc_rec.lcc_attribute30,
1707             p_information114     => l_lcc_rec.lcc_attribute4,
1708             p_information115     => l_lcc_rec.lcc_attribute5,
1709             p_information116     => l_lcc_rec.lcc_attribute6,
1710             p_information117     => l_lcc_rec.lcc_attribute7,
1711             p_information118     => l_lcc_rec.lcc_attribute8,
1712             p_information119     => l_lcc_rec.lcc_attribute9,
1713             p_information110     => l_lcc_rec.lcc_attribute_category,
1714             p_information260     => l_lcc_rec.ler_chg_dpnt_cvg_id,
1715             p_information14     => l_lcc_rec.rlshp_typ_cd,
1716             p_information11     => l_lcc_rec.rqd_flag,
1717             p_information265    => l_lcc_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_lcc_result_id is null then
1724               l_out_lcc_result_id := l_copy_entity_result_id;
1725             end if;
1726 
1727             if l_result_type_cd = 'DISPLAY' then
1728                l_out_lcc_result_id := l_copy_entity_result_id ;
1729             end if;
1730 
1731       -- Copy Fast Formulas if any are attached to any column --
1732       ---------------------------------------------------------------
1733       -- CTFN_RQD_WHEN_RL  -----------------
1734       ---------------------------------------------------------------
1735 
1736          if to_char(l_lcc_rec.ctfn_rqd_when_rl) is not null then
1737              --
1738              ben_plan_design_program_module.create_formula_result
1739              (
1740               p_validate                       =>  0
1741              ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1742              ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1743              ,p_formula_id                     =>  l_lcc_rec.ctfn_rqd_when_rl
1744              ,p_business_group_id              =>  l_lcc_rec.business_group_id
1745              ,p_number_of_copies               =>  l_number_of_copies
1746              ,p_object_version_number          =>  l_object_version_number
1747              ,p_effective_date                 =>  p_effective_date
1748              );
1749 
1750              --
1751          end if;
1752       end loop;
1753     --
1754     end loop;
1755    ---------------------------------------------------------------
1756    -- END OF BEN_LER_CHG_DPNT_CVG_CTFN_F ----------------------
1757    ---------------------------------------------------------------
1758    end loop;
1759   ---------------------------------------------------------------
1760   -- END OF BEN_LER_CHG_DPNT_CVG_F ----------------------
1761   ---------------------------------------------------------------
1762    ---------------------------------------------------------------
1763    -- START OF BEN_LER_CHG_PGM_ENRT_F ----------------------
1764    ---------------------------------------------------------------
1765    --
1766    for l_parent_rec  in c_lge_from_parent(l_PGM_ID) loop
1767    --
1768     l_mirror_src_entity_result_id := l_out_pgm_result_id ;
1769 
1770     l_ler_chg_pgm_enrt_id := l_parent_rec.ler_chg_pgm_enrt_id ;
1771     --
1772     for l_lge_rec in c_lge(l_parent_rec.ler_chg_pgm_enrt_id,l_mirror_src_entity_result_id,'LGE' ) loop
1773     --
1774     --
1775       l_table_route_id := null ;
1776       open g_table_route('LGE');
1777       fetch g_table_route into l_table_route_id ;
1778       close g_table_route ;
1779       --
1780       l_information5  := get_ler_name(l_lge_rec.ler_id,p_effective_date); --'Intersection';
1781       --
1782 
1783       if p_effective_date between l_lge_rec.effective_start_date
1784       and l_lge_rec.effective_end_date then
1785        --
1786         l_result_type_cd := 'DISPLAY';
1787       else
1788         l_result_type_cd := 'NO DISPLAY';
1789       end if;
1790       --
1791       l_copy_entity_result_id := null;
1792       l_object_version_number := null;
1793       ben_copy_entity_results_api.create_copy_entity_results(
1794         p_copy_entity_result_id           => l_copy_entity_result_id,
1795         p_copy_entity_txn_id             => p_copy_entity_txn_id,
1796         p_result_type_cd                 => l_result_type_cd,
1797         p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
1798         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
1799         p_number_of_copies               => l_number_of_copies,
1800         p_table_route_id                 => l_table_route_id,
1801         p_table_alias                   => 'LGE',
1802         p_information1     => l_lge_rec.ler_chg_pgm_enrt_id,
1803         p_information2     => l_lge_rec.EFFECTIVE_START_DATE,
1804         p_information3     => l_lge_rec.EFFECTIVE_END_DATE,
1805         p_information4     => l_lge_rec.business_group_id,
1806         p_information5     => l_information5 , -- 9999 put name for h-grid
1807             p_information262     => l_lge_rec.auto_enrt_mthd_rl,
1808             p_information11     => l_lge_rec.crnt_enrt_prclds_chg_flag,
1809             p_information13     => l_lge_rec.dflt_enrt_cd,
1810             p_information263     => l_lge_rec.dflt_enrt_rl,
1811             p_information14     => l_lge_rec.enrt_cd,
1812             p_information15     => l_lge_rec.enrt_mthd_cd,
1813             p_information264     => l_lge_rec.enrt_rl,
1814             p_information257     => l_lge_rec.ler_id,
1815 
1816             p_information111     => l_lge_rec.lge_attribute1,
1817             p_information120     => l_lge_rec.lge_attribute10,
1818             p_information121     => l_lge_rec.lge_attribute11,
1819             p_information122     => l_lge_rec.lge_attribute12,
1820             p_information123     => l_lge_rec.lge_attribute13,
1821             p_information124     => l_lge_rec.lge_attribute14,
1822             p_information125     => l_lge_rec.lge_attribute15,
1823             p_information126     => l_lge_rec.lge_attribute16,
1824             p_information127     => l_lge_rec.lge_attribute17,
1825             p_information128     => l_lge_rec.lge_attribute18,
1826             p_information129     => l_lge_rec.lge_attribute19,
1827             p_information112     => l_lge_rec.lge_attribute2,
1828             p_information130     => l_lge_rec.lge_attribute20,
1829             p_information131     => l_lge_rec.lge_attribute21,
1830             p_information132     => l_lge_rec.lge_attribute22,
1831             p_information133     => l_lge_rec.lge_attribute23,
1832             p_information134     => l_lge_rec.lge_attribute24,
1833             p_information135     => l_lge_rec.lge_attribute25,
1834             p_information136     => l_lge_rec.lge_attribute26,
1835             p_information137     => l_lge_rec.lge_attribute27,
1836             p_information138     => l_lge_rec.lge_attribute28,
1837             p_information139     => l_lge_rec.lge_attribute29,
1838             p_information113     => l_lge_rec.lge_attribute3,
1839             p_information140     => l_lge_rec.lge_attribute30,
1840             p_information114     => l_lge_rec.lge_attribute4,
1841             p_information115     => l_lge_rec.lge_attribute5,
1842             p_information116     => l_lge_rec.lge_attribute6,
1843             p_information117     => l_lge_rec.lge_attribute7,
1844             p_information118     => l_lge_rec.lge_attribute8,
1845             p_information119     => l_lge_rec.lge_attribute9,
1846             p_information110     => l_lge_rec.lge_attribute_category,
1847 
1848             p_information260     => l_lge_rec.pgm_id,
1849             p_information12     => l_lge_rec.stl_elig_cant_chg_flag,
1850             p_information265    => l_lge_rec.object_version_number,
1851             --
1852         p_object_version_number          => l_object_version_number,
1853         p_effective_date                 => p_effective_date       );
1854         --
1855 
1856         if l_out_lge_result_id is null then
1857           l_out_lge_result_id := l_copy_entity_result_id;
1858         end if;
1859 
1860         if l_result_type_cd = 'DISPLAY' then
1861           l_out_lge_result_id := l_copy_entity_result_id ;
1862         end if;
1863         --
1864 
1865         -- Copy Fast Formulas if any are attached to any column --
1866         ---------------------------------------------------------------
1867         -- AUTO_ENRT_MTHD_RL -----------------
1868         ---------------------------------------------------------------
1869 
1870         if to_char(l_lge_rec.auto_enrt_mthd_rl) is not null then
1871                 --
1872                 ben_plan_design_program_module.create_formula_result
1873                 (
1874                  p_validate                       =>  0
1875                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1876                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1877                 ,p_formula_id                     =>  l_lge_rec.auto_enrt_mthd_rl
1878                 ,p_business_group_id              =>  l_lge_rec.business_group_id
1879                 ,p_number_of_copies               =>  l_number_of_copies
1880                 ,p_object_version_number          =>  l_object_version_number
1881                 ,p_effective_date                 =>  p_effective_date
1882                 );
1883 
1884                 --
1885         end if;
1886         ---------------------------------------------------------------
1887         -- DFLT_ENRT_RL -----------------
1888         ---------------------------------------------------------------
1889 
1890         if to_char(l_lge_rec.dflt_enrt_rl) is not null then
1891                 --
1892                 ben_plan_design_program_module.create_formula_result
1893                 (
1894                  p_validate                       =>  0
1895                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1896                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1897                 ,p_formula_id                     =>  l_lge_rec.dflt_enrt_rl
1898                 ,p_business_group_id              =>  l_lge_rec.business_group_id
1899                 ,p_number_of_copies               =>  l_number_of_copies
1900                 ,p_object_version_number          =>  l_object_version_number
1901                 ,p_effective_date                 =>  p_effective_date
1902                 );
1903 
1904                 --
1905         end if;
1906 
1907         ---------------------------------------------------------------
1908         -- ENRT_RL -----------------
1909         ---------------------------------------------------------------
1910 
1911         if to_char(l_lge_rec.enrt_rl) is not null then
1912                 --
1913                 ben_plan_design_program_module.create_formula_result
1914                 (
1915                  p_validate                       =>  0
1916                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
1917                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
1918                 ,p_formula_id                     =>  l_lge_rec.enrt_rl
1919                 ,p_business_group_id              =>  l_lge_rec.business_group_id
1920                 ,p_number_of_copies               =>  l_number_of_copies
1921                 ,p_object_version_number          =>  l_object_version_number
1922                 ,p_effective_date                 =>  p_effective_date
1923                 );
1924 
1925                 --
1926         end if;
1927 
1928     end loop;
1929     --
1930     for l_lge_rec in c_lge_drp(l_parent_rec.ler_chg_pgm_enrt_id,l_mirror_src_entity_result_id,'LGE' ) loop
1931           ben_plan_design_plan_module.create_ler_result (
1932              p_validate                       => p_validate
1933             ,p_copy_entity_result_id          => l_out_lge_result_id
1934             ,p_copy_entity_txn_id             => p_copy_entity_txn_id
1935             ,p_ler_id                         => l_lge_rec.ler_id
1936             ,p_business_group_id              => p_business_group_id
1937             ,p_number_of_copies               => p_number_of_copies
1938             ,p_object_version_number          => l_object_version_number
1939             ,p_effective_date                 => p_effective_date
1940             );
1941    end loop;
1942    --
1943    end loop;
1944   ---------------------------------------------------------------
1945   -- END OF BEN_LER_CHG_PGM_ENRT_F ----------------------
1946   ---------------------------------------------------------------
1947    ---------------------------------------------------------------
1948    -- START OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
1949    ---------------------------------------------------------------
1950    --
1951    for l_parent_rec  in c_peo_from_parent(l_PGM_ID) loop
1952    --
1953     l_mirror_src_entity_result_id := l_out_pgm_result_id ;
1954 
1955     l_elig_to_prte_rsn_id := l_parent_rec.elig_to_prte_rsn_id ;
1956     --
1957     for l_peo_rec in c_peo(l_parent_rec.elig_to_prte_rsn_id,l_mirror_src_entity_result_id,'PEO' ) loop
1958     --
1959     --
1960       l_table_route_id := null ;
1961       open g_table_route('PEO');
1962       fetch g_table_route into l_table_route_id ;
1963       close g_table_route ;
1964       --
1965       l_information5  := get_ler_name(l_peo_rec.ler_id,p_effective_date); --'Intersection';
1966       --
1967 
1968       if p_effective_date between l_peo_rec.effective_start_date
1969       and l_peo_rec.effective_end_date then
1970       --
1971         l_result_type_cd := 'DISPLAY';
1972       else
1973         l_result_type_cd := 'NO DISPLAY';
1974       end if;
1975       --
1976      l_copy_entity_result_id := null;
1977      l_object_version_number := null;
1978      ben_copy_entity_results_api.create_copy_entity_results(
1979         p_copy_entity_result_id           => l_copy_entity_result_id,
1980         p_copy_entity_txn_id             => p_copy_entity_txn_id,
1981         p_result_type_cd                 => l_result_type_cd,
1982         p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
1983         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
1984         p_number_of_copies               => l_number_of_copies,
1985         p_table_route_id                 => l_table_route_id,
1986         p_table_alias                 => 'PEO',
1987         p_information1     => l_peo_rec.elig_to_prte_rsn_id,
1988         p_information2     => l_peo_rec.EFFECTIVE_START_DATE,
1989         p_information3     => l_peo_rec.EFFECTIVE_END_DATE,
1990         p_information4     => l_peo_rec.business_group_id,
1991         p_information5     => l_information5 , -- 9999 put name for h-grid
1992             p_information21     => l_peo_rec.elig_inelig_cd,
1993             p_information20     => l_peo_rec.ignr_prtn_ovrid_flag,
1994             p_information257     => l_peo_rec.ler_id,
1995             p_information17     => l_peo_rec.mx_poe_apls_cd,
1996             p_information16     => l_peo_rec.mx_poe_det_dt_cd,
1997             p_information272     => l_peo_rec.mx_poe_det_dt_rl,
1998             p_information270     => l_peo_rec.mx_poe_rl,
1999             p_information15     => l_peo_rec.mx_poe_uom,
2000             p_information269     => l_peo_rec.mx_poe_val,
2001             p_information258     => l_peo_rec.oipl_id,
2002             p_information111     => l_peo_rec.peo_attribute1,
2003             p_information120     => l_peo_rec.peo_attribute10,
2004             p_information121     => l_peo_rec.peo_attribute11,
2005             p_information122     => l_peo_rec.peo_attribute12,
2006             p_information123     => l_peo_rec.peo_attribute13,
2007             p_information124     => l_peo_rec.peo_attribute14,
2008             p_information125     => l_peo_rec.peo_attribute15,
2009             p_information126     => l_peo_rec.peo_attribute16,
2010             p_information127     => l_peo_rec.peo_attribute17,
2011             p_information128     => l_peo_rec.peo_attribute18,
2012             p_information129     => l_peo_rec.peo_attribute19,
2013             p_information112     => l_peo_rec.peo_attribute2,
2014             p_information130     => l_peo_rec.peo_attribute20,
2015             p_information131     => l_peo_rec.peo_attribute21,
2016             p_information132     => l_peo_rec.peo_attribute22,
2017             p_information133     => l_peo_rec.peo_attribute23,
2018             p_information134     => l_peo_rec.peo_attribute24,
2019             p_information135     => l_peo_rec.peo_attribute25,
2020             p_information136     => l_peo_rec.peo_attribute26,
2021             p_information137     => l_peo_rec.peo_attribute27,
2022             p_information138     => l_peo_rec.peo_attribute28,
2023             p_information139     => l_peo_rec.peo_attribute29,
2024             p_information113     => l_peo_rec.peo_attribute3,
2025             p_information140     => l_peo_rec.peo_attribute30,
2026             p_information114     => l_peo_rec.peo_attribute4,
2027             p_information115     => l_peo_rec.peo_attribute5,
2028             p_information116     => l_peo_rec.peo_attribute6,
2029             p_information117     => l_peo_rec.peo_attribute7,
2030             p_information118     => l_peo_rec.peo_attribute8,
2031             p_information119     => l_peo_rec.peo_attribute9,
2032             p_information110     => l_peo_rec.peo_attribute_category,
2033             p_information260     => l_peo_rec.pgm_id,
2034             p_information261     => l_peo_rec.pl_id,
2035             p_information256     => l_peo_rec.plip_id,
2036             p_information12     => l_peo_rec.prtn_eff_end_dt_cd,
2037             p_information266     => l_peo_rec.prtn_eff_end_dt_rl,
2038             p_information11     => l_peo_rec.prtn_eff_strt_dt_cd,
2039             p_information264     => l_peo_rec.prtn_eff_strt_dt_rl,
2040             p_information19     => l_peo_rec.prtn_ovridbl_flag,
2041             p_information259     => l_peo_rec.ptip_id,
2042             p_information18     => l_peo_rec.vrfy_fmly_mmbr_cd,
2043             p_information273     => l_peo_rec.vrfy_fmly_mmbr_rl,
2044             p_information14     => l_peo_rec.wait_perd_dt_to_use_cd,
2045             p_information268     => l_peo_rec.wait_perd_dt_to_use_rl,
2046             p_information271     => l_peo_rec.wait_perd_rl,
2047             p_information13     => l_peo_rec.wait_perd_uom,
2048             p_information267     => l_peo_rec.wait_perd_val,
2049             p_information265     => l_peo_rec.object_version_number,
2050             --
2051         p_object_version_number          => l_object_version_number,
2052         p_effective_date                 => p_effective_date       );
2053  --
2054 
2055         if l_out_peo_result_id is null then
2056           l_out_peo_result_id := l_copy_entity_result_id;
2057         end if;
2058 
2059         if l_result_type_cd = 'DISPLAY' then
2060           l_out_peo_result_id := l_copy_entity_result_id ;
2061         end if;
2062 
2063  -- Copy Fast Formulas if any are attached to any column --
2064  ---------------------------------------------------------------
2065  -- MX_POE_DET_DT_RL  -----------------
2066  ---------------------------------------------------------------
2067 
2068  if to_char(l_peo_rec.mx_poe_det_dt_rl) is not null then
2069          --
2070          ben_plan_design_program_module.create_formula_result
2071          (
2072           p_validate                       =>  0
2073          ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2074          ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2075          ,p_formula_id                     =>  l_peo_rec.mx_poe_det_dt_rl
2076          ,p_business_group_id              =>  l_peo_rec.business_group_id
2077          ,p_number_of_copies               =>  l_number_of_copies
2078          ,p_object_version_number          =>  l_object_version_number
2079          ,p_effective_date                 =>  p_effective_date
2080          );
2081 
2082          --
2083  end if;
2084 
2085   ---------------------------------------------------------------
2086   -- MX_POE_RL  -----------------
2087   ---------------------------------------------------------------
2088 
2089   if to_char(l_peo_rec.mx_poe_rl) is not null then
2090           --
2091           ben_plan_design_program_module.create_formula_result
2092           (
2093            p_validate                       =>  0
2094           ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2095           ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2096           ,p_formula_id                     =>  l_peo_rec.mx_poe_rl
2097           ,p_business_group_id              =>  l_peo_rec.business_group_id
2098           ,p_number_of_copies               =>  l_number_of_copies
2099           ,p_object_version_number          =>  l_object_version_number
2100           ,p_effective_date                 =>  p_effective_date
2101           );
2102 
2103           --
2104  end if;
2105 
2106  ---------------------------------------------------------------
2107  -- PRTN_EFF_END_DT_RL  -----------------
2108  ---------------------------------------------------------------
2109 
2110    if to_char(l_peo_rec.prtn_eff_end_dt_rl) is not null then
2111            --
2112            ben_plan_design_program_module.create_formula_result
2113            (
2114             p_validate                       =>  0
2115            ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2116            ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2117            ,p_formula_id                     =>  l_peo_rec.prtn_eff_end_dt_rl
2118            ,p_business_group_id              =>  l_peo_rec.business_group_id
2119            ,p_number_of_copies               =>  l_number_of_copies
2120            ,p_object_version_number          =>  l_object_version_number
2121            ,p_effective_date                 =>  p_effective_date
2122            );
2123 
2124            --
2125   end if;
2126 
2127   ---------------------------------------------------------------
2128   -- PRTN_EFF_STRT_DT_RL  -----------------
2129   ---------------------------------------------------------------
2130 
2131    if to_char(l_peo_rec.prtn_eff_strt_dt_rl) is not null then
2132             --
2133             ben_plan_design_program_module.create_formula_result
2134             (
2135              p_validate                       =>  0
2136             ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2137             ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2138             ,p_formula_id                     =>  l_peo_rec.prtn_eff_strt_dt_rl
2139             ,p_business_group_id              =>  l_peo_rec.business_group_id
2140             ,p_number_of_copies               =>  l_number_of_copies
2141             ,p_object_version_number          =>  l_object_version_number
2142             ,p_effective_date                 =>  p_effective_date
2143             );
2144 
2145             --
2146    end if;
2147 
2148   ---------------------------------------------------------------
2149   -- VRFY_FMLY_MMBR_RL -----------------
2150   ---------------------------------------------------------------
2151 
2152    if to_char(l_peo_rec.vrfy_fmly_mmbr_rl) is not null then
2153             --
2154             ben_plan_design_program_module.create_formula_result
2155             (
2156              p_validate                       =>  0
2157             ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2158             ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2159             ,p_formula_id                     =>  l_peo_rec.vrfy_fmly_mmbr_rl
2160             ,p_business_group_id              =>  l_peo_rec.business_group_id
2161             ,p_number_of_copies               =>  l_number_of_copies
2162             ,p_object_version_number          =>  l_object_version_number
2163             ,p_effective_date                 =>  p_effective_date
2164             );
2165 
2166             --
2167    end if;
2168 
2169   ---------------------------------------------------------------
2170   -- WAIT_PERD_DT_TO_USE_RL -----------------
2171   ---------------------------------------------------------------
2172 
2173    if to_char(l_peo_rec.wait_perd_dt_to_use_rl) is not null then
2174             --
2175             ben_plan_design_program_module.create_formula_result
2176             (
2177              p_validate                       =>  0
2178             ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2179             ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2180             ,p_formula_id                     =>  l_peo_rec.wait_perd_dt_to_use_rl
2181             ,p_business_group_id              =>  l_peo_rec.business_group_id
2182             ,p_number_of_copies               =>  l_number_of_copies
2183             ,p_object_version_number          =>  l_object_version_number
2184             ,p_effective_date                 =>  p_effective_date
2185             );
2186 
2187             --
2188    end if;
2189 
2190    ---------------------------------------------------------------
2191    -- WAIT_PERD_RL -----------------
2192    ---------------------------------------------------------------
2193 
2194      if to_char(l_peo_rec.wait_perd_rl) is not null then
2195              --
2196              ben_plan_design_program_module.create_formula_result
2197              (
2198               p_validate                       =>  0
2199              ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2200              ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2201              ,p_formula_id                     =>  l_peo_rec.wait_perd_rl
2202              ,p_business_group_id              =>  l_peo_rec.business_group_id
2203              ,p_number_of_copies               =>  l_number_of_copies
2204              ,p_object_version_number          =>  l_object_version_number
2205              ,p_effective_date                 =>  p_effective_date
2206              );
2207             --
2208      end if;
2209             ben_plan_design_plan_module.create_ler_result (
2210                p_validate                       => p_validate
2211               ,p_copy_entity_result_id          => l_copy_entity_result_id
2212               ,p_copy_entity_txn_id             => p_copy_entity_txn_id
2213               ,p_ler_id                         => l_peo_rec.ler_id
2214               ,p_business_group_id              => p_business_group_id
2215               ,p_number_of_copies               => l_number_of_copies
2216               ,p_object_version_number          => l_object_version_number
2217               ,p_effective_date                 => p_effective_date
2218               );
2219             --
2220      end loop;
2221      --
2222 
2223    end loop;
2224    ---------------------------------------------------------------
2225    -- END OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
2226    ---------------------------------------------------------------
2227    ---------------------------------------------------------------
2228    -- START OF BEN_PGM_DPNT_CVG_CTFN_F ----------------------
2229    ---------------------------------------------------------------
2230    --
2231    for l_parent_rec  in c_pgc_from_parent(l_PGM_ID) loop
2232    --
2233     l_mirror_src_entity_result_id := l_out_pgm_result_id ;
2234 
2235     l_pgm_dpnt_cvg_ctfn_id := l_parent_rec.pgm_dpnt_cvg_ctfn_id ;
2236     --
2237     for l_pgc_rec in c_pgc(l_parent_rec.pgm_dpnt_cvg_ctfn_id,l_mirror_src_entity_result_id,'PGC' ) loop
2238     --
2239     --
2240       l_table_route_id := null ;
2241       open g_table_route('PGC');
2242       fetch g_table_route into l_table_route_id ;
2243       close g_table_route ;
2244       --
2245       l_information5  := hr_general.decode_lookup('BEN_DPNT_CVG_CTFN_TYP',l_pgc_rec.dpnt_cvg_ctfn_typ_cd); --'Intersection';
2246       --
2247 
2248       if p_effective_date between l_pgc_rec.effective_start_date
2249       and l_pgc_rec.effective_end_date then
2250       --
2251         l_result_type_cd := 'DISPLAY';
2252       else
2253         l_result_type_cd := 'NO DISPLAY';
2254       end if;
2255       --
2256       l_copy_entity_result_id := null;
2257       l_object_version_number := null;
2258       ben_copy_entity_results_api.create_copy_entity_results(
2259         p_copy_entity_result_id           => l_copy_entity_result_id,
2260         p_copy_entity_txn_id             => p_copy_entity_txn_id,
2261         p_result_type_cd                 => l_result_type_cd,
2262         p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2263         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
2264         p_number_of_copies               => l_number_of_copies,
2265         p_table_route_id                 => l_table_route_id,
2266         p_table_alias                 => 'PGC',
2267         p_information1     => l_pgc_rec.pgm_dpnt_cvg_ctfn_id,
2268         p_information2     => l_pgc_rec.EFFECTIVE_START_DATE,
2269         p_information3     => l_pgc_rec.EFFECTIVE_END_DATE,
2270         p_information4     => l_pgc_rec.business_group_id,
2271         p_information5     => l_information5 , -- 9999 put name for h-grid
2272             p_information261     => l_pgc_rec.ctfn_rqd_when_rl,
2273             p_information13     => l_pgc_rec.dpnt_cvg_ctfn_typ_cd,
2274             p_information11     => l_pgc_rec.lack_ctfn_sspnd_enrt_flag,
2275             p_information12     => l_pgc_rec.pfd_flag,
2276             p_information111     => l_pgc_rec.pgc_attribute1,
2277             p_information120     => l_pgc_rec.pgc_attribute10,
2278             p_information121     => l_pgc_rec.pgc_attribute11,
2279             p_information122     => l_pgc_rec.pgc_attribute12,
2280             p_information123     => l_pgc_rec.pgc_attribute13,
2281             p_information124     => l_pgc_rec.pgc_attribute14,
2282             p_information125     => l_pgc_rec.pgc_attribute15,
2283             p_information126     => l_pgc_rec.pgc_attribute16,
2284             p_information127     => l_pgc_rec.pgc_attribute17,
2285             p_information128     => l_pgc_rec.pgc_attribute18,
2286             p_information129     => l_pgc_rec.pgc_attribute19,
2287             p_information112     => l_pgc_rec.pgc_attribute2,
2288             p_information130     => l_pgc_rec.pgc_attribute20,
2289             p_information131     => l_pgc_rec.pgc_attribute21,
2290             p_information132     => l_pgc_rec.pgc_attribute22,
2291             p_information133     => l_pgc_rec.pgc_attribute23,
2292             p_information134     => l_pgc_rec.pgc_attribute24,
2293             p_information135     => l_pgc_rec.pgc_attribute25,
2294             p_information136     => l_pgc_rec.pgc_attribute26,
2295             p_information137     => l_pgc_rec.pgc_attribute27,
2296             p_information138     => l_pgc_rec.pgc_attribute28,
2297             p_information139     => l_pgc_rec.pgc_attribute29,
2298             p_information113     => l_pgc_rec.pgc_attribute3,
2299             p_information140     => l_pgc_rec.pgc_attribute30,
2300             p_information114     => l_pgc_rec.pgc_attribute4,
2301             p_information115     => l_pgc_rec.pgc_attribute5,
2302             p_information116     => l_pgc_rec.pgc_attribute6,
2303             p_information117     => l_pgc_rec.pgc_attribute7,
2304             p_information118     => l_pgc_rec.pgc_attribute8,
2305             p_information119     => l_pgc_rec.pgc_attribute9,
2306             p_information110     => l_pgc_rec.pgc_attribute_category,
2307             p_information260     => l_pgc_rec.pgm_id,
2308             p_information15     => l_pgc_rec.rlshp_typ_cd,
2309             p_information14     => l_pgc_rec.rqd_flag,
2310             p_information265    => l_pgc_rec.object_version_number,
2311             --
2312         p_object_version_number          => l_object_version_number,
2313         p_effective_date                 => p_effective_date       );
2314      --
2315 
2316         if l_out_pgc_result_id is null then
2317           l_out_pgc_result_id := l_copy_entity_result_id;
2318         end if;
2319 
2320         if l_result_type_cd = 'DISPLAY' then
2321           l_out_pgc_result_id := l_copy_entity_result_id ;
2322         end if;
2323 
2324      -- Copy Fast Formulas if any are attached to any column --
2325      ---------------------------------------------------------------
2326      -- CTFN_RQD_WHEN_RL -----------------
2327      ---------------------------------------------------------------
2328 
2329        if to_char(l_pgc_rec.ctfn_rqd_when_rl) is not null then
2330              --
2331              ben_plan_design_program_module.create_formula_result
2332              (
2333               p_validate                       =>  0
2334              ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2335              ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2336              ,p_formula_id                     =>  l_pgc_rec.ctfn_rqd_when_rl
2337              ,p_business_group_id              =>  l_pgc_rec.business_group_id
2338              ,p_number_of_copies               =>  l_number_of_copies
2339              ,p_object_version_number          =>  l_object_version_number
2340              ,p_effective_date                 =>  p_effective_date
2341              );
2342 
2343              --
2344        end if;
2345 
2346      end loop;
2347    --
2348    end loop;
2349   ---------------------------------------------------------------
2350   -- END OF BEN_PGM_DPNT_CVG_CTFN_F ----------------------
2351   ---------------------------------------------------------------
2352    ---------------------------------------------------------------
2353    -- START OF BEN_PTIP_F ----------------------
2354    ---------------------------------------------------------------
2355    --
2356    for l_parent_rec  in c_ctp_from_parent(l_PGM_ID) loop
2357    --
2358     l_mirror_src_entity_result_id := l_out_pgm_result_id ;
2359 
2360     l_ptip_id := l_parent_rec.ptip_id ;
2361     --
2362     for l_ctp_rec in c_ctp(l_parent_rec.ptip_id,l_mirror_src_entity_result_id,'CTP' ) loop
2363     --
2364     --
2365       l_table_route_id := null ;
2366       open g_table_route('CTP');
2367       fetch g_table_route into l_table_route_id ;
2368       close g_table_route ;
2369       --
2370       l_information5  := get_pl_typ_name(l_ctp_rec.pl_typ_id,p_effective_date); --'Intersection';
2371       --
2372 
2373       if p_effective_date between l_ctp_rec.effective_start_date
2374       and l_ctp_rec.effective_end_date then
2375       --
2376         l_result_type_cd := 'DISPLAY';
2377       else
2378         l_result_type_cd := 'NO DISPLAY';
2379       end if;
2380       --
2381       l_copy_entity_result_id := null;
2382       l_object_version_number := null;
2383       ben_copy_entity_results_api.create_copy_entity_results(
2384         p_copy_entity_result_id           => l_copy_entity_result_id,
2385         p_copy_entity_txn_id             => p_copy_entity_txn_id,
2386         p_result_type_cd                 => l_result_type_cd,
2387         p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2388         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
2389         p_number_of_copies               => l_number_of_copies,
2390         p_table_route_id                 => l_table_route_id,
2391         p_table_alias                 => 'CTP',
2392         p_information1     => l_ctp_rec.ptip_id,
2393         p_information2     => l_ctp_rec.EFFECTIVE_START_DATE,
2394         p_information3     => l_ctp_rec.EFFECTIVE_END_DATE,
2395         p_information4     => l_ctp_rec.business_group_id,
2396         p_information5     => l_information5 , -- 9999 put name for h-grid
2397             p_information274     => l_ctp_rec.acrs_ptip_cvg_id,
2398             p_information275     => l_ctp_rec.auto_enrt_mthd_rl,
2399             p_information236     => l_ctp_rec.cmbn_ptip_id,
2400             p_information249     => l_ctp_rec.cmbn_ptip_opt_id,
2401             p_information15     => l_ctp_rec.coord_cvg_for_all_pls_flag,
2402             p_information20     => l_ctp_rec.crs_this_pl_typ_only_flag,
2403             p_information111     => l_ctp_rec.ctp_attribute1,
2404             p_information120     => l_ctp_rec.ctp_attribute10,
2405             p_information121     => l_ctp_rec.ctp_attribute11,
2406             p_information122     => l_ctp_rec.ctp_attribute12,
2407             p_information123     => l_ctp_rec.ctp_attribute13,
2408             p_information124     => l_ctp_rec.ctp_attribute14,
2409             p_information125     => l_ctp_rec.ctp_attribute15,
2410             p_information126     => l_ctp_rec.ctp_attribute16,
2411             p_information127     => l_ctp_rec.ctp_attribute17,
2412             p_information128     => l_ctp_rec.ctp_attribute18,
2413             p_information129     => l_ctp_rec.ctp_attribute19,
2414             p_information112     => l_ctp_rec.ctp_attribute2,
2415             p_information130     => l_ctp_rec.ctp_attribute20,
2416             p_information131     => l_ctp_rec.ctp_attribute21,
2417             p_information132     => l_ctp_rec.ctp_attribute22,
2418             p_information133     => l_ctp_rec.ctp_attribute23,
2419             p_information134     => l_ctp_rec.ctp_attribute24,
2420             p_information135     => l_ctp_rec.ctp_attribute25,
2421             p_information136     => l_ctp_rec.ctp_attribute26,
2422             p_information137     => l_ctp_rec.ctp_attribute27,
2423             p_information138     => l_ctp_rec.ctp_attribute28,
2424             p_information139     => l_ctp_rec.ctp_attribute29,
2425             p_information113     => l_ctp_rec.ctp_attribute3,
2426             p_information140     => l_ctp_rec.ctp_attribute30,
2427             p_information114     => l_ctp_rec.ctp_attribute4,
2428             p_information115     => l_ctp_rec.ctp_attribute5,
2429             p_information116     => l_ctp_rec.ctp_attribute6,
2430             p_information117     => l_ctp_rec.ctp_attribute7,
2431             p_information118     => l_ctp_rec.ctp_attribute8,
2432             p_information119     => l_ctp_rec.ctp_attribute9,
2433             p_information110     => l_ctp_rec.ctp_attribute_category,
2434             p_information45     => l_ctp_rec.dflt_enrt_cd,
2435             p_information277     => l_ctp_rec.dflt_enrt_det_rl,
2436             p_information17     => l_ctp_rec.dpnt_adrs_rqd_flag,
2437             p_information36     => l_ctp_rec.dpnt_cvg_end_dt_cd,
2438             p_information263     => l_ctp_rec.dpnt_cvg_end_dt_rl,
2439             p_information16     => l_ctp_rec.dpnt_cvg_no_ctfn_rqd_flag,
2440             p_information35     => l_ctp_rec.dpnt_cvg_strt_dt_cd,
2441             p_information262     => l_ctp_rec.dpnt_cvg_strt_dt_rl,
2442             p_information19     => l_ctp_rec.dpnt_dob_rqd_flag,
2443             p_information34     => l_ctp_rec.dpnt_dsgn_cd,
2444             p_information18     => l_ctp_rec.dpnt_legv_id_rqd_flag,
2445             p_information29     => l_ctp_rec.drvbl_fctr_apls_rts_flag,
2446             p_information30     => l_ctp_rec.drvbl_fctr_prtn_elig_flag,
2447             p_information24     => l_ctp_rec.drvd_fctr_dpnt_cvg_flag,
2448             p_information31     => l_ctp_rec.elig_apls_flag,
2449             p_information44     => l_ctp_rec.enrt_cd,
2450             p_information40     => l_ctp_rec.enrt_cvg_end_dt_cd,
2451             p_information271     => l_ctp_rec.enrt_cvg_end_dt_rl,
2452             p_information39     => l_ctp_rec.enrt_cvg_strt_dt_cd,
2453             p_information270     => l_ctp_rec.enrt_cvg_strt_dt_rl,
2454             p_information43     => l_ctp_rec.enrt_mthd_cd,
2455             p_information276     => l_ctp_rec.enrt_rl,
2456             p_information141     => l_ctp_rec.ivr_ident,
2457             p_information266     => l_ctp_rec.mn_enrd_rqd_ovrid_num,
2458             p_information293     => l_ctp_rec.mx_cvg_alwd_amt,
2459             p_information267     => l_ctp_rec.mx_enrd_alwd_ovrid_num,
2460             p_information25     => l_ctp_rec.no_mn_pl_typ_overid_flag,
2461             p_information21     => l_ctp_rec.no_mx_pl_typ_ovrid_flag,
2462             p_information268     => l_ctp_rec.ordr_num,
2463             p_information11     => l_ctp_rec.per_cvrd_cd,
2464             p_information260     => l_ctp_rec.pgm_id,
2465             p_information248     => l_ctp_rec.pl_typ_id,
2466             p_information264     => l_ctp_rec.postelcn_edit_rl,
2467             p_information32     => l_ctp_rec.prtn_elig_ovrid_alwd_flag,
2468             p_information22     => l_ctp_rec.prvds_cr_flag,
2469             p_information14     => l_ctp_rec.ptip_stat_cd,
2470             p_information38     => l_ctp_rec.rqd_enrt_perd_tco_cd,
2471             p_information269     => l_ctp_rec.rqd_perd_enrt_nenrt_rl,
2472             p_information37     => l_ctp_rec.rqd_perd_enrt_nenrt_tm_uom,
2473             p_information287     => l_ctp_rec.rqd_perd_enrt_nenrt_val,
2474             p_information42     => l_ctp_rec.rt_end_dt_cd,
2475             p_information273     => l_ctp_rec.rt_end_dt_rl,
2476             p_information41     => l_ctp_rec.rt_strt_dt_cd,
2477             p_information272     => l_ctp_rec.rt_strt_dt_rl,
2478             p_information27     => l_ctp_rec.sbj_to_dpnt_lf_ins_mx_flag,
2479             p_information26     => l_ctp_rec.sbj_to_sps_lf_ins_mx_flag,
2480             p_information12     => l_ctp_rec.short_code,
2481             p_information13     => l_ctp_rec.short_name,
2482             p_information33     => l_ctp_rec.trk_inelig_per_flag,
2483             p_information185     => l_ctp_rec.url_ref_name,
2484             p_information28     => l_ctp_rec.use_to_sum_ee_lf_ins_flag,
2485             p_information46     => l_ctp_rec.vrfy_fmly_mmbr_cd,
2486             p_information278     => l_ctp_rec.vrfy_fmly_mmbr_rl,
2487             p_information23     => l_ctp_rec.wvbl_flag,
2488             p_INFORMATION196    => l_ctp_rec.SUSP_IF_DPNT_SSN_NT_PRV_CD,
2489             p_INFORMATION190    => l_ctp_rec.SUSP_IF_DPNT_DOB_NT_PRV_CD,
2490             p_INFORMATION191    => l_ctp_rec.SUSP_IF_DPNT_ADR_NT_PRV_CD,
2491             p_INFORMATION192    => l_ctp_rec.SUSP_IF_CTFN_NOT_DPNT_FLAG,
2492             p_INFORMATION193    => l_ctp_rec.DPNT_CTFN_DETERMINE_CD,
2493             p_information265    => l_ctp_rec.object_version_number,
2494             --
2495         p_object_version_number          => l_object_version_number,
2496         p_effective_date                 => p_effective_date       );
2497 
2498 
2499         if l_out_ctp_result_id is null then
2500           l_out_ctp_result_id := l_copy_entity_result_id;
2501         end if;
2502 
2503         if l_result_type_cd = 'DISPLAY' then
2504            l_out_ctp_result_id := l_copy_entity_result_id ;
2505         end if;
2506         -- Copy Fast Formulas if any are attached to any column --
2507         ---------------------------------------------------------------
2508         -- AUTO_ENRT_MTHD_RL  -----------------
2509         ---------------------------------------------------------------
2510 
2511         if to_char(l_ctp_rec.auto_enrt_mthd_rl) is not null then
2512                 --
2513                 ben_plan_design_program_module.create_formula_result
2514                 (
2515                  p_validate                       =>  0
2516                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2517                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2518                 ,p_formula_id                     =>  l_ctp_rec.auto_enrt_mthd_rl
2519                 ,p_business_group_id              =>  l_ctp_rec.business_group_id
2520                 ,p_number_of_copies               =>  l_number_of_copies
2521                 ,p_object_version_number          =>  l_object_version_number
2522                 ,p_effective_date                 =>  p_effective_date
2523                 );
2524 
2525                 --
2526         end if;
2527 
2528         ---------------------------------------------------------------
2529         -- DFLT_ENRT_DET_RL  -----------------
2530         ---------------------------------------------------------------
2531 
2532         if to_char(l_ctp_rec.dflt_enrt_det_rl) is not null then
2533                 --
2534                 ben_plan_design_program_module.create_formula_result
2535                 (
2536                  p_validate                       =>  0
2537                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2538                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2539                 ,p_formula_id                     =>  l_ctp_rec.dflt_enrt_det_rl
2540                 ,p_business_group_id              =>  l_ctp_rec.business_group_id
2541                 ,p_number_of_copies               =>  l_number_of_copies
2542                 ,p_object_version_number          =>  l_object_version_number
2543                 ,p_effective_date                 =>  p_effective_date
2544                 );
2545 
2546                 --
2547         end if;
2548 
2549         ---------------------------------------------------------------
2550         -- DPNT_CVG_END_DT_RL  -----------------
2551         ---------------------------------------------------------------
2552 
2553         if to_char(l_ctp_rec.dpnt_cvg_end_dt_rl) is not null then
2554                 --
2555                 ben_plan_design_program_module.create_formula_result
2556                 (
2557                  p_validate                       =>  0
2558                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2559                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2560                 ,p_formula_id                     =>  l_ctp_rec.dpnt_cvg_end_dt_rl
2561                 ,p_business_group_id              =>  l_ctp_rec.business_group_id
2562                 ,p_number_of_copies               =>  l_number_of_copies
2563                 ,p_object_version_number          =>  l_object_version_number
2564                 ,p_effective_date                 =>  p_effective_date
2565                 );
2566 
2567                 --
2568         end if;
2569 
2570         ---------------------------------------------------------------
2571         -- DPNT_CVG_STRT_DT_RL  -----------------
2572         ---------------------------------------------------------------
2573 
2574         if to_char(l_ctp_rec.dpnt_cvg_strt_dt_rl) is not null then
2575                 --
2576                 ben_plan_design_program_module.create_formula_result
2577                 (
2578                  p_validate                       =>  0
2579                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2580                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2581                 ,p_formula_id                     =>  l_ctp_rec.dpnt_cvg_strt_dt_rl
2582                 ,p_business_group_id              =>  l_ctp_rec.business_group_id
2583                 ,p_number_of_copies               =>  l_number_of_copies
2584                 ,p_object_version_number          =>  l_object_version_number
2585                 ,p_effective_date                 =>  p_effective_date
2586                 );
2587 
2588                 --
2589         end if;
2590 
2591         ---------------------------------------------------------------
2592         -- ENRT_CVG_END_DT_RL  -----------------
2593         ---------------------------------------------------------------
2594 
2595         if to_char(l_ctp_rec.enrt_cvg_end_dt_rl) is not null then
2596                 --
2597                 ben_plan_design_program_module.create_formula_result
2598                 (
2599                  p_validate                       =>  0
2600                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2601                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2602                 ,p_formula_id                     =>  l_ctp_rec.enrt_cvg_end_dt_rl
2603                 ,p_business_group_id              =>  l_ctp_rec.business_group_id
2604                 ,p_number_of_copies               =>  l_number_of_copies
2605                 ,p_object_version_number          =>  l_object_version_number
2606                 ,p_effective_date                 =>  p_effective_date
2607                 );
2608 
2609                 --
2610         end if;
2611 
2612         ---------------------------------------------------------------
2613         -- ENRT_CVG_STRT_DT_RL  -----------------
2614         ---------------------------------------------------------------
2615 
2616         if to_char(l_ctp_rec.enrt_cvg_strt_dt_rl) is not null then
2617                 --
2618                 ben_plan_design_program_module.create_formula_result
2619                 (
2620                  p_validate                       =>  0
2621                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2622                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2623                 ,p_formula_id                     =>  l_ctp_rec.enrt_cvg_strt_dt_rl
2624                 ,p_business_group_id              =>  l_ctp_rec.business_group_id
2625                 ,p_number_of_copies               =>  l_number_of_copies
2626                 ,p_object_version_number          =>  l_object_version_number
2627                 ,p_effective_date                 =>  p_effective_date
2628                 );
2629 
2630                 --
2631         end if;
2632 
2633         ---------------------------------------------------------------
2634         -- ENRT_RL  -----------------
2635         ---------------------------------------------------------------
2636 
2637         if to_char(l_ctp_rec.enrt_rl) is not null then
2638                  --
2639                  ben_plan_design_program_module.create_formula_result
2640                  (
2641                   p_validate                       =>  0
2642                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2643                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2644                  ,p_formula_id                     =>  l_ctp_rec.enrt_rl
2645                  ,p_business_group_id              =>  l_ctp_rec.business_group_id
2646                  ,p_number_of_copies               =>  l_number_of_copies
2647                  ,p_object_version_number          =>  l_object_version_number
2648                  ,p_effective_date                 =>  p_effective_date
2649                  );
2650 
2651                  --
2652         end if;
2653 
2654         ---------------------------------------------------------------
2655         -- POSTELCN_EDIT_RL  -----------------
2656         ---------------------------------------------------------------
2657 
2658         if to_char(l_ctp_rec.postelcn_edit_rl) is not null then
2659                  --
2660                  ben_plan_design_program_module.create_formula_result
2661                  (
2662                   p_validate                       =>  0
2663                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2664                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2665                  ,p_formula_id                     =>  l_ctp_rec.postelcn_edit_rl
2666                  ,p_business_group_id              =>  l_ctp_rec.business_group_id
2667                  ,p_number_of_copies               =>  l_number_of_copies
2668                  ,p_object_version_number          =>  l_object_version_number
2669                  ,p_effective_date                 =>  p_effective_date
2670                  );
2671 
2672                  --
2673         end if;
2674 
2675         ---------------------------------------------------------------
2676         -- RQD_PERD_ENRT_NENRT_RL  -----------------
2677         ---------------------------------------------------------------
2678 
2679         if to_char(l_ctp_rec.rqd_perd_enrt_nenrt_rl) is not null then
2680                  --
2681                  ben_plan_design_program_module.create_formula_result
2682                  (
2683                   p_validate                       =>  0
2684                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2685                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2686                  ,p_formula_id                     =>  l_ctp_rec.rqd_perd_enrt_nenrt_rl
2687                  ,p_business_group_id              =>  l_ctp_rec.business_group_id
2688                  ,p_number_of_copies               =>  l_number_of_copies
2689                  ,p_object_version_number          =>  l_object_version_number
2690                  ,p_effective_date                 =>  p_effective_date
2691                  );
2692 
2693                  --
2694         end if;
2695         ---------------------------------------------------------------
2696         -- RT_END_DT_RL  -----------------
2697         ---------------------------------------------------------------
2698 
2699         if to_char(l_ctp_rec.rt_end_dt_rl) is not null then
2700                  --
2701                  ben_plan_design_program_module.create_formula_result
2702                  (
2703                   p_validate                       =>  0
2704                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2705                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2706                  ,p_formula_id                     =>  l_ctp_rec.rt_end_dt_rl
2707                  ,p_business_group_id              =>  l_ctp_rec.business_group_id
2708                  ,p_number_of_copies               =>  l_number_of_copies
2709                  ,p_object_version_number          =>  l_object_version_number
2710                  ,p_effective_date                 =>  p_effective_date
2711                  );
2712 
2713                  --
2714         end if;
2715 
2716         ---------------------------------------------------------------
2717         -- RT_STRT_DT_RL  -----------------
2718         ---------------------------------------------------------------
2719 
2720         if to_char(l_ctp_rec.rt_strt_dt_rl) is not null then
2721                  --
2722                  ben_plan_design_program_module.create_formula_result
2723                  (
2724                   p_validate                       =>  0
2725                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2726                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2727                  ,p_formula_id                     =>  l_ctp_rec.rt_strt_dt_rl
2728                  ,p_business_group_id              =>  l_ctp_rec.business_group_id
2729                  ,p_number_of_copies               =>  l_number_of_copies
2730                  ,p_object_version_number          =>  l_object_version_number
2731                  ,p_effective_date                 =>  p_effective_date
2732                  );
2733 
2734                  --
2735         end if;
2736 
2737         ---------------------------------------------------------------
2738         -- VRFY_FMLY_MMBR_RL -----------------
2739         ---------------------------------------------------------------
2740 
2741         if to_char(l_ctp_rec.vrfy_fmly_mmbr_rl) is not null then
2742                  --
2743                  ben_plan_design_program_module.create_formula_result
2744                  (
2745                   p_validate                       =>  0
2746                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2747                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2748                  ,p_formula_id                     =>  l_ctp_rec.vrfy_fmly_mmbr_rl
2749                  ,p_business_group_id              =>  l_ctp_rec.business_group_id
2750                  ,p_number_of_copies               =>  l_number_of_copies
2751                  ,p_object_version_number          =>  l_object_version_number
2752                  ,p_effective_date                 =>  p_effective_date
2753                  );
2754 
2755                  --
2756         end if;
2757      end loop;
2758          -- ------------------------------------------------------------------------
2759          -- Eligibility Profiles
2760          -- ------------------------------------------------------------------------
2761          ben_plan_design_elpro_module.create_elpro_results
2762             (
2763               p_validate                     => p_validate
2764              ,p_copy_entity_result_id        => l_out_ctp_result_id
2765              ,p_copy_entity_txn_id           => p_copy_entity_txn_id
2766              ,p_pgm_id                       => null
2767              ,p_ptip_id                      => l_ptip_id
2768              ,p_plip_id                      => null
2769              ,p_pl_id                        => null
2770              ,p_oipl_id                      => null
2771              ,p_business_group_id            => p_business_group_id
2772              ,p_number_of_copies             => p_number_of_copies
2773              ,p_object_version_number        => l_object_version_number
2774              ,p_effective_date               => p_effective_date
2775              ,p_parent_entity_result_id      => l_out_ctp_result_id
2776             );
2777           -- ------------------------------------------------------------------------
2778           -- Dependent Eligibility Profiles
2779           -- ------------------------------------------------------------------------
2780 
2781           ben_plan_design_elpro_module.create_dep_elpro_result
2782             (
2783               p_validate                   => p_validate
2784              ,p_copy_entity_result_id      => l_out_ctp_result_id
2785              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
2786              ,p_pgm_id                     => null
2787              ,p_ptip_id                    => l_ptip_id
2788              ,p_pl_id                      => null
2789              ,p_business_group_id          => p_business_group_id
2790              ,p_number_of_copies           => p_number_of_copies
2791              ,p_object_version_number      => l_object_version_number
2792              ,p_effective_date             => p_effective_date
2793              ,p_parent_entity_result_id    => l_out_ctp_result_id
2794             );
2795             -- ------------------------------------------------------------------------
2796             -- Standard Rates ,Flex Credits at Ptip level
2797             -- ------------------------------------------------------------------------
2798           ben_pd_rate_and_cvg_module.create_rate_results
2799             (
2800               p_validate                   => p_validate
2801              ,p_copy_entity_result_id      => l_out_ctp_result_id
2802              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
2803              ,p_pgm_id                     => null
2804              ,p_ptip_id                    => l_ptip_id
2805              ,p_plip_id                    => null
2806              ,p_pl_id                      => null
2807              ,p_oiplip_id                  => null
2808              ,p_cmbn_plip_id               => null
2809              ,p_cmbn_ptip_id               => null
2810              ,p_cmbn_ptip_opt_id           => null
2811              ,p_business_group_id          => p_business_group_id
2812              ,p_number_of_copies           => p_number_of_copies
2813              ,p_object_version_number      => l_object_version_number
2814              ,p_effective_date             => p_effective_date
2815              ,p_parent_entity_result_id    => l_out_ctp_result_id
2816              ) ;
2817             -- ------------------------------------------------------------------------
2818             -- Benefit Pools  Ptip Level
2819             -- ------------------------------------------------------------------------
2820           ben_pd_rate_and_cvg_module.create_bnft_pool_results
2821             (
2822               p_validate                   =>p_validate
2823              ,p_copy_entity_result_id      =>l_out_ctp_result_id
2824              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
2825              ,p_pgm_id                     => null
2826              ,p_ptip_id                    => l_ptip_id
2827              ,p_plip_id                    => null
2828              ,p_oiplip_id                  => null
2829              ,p_cmbn_plip_id               => null
2830              ,p_cmbn_ptip_id               => null
2831              ,p_cmbn_ptip_opt_id           => null
2832              ,p_business_group_id          => p_business_group_id
2833              ,p_number_of_copies           => p_number_of_copies
2834              ,p_object_version_number      => l_object_version_number
2835              ,p_effective_date             => p_effective_date
2836              ,p_parent_entity_result_id    => l_out_ctp_result_id
2837              ) ;
2838 
2839       ---------------------------------------------------------------
2840       -- START OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
2841       ---------------------------------------------------------------
2842       --
2843       ---------------------------------------------------------------
2844       -- START OF BEN_PL_TYP_F ----------------------
2845       ---------------------------------------------------------------
2846       --
2847       for l_parent_rec  in c_ptp_from_parent(l_PTIP_ID) loop
2848         ben_plan_design_plan_module.create_pl_typ_result
2849         (p_validate                       => p_validate
2850         ,p_copy_entity_result_id          => l_out_ctp_result_id
2851         ,p_copy_entity_txn_id             => p_copy_entity_txn_id
2852         ,p_pl_typ_id                      => l_parent_rec.pl_typ_id
2853         ,p_business_group_id              => p_business_group_id
2854         ,p_number_of_copies               => p_number_of_copies
2855         ,p_object_version_number          => l_object_version_number
2856         ,p_effective_date                 => p_effective_date
2857         ,p_parent_entity_result_id        => NULL -- Hide PTP for HGrid
2858         );
2859       end loop;
2860      ---------------------------------------------------------------
2861      -- END OF BEN_PL_TYP_F ----------------------
2862      ---------------------------------------------------------------
2863       for l_parent_rec  in c_peo1_from_parent(l_PTIP_ID) loop
2864          --
2865          l_mirror_src_entity_result_id := l_out_ctp_result_id ;
2866          --
2867          l_elig_to_prte_rsn_id1 := l_parent_rec.elig_to_prte_rsn_id ;
2868          --
2869          for l_peo_rec in c_peo1(l_parent_rec.elig_to_prte_rsn_id,l_mirror_src_entity_result_id,'PEO') loop
2870            --
2871            l_table_route_id := null ;
2872            open g_table_route('PEO');
2873              fetch g_table_route into l_table_route_id ;
2874            close g_table_route ;
2875            --
2876            l_information5  := get_ler_name(l_peo_rec.ler_id,p_effective_date); --'Intersection';
2877            --
2878            if p_effective_date between l_peo_rec.effective_start_date
2879               and l_peo_rec.effective_end_date then
2880             --
2881               l_result_type_cd := 'DISPLAY';
2882            else
2883               l_result_type_cd := 'NO DISPLAY';
2884            end if;
2885              --
2886            l_copy_entity_result_id := null;
2887            l_object_version_number := null;
2888            ben_copy_entity_results_api.create_copy_entity_results(
2889              p_copy_entity_result_id           => l_copy_entity_result_id,
2890              p_copy_entity_txn_id             => p_copy_entity_txn_id,
2891              p_result_type_cd                 => l_result_type_cd,
2892              p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2893              p_parent_entity_result_id        => l_mirror_src_entity_result_id,
2894              p_number_of_copies               => l_number_of_copies,
2895              p_table_route_id                 => l_table_route_id,
2896              p_table_alias                    => 'PEO',
2897              p_information1     => l_peo_rec.elig_to_prte_rsn_id,
2898              p_information2     => l_peo_rec.EFFECTIVE_START_DATE,
2899              p_information3     => l_peo_rec.EFFECTIVE_END_DATE,
2900              p_information4     => l_peo_rec.business_group_id,
2901              p_information5     => l_information5 , -- 9999 put name for h-grid
2902             p_information21     => l_peo_rec.elig_inelig_cd,
2903             p_information20     => l_peo_rec.ignr_prtn_ovrid_flag,
2904             p_information257     => l_peo_rec.ler_id,
2905             p_information17     => l_peo_rec.mx_poe_apls_cd,
2906             p_information16     => l_peo_rec.mx_poe_det_dt_cd,
2907             p_information272     => l_peo_rec.mx_poe_det_dt_rl,
2908             p_information270     => l_peo_rec.mx_poe_rl,
2909             p_information15     => l_peo_rec.mx_poe_uom,
2910             p_information269     => l_peo_rec.mx_poe_val,
2911             p_information258     => l_peo_rec.oipl_id,
2912             p_information111     => l_peo_rec.peo_attribute1,
2913             p_information120     => l_peo_rec.peo_attribute10,
2914             p_information121     => l_peo_rec.peo_attribute11,
2915             p_information122     => l_peo_rec.peo_attribute12,
2916             p_information123     => l_peo_rec.peo_attribute13,
2917             p_information124     => l_peo_rec.peo_attribute14,
2918             p_information125     => l_peo_rec.peo_attribute15,
2919             p_information126     => l_peo_rec.peo_attribute16,
2920             p_information127     => l_peo_rec.peo_attribute17,
2921             p_information128     => l_peo_rec.peo_attribute18,
2922             p_information129     => l_peo_rec.peo_attribute19,
2923             p_information112     => l_peo_rec.peo_attribute2,
2924             p_information130     => l_peo_rec.peo_attribute20,
2925             p_information131     => l_peo_rec.peo_attribute21,
2926             p_information132     => l_peo_rec.peo_attribute22,
2927             p_information133     => l_peo_rec.peo_attribute23,
2928             p_information134     => l_peo_rec.peo_attribute24,
2929             p_information135     => l_peo_rec.peo_attribute25,
2930             p_information136     => l_peo_rec.peo_attribute26,
2931             p_information137     => l_peo_rec.peo_attribute27,
2932             p_information138     => l_peo_rec.peo_attribute28,
2933             p_information139     => l_peo_rec.peo_attribute29,
2934             p_information113     => l_peo_rec.peo_attribute3,
2935             p_information140     => l_peo_rec.peo_attribute30,
2936             p_information114     => l_peo_rec.peo_attribute4,
2937             p_information115     => l_peo_rec.peo_attribute5,
2938             p_information116     => l_peo_rec.peo_attribute6,
2939             p_information117     => l_peo_rec.peo_attribute7,
2940             p_information118     => l_peo_rec.peo_attribute8,
2941             p_information119     => l_peo_rec.peo_attribute9,
2942             p_information110     => l_peo_rec.peo_attribute_category,
2943             p_information260     => l_peo_rec.pgm_id,
2944             p_information261     => l_peo_rec.pl_id,
2945             p_information256     => l_peo_rec.plip_id,
2946             p_information12     => l_peo_rec.prtn_eff_end_dt_cd,
2947             p_information266     => l_peo_rec.prtn_eff_end_dt_rl,
2948             p_information11     => l_peo_rec.prtn_eff_strt_dt_cd,
2949             p_information264     => l_peo_rec.prtn_eff_strt_dt_rl,
2950             p_information19     => l_peo_rec.prtn_ovridbl_flag,
2951             p_information259     => l_peo_rec.ptip_id,
2952             p_information18     => l_peo_rec.vrfy_fmly_mmbr_cd,
2953             p_information273     => l_peo_rec.vrfy_fmly_mmbr_rl,
2954             p_information14     => l_peo_rec.wait_perd_dt_to_use_cd,
2955             p_information268     => l_peo_rec.wait_perd_dt_to_use_rl,
2956             p_information271     => l_peo_rec.wait_perd_rl,
2957             p_information13     => l_peo_rec.wait_perd_uom,
2958             p_information267     => l_peo_rec.wait_perd_val,
2959             p_information265    => l_peo_rec.object_version_number,
2960             --
2961              p_object_version_number          => l_object_version_number,
2962              p_effective_date                 => p_effective_date       );
2963              --
2964 
2965              if l_out_peo1_result_id is null then
2966                l_out_peo1_result_id := l_copy_entity_result_id;
2967              end if;
2968 
2969              if l_result_type_cd = 'DISPLAY' then
2970                 l_out_peo1_result_id := l_copy_entity_result_id ;
2971              end if;
2972              --
2973 
2974              -- Copy Fast Formulas if any are attached to any column --
2975              ---------------------------------------------------------------
2976              -- MX_POE_DET_DT_RL -----------------
2977              ---------------------------------------------------------------
2978 
2979              if to_char(l_peo_rec.mx_poe_det_dt_rl) is not null then
2980                --
2981                ben_plan_design_program_module.create_formula_result
2982                (
2983                  p_validate                       =>  0
2984                  ,p_copy_entity_result_id          =>  l_copy_entity_result_id
2985                  ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
2986                  ,p_formula_id                     =>  l_peo_rec.mx_poe_det_dt_rl
2987                  ,p_business_group_id              =>  l_peo_rec.business_group_id
2988                  ,p_number_of_copies               =>  l_number_of_copies
2989                  ,p_object_version_number          =>  l_object_version_number
2990                  ,p_effective_date                 =>  p_effective_date
2991                );
2992 
2993                --
2994              end if;
2995 
2996              ---------------------------------------------------------------
2997              -- MX_POE_RL -----------------
2998              ---------------------------------------------------------------
2999 
3000              if to_char(l_peo_rec.mx_poe_rl) is not null then
3001                   --
3002                   ben_plan_design_program_module.create_formula_result
3003                     (
3004                       p_validate                       =>  0
3005                       ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3006                       ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3007                       ,p_formula_id                     =>  l_peo_rec.mx_poe_rl
3008                       ,p_business_group_id              =>  l_peo_rec.business_group_id
3009                       ,p_number_of_copies               =>  l_number_of_copies
3010                       ,p_object_version_number          =>  l_object_version_number
3011                       ,p_effective_date                 =>  p_effective_date
3012                     );
3013                   --
3014              end if;
3015 
3016              ---------------------------------------------------------------
3017              -- PRTN_EFF_END_DT_RL -----------------
3018              ---------------------------------------------------------------
3019 
3020              if to_char(l_peo_rec.prtn_eff_end_dt_rl) is not null then
3021                   --
3022                   ben_plan_design_program_module.create_formula_result
3023                    (
3024                         p_validate                       =>  0
3025                         ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3026                         ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3027                         ,p_formula_id                     =>  l_peo_rec.prtn_eff_end_dt_rl
3028                         ,p_business_group_id              =>  l_peo_rec.business_group_id
3029                         ,p_number_of_copies               =>  l_number_of_copies
3030                         ,p_object_version_number          =>  l_object_version_number
3031                         ,p_effective_date                 =>  p_effective_date
3032                    );
3033                   --
3034              end if;
3035 
3036              ---------------------------------------------------------------
3037              -- PRTN_EFF_STRT_DT_RL   -----------------
3038              ---------------------------------------------------------------
3039 
3040              if to_char(l_peo_rec.prtn_eff_strt_dt_rl) is not null then
3041                   --
3042                   ben_plan_design_program_module.create_formula_result
3043                   (
3044                   p_validate                       =>  0
3045                   ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3046                   ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3047                   ,p_formula_id                     =>  l_peo_rec.prtn_eff_strt_dt_rl
3048                   ,p_business_group_id              =>  l_peo_rec.business_group_id
3049                   ,p_number_of_copies               =>  l_number_of_copies
3050                   ,p_object_version_number          =>  l_object_version_number
3051                   ,p_effective_date                 =>  p_effective_date
3052                   );
3053                   --
3054               end if;
3055 
3056               ---------------------------------------------------------------
3057               -- VRFY_FMLY_MMBR_RL  -----------------
3058               ---------------------------------------------------------------
3059 
3060               if to_char(l_peo_rec.vrfy_fmly_mmbr_rl) is not null then
3061                    --
3062                    ben_plan_design_program_module.create_formula_result
3063                    (
3064                    p_validate                       =>  0
3065                    ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3066                    ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3067                    ,p_formula_id                     =>  l_peo_rec.vrfy_fmly_mmbr_rl
3068                    ,p_business_group_id              =>  l_peo_rec.business_group_id
3069                    ,p_number_of_copies               =>  l_number_of_copies
3070                    ,p_object_version_number          =>  l_object_version_number
3071                    ,p_effective_date                 =>  p_effective_date
3072                    );
3073                    --
3074               end if;
3075 
3076               ---------------------------------------------------------------
3077               -- WAIT_PERD_DT_TO_USE_RL  -----------------
3078               ---------------------------------------------------------------
3079 
3080               if to_char(l_peo_rec.wait_perd_dt_to_use_rl) is not null then
3081                    --
3082                    ben_plan_design_program_module.create_formula_result
3083                    (
3084                    p_validate                       =>  0
3085                    ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3086                    ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3087                    ,p_formula_id                     =>  l_peo_rec.wait_perd_dt_to_use_rl
3088                    ,p_business_group_id              =>  l_peo_rec.business_group_id
3089                    ,p_number_of_copies               =>  l_number_of_copies
3090                    ,p_object_version_number          =>  l_object_version_number
3091                    ,p_effective_date                 =>  p_effective_date
3092                    );
3093                    --
3094               end if;
3095 
3096               ---------------------------------------------------------------
3097               -- WAIT_PERD_RL  -----------------
3098               ---------------------------------------------------------------
3099 
3100               if to_char(l_peo_rec.wait_perd_rl) is not null then
3101                    --
3102                    ben_plan_design_program_module.create_formula_result
3103                    (
3104                    p_validate                       =>  0
3105                    ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3106                    ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3107                    ,p_formula_id                     =>  l_peo_rec.wait_perd_rl
3108                    ,p_business_group_id              =>  l_peo_rec.business_group_id
3109                    ,p_number_of_copies               =>  l_number_of_copies
3110                    ,p_object_version_number          =>  l_object_version_number
3111                    ,p_effective_date                 =>  p_effective_date
3112                    );
3113                    --
3114               end if;
3115             --
3116             ben_plan_design_plan_module.create_ler_result (
3117                p_validate                       => p_validate
3118               ,p_copy_entity_result_id          => l_copy_entity_result_id
3119               ,p_copy_entity_txn_id             => p_copy_entity_txn_id
3120               ,p_ler_id                         => l_peo_rec.ler_id
3121               ,p_business_group_id              => p_business_group_id
3122               ,p_number_of_copies               => l_number_of_copies
3123               ,p_object_version_number          => l_object_version_number
3124               ,p_effective_date                 => p_effective_date
3125               );
3126             --
3127           end loop;
3128           --
3129         end loop;
3130      ---------------------------------------------------------------
3131      -- END OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
3132      ---------------------------------------------------------------
3133       ---------------------------------------------------------------
3134       -- START OF BEN_LER_CHG_DPNT_CVG_F ----------------------
3135       ---------------------------------------------------------------
3136       --
3137       for l_parent_rec  in c_ldc1_from_parent(l_PTIP_ID) loop
3138          --
3139          l_mirror_src_entity_result_id := l_out_ctp_result_id ;
3140          --
3141          l_ler_chg_dpnt_cvg_id1 := l_parent_rec.ler_chg_dpnt_cvg_id ;
3142          --
3143          for l_ldc_rec in c_ldc1(l_parent_rec.ler_chg_dpnt_cvg_id,l_mirror_src_entity_result_id,'LDC' ) loop
3144            --
3145            l_table_route_id := null ;
3146            open g_table_route('LDC');
3147              fetch g_table_route into l_table_route_id ;
3148            close g_table_route ;
3149            --
3150            l_information5  := get_ler_name(l_ldc_rec.ler_id,p_effective_date); --'Intersection';
3151            --
3152            if p_effective_date between l_ldc_rec.effective_start_date
3153               and l_ldc_rec.effective_end_date then
3154             --
3155               l_result_type_cd := 'DISPLAY';
3156            else
3157               l_result_type_cd := 'NO DISPLAY';
3158            end if;
3159              --
3160            l_copy_entity_result_id := null;
3161            l_object_version_number := null;
3162            ben_copy_entity_results_api.create_copy_entity_results(
3163              p_copy_entity_result_id           => l_copy_entity_result_id,
3164              p_copy_entity_txn_id             => p_copy_entity_txn_id,
3165              p_result_type_cd                 => l_result_type_cd,
3166              p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3167              p_parent_entity_result_id        => l_mirror_src_entity_result_id,
3168              p_number_of_copies               => l_number_of_copies,
3169              p_table_route_id                 => l_table_route_id,
3170              p_table_alias                    => 'LDC',
3171              p_information1     => l_ldc_rec.ler_chg_dpnt_cvg_id,
3172              p_information2     => l_ldc_rec.EFFECTIVE_START_DATE,
3173              p_information3     => l_ldc_rec.EFFECTIVE_END_DATE,
3174              p_information4     => l_ldc_rec.business_group_id,
3175              p_information5     => l_information5 , -- 9999 put name for h-grid
3176             p_information11     => l_ldc_rec.add_rmv_cvg_cd,
3177             p_information12     => l_ldc_rec.cvg_eff_end_cd,
3178             p_information263     => l_ldc_rec.cvg_eff_end_rl,
3179             p_information13     => l_ldc_rec.cvg_eff_strt_cd,
3180             p_information262     => l_ldc_rec.cvg_eff_strt_rl,
3181             p_information111     => l_ldc_rec.ldc_attribute1,
3182             p_information120     => l_ldc_rec.ldc_attribute10,
3183             p_information121     => l_ldc_rec.ldc_attribute11,
3184             p_information122     => l_ldc_rec.ldc_attribute12,
3185             p_information123     => l_ldc_rec.ldc_attribute13,
3186             p_information124     => l_ldc_rec.ldc_attribute14,
3187             p_information125     => l_ldc_rec.ldc_attribute15,
3188             p_information126     => l_ldc_rec.ldc_attribute16,
3189             p_information127     => l_ldc_rec.ldc_attribute17,
3190             p_information128     => l_ldc_rec.ldc_attribute18,
3191             p_information129     => l_ldc_rec.ldc_attribute19,
3192             p_information112     => l_ldc_rec.ldc_attribute2,
3193             p_information130     => l_ldc_rec.ldc_attribute20,
3194             p_information131     => l_ldc_rec.ldc_attribute21,
3195             p_information132     => l_ldc_rec.ldc_attribute22,
3196             p_information133     => l_ldc_rec.ldc_attribute23,
3197             p_information134     => l_ldc_rec.ldc_attribute24,
3198             p_information135     => l_ldc_rec.ldc_attribute25,
3199             p_information136     => l_ldc_rec.ldc_attribute26,
3200             p_information137     => l_ldc_rec.ldc_attribute27,
3201             p_information138     => l_ldc_rec.ldc_attribute28,
3202             p_information139     => l_ldc_rec.ldc_attribute29,
3203             p_information113     => l_ldc_rec.ldc_attribute3,
3204             p_information140     => l_ldc_rec.ldc_attribute30,
3205             p_information114     => l_ldc_rec.ldc_attribute4,
3206             p_information115     => l_ldc_rec.ldc_attribute5,
3207             p_information116     => l_ldc_rec.ldc_attribute6,
3208             p_information117     => l_ldc_rec.ldc_attribute7,
3209             p_information118     => l_ldc_rec.ldc_attribute8,
3210             p_information119     => l_ldc_rec.ldc_attribute9,
3211             p_information110     => l_ldc_rec.ldc_attribute_category,
3212             p_information14     => l_ldc_rec.ler_chg_dpnt_cvg_cd,
3213             p_information258     => l_ldc_rec.ler_chg_dpnt_cvg_rl,
3214             p_information257     => l_ldc_rec.ler_id,
3215             p_information260     => l_ldc_rec.pgm_id,
3216             p_information261     => l_ldc_rec.pl_id,
3217             p_information259     => l_ldc_rec.ptip_id,
3218             p_information265     => l_ldc_rec.object_version_number,
3219             --
3220              p_object_version_number          => l_object_version_number,
3221              p_effective_date                 => p_effective_date       );
3222              --
3223 
3224              if l_out_ldc1_result_id is null then
3225                l_out_ldc1_result_id := l_copy_entity_result_id;
3226              end if;
3227 
3228              if l_result_type_cd = 'DISPLAY' then
3229                 l_out_ldc1_result_id := l_copy_entity_result_id ;
3230              end if;
3231              --
3232 
3233              -- Copy Fast Formulas if any are attached to any column --
3234              ---------------------------------------------------------------
3235              --   CVG_EFF_END_RL -----------------
3236              ---------------------------------------------------------------
3237 
3238              if to_char(l_ldc_rec.cvg_eff_end_rl) is not null then
3239                      --
3240                      ben_plan_design_program_module.create_formula_result
3241                      (
3242                       p_validate                       =>  0
3243                      ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3244                      ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3245                      ,p_formula_id                     =>  l_ldc_rec.cvg_eff_end_rl
3246                      ,p_business_group_id              =>  l_ldc_rec.business_group_id
3247                      ,p_number_of_copies               =>  l_number_of_copies
3248                      ,p_object_version_number          =>  l_object_version_number
3249                      ,p_effective_date                 =>  p_effective_date
3250                      );
3251 
3252                      --
3253              end if;
3254 
3255              ---------------------------------------------------------------
3256              --   CVG_EFF_STRT_RL -----------------
3257              ---------------------------------------------------------------
3258 
3259              if to_char(l_ldc_rec.cvg_eff_strt_rl) is not null then
3260                     --
3261                     ben_plan_design_program_module.create_formula_result
3262                     (
3263                      p_validate                       =>  0
3264                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3265                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3266                     ,p_formula_id                     =>  l_ldc_rec.cvg_eff_strt_rl
3267                     ,p_business_group_id              =>  l_ldc_rec.business_group_id
3268                     ,p_number_of_copies               =>  l_number_of_copies
3269                     ,p_object_version_number          =>  l_object_version_number
3270                     ,p_effective_date                 =>  p_effective_date
3271                     );
3272 
3273                     --
3274              end if;
3275 
3276              ---------------------------------------------------------------
3277              --   LER_CHG_DPNT_CVG_RL -----------------
3278              ---------------------------------------------------------------
3279 
3280              if to_char(l_ldc_rec.ler_chg_dpnt_cvg_rl) is not null then
3281                   --
3282                   ben_plan_design_program_module.create_formula_result
3283                   (
3284                    p_validate                       =>  0
3285                   ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3286                   ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3287                   ,p_formula_id                     =>  l_ldc_rec.ler_chg_dpnt_cvg_rl
3288                   ,p_business_group_id              =>  l_ldc_rec.business_group_id
3289                   ,p_number_of_copies               =>  l_number_of_copies
3290                   ,p_object_version_number          =>  l_object_version_number
3291                   ,p_effective_date                 =>  p_effective_date
3292                   );
3293 
3294                   --
3295              end if;
3296           end loop;
3297 
3298           for l_ldc_rec in c_ldc1_drp(l_parent_rec.ler_chg_dpnt_cvg_id,l_mirror_src_entity_result_id,'LDC' ) loop
3299             ben_plan_design_plan_module.create_ler_result (
3300                p_validate                       => p_validate
3301               ,p_copy_entity_result_id          => l_out_ldc1_result_id
3302               ,p_copy_entity_txn_id             => p_copy_entity_txn_id
3303               ,p_ler_id                         => l_ldc_rec.ler_id
3304               ,p_business_group_id              => p_business_group_id
3305               ,p_number_of_copies               => p_number_of_copies
3306               ,p_object_version_number          => l_object_version_number
3307               ,p_effective_date                 => p_effective_date
3308               );
3309           end loop;
3310          ---------------------------------------------------------------
3311          -- START OF BEN_LER_CHG_DPNT_CVG_CTFN_F ----------------------
3312          ---------------------------------------------------------------
3313          --
3314          for l_parent_rec  in c_lcc1_from_parent(l_LER_CHG_DPNT_CVG_ID1) loop
3315             --
3316             l_mirror_src_entity_result_id := l_out_ldc1_result_id ;
3317 
3318             --
3319             l_ler_chg_dpnt_cvg_ctfn_id1 := l_parent_rec.ler_chg_dpnt_cvg_ctfn_id ;
3320             --
3321             for l_lcc_rec in c_lcc1(l_parent_rec.ler_chg_dpnt_cvg_ctfn_id,l_mirror_src_entity_result_id,'LCC' ) loop
3322               --
3323               l_table_route_id := null ;
3324               open g_table_route('LCC');
3325                 fetch g_table_route into l_table_route_id ;
3326               close g_table_route ;
3327               --
3328               l_information5  := hr_general.decode_lookup('BEN_DPNT_CVG_CTFN_TYP',l_lcc_rec.dpnt_cvg_ctfn_typ_cd); --'Intersection';
3329               --
3330               if p_effective_date between l_lcc_rec.effective_start_date
3331                  and l_lcc_rec.effective_end_date then
3332                --
3333                  l_result_type_cd := 'DISPLAY';
3334               else
3335                  l_result_type_cd := 'NO DISPLAY';
3336               end if;
3337                 --
3338               l_copy_entity_result_id := null;
3339               l_object_version_number := null;
3340               ben_copy_entity_results_api.create_copy_entity_results(
3341                 p_copy_entity_result_id           => l_copy_entity_result_id,
3342                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
3343                 p_result_type_cd                 => l_result_type_cd,
3344                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3345                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
3346                 p_number_of_copies               => l_number_of_copies,
3347                 p_table_route_id                 => l_table_route_id,
3348              p_table_alias                    => 'LCC',
3349                 p_information1     => l_lcc_rec.ler_chg_dpnt_cvg_ctfn_id,
3350                 p_information2     => l_lcc_rec.EFFECTIVE_START_DATE,
3351                 p_information3     => l_lcc_rec.EFFECTIVE_END_DATE,
3352                 p_information4     => l_lcc_rec.business_group_id,
3353                 p_information5     => l_information5 , -- 9999 put name for h-grid
3354             p_information261     => l_lcc_rec.ctfn_rqd_when_rl,
3355             p_information12     => l_lcc_rec.dpnt_cvg_ctfn_typ_cd,
3356             p_information13     => l_lcc_rec.lack_ctfn_sspnd_enrt_flag,
3357             p_information111     => l_lcc_rec.lcc_attribute1,
3358             p_information120     => l_lcc_rec.lcc_attribute10,
3359             p_information121     => l_lcc_rec.lcc_attribute11,
3360             p_information122     => l_lcc_rec.lcc_attribute12,
3361             p_information123     => l_lcc_rec.lcc_attribute13,
3362             p_information124     => l_lcc_rec.lcc_attribute14,
3363             p_information125     => l_lcc_rec.lcc_attribute15,
3364             p_information126     => l_lcc_rec.lcc_attribute16,
3365             p_information127     => l_lcc_rec.lcc_attribute17,
3366             p_information128     => l_lcc_rec.lcc_attribute18,
3367             p_information129     => l_lcc_rec.lcc_attribute19,
3368             p_information112     => l_lcc_rec.lcc_attribute2,
3369             p_information130     => l_lcc_rec.lcc_attribute20,
3370             p_information131     => l_lcc_rec.lcc_attribute21,
3371             p_information132     => l_lcc_rec.lcc_attribute22,
3372             p_information133     => l_lcc_rec.lcc_attribute23,
3373             p_information134     => l_lcc_rec.lcc_attribute24,
3374             p_information135     => l_lcc_rec.lcc_attribute25,
3375             p_information136     => l_lcc_rec.lcc_attribute26,
3376             p_information137     => l_lcc_rec.lcc_attribute27,
3377             p_information138     => l_lcc_rec.lcc_attribute28,
3378             p_information139     => l_lcc_rec.lcc_attribute29,
3379             p_information113     => l_lcc_rec.lcc_attribute3,
3380             p_information140     => l_lcc_rec.lcc_attribute30,
3381             p_information114     => l_lcc_rec.lcc_attribute4,
3382             p_information115     => l_lcc_rec.lcc_attribute5,
3383             p_information116     => l_lcc_rec.lcc_attribute6,
3384             p_information117     => l_lcc_rec.lcc_attribute7,
3385             p_information118     => l_lcc_rec.lcc_attribute8,
3386             p_information119     => l_lcc_rec.lcc_attribute9,
3387             p_information110     => l_lcc_rec.lcc_attribute_category,
3388             p_information260     => l_lcc_rec.ler_chg_dpnt_cvg_id,
3389             p_information14     => l_lcc_rec.rlshp_typ_cd,
3390             p_information11     => l_lcc_rec.rqd_flag,
3391             p_information265    => l_lcc_rec.object_version_number,
3392             --
3393                 p_object_version_number          => l_object_version_number,
3394                 p_effective_date                 => p_effective_date       );
3395                 --
3396 
3397                 if l_out_lcc1_result_id is null then
3398                   l_out_lcc1_result_id := l_copy_entity_result_id;
3399                 end if;
3400 
3401                 if l_result_type_cd = 'DISPLAY' then
3402                    l_out_lcc1_result_id := l_copy_entity_result_id ;
3403                 end if;
3404                 --
3405              end loop;
3406              --
3407            end loop;
3408         ---------------------------------------------------------------
3409         -- END OF BEN_LER_CHG_DPNT_CVG_CTFN_F ----------------------
3410         ---------------------------------------------------------------
3411           --
3412         end loop;
3413      ---------------------------------------------------------------
3414      -- END OF BEN_LER_CHG_DPNT_CVG_F ----------------------
3415      ---------------------------------------------------------------
3416       ---------------------------------------------------------------
3417       -- START OF BEN_LER_CHG_PTIP_ENRT_F ----------------------
3418       ---------------------------------------------------------------
3419       --
3420       for l_parent_rec  in c_lct1_from_parent(l_PTIP_ID) loop
3421          --
3422          l_mirror_src_entity_result_id := l_out_ctp_result_id ;
3423          --
3424          l_ler_chg_ptip_enrt_id := l_parent_rec.ler_chg_ptip_enrt_id ;
3425          --
3426          for l_lct_rec in c_lct1(l_parent_rec.ler_chg_ptip_enrt_id,l_mirror_src_entity_result_id,'LCT' ) loop
3427            --
3428            l_table_route_id := null ;
3429            open g_table_route('LCT');
3430              fetch g_table_route into l_table_route_id ;
3431            close g_table_route ;
3432            --
3433            l_information5  := get_ler_name(l_lct_rec.ler_id,p_effective_date); --'Intersection';
3434            --
3435            if p_effective_date between l_lct_rec.effective_start_date
3436               and l_lct_rec.effective_end_date then
3437             --
3438               l_result_type_cd := 'DISPLAY';
3439            else
3440               l_result_type_cd := 'NO DISPLAY';
3441            end if;
3442              --
3443            l_copy_entity_result_id := null;
3444            l_object_version_number := null;
3445            ben_copy_entity_results_api.create_copy_entity_results(
3446              p_copy_entity_result_id           => l_copy_entity_result_id,
3447              p_copy_entity_txn_id             => p_copy_entity_txn_id,
3448              p_result_type_cd                 => l_result_type_cd,
3449              p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3450              p_parent_entity_result_id        => l_mirror_src_entity_result_id,
3451              p_number_of_copies               => l_number_of_copies,
3452              p_table_route_id                 => l_table_route_id,
3453              p_table_alias                    => 'LCT',
3454              p_information1     => l_lct_rec.ler_chg_ptip_enrt_id,
3455              p_information2     => l_lct_rec.EFFECTIVE_START_DATE,
3456              p_information3     => l_lct_rec.EFFECTIVE_END_DATE,
3457              p_information4     => l_lct_rec.business_group_id,
3458              p_information5     => l_information5 , -- 9999 put name for h-grid
3459             p_information18     => l_lct_rec.crnt_enrt_prclds_chg_flag,
3460             p_information12     => l_lct_rec.dflt_enrt_cd,
3461             p_information13     => l_lct_rec.dflt_enrt_rl,
3462             p_information11     => l_lct_rec.dflt_flag,
3463             p_information14     => l_lct_rec.enrt_cd,
3464             p_information15     => l_lct_rec.enrt_mthd_cd,
3465             p_information16     => l_lct_rec.enrt_rl,
3466             p_information111     => l_lct_rec.lct_attribute1,
3467             p_information120     => l_lct_rec.lct_attribute10,
3468             p_information121     => l_lct_rec.lct_attribute11,
3469             p_information122     => l_lct_rec.lct_attribute12,
3470             p_information123     => l_lct_rec.lct_attribute13,
3471             p_information124     => l_lct_rec.lct_attribute14,
3472             p_information125     => l_lct_rec.lct_attribute15,
3473             p_information126     => l_lct_rec.lct_attribute16,
3474             p_information127     => l_lct_rec.lct_attribute17,
3475             p_information128     => l_lct_rec.lct_attribute18,
3476             p_information129     => l_lct_rec.lct_attribute19,
3477             p_information112     => l_lct_rec.lct_attribute2,
3478             p_information130     => l_lct_rec.lct_attribute20,
3479             p_information131     => l_lct_rec.lct_attribute21,
3480             p_information132     => l_lct_rec.lct_attribute22,
3481             p_information133     => l_lct_rec.lct_attribute23,
3482             p_information134     => l_lct_rec.lct_attribute24,
3483             p_information135     => l_lct_rec.lct_attribute25,
3484             p_information136     => l_lct_rec.lct_attribute26,
3485             p_information137     => l_lct_rec.lct_attribute27,
3486             p_information138     => l_lct_rec.lct_attribute28,
3487             p_information139     => l_lct_rec.lct_attribute29,
3488             p_information113     => l_lct_rec.lct_attribute3,
3489             p_information140     => l_lct_rec.lct_attribute30,
3490             p_information114     => l_lct_rec.lct_attribute4,
3491             p_information115     => l_lct_rec.lct_attribute5,
3492             p_information116     => l_lct_rec.lct_attribute6,
3493             p_information117     => l_lct_rec.lct_attribute7,
3494             p_information118     => l_lct_rec.lct_attribute8,
3495             p_information119     => l_lct_rec.lct_attribute9,
3496             p_information110     => l_lct_rec.lct_attribute_category,
3497             p_information257     => l_lct_rec.ler_id,
3498             p_information259     => l_lct_rec.ptip_id,
3499             p_information19     => l_lct_rec.stl_elig_cant_chg_flag,
3500             p_information17     => l_lct_rec.tco_chg_enrt_cd,
3501             p_information265    => l_lct_rec.object_version_number,
3502             --
3503              p_object_version_number          => l_object_version_number,
3504              p_effective_date                 => p_effective_date       );
3505              --
3506 
3507              if l_out_lct_result_id is null then
3508                l_out_lct_result_id := l_copy_entity_result_id;
3509              end if;
3510 
3511              if l_result_type_cd = 'DISPLAY' then
3512                 l_out_lct_result_id := l_copy_entity_result_id ;
3513              end if;
3514              --
3515 
3516              -- Copy Fast Formulas if any are attached to any column --
3517              ---------------------------------------------------------------
3518              -- DFLT_ENRT_RL -----------------
3519              ---------------------------------------------------------------
3520 
3521              if l_lct_rec.dflt_enrt_rl is not null then
3522                      --
3523                      ben_plan_design_program_module.create_formula_result
3524                      (
3525                       p_validate                       =>  0
3526                      ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3527                      ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3528                      ,p_formula_id                     =>  l_lct_rec.dflt_enrt_rl
3529                      ,p_business_group_id              =>  l_lct_rec.business_group_id
3530                      ,p_number_of_copies               =>  l_number_of_copies
3531                      ,p_object_version_number          =>  l_object_version_number
3532                      ,p_effective_date                 =>  p_effective_date
3533                      );
3534 
3535                      --
3536              end if;
3537 
3538              ---------------------------------------------------------------
3539              -- ENRT_RL -----------------
3540              ---------------------------------------------------------------
3541 
3542              if l_lct_rec.enrt_rl is not null then
3543                    --
3544                    ben_plan_design_program_module.create_formula_result
3545                    (
3546                     p_validate                       =>  0
3547                    ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3548                    ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3549                    ,p_formula_id                     =>  l_lct_rec.enrt_rl
3550                    ,p_business_group_id              =>  l_lct_rec.business_group_id
3551                    ,p_number_of_copies               =>  l_number_of_copies
3552                    ,p_object_version_number          =>  l_object_version_number
3553                    ,p_effective_date                 =>  p_effective_date
3554                    );
3555 
3556                    --
3557              end if;
3558 
3559           end loop;
3560           for l_lct_rec in c_lct1_drp(l_parent_rec.ler_chg_ptip_enrt_id,l_mirror_src_entity_result_id,'LCT' ) loop
3561             ben_plan_design_plan_module.create_ler_result (
3562                      p_validate                       => p_validate
3563                     ,p_copy_entity_result_id          => l_out_lct_result_id
3564                     ,p_copy_entity_txn_id             => p_copy_entity_txn_id
3565                     ,p_ler_id                         => l_lct_rec.ler_id
3566                     ,p_business_group_id              => p_business_group_id
3567                     ,p_number_of_copies               => p_number_of_copies
3568                     ,p_object_version_number          => l_object_version_number
3569                     ,p_effective_date                 => p_effective_date
3570                     );
3571           end loop;
3572           --
3573         end loop;
3574      ---------------------------------------------------------------
3575      -- END OF BEN_LER_CHG_PTIP_ENRT_F ----------------------
3576      ---------------------------------------------------------------
3577       ---------------------------------------------------------------
3578       -- START OF BEN_PTIP_DPNT_CVG_CTFN_F ----------------------
3579       ---------------------------------------------------------------
3580       --
3581       for l_parent_rec  in c_pyd1_from_parent(l_PTIP_ID) loop
3582          --
3583          l_mirror_src_entity_result_id := l_out_ctp_result_id ;
3584 
3585          --
3586          l_ptip_dpnt_cvg_ctfn_id := l_parent_rec.ptip_dpnt_cvg_ctfn_id ;
3587          --
3588          for l_pyd_rec in c_pyd1(l_parent_rec.ptip_dpnt_cvg_ctfn_id,l_mirror_src_entity_result_id,'PYD' ) loop
3589            --
3590            l_table_route_id := null ;
3591            open g_table_route('PYD');
3592              fetch g_table_route into l_table_route_id ;
3593            close g_table_route ;
3594            --
3595            l_information5  := hr_general.decode_lookup('BEN_DPNT_CVG_CTFN_TYP',l_pyd_rec.dpnt_cvg_ctfn_typ_cd); --'Intersection';
3596            --
3597            if p_effective_date between l_pyd_rec.effective_start_date
3598               and l_pyd_rec.effective_end_date then
3599             --
3600               l_result_type_cd := 'DISPLAY';
3601            else
3602               l_result_type_cd := 'NO DISPLAY';
3603            end if;
3604              --
3605            l_copy_entity_result_id := null;
3606            l_object_version_number := null;
3607            ben_copy_entity_results_api.create_copy_entity_results(
3608              p_copy_entity_result_id           => l_copy_entity_result_id,
3609              p_copy_entity_txn_id             => p_copy_entity_txn_id,
3610              p_result_type_cd                 => l_result_type_cd,
3611              p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3612              p_parent_entity_result_id        => l_mirror_src_entity_result_id,
3613              p_number_of_copies               => l_number_of_copies,
3614              p_table_route_id                 => l_table_route_id,
3615              p_table_alias                    => 'PYD',
3616              p_information1     => l_pyd_rec.ptip_dpnt_cvg_ctfn_id,
3617              p_information2     => l_pyd_rec.EFFECTIVE_START_DATE,
3618              p_information3     => l_pyd_rec.EFFECTIVE_END_DATE,
3619              p_information4     => l_pyd_rec.business_group_id,
3620              p_information5     => l_information5 , -- 9999 put name for h-grid
3621             p_information257     => l_pyd_rec.ctfn_rqd_when_rl,
3622             p_information13     => l_pyd_rec.dpnt_cvg_ctfn_typ_cd,
3623             p_information12     => l_pyd_rec.lack_ctfn_sspnd_enrt_flag,
3624             p_information11     => l_pyd_rec.pfd_flag,
3625             p_information259     => l_pyd_rec.ptip_id,
3626             p_information111     => l_pyd_rec.pyd_attribute1,
3627             p_information120     => l_pyd_rec.pyd_attribute10,
3628             p_information121     => l_pyd_rec.pyd_attribute11,
3629             p_information122     => l_pyd_rec.pyd_attribute12,
3630             p_information123     => l_pyd_rec.pyd_attribute13,
3631             p_information124     => l_pyd_rec.pyd_attribute14,
3632             p_information125     => l_pyd_rec.pyd_attribute15,
3633             p_information126     => l_pyd_rec.pyd_attribute16,
3634             p_information127     => l_pyd_rec.pyd_attribute17,
3635             p_information128     => l_pyd_rec.pyd_attribute18,
3636             p_information129     => l_pyd_rec.pyd_attribute19,
3637             p_information112     => l_pyd_rec.pyd_attribute2,
3638             p_information130     => l_pyd_rec.pyd_attribute20,
3639             p_information131     => l_pyd_rec.pyd_attribute21,
3640             p_information132     => l_pyd_rec.pyd_attribute22,
3641             p_information133     => l_pyd_rec.pyd_attribute23,
3642             p_information134     => l_pyd_rec.pyd_attribute24,
3643             p_information135     => l_pyd_rec.pyd_attribute25,
3644             p_information136     => l_pyd_rec.pyd_attribute26,
3645             p_information137     => l_pyd_rec.pyd_attribute27,
3646             p_information138     => l_pyd_rec.pyd_attribute28,
3647             p_information139     => l_pyd_rec.pyd_attribute29,
3648             p_information113     => l_pyd_rec.pyd_attribute3,
3649             p_information140     => l_pyd_rec.pyd_attribute30,
3650             p_information114     => l_pyd_rec.pyd_attribute4,
3651             p_information115     => l_pyd_rec.pyd_attribute5,
3652             p_information116     => l_pyd_rec.pyd_attribute6,
3653             p_information117     => l_pyd_rec.pyd_attribute7,
3654             p_information118     => l_pyd_rec.pyd_attribute8,
3655             p_information119     => l_pyd_rec.pyd_attribute9,
3656             p_information110     => l_pyd_rec.pyd_attribute_category,
3657             p_information15     => l_pyd_rec.rlshp_typ_cd,
3658             p_information14     => l_pyd_rec.rqd_flag,
3659             p_information265    => l_pyd_rec.object_version_number,
3660             --
3661              p_object_version_number          => l_object_version_number,
3662              p_effective_date                 => p_effective_date       );
3663              --
3664 
3665              if l_out_pyd_result_id is null then
3666               l_out_pyd_result_id := l_copy_entity_result_id;
3667             end if;
3668 
3669              if l_result_type_cd = 'DISPLAY' then
3670                 l_out_pyd_result_id := l_copy_entity_result_id ;
3671              end if;
3672              --
3673 
3674              -- Copy Fast Formulas if any are attached to any column --
3675              ---------------------------------------------------------------
3676              --  CTFN_RQD_WHEN_RL -----------------
3677              ---------------------------------------------------------------
3678 
3679              if to_char(l_pyd_rec.ctfn_rqd_when_rl) is not null then
3680                      --
3681                      ben_plan_design_program_module.create_formula_result
3682                      (
3683                       p_validate                       =>  0
3684                      ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3685                      ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3686                      ,p_formula_id                     =>  l_pyd_rec.ctfn_rqd_when_rl
3687                      ,p_business_group_id              =>  l_pyd_rec.business_group_id
3688                      ,p_number_of_copies               =>  l_number_of_copies
3689                      ,p_object_version_number          =>  l_object_version_number
3690                      ,p_effective_date                 =>  p_effective_date
3691                      );
3692 
3693                      --
3694              end if;
3695 
3696           end loop;
3697           --
3698         end loop;
3699      ---------------------------------------------------------------
3700      -- END OF BEN_PTIP_DPNT_CVG_CTFN_F ----------------------
3701      ---------------------------------------------------------------
3702       ---------------------------------------------------------------
3703       -- START OF BEN_WV_PRTN_RSN_PTIP_F ----------------------
3704       ---------------------------------------------------------------
3705       --
3706       for l_parent_rec  in c_wpt1_from_parent(l_PTIP_ID) loop
3707          --
3708          l_mirror_src_entity_result_id := l_out_ctp_result_id ;
3709 
3710          --
3711          l_wv_prtn_rsn_ptip_id := l_parent_rec.wv_prtn_rsn_ptip_id ;
3712          --
3713          for l_wpt_rec in c_wpt1(l_parent_rec.wv_prtn_rsn_ptip_id,l_mirror_src_entity_result_id,'WPT' ) loop
3714            --
3715            l_table_route_id := null ;
3716            open g_table_route('WPT');
3717              fetch g_table_route into l_table_route_id ;
3718            close g_table_route ;
3719            --
3720            l_information5  := hr_general.decode_lookup('BEN_WV_PRTN_RSN',l_wpt_rec.wv_prtn_rsn_cd); --'Intersection';
3721            --
3722            if p_effective_date between l_wpt_rec.effective_start_date
3723               and l_wpt_rec.effective_end_date then
3724             --
3725               l_result_type_cd := 'DISPLAY';
3726            else
3727               l_result_type_cd := 'NO DISPLAY';
3728            end if;
3729              --
3730            l_copy_entity_result_id := null;
3731            l_object_version_number := null;
3732            ben_copy_entity_results_api.create_copy_entity_results(
3733              p_copy_entity_result_id          => l_copy_entity_result_id,
3734              p_copy_entity_txn_id             => p_copy_entity_txn_id,
3735              p_result_type_cd                 => l_result_type_cd,
3736              p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3737              p_parent_entity_result_id        => l_mirror_src_entity_result_id,
3738              p_number_of_copies               => l_number_of_copies,
3739              p_table_route_id                 => l_table_route_id,
3740              p_table_alias                    => 'WPT',
3741              p_information1     => l_wpt_rec.wv_prtn_rsn_ptip_id,
3742              p_information2     => l_wpt_rec.EFFECTIVE_START_DATE,
3743              p_information3     => l_wpt_rec.EFFECTIVE_END_DATE,
3744              p_information4     => l_wpt_rec.business_group_id,
3745              p_information5     => l_information5 , -- 9999 put name for h-grid
3746             p_information11     => l_wpt_rec.dflt_flag,
3747             p_information259     => l_wpt_rec.ptip_id,
3748             p_information111     => l_wpt_rec.wpt_attribute1,
3749             p_information120     => l_wpt_rec.wpt_attribute10,
3750             p_information121     => l_wpt_rec.wpt_attribute11,
3751             p_information122     => l_wpt_rec.wpt_attribute12,
3752             p_information123     => l_wpt_rec.wpt_attribute13,
3753             p_information124     => l_wpt_rec.wpt_attribute14,
3754             p_information125     => l_wpt_rec.wpt_attribute15,
3755             p_information126     => l_wpt_rec.wpt_attribute16,
3756             p_information127     => l_wpt_rec.wpt_attribute17,
3757             p_information128     => l_wpt_rec.wpt_attribute18,
3758             p_information129     => l_wpt_rec.wpt_attribute19,
3759             p_information112     => l_wpt_rec.wpt_attribute2,
3760             p_information130     => l_wpt_rec.wpt_attribute20,
3761             p_information131     => l_wpt_rec.wpt_attribute21,
3762             p_information132     => l_wpt_rec.wpt_attribute22,
3763             p_information133     => l_wpt_rec.wpt_attribute23,
3764             p_information134     => l_wpt_rec.wpt_attribute24,
3765             p_information135     => l_wpt_rec.wpt_attribute25,
3766             p_information136     => l_wpt_rec.wpt_attribute26,
3767             p_information137     => l_wpt_rec.wpt_attribute27,
3768             p_information138     => l_wpt_rec.wpt_attribute28,
3769             p_information139     => l_wpt_rec.wpt_attribute29,
3770             p_information113     => l_wpt_rec.wpt_attribute3,
3771             p_information140     => l_wpt_rec.wpt_attribute30,
3772             p_information114     => l_wpt_rec.wpt_attribute4,
3773             p_information115     => l_wpt_rec.wpt_attribute5,
3774             p_information116     => l_wpt_rec.wpt_attribute6,
3775             p_information117     => l_wpt_rec.wpt_attribute7,
3776             p_information118     => l_wpt_rec.wpt_attribute8,
3777             p_information119     => l_wpt_rec.wpt_attribute9,
3778             p_information110     => l_wpt_rec.wpt_attribute_category,
3779             p_information12     => l_wpt_rec.wv_prtn_rsn_cd,
3780             p_information265    => l_wpt_rec.object_version_number,
3781             --
3782              p_object_version_number          => l_object_version_number,
3783              p_effective_date                 => p_effective_date       );
3784              --
3785 
3786              if l_out_wpt_result_id is null then
3787                l_out_wpt_result_id := l_copy_entity_result_id;
3788              end if;
3789 
3790              if l_result_type_cd = 'DISPLAY' then
3791                 l_out_wpt_result_id := l_copy_entity_result_id ;
3792              end if;
3793              --
3794           end loop;
3795         ---------------------------------------------------------------
3796         -- START OF BEN_WV_PRTN_RSN_CTFN_PTIP_F ----------------------
3797         ---------------------------------------------------------------
3798         --
3799         for l_parent_rec  in c_wct1_from_parent(l_WV_PRTN_RSN_PTIP_ID) loop
3800            --
3801            l_mirror_src_entity_result_id := l_out_wpt_result_id ;
3802 
3803            --
3804            l_wv_prtn_rsn_ctfn_ptip_id := l_parent_rec.wv_prtn_rsn_ctfn_ptip_id ;
3805            --
3806            for l_wct_rec in c_wct1(l_parent_rec.wv_prtn_rsn_ctfn_ptip_id,l_mirror_src_entity_result_id,'WCT') loop
3807              --
3808              l_table_route_id := null ;
3809              open g_table_route('WCT');
3810                fetch g_table_route into l_table_route_id ;
3811              close g_table_route ;
3812              --
3813              l_information5  := hr_general.decode_lookup('BEN_WV_PRTN_CTFN_TYP',l_wct_rec.wv_prtn_ctfn_typ_cd); --'Intersection';
3814              --
3815              if p_effective_date between l_wct_rec.effective_start_date
3816                 and l_wct_rec.effective_end_date then
3817               --
3818                 l_result_type_cd := 'DISPLAY';
3819              else
3820                 l_result_type_cd := 'NO DISPLAY';
3821              end if;
3822                --
3823              l_copy_entity_result_id := null;
3824              l_object_version_number := null;
3825              ben_copy_entity_results_api.create_copy_entity_results(
3826                p_copy_entity_result_id           => l_copy_entity_result_id,
3827                p_copy_entity_txn_id             => p_copy_entity_txn_id,
3828                p_result_type_cd                 => l_result_type_cd,
3829                p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3830                p_parent_entity_result_id        => l_mirror_src_entity_result_id,
3831                p_number_of_copies               => l_number_of_copies,
3832                p_table_route_id                 => l_table_route_id,
3833              p_table_alias                    => 'WCT',
3834                p_information1     => l_wct_rec.wv_prtn_rsn_ctfn_ptip_id,
3835                p_information2     => l_wct_rec.EFFECTIVE_START_DATE,
3836                p_information3     => l_wct_rec.EFFECTIVE_END_DATE,
3837                p_information4     => l_wct_rec.business_group_id,
3838                p_information5     => l_information5 , -- 9999 put name for h-grid
3839             p_information258     => l_wct_rec.ctfn_rqd_when_rl,
3840             p_information11     => l_wct_rec.lack_ctfn_sspnd_wvr_flag,
3841             p_information13     => l_wct_rec.pfd_flag,
3842             p_information12     => l_wct_rec.rqd_flag,
3843             p_information111     => l_wct_rec.wct_attribute1,
3844             p_information120     => l_wct_rec.wct_attribute10,
3845             p_information121     => l_wct_rec.wct_attribute11,
3846             p_information122     => l_wct_rec.wct_attribute12,
3847             p_information123     => l_wct_rec.wct_attribute13,
3848             p_information124     => l_wct_rec.wct_attribute14,
3849             p_information125     => l_wct_rec.wct_attribute15,
3850             p_information126     => l_wct_rec.wct_attribute16,
3851             p_information127     => l_wct_rec.wct_attribute17,
3852             p_information128     => l_wct_rec.wct_attribute18,
3853             p_information129     => l_wct_rec.wct_attribute19,
3854             p_information112     => l_wct_rec.wct_attribute2,
3855             p_information130     => l_wct_rec.wct_attribute20,
3856             p_information131     => l_wct_rec.wct_attribute21,
3857             p_information132     => l_wct_rec.wct_attribute22,
3858             p_information133     => l_wct_rec.wct_attribute23,
3859             p_information134     => l_wct_rec.wct_attribute24,
3860             p_information135     => l_wct_rec.wct_attribute25,
3861             p_information136     => l_wct_rec.wct_attribute26,
3862             p_information137     => l_wct_rec.wct_attribute27,
3863             p_information138     => l_wct_rec.wct_attribute28,
3864             p_information139     => l_wct_rec.wct_attribute29,
3865             p_information113     => l_wct_rec.wct_attribute3,
3866             p_information140     => l_wct_rec.wct_attribute30,
3867             p_information114     => l_wct_rec.wct_attribute4,
3868             p_information115     => l_wct_rec.wct_attribute5,
3869             p_information116     => l_wct_rec.wct_attribute6,
3870             p_information117     => l_wct_rec.wct_attribute7,
3871             p_information118     => l_wct_rec.wct_attribute8,
3872             p_information119     => l_wct_rec.wct_attribute9,
3873             p_information110     => l_wct_rec.wct_attribute_category,
3874             p_information15     => l_wct_rec.wv_prtn_ctfn_cd,
3875             p_information14     => l_wct_rec.wv_prtn_ctfn_typ_cd,
3876             p_information257     => l_wct_rec.wv_prtn_rsn_ptip_id,
3877             p_information265    => l_wct_rec.object_version_number,
3878             --
3879                p_object_version_number          => l_object_version_number,
3880                p_effective_date                 => p_effective_date       );
3881                --
3882 
3883                if l_out_wct_result_id is null then
3884                  l_out_wct_result_id := l_copy_entity_result_id;
3885                end if;
3886 
3887                if l_result_type_cd = 'DISPLAY' then
3888                   l_out_wct_result_id := l_copy_entity_result_id ;
3889                end if;
3890                --
3891 
3892                -- Copy Fast Formulas if any are attached to any column --
3893                ---------------------------------------------------------------
3894                -- CTFN_RQD_WHEN_RL -----------------
3895                ---------------------------------------------------------------
3896 
3897                if to_char(l_wct_rec.ctfn_rqd_when_rl) is not null then
3898                        --
3899                        ben_plan_design_program_module.create_formula_result
3900                        (
3901                         p_validate                       =>  0
3902                        ,p_copy_entity_result_id          =>  l_copy_entity_result_id
3903                        ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
3904                        ,p_formula_id                     =>  l_wct_rec.ctfn_rqd_when_rl
3905                        ,p_business_group_id              =>  l_wct_rec.business_group_id
3906                        ,p_number_of_copies               =>  l_number_of_copies
3907                        ,p_object_version_number          =>  l_object_version_number
3908                        ,p_effective_date                 =>  p_effective_date
3909                        );
3910 
3911                        --
3912                end if;
3913 
3914             end loop;
3915             --
3916           end loop;
3917        ---------------------------------------------------------------
3918        -- END OF BEN_WV_PRTN_RSN_CTFN_PTIP_F ----------------------
3919        ---------------------------------------------------------------
3920           --
3921         end loop;
3922      ---------------------------------------------------------------
3923      -- END OF BEN_WV_PRTN_RSN_PTIP_F ----------------------
3924      ---------------------------------------------------------------
3925    --
3926    end loop;
3927    ---------------------------------------------------------------
3928    -- END OF BEN_PTIP_F ----------------------
3929    ---------------------------------------------------------------
3930    ---------------------------------------------------------------
3931    -- START OF BEN_PLIP_F ----------------------
3932    ---------------------------------------------------------------
3933    --
3934    for l_parent_rec  in c_cpp_from_parent(l_PGM_ID) loop
3935      --
3936      l_plip_id := l_parent_rec.plip_id ;
3937      l_mirror_src_entity_result_id := l_out_pgm_result_id ;
3938 
3939      --
3940      for l_cpp_rec in c_cpp(l_parent_rec.plip_id,l_mirror_src_entity_result_id,'CPP') loop
3941      --
3942      --
3943        l_table_route_id := null ;
3944        open g_table_route('CPP');
3945        fetch g_table_route into l_table_route_id ;
3946        close g_table_route ;
3947        --
3948        l_information5  := get_pl_name(l_cpp_rec.pl_id,p_effective_date); --'Intersection';
3949        --
3950 
3951        if p_effective_date between l_cpp_rec.effective_start_date
3952        and l_cpp_rec.effective_end_date then
3953        --
3954          l_result_type_cd := 'DISPLAY';
3955        else
3956          l_result_type_cd := 'NO DISPLAY';
3957        end if;
3958        --
3959        l_copy_entity_result_id := null;
3960        l_object_version_number := null;
3961        ben_copy_entity_results_api.create_copy_entity_results(
3962         p_copy_entity_result_id           => l_copy_entity_result_id,
3963         p_copy_entity_txn_id             => p_copy_entity_txn_id,
3964         p_result_type_cd                 => l_result_type_cd,
3965         p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3966         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
3967         p_number_of_copies               => l_number_of_copies,
3968         p_table_route_id                 => l_table_route_id,
3969              p_table_alias                    => 'CPP',
3970         p_information1     => l_cpp_rec.plip_id,
3971         p_information2     => l_cpp_rec.EFFECTIVE_START_DATE,
3972         p_information3     => l_cpp_rec.EFFECTIVE_END_DATE,
3973         p_information4     => l_cpp_rec.business_group_id,
3974         p_information5     => l_information5 , -- 9999 put name for h-grid
3975             p_information15     => l_cpp_rec.alws_unrstrctd_enrt_flag,
3976             p_information266     => l_cpp_rec.auto_enrt_mthd_rl,
3977             p_information36     => l_cpp_rec.bnft_or_option_rstrctn_cd,
3978             p_information239     => l_cpp_rec.cmbn_plip_id,
3979             p_information111     => l_cpp_rec.cpp_attribute1,
3980             p_information120     => l_cpp_rec.cpp_attribute10,
3981             p_information121     => l_cpp_rec.cpp_attribute11,
3982             p_information122     => l_cpp_rec.cpp_attribute12,
3983             p_information123     => l_cpp_rec.cpp_attribute13,
3984             p_information124     => l_cpp_rec.cpp_attribute14,
3985             p_information125     => l_cpp_rec.cpp_attribute15,
3986             p_information126     => l_cpp_rec.cpp_attribute16,
3987             p_information127     => l_cpp_rec.cpp_attribute17,
3988             p_information128     => l_cpp_rec.cpp_attribute18,
3989             p_information129     => l_cpp_rec.cpp_attribute19,
3990             p_information112     => l_cpp_rec.cpp_attribute2,
3991             p_information130     => l_cpp_rec.cpp_attribute20,
3992             p_information131     => l_cpp_rec.cpp_attribute21,
3993             p_information132     => l_cpp_rec.cpp_attribute22,
3994             p_information133     => l_cpp_rec.cpp_attribute23,
3995             p_information134     => l_cpp_rec.cpp_attribute24,
3996             p_information135     => l_cpp_rec.cpp_attribute25,
3997             p_information136     => l_cpp_rec.cpp_attribute26,
3998             p_information137     => l_cpp_rec.cpp_attribute27,
3999             p_information138     => l_cpp_rec.cpp_attribute28,
4000             p_information139     => l_cpp_rec.cpp_attribute29,
4001             p_information113     => l_cpp_rec.cpp_attribute3,
4002             p_information140     => l_cpp_rec.cpp_attribute30,
4003             p_information114     => l_cpp_rec.cpp_attribute4,
4004             p_information115     => l_cpp_rec.cpp_attribute5,
4005             p_information116     => l_cpp_rec.cpp_attribute6,
4006             p_information117     => l_cpp_rec.cpp_attribute7,
4007             p_information118     => l_cpp_rec.cpp_attribute8,
4008             p_information119     => l_cpp_rec.cpp_attribute9,
4009             p_information110     => l_cpp_rec.cpp_attribute_category,
4010             p_information28     => l_cpp_rec.cvg_incr_r_decr_only_cd,
4011             p_information21     => l_cpp_rec.dflt_enrt_cd,
4012             p_information264     => l_cpp_rec.dflt_enrt_det_rl,
4013             p_information13     => l_cpp_rec.dflt_flag,
4014             p_information29     => l_cpp_rec.dflt_to_asn_pndg_ctfn_cd,
4015             p_information272     => l_cpp_rec.dflt_to_asn_pndg_ctfn_rl,
4016             p_information16     => l_cpp_rec.drvbl_fctr_apls_rts_flag,
4017             p_information17     => l_cpp_rec.drvbl_fctr_prtn_elig_flag,
4018             p_information18     => l_cpp_rec.elig_apls_flag,
4019             p_information22     => l_cpp_rec.enrt_cd,
4020             p_information25     => l_cpp_rec.enrt_cvg_end_dt_cd,
4021             p_information269     => l_cpp_rec.enrt_cvg_end_dt_rl,
4022             p_information24     => l_cpp_rec.enrt_cvg_strt_dt_cd,
4023             p_information268     => l_cpp_rec.enrt_cvg_strt_dt_rl,
4024             p_information23     => l_cpp_rec.enrt_mthd_cd,
4025             p_information267     => l_cpp_rec.enrt_rl,
4026             p_information141     => l_cpp_rec.ivr_ident,
4027             p_information293     => l_cpp_rec.mn_cvg_amt,
4028             p_information273     => l_cpp_rec.mn_cvg_rl,
4029             p_information294     => l_cpp_rec.mx_cvg_alwd_amt,
4030             p_information295     => l_cpp_rec.mx_cvg_incr_alwd_amt,
4031             p_information296     => l_cpp_rec.mx_cvg_incr_wcf_alwd_amt,
4032             p_information274     => l_cpp_rec.mx_cvg_mlt_incr_num,
4033             p_information275     => l_cpp_rec.mx_cvg_mlt_incr_wcf_num,
4034             p_information276     => l_cpp_rec.mx_cvg_rl,
4035             p_information297     => l_cpp_rec.mx_cvg_wcfn_amt,
4036             p_information277     => l_cpp_rec.mx_cvg_wcfn_mlt_num,
4037             p_information30     => l_cpp_rec.no_mn_cvg_amt_apls_flag,
4038             p_information31     => l_cpp_rec.no_mn_cvg_incr_apls_flag,
4039             p_information32     => l_cpp_rec.no_mx_cvg_amt_apls_flag,
4040             p_information33     => l_cpp_rec.no_mx_cvg_incr_apls_flag,
4041             p_information263     => l_cpp_rec.ordr_num,
4042             p_information38     => l_cpp_rec.per_cvrd_cd,
4043             p_information260     => l_cpp_rec.pgm_id,
4044             p_information261     => l_cpp_rec.pl_id,
4045             p_information14     => l_cpp_rec.plip_stat_cd,
4046             p_information257     => l_cpp_rec.postelcn_edit_rl,
4047             p_information35     => l_cpp_rec.prort_prtl_yr_cvg_rstrn_cd,
4048             p_information278     => l_cpp_rec.prort_prtl_yr_cvg_rstrn_rl,
4049             p_information19     => l_cpp_rec.prtn_elig_ovrid_alwd_flag,
4050             p_information27     => l_cpp_rec.rt_end_dt_cd,
4051             p_information271     => l_cpp_rec.rt_end_dt_rl,
4052             p_information26     => l_cpp_rec.rt_strt_dt_cd,
4053             p_information270     => l_cpp_rec.rt_strt_dt_rl,
4054             p_information11     => l_cpp_rec.short_code,
4055             p_information12     => l_cpp_rec.short_name,
4056             p_information20     => l_cpp_rec.trk_inelig_per_flag,
4057             p_information34     => l_cpp_rec.unsspnd_enrt_cd,
4058             p_information185     => l_cpp_rec.url_ref_name,
4059             p_information37     => l_cpp_rec.vrfy_fmly_mmbr_cd,
4060             p_information279     => l_cpp_rec.vrfy_fmly_mmbr_rl,
4061             p_information265    => l_cpp_rec.object_version_number,
4062             --
4063         p_object_version_number          => l_object_version_number,
4064         p_effective_date                 => p_effective_date       );
4065         --
4066 
4067         if l_out_cpp_result_id is null then
4068           l_out_cpp_result_id := l_copy_entity_result_id;
4069         end if;
4070 
4071         if l_result_type_cd = 'DISPLAY' then
4072           l_out_cpp_result_id := l_copy_entity_result_id ;
4073         end if;
4074 
4075         -- Copy Fast Formulas if any are attached to any column --
4076         ---------------------------------------------------------------
4077         -- AUTO_ENRT_MTHD_RL -----------------
4078         ---------------------------------------------------------------
4079 
4080         if to_char(l_cpp_rec.auto_enrt_mthd_rl) is not null then
4081                 --
4082                 ben_plan_design_program_module.create_formula_result
4083                 (
4084                  p_validate                       =>  0
4085                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4086                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4087                 ,p_formula_id                     =>  l_cpp_rec.auto_enrt_mthd_rl
4088                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4089                 ,p_number_of_copies               =>  l_number_of_copies
4090                 ,p_object_version_number          =>  l_object_version_number
4091                 ,p_effective_date                 =>  p_effective_date
4092                 );
4093 
4094                 --
4095         end if;
4096 
4097 
4098         ---------------------------------------------------------------
4099         -- DFLT_ENRT_DET_RL -----------------
4100         ---------------------------------------------------------------
4101 
4102         if to_char(l_cpp_rec.dflt_enrt_det_rl) is not null then
4103                 --
4104                 ben_plan_design_program_module.create_formula_result
4105                 (
4106                  p_validate                       =>  0
4107                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4108                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4109                 ,p_formula_id                     =>  l_cpp_rec.dflt_enrt_det_rl
4110                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4111                 ,p_number_of_copies               =>  l_number_of_copies
4112                 ,p_object_version_number          =>  l_object_version_number
4113                 ,p_effective_date                 =>  p_effective_date
4114                 );
4115 
4116                 --
4117         end if;
4118 
4119         ---------------------------------------------------------------
4120         -- DFLT_TO_ASN_PNDG_CTFN_RL -----------------
4121         ---------------------------------------------------------------
4122 
4123         if to_char(l_cpp_rec.dflt_to_asn_pndg_ctfn_rl) is not null then
4124                 --
4125                 ben_plan_design_program_module.create_formula_result
4126                 (
4127                  p_validate                       =>  0
4128                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4129                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4130                 ,p_formula_id                     =>  l_cpp_rec.dflt_to_asn_pndg_ctfn_rl
4131                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4132                 ,p_number_of_copies               =>  l_number_of_copies
4133                 ,p_object_version_number          =>  l_object_version_number
4134                 ,p_effective_date                 =>  p_effective_date
4135                 );
4136 
4137                 --
4138         end if;
4139 
4140         ---------------------------------------------------------------
4141         -- ENRT_CVG_END_DT_RL-----------------
4142         ---------------------------------------------------------------
4143 
4144         if to_char(l_cpp_rec.enrt_cvg_end_dt_rl) is not null then
4145                 --
4146                 ben_plan_design_program_module.create_formula_result
4147                 (
4148                  p_validate                       =>  0
4149                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4150                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4151                 ,p_formula_id                     =>  l_cpp_rec.enrt_cvg_end_dt_rl
4152                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4153                 ,p_number_of_copies               =>  l_number_of_copies
4154                 ,p_object_version_number          =>  l_object_version_number
4155                 ,p_effective_date                 =>  p_effective_date
4156                 );
4157 
4158                 --
4159         end if;
4160 
4161         ---------------------------------------------------------------
4162         -- ENRT_CVG_STRT_DT_RL-----------------
4163         ---------------------------------------------------------------
4164 
4165         if to_char(l_cpp_rec.enrt_cvg_strt_dt_rl) is not null then
4166                 --
4167                 ben_plan_design_program_module.create_formula_result
4168                 (
4169                  p_validate                       =>  0
4170                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4171                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4172                 ,p_formula_id                     =>  l_cpp_rec.enrt_cvg_strt_dt_rl
4173                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4174                 ,p_number_of_copies               =>  l_number_of_copies
4175                 ,p_object_version_number          =>  l_object_version_number
4176                 ,p_effective_date                 =>  p_effective_date
4177                 );
4178 
4179                 --
4180         end if;
4181 
4182         ---------------------------------------------------------------
4183         -- ENRT_RL -----------------
4184         ---------------------------------------------------------------
4185 
4186         if to_char(l_cpp_rec.enrt_rl) is not null then
4187                 --
4188                 ben_plan_design_program_module.create_formula_result
4189                 (
4190                  p_validate                       =>  0
4191                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4192                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4193                 ,p_formula_id                     =>  l_cpp_rec.enrt_rl
4194                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4195                 ,p_number_of_copies               =>  l_number_of_copies
4196                 ,p_object_version_number          =>  l_object_version_number
4197                 ,p_effective_date                 =>  p_effective_date
4198                 );
4199 
4200                 --
4201         end if;
4202 
4203         ---------------------------------------------------------------
4204         -- MN_CVG_RL -----------------
4205         ---------------------------------------------------------------
4206 
4207         if to_char(l_cpp_rec.mn_cvg_rl) is not null then
4208                 --
4209                 ben_plan_design_program_module.create_formula_result
4210                 (
4211                  p_validate                       =>  0
4212                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4213                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4214                 ,p_formula_id                     =>  l_cpp_rec.mn_cvg_rl
4215                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4216                 ,p_number_of_copies               =>  l_number_of_copies
4217                 ,p_object_version_number          =>  l_object_version_number
4218                 ,p_effective_date                 =>  p_effective_date
4219                 );
4220 
4221                 --
4222         end if;
4223 
4224         ---------------------------------------------------------------
4225         -- MX_CVG_RL -----------------
4226         ---------------------------------------------------------------
4227 
4228         if to_char(l_cpp_rec.mx_cvg_rl) is not null then
4229                 --
4230                 ben_plan_design_program_module.create_formula_result
4231                 (
4232                  p_validate                       =>  0
4233                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4234                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4235                 ,p_formula_id                     =>  l_cpp_rec.mx_cvg_rl
4236                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4237                 ,p_number_of_copies               =>  l_number_of_copies
4238                 ,p_object_version_number          =>  l_object_version_number
4239                 ,p_effective_date                 =>  p_effective_date
4240                 );
4241 
4242                 --
4243         end if;
4244 
4245 
4246         ---------------------------------------------------------------
4247         -- POSTELCN_EDIT_RL -----------------
4248         ---------------------------------------------------------------
4249 
4250         if to_char(l_cpp_rec.postelcn_edit_rl) is not null then
4251                 --
4252                 ben_plan_design_program_module.create_formula_result
4253                 (
4254                  p_validate                       =>  0
4255                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4256                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4257                 ,p_formula_id                     =>  l_cpp_rec.postelcn_edit_rl
4258                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4259                 ,p_number_of_copies               =>  l_number_of_copies
4260                 ,p_object_version_number          =>  l_object_version_number
4261                 ,p_effective_date                 =>  p_effective_date
4262                 );
4263 
4264                 --
4265         end if;
4266 
4267         ---------------------------------------------------------------
4268         -- PRORT_PRTL_YR_CVG_RSTRN_RL -----------------
4269         ---------------------------------------------------------------
4270 
4271         if to_char(l_cpp_rec.prort_prtl_yr_cvg_rstrn_rl) is not null then
4272                 --
4273                 ben_plan_design_program_module.create_formula_result
4274                 (
4275                  p_validate                       =>  0
4276                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4277                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4278                 ,p_formula_id                     =>  l_cpp_rec.prort_prtl_yr_cvg_rstrn_rl
4279                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4280                 ,p_number_of_copies               =>  l_number_of_copies
4281                 ,p_object_version_number          =>  l_object_version_number
4282                 ,p_effective_date                 =>  p_effective_date
4283                 );
4284 
4285                 --
4286         end if;
4287 
4288         ---------------------------------------------------------------
4289         -- RT_END_DT_RL -----------------
4290         ---------------------------------------------------------------
4291 
4292         if to_char(l_cpp_rec.rt_end_dt_rl) is not null then
4293                 --
4294                 ben_plan_design_program_module.create_formula_result
4295                 (
4296                  p_validate                       =>  0
4297                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4298                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4299                 ,p_formula_id                     =>  l_cpp_rec.rt_end_dt_rl
4300                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4301                 ,p_number_of_copies               =>  l_number_of_copies
4302                 ,p_object_version_number          =>  l_object_version_number
4303                 ,p_effective_date                 =>  p_effective_date
4304                 );
4305 
4306                 --
4307         end if;
4308 
4309         ---------------------------------------------------------------
4310         -- RT_STRT_DT_RL -----------------
4311         ---------------------------------------------------------------
4312 
4313         if to_char(l_cpp_rec.rt_strt_dt_rl) is not null then
4314                 --
4315                 ben_plan_design_program_module.create_formula_result
4316                 (
4317                  p_validate                       =>  0
4318                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4319                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4320                 ,p_formula_id                     =>  l_cpp_rec.rt_strt_dt_rl
4321                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4322                 ,p_number_of_copies               =>  l_number_of_copies
4323                 ,p_object_version_number          =>  l_object_version_number
4324                 ,p_effective_date                 =>  p_effective_date
4325                 );
4326 
4327                 --
4328         end if;
4329 
4330         ---------------------------------------------------------------
4331         -- VRFY_FMLY_MMBR_RL -----------------
4332         ---------------------------------------------------------------
4333 
4334         if to_char(l_cpp_rec.vrfy_fmly_mmbr_rl) is not null then
4335                 --
4336                 ben_plan_design_program_module.create_formula_result
4337                 (
4338                  p_validate                       =>  0
4339                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4340                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4341                 ,p_formula_id                     =>  l_cpp_rec.vrfy_fmly_mmbr_rl
4342                 ,p_business_group_id              =>  l_cpp_rec.business_group_id
4343                 ,p_number_of_copies               =>  l_number_of_copies
4344                 ,p_object_version_number          =>  l_object_version_number
4345                 ,p_effective_date                 =>  p_effective_date
4346                 );
4347 
4348                 --
4349         end if;
4350    --
4351    end loop;
4352    --
4353    hr_utility.set_location('l_copy_entity_result_id '||l_copy_entity_result_id,20);
4354    hr_utility.set_location('p_copy_entity_txn_id    '||p_copy_entity_txn_id,20);
4355    hr_utility.set_location('l_parent_rec.plip_id    '||l_parent_rec.plip_id,20);
4356    hr_utility.set_location('p_business_group_id     '||p_business_group_id,20);
4357        -- ------------------------------------------------------------------------
4358        -- Eligibility Profiles
4359        -- ------------------------------------------------------------------------
4360           ben_plan_design_elpro_module.create_elpro_results
4361           (
4362               p_validate                     => p_validate
4363              ,p_copy_entity_result_id        => l_out_cpp_result_id
4364              ,p_copy_entity_txn_id           => p_copy_entity_txn_id
4365              ,p_pgm_id                       => null
4366              ,p_ptip_id                      => null
4367              ,p_plip_id                      => l_plip_id
4368              ,p_pl_id                        => null
4369              ,p_oipl_id                      => null
4370              ,p_business_group_id            => p_business_group_id
4371              ,p_number_of_copies             => p_number_of_copies
4372              ,p_object_version_number        => l_object_version_number
4373              ,p_effective_date               => p_effective_date
4374              ,p_parent_entity_result_id      => l_out_cpp_result_id
4375           );
4376          --
4377             -- ------------------------------------------------------------------------
4378             -- Standard Rates ,Flex Credits at Plip level
4379             -- ------------------------------------------------------------------------
4380           ben_pd_rate_and_cvg_module.create_rate_results
4381             (
4382               p_validate                   => p_validate
4383              ,p_copy_entity_result_id      => l_out_cpp_result_id
4384              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
4385              ,p_pgm_id                     => null
4386              ,p_ptip_id                    => null
4387              ,p_plip_id                    => l_plip_id
4388              ,p_pl_id                      => null
4389              ,p_oiplip_id                  => null
4390              ,p_cmbn_plip_id               => null
4391              ,p_cmbn_ptip_id               => null
4392              ,p_cmbn_ptip_opt_id           => null
4393              ,p_business_group_id          => p_business_group_id
4394              ,p_number_of_copies           => p_number_of_copies
4395              ,p_object_version_number      => l_object_version_number
4396              ,p_effective_date             => p_effective_date
4397              ,p_parent_entity_result_id    => l_out_cpp_result_id
4398              ) ;
4399             -- ------------------------------------------------------------------------
4400             -- Benefit Pools  Plip Level
4401             -- ------------------------------------------------------------------------
4402           ben_pd_rate_and_cvg_module.create_bnft_pool_results
4403             (
4404               p_validate                   =>p_validate
4405              ,p_copy_entity_result_id      =>l_out_cpp_result_id
4406              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
4407              ,p_pgm_id                     => null
4408              ,p_ptip_id                    => null
4409              ,p_plip_id                    => l_plip_id
4410              ,p_oiplip_id                  => null
4411              ,p_cmbn_plip_id               => null
4412              ,p_cmbn_ptip_id               => null
4413              ,p_cmbn_ptip_opt_id           => null
4414              ,p_business_group_id          => p_business_group_id
4415              ,p_number_of_copies           => p_number_of_copies
4416              ,p_object_version_number      => l_object_version_number
4417              ,p_effective_date             => p_effective_date
4418              ,p_parent_entity_result_id    => l_out_cpp_result_id
4419              ) ;
4420 
4421             -- ------------------------------------------------------------------------
4422             -- Coverage Calculations PLIP Level
4423             -- ------------------------------------------------------------------------
4424 
4425             ben_pd_rate_and_cvg_module.create_coverage_results
4426             (
4427               p_validate                   => p_validate
4428              ,p_copy_entity_result_id      => l_out_cpp_result_id
4429              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
4430              ,p_plip_id                    => l_plip_id
4431              ,p_pl_id                      => null
4432              ,p_oipl_id                    => null
4433              ,p_business_group_id          => p_business_group_id
4434              ,p_number_of_copies           => p_number_of_copies
4435              ,p_object_version_number      => l_object_version_number
4436              ,p_effective_date             => p_effective_date
4437              ,p_parent_entity_result_id    => l_out_cpp_result_id
4438            ) ;
4439 
4440          ---------------------------------------------------------------
4441          -- START OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
4442          ---------------------------------------------------------------
4443          --
4444          for l_parent_rec  in c_peo2_from_parent(l_PLIP_ID) loop
4445             --
4446             l_mirror_src_entity_result_id := l_out_cpp_result_id ;
4447             --
4448             l_elig_to_prte_rsn_id2 := l_parent_rec.elig_to_prte_rsn_id ;
4449             --
4450             for l_peo_rec in c_peo2(l_parent_rec.elig_to_prte_rsn_id,l_mirror_src_entity_result_id,'PEO' ) loop
4451               --
4452               l_table_route_id := null ;
4453               open g_table_route('PEO');
4454                 fetch g_table_route into l_table_route_id ;
4455               close g_table_route ;
4456               --
4457               l_information5  := get_ler_name(l_peo_rec.ler_id,p_effective_date); --'Intersection';
4458               --
4459               if p_effective_date between l_peo_rec.effective_start_date
4460                  and l_peo_rec.effective_end_date then
4461                --
4462                  l_result_type_cd := 'DISPLAY';
4463               else
4464                  l_result_type_cd := 'NO DISPLAY';
4465               end if;
4466                 --
4467               l_copy_entity_result_id := null;
4468               l_object_version_number := null;
4469               ben_copy_entity_results_api.create_copy_entity_results(
4470                 p_copy_entity_result_id          => l_copy_entity_result_id,
4471                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
4472                 p_result_type_cd                 => l_result_type_cd,
4473                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
4474                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
4475                 p_number_of_copies               => l_number_of_copies,
4476                 p_table_route_id                 => l_table_route_id,
4477                 p_table_alias                    => 'PEO',
4478                 p_information1     => l_peo_rec.elig_to_prte_rsn_id,
4479                 p_information2     => l_peo_rec.EFFECTIVE_START_DATE,
4480                 p_information3     => l_peo_rec.EFFECTIVE_END_DATE,
4481                 p_information4     => l_peo_rec.business_group_id,
4482                 p_information5     => l_information5 , -- 9999 put name for h-grid
4483             p_information21     => l_peo_rec.elig_inelig_cd,
4484             p_information20     => l_peo_rec.ignr_prtn_ovrid_flag,
4485             p_information257     => l_peo_rec.ler_id,
4486             p_information17     => l_peo_rec.mx_poe_apls_cd,
4487             p_information16     => l_peo_rec.mx_poe_det_dt_cd,
4488             p_information272     => l_peo_rec.mx_poe_det_dt_rl,
4489             p_information270     => l_peo_rec.mx_poe_rl,
4490             p_information15     => l_peo_rec.mx_poe_uom,
4491             p_information269     => l_peo_rec.mx_poe_val,
4492             p_information258     => l_peo_rec.oipl_id,
4493             p_information111     => l_peo_rec.peo_attribute1,
4494             p_information120     => l_peo_rec.peo_attribute10,
4495             p_information121     => l_peo_rec.peo_attribute11,
4496             p_information122     => l_peo_rec.peo_attribute12,
4497             p_information123     => l_peo_rec.peo_attribute13,
4498             p_information124     => l_peo_rec.peo_attribute14,
4499             p_information125     => l_peo_rec.peo_attribute15,
4500             p_information126     => l_peo_rec.peo_attribute16,
4501             p_information127     => l_peo_rec.peo_attribute17,
4502             p_information128     => l_peo_rec.peo_attribute18,
4503             p_information129     => l_peo_rec.peo_attribute19,
4504             p_information112     => l_peo_rec.peo_attribute2,
4505             p_information130     => l_peo_rec.peo_attribute20,
4506             p_information131     => l_peo_rec.peo_attribute21,
4507             p_information132     => l_peo_rec.peo_attribute22,
4508             p_information133     => l_peo_rec.peo_attribute23,
4509             p_information134     => l_peo_rec.peo_attribute24,
4510             p_information135     => l_peo_rec.peo_attribute25,
4511             p_information136     => l_peo_rec.peo_attribute26,
4512             p_information137     => l_peo_rec.peo_attribute27,
4513             p_information138     => l_peo_rec.peo_attribute28,
4514             p_information139     => l_peo_rec.peo_attribute29,
4515             p_information113     => l_peo_rec.peo_attribute3,
4516             p_information140     => l_peo_rec.peo_attribute30,
4517             p_information114     => l_peo_rec.peo_attribute4,
4518             p_information115     => l_peo_rec.peo_attribute5,
4519             p_information116     => l_peo_rec.peo_attribute6,
4520             p_information117     => l_peo_rec.peo_attribute7,
4521             p_information118     => l_peo_rec.peo_attribute8,
4522             p_information119     => l_peo_rec.peo_attribute9,
4523             p_information110     => l_peo_rec.peo_attribute_category,
4524             p_information260     => l_peo_rec.pgm_id,
4525             p_information261     => l_peo_rec.pl_id,
4526             p_information256     => l_peo_rec.plip_id,
4527             p_information12     => l_peo_rec.prtn_eff_end_dt_cd,
4528             p_information266     => l_peo_rec.prtn_eff_end_dt_rl,
4529             p_information11     => l_peo_rec.prtn_eff_strt_dt_cd,
4530             p_information264     => l_peo_rec.prtn_eff_strt_dt_rl,
4531             p_information19     => l_peo_rec.prtn_ovridbl_flag,
4532             p_information259     => l_peo_rec.ptip_id,
4533             p_information18     => l_peo_rec.vrfy_fmly_mmbr_cd,
4534             p_information273     => l_peo_rec.vrfy_fmly_mmbr_rl,
4535             p_information14     => l_peo_rec.wait_perd_dt_to_use_cd,
4536             p_information268     => l_peo_rec.wait_perd_dt_to_use_rl,
4537             p_information271     => l_peo_rec.wait_perd_rl,
4538             p_information13     => l_peo_rec.wait_perd_uom,
4539             p_information267     => l_peo_rec.wait_perd_val,
4540             p_information265    => l_peo_rec.object_version_number,
4541             --
4542                 p_object_version_number          => l_object_version_number,
4543                 p_effective_date                 => p_effective_date       );
4544                 --
4545 
4546                 if l_out_peo2_result_id is null then
4547                   l_out_peo2_result_id := l_copy_entity_result_id;
4548                 end if;
4549 
4550                 if l_result_type_cd = 'DISPLAY' then
4551                    l_out_peo2_result_id := l_copy_entity_result_id ;
4552                 end if;
4553                 --
4554 
4555                 -- Copy Fast Formulas if any are attached to any column --
4556                  ---------------------------------------------------------------
4557                  -- MX_POE_DET_DT_RL  -----------------
4558                  ---------------------------------------------------------------
4559 
4560                  if to_char(l_peo_rec.mx_poe_det_dt_rl) is not null then
4561                          --
4562                          ben_plan_design_program_module.create_formula_result
4563                          (
4564                           p_validate                       =>  0
4565                          ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4566                          ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4567                          ,p_formula_id                     =>  l_peo_rec.mx_poe_det_dt_rl
4568                          ,p_business_group_id              =>  l_peo_rec.business_group_id
4569                          ,p_number_of_copies               =>  l_number_of_copies
4570                          ,p_object_version_number          =>  l_object_version_number
4571                          ,p_effective_date                 =>  p_effective_date
4572                          );
4573 
4574                          --
4575                  end if;
4576 
4577                   ---------------------------------------------------------------
4578                   -- MX_POE_RL  -----------------
4579                   ---------------------------------------------------------------
4580 
4581                   if to_char(l_peo_rec.mx_poe_rl) is not null then
4582                           --
4583                           ben_plan_design_program_module.create_formula_result
4584                           (
4585                            p_validate                       =>  0
4586                           ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4587                           ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4588                           ,p_formula_id                     =>  l_peo_rec.mx_poe_rl
4589                           ,p_business_group_id              =>  l_peo_rec.business_group_id
4590                           ,p_number_of_copies               =>  l_number_of_copies
4591                           ,p_object_version_number          =>  l_object_version_number
4592                           ,p_effective_date                 =>  p_effective_date
4593                           );
4594 
4595                           --
4596                  end if;
4597 
4598                  ---------------------------------------------------------------
4599                  -- PRTN_EFF_END_DT_RL  -----------------
4600                  ---------------------------------------------------------------
4601 
4602                    if to_char(l_peo_rec.prtn_eff_end_dt_rl) is not null then
4603                            --
4604                            ben_plan_design_program_module.create_formula_result
4605                            (
4606                             p_validate                       =>  0
4607                            ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4608                            ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4609                            ,p_formula_id                     =>  l_peo_rec.prtn_eff_end_dt_rl
4610                            ,p_business_group_id              =>  l_peo_rec.business_group_id
4611                            ,p_number_of_copies               =>  l_number_of_copies
4612                            ,p_object_version_number          =>  l_object_version_number
4613                            ,p_effective_date                 =>  p_effective_date
4614                            );
4615 
4616                            --
4617                   end if;
4618 
4619                   ---------------------------------------------------------------
4620                   -- PRTN_EFF_STRT_DT_RL  -----------------
4621                   ---------------------------------------------------------------
4622 
4623                    if to_char(l_peo_rec.prtn_eff_strt_dt_rl) is not null then
4624                             --
4625                             ben_plan_design_program_module.create_formula_result
4626                             (
4627                              p_validate                       =>  0
4628                             ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4629                             ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4630                             ,p_formula_id                     =>  l_peo_rec.prtn_eff_strt_dt_rl
4631                             ,p_business_group_id              =>  l_peo_rec.business_group_id
4632                             ,p_number_of_copies               =>  l_number_of_copies
4633                             ,p_object_version_number          =>  l_object_version_number
4634                             ,p_effective_date                 =>  p_effective_date
4635                             );
4636 
4637                             --
4638                    end if;
4639 
4640                   ---------------------------------------------------------------
4641                   -- VRFY_FMLY_MMBR_RL -----------------
4642                   ---------------------------------------------------------------
4643 
4644                    if to_char(l_peo_rec.vrfy_fmly_mmbr_rl) is not null then
4645                             --
4646                             ben_plan_design_program_module.create_formula_result
4647                             (
4648                              p_validate                       =>  0
4649                             ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4650                             ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4651                             ,p_formula_id                     =>  l_peo_rec.vrfy_fmly_mmbr_rl
4652                             ,p_business_group_id              =>  l_peo_rec.business_group_id
4653                             ,p_number_of_copies               =>  l_number_of_copies
4654                             ,p_object_version_number          =>  l_object_version_number
4655                             ,p_effective_date                 =>  p_effective_date
4656                             );
4657 
4658                             --
4659                    end if;
4660 
4661                   ---------------------------------------------------------------
4662                   -- WAIT_PERD_DT_TO_USE_RL -----------------
4663                   ---------------------------------------------------------------
4664 
4665                    if to_char(l_peo_rec.wait_perd_dt_to_use_rl) is not null then
4666                             --
4667                             ben_plan_design_program_module.create_formula_result
4668                             (
4669                              p_validate                       =>  0
4670                             ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4671                             ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4672                             ,p_formula_id                     =>  l_peo_rec.wait_perd_dt_to_use_rl
4673                             ,p_business_group_id              =>  l_peo_rec.business_group_id
4674                             ,p_number_of_copies               =>  l_number_of_copies
4675                             ,p_object_version_number          =>  l_object_version_number
4676                             ,p_effective_date                 =>  p_effective_date
4677                             );
4678 
4679                             --
4680                    end if;
4681 
4682                    ---------------------------------------------------------------
4683                    -- WAIT_PERD_RL -----------------
4684                    ---------------------------------------------------------------
4685 
4686                    if to_char(l_peo_rec.wait_perd_rl) is not null then
4687                              --
4688                              ben_plan_design_program_module.create_formula_result
4689                              (
4690                               p_validate                       =>  0
4691                              ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4692                              ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4693                              ,p_formula_id                     =>  l_peo_rec.wait_perd_rl
4694                              ,p_business_group_id              =>  l_peo_rec.business_group_id
4695                              ,p_number_of_copies               =>  l_number_of_copies
4696                              ,p_object_version_number          =>  l_object_version_number
4697                              ,p_effective_date                 =>  p_effective_date
4698                              );
4699 
4700                              --
4701                    end if;
4702                    --
4703                    ben_plan_design_plan_module.create_ler_result (
4704                       p_validate                       => p_validate
4705                       ,p_copy_entity_result_id          => l_copy_entity_result_id
4706                       ,p_copy_entity_txn_id             => p_copy_entity_txn_id
4707                       ,p_ler_id                         => l_peo_rec.ler_id
4708                       ,p_business_group_id              => p_business_group_id
4709                       ,p_number_of_copies               => l_number_of_copies
4710                       ,p_object_version_number          => l_object_version_number
4711                       ,p_effective_date                 => p_effective_date
4712                       );
4713                    --
4714              end loop;
4715              --
4716            end loop;
4717         ---------------------------------------------------------------
4718         -- END OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
4719         ---------------------------------------------------------------
4720          ---------------------------------------------------------------
4721          -- START OF BEN_LER_BNFT_RSTRN_F ----------------------
4722          ---------------------------------------------------------------
4723          --
4724          for l_parent_rec  in c_lbr1_from_parent(l_PLIP_ID) loop
4725             --
4726             l_mirror_src_entity_result_id := l_out_cpp_result_id ;
4727             --
4728             l_ler_bnft_rstrn_id := l_parent_rec.ler_bnft_rstrn_id ;
4729             --
4730             for l_lbr_rec in c_lbr1(l_parent_rec.ler_bnft_rstrn_id,l_mirror_src_entity_result_id,'LBR' ) loop
4731               --
4732               l_table_route_id := null ;
4733               open g_table_route('LBR');
4734                 fetch g_table_route into l_table_route_id ;
4735               close g_table_route ;
4736               --
4737               l_information5  := get_ler_name(l_lbr_rec.ler_id,p_effective_date); --'Intersection';
4738               --
4739               if p_effective_date between l_lbr_rec.effective_start_date
4740                  and l_lbr_rec.effective_end_date then
4741                --
4742                  l_result_type_cd := 'DISPLAY';
4743               else
4744                  l_result_type_cd := 'NO DISPLAY';
4745               end if;
4746                 --
4747               l_copy_entity_result_id := null;
4748               l_object_version_number := null;
4749               ben_copy_entity_results_api.create_copy_entity_results(
4750                 p_copy_entity_result_id          => l_copy_entity_result_id,
4751                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
4752                 p_result_type_cd                 => l_result_type_cd,
4753                 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
4754                 p_parent_entity_result_id        => l_mirror_src_entity_result_id,
4755                 p_number_of_copies               => l_number_of_copies,
4756                 p_table_route_id                 => l_table_route_id,
4757              p_table_alias                    => 'LBR',
4758                 p_information1     => l_lbr_rec.ler_bnft_rstrn_id,
4759                 p_information2     => l_lbr_rec.EFFECTIVE_START_DATE,
4760                 p_information3     => l_lbr_rec.EFFECTIVE_END_DATE,
4761                 p_information4     => l_lbr_rec.business_group_id,
4762                 p_information5     => l_information5 , -- 9999 put name for h-grid
4763             p_information12     => l_lbr_rec.cvg_incr_r_decr_only_cd,
4764             p_information11     => l_lbr_rec.dflt_to_asn_pndg_ctfn_cd,
4765             p_information262     => l_lbr_rec.dflt_to_asn_pndg_ctfn_rl,
4766             p_information111     => l_lbr_rec.lbr_attribute1,
4767             p_information120     => l_lbr_rec.lbr_attribute10,
4768             p_information121     => l_lbr_rec.lbr_attribute11,
4769             p_information122     => l_lbr_rec.lbr_attribute12,
4770             p_information123     => l_lbr_rec.lbr_attribute13,
4771             p_information124     => l_lbr_rec.lbr_attribute14,
4772             p_information125     => l_lbr_rec.lbr_attribute15,
4773             p_information126     => l_lbr_rec.lbr_attribute16,
4774             p_information127     => l_lbr_rec.lbr_attribute17,
4775             p_information128     => l_lbr_rec.lbr_attribute18,
4776             p_information129     => l_lbr_rec.lbr_attribute19,
4777             p_information112     => l_lbr_rec.lbr_attribute2,
4778             p_information130     => l_lbr_rec.lbr_attribute20,
4779             p_information131     => l_lbr_rec.lbr_attribute21,
4780             p_information132     => l_lbr_rec.lbr_attribute22,
4781             p_information133     => l_lbr_rec.lbr_attribute23,
4782             p_information134     => l_lbr_rec.lbr_attribute24,
4783             p_information135     => l_lbr_rec.lbr_attribute25,
4784             p_information136     => l_lbr_rec.lbr_attribute26,
4785             p_information137     => l_lbr_rec.lbr_attribute27,
4786             p_information138     => l_lbr_rec.lbr_attribute28,
4787             p_information139     => l_lbr_rec.lbr_attribute29,
4788             p_information113     => l_lbr_rec.lbr_attribute3,
4789             p_information140     => l_lbr_rec.lbr_attribute30,
4790             p_information114     => l_lbr_rec.lbr_attribute4,
4791             p_information115     => l_lbr_rec.lbr_attribute5,
4792             p_information116     => l_lbr_rec.lbr_attribute6,
4793             p_information117     => l_lbr_rec.lbr_attribute7,
4794             p_information118     => l_lbr_rec.lbr_attribute8,
4795             p_information119     => l_lbr_rec.lbr_attribute9,
4796             p_information110     => l_lbr_rec.lbr_attribute_category,
4797             p_information257     => l_lbr_rec.ler_id,
4798             p_information297     => l_lbr_rec.mn_cvg_amt,
4799             p_information268     => l_lbr_rec.mn_cvg_rl,
4800             p_information295     => l_lbr_rec.mx_cvg_alwd_amt,
4801             p_information294     => l_lbr_rec.mx_cvg_incr_alwd_amt,
4802             p_information293     => l_lbr_rec.mx_cvg_incr_wcf_alwd_amt,
4803             p_information263     => l_lbr_rec.mx_cvg_mlt_incr_num,
4804             p_information264     => l_lbr_rec.mx_cvg_mlt_incr_wcf_num,
4805             p_information266     => l_lbr_rec.mx_cvg_rl,
4806             p_information296     => l_lbr_rec.mx_cvg_wcfn_amt,
4807             p_information267     => l_lbr_rec.mx_cvg_wcfn_mlt_num,
4808             p_information14     => l_lbr_rec.no_mn_cvg_incr_apls_flag,
4809             p_information15     => l_lbr_rec.no_mx_cvg_amt_apls_flag,
4810             p_information16     => l_lbr_rec.no_mx_cvg_incr_apls_flag,
4811             p_information261     => l_lbr_rec.pl_id,
4812             p_information256     => l_lbr_rec.plip_id,
4813             p_information13     => l_lbr_rec.unsspnd_enrt_cd,
4814             p_information265    => l_lbr_rec.object_version_number,
4815             --
4816                 p_object_version_number          => l_object_version_number,
4817                 p_effective_date                 => p_effective_date       );
4818                 --
4819 
4820                 if l_out_lbr_result_id is null then
4821                   l_out_lbr_result_id := l_copy_entity_result_id;
4822                 end if;
4823 
4824                 if l_result_type_cd = 'DISPLAY' then
4825                    l_out_lbr_result_id := l_copy_entity_result_id ;
4826                 end if;
4827                 --
4828 
4829                 -- Copy Fast Formulas if any are attached to any column --
4830                 ---------------------------------------------------------------
4831                 --  DFLT_TO_ASN_PNDG_CTFN_RL -----------------
4832                 ---------------------------------------------------------------
4833 
4834                 if to_char(l_lbr_rec.dflt_to_asn_pndg_ctfn_rl) is not null then
4835                         --
4836                         ben_plan_design_program_module.create_formula_result
4837                         (
4838                          p_validate                       =>  0
4839                         ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4840                         ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4841                         ,p_formula_id                     =>  l_lbr_rec.dflt_to_asn_pndg_ctfn_rl
4842                         ,p_business_group_id              =>  l_lbr_rec.business_group_id
4843                         ,p_number_of_copies               =>  l_number_of_copies
4844                         ,p_object_version_number          =>  l_object_version_number
4845                         ,p_effective_date                 =>  p_effective_date
4846                         );
4847 
4848                         --
4849                 end if;
4850                 ---------------------------------------------------------------
4851                 --  MN_CVG_RL -----------------
4852                 ---------------------------------------------------------------
4853 
4854                 if to_char(l_lbr_rec.mn_cvg_rl) is not null then
4855                         --
4856                         ben_plan_design_program_module.create_formula_result
4857                         (
4858                          p_validate                       =>  0
4859                         ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4860                         ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4861                         ,p_formula_id                     =>  l_lbr_rec.mn_cvg_rl
4862                         ,p_business_group_id              =>  l_lbr_rec.business_group_id
4863                         ,p_number_of_copies               =>  l_number_of_copies
4864                         ,p_object_version_number          =>  l_object_version_number
4865                         ,p_effective_date                 =>  p_effective_date
4866                         );
4867 
4868                         --
4869                 end if;
4870                 ---------------------------------------------------------------
4871                 --  MX_CVG_RL -----------------
4872                 ---------------------------------------------------------------
4873 
4874                 if to_char(l_lbr_rec.mx_cvg_rl) is not null then
4875                         --
4876                         ben_plan_design_program_module.create_formula_result
4877                         (
4878                          p_validate                       =>  0
4879                         ,p_copy_entity_result_id          =>  l_copy_entity_result_id
4880                         ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
4881                         ,p_formula_id                     =>  l_lbr_rec.mx_cvg_rl
4882                         ,p_business_group_id              =>  l_lbr_rec.business_group_id
4883                         ,p_number_of_copies               =>  l_number_of_copies
4884                         ,p_object_version_number          =>  l_object_version_number
4885                         ,p_effective_date                 =>  p_effective_date
4886                         );
4887 
4888                         --
4889                 end if;
4890 
4891 
4892              end loop;
4893              --
4894            end loop;
4895         ---------------------------------------------------------------
4896         -- END OF BEN_LER_BNFT_RSTRN_F ----------------------
4897         ---------------------------------------------------------------
4898         ---------------------------------------------------------------
4899         -- START OF BEN_LER_CHG_PLIP_ENRT_F ----------------------
4900         ---------------------------------------------------------------
4901         --
4902         for l_parent_rec  in c_lpr_from_parent(l_PLIP_ID) loop
4903           --
4904           l_mirror_src_entity_result_id := l_out_cpp_result_id ;
4905           --
4906           l_ler_chg_plip_enrt_id := l_parent_rec.ler_chg_plip_enrt_id ;
4907           --
4908           for l_lpr_rec in c_lpr(l_parent_rec.ler_chg_plip_enrt_id,l_mirror_src_entity_result_id,'LPR1') loop
4909           --
4910             l_table_route_id := null ;
4911             open g_table_route('LPR1');
4912             fetch g_table_route into l_table_route_id ;
4913             close g_table_route ;
4914             --
4915             l_information5  := get_ler_name(l_lpr_rec.ler_id,p_effective_date); --'Intersection';
4916             --
4917             if p_effective_date between l_lpr_rec.effective_start_date
4918              and l_lpr_rec.effective_end_date then
4919              --
4920               l_result_type_cd := 'DISPLAY';
4921             else
4922               l_result_type_cd := 'NO DISPLAY';
4923             end if;
4924             --
4925             l_copy_entity_result_id := null;
4926             l_object_version_number := null;
4927             ben_copy_entity_results_api.create_copy_entity_results(
4928               p_copy_entity_result_id           => l_copy_entity_result_id,
4929               p_copy_entity_txn_id             => p_copy_entity_txn_id,
4930               p_result_type_cd                 => l_result_type_cd,
4931               p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
4932               p_parent_entity_result_id      => l_mirror_src_entity_result_id,
4933               p_number_of_copies               => l_number_of_copies,
4934               p_table_route_id                 => l_table_route_id,
4935              p_table_alias                    => 'LPR1',
4936               p_information1     => l_lpr_rec.ler_chg_plip_enrt_id,
4937               p_information2     => l_lpr_rec.EFFECTIVE_START_DATE,
4938               p_information3     => l_lpr_rec.EFFECTIVE_END_DATE,
4939               p_information4     => l_lpr_rec.business_group_id,
4940               p_information5     => l_information5 , -- 9999 put name for h-grid
4941             p_information262     => l_lpr_rec.auto_enrt_mthd_rl,
4942             p_information12     => l_lpr_rec.crnt_enrt_prclds_chg_flag,
4943             p_information15     => l_lpr_rec.dflt_enrt_cd,
4944             p_information263     => l_lpr_rec.dflt_enrt_rl,
4945             p_information13     => l_lpr_rec.dflt_flag,
4946             p_information16     => l_lpr_rec.enrt_cd,
4947             p_information17     => l_lpr_rec.enrt_mthd_cd,
4948             p_information258     => l_lpr_rec.enrt_rl,
4949             p_information257     => l_lpr_rec.ler_id,
4950             p_information111     => l_lpr_rec.lpr_attribute1,
4951             p_information120     => l_lpr_rec.lpr_attribute10,
4952             p_information121     => l_lpr_rec.lpr_attribute11,
4953             p_information122     => l_lpr_rec.lpr_attribute12,
4954             p_information123     => l_lpr_rec.lpr_attribute13,
4955             p_information124     => l_lpr_rec.lpr_attribute14,
4956             p_information125     => l_lpr_rec.lpr_attribute15,
4957             p_information126     => l_lpr_rec.lpr_attribute16,
4958             p_information127     => l_lpr_rec.lpr_attribute17,
4959             p_information128     => l_lpr_rec.lpr_attribute18,
4960             p_information129     => l_lpr_rec.lpr_attribute19,
4961             p_information112     => l_lpr_rec.lpr_attribute2,
4962             p_information130     => l_lpr_rec.lpr_attribute20,
4963             p_information131     => l_lpr_rec.lpr_attribute21,
4964             p_information132     => l_lpr_rec.lpr_attribute22,
4965             p_information133     => l_lpr_rec.lpr_attribute23,
4966             p_information134     => l_lpr_rec.lpr_attribute24,
4967             p_information135     => l_lpr_rec.lpr_attribute25,
4968             p_information136     => l_lpr_rec.lpr_attribute26,
4969             p_information137     => l_lpr_rec.lpr_attribute27,
4970             p_information138     => l_lpr_rec.lpr_attribute28,
4971             p_information139     => l_lpr_rec.lpr_attribute29,
4972             p_information113     => l_lpr_rec.lpr_attribute3,
4973             p_information140     => l_lpr_rec.lpr_attribute30,
4974             p_information114     => l_lpr_rec.lpr_attribute4,
4975             p_information115     => l_lpr_rec.lpr_attribute5,
4976             p_information116     => l_lpr_rec.lpr_attribute6,
4977             p_information117     => l_lpr_rec.lpr_attribute7,
4978             p_information118     => l_lpr_rec.lpr_attribute8,
4979             p_information119     => l_lpr_rec.lpr_attribute9,
4980             p_information110     => l_lpr_rec.lpr_attribute_category,
4981             p_information256     => l_lpr_rec.plip_id,
4982             p_information14     => l_lpr_rec.stl_elig_cant_chg_flag,
4983             p_information11     => l_lpr_rec.tco_chg_enrt_cd,
4984             p_information265    => l_lpr_rec.object_version_number,
4985             --
4986               p_object_version_number          => l_object_version_number,
4987               p_effective_date                 => p_effective_date       );
4988               --
4989 
4990             if l_out_lpr_result_id is null then
4991               l_out_lpr_result_id := l_copy_entity_result_id;
4992             end if;
4993 
4994             if l_result_type_cd = 'DISPLAY' then
4995                l_out_lpr_result_id := l_copy_entity_result_id ;
4996             end if;
4997             --
4998 
4999             -- Copy Fast Formulas if any are attached to any column --
5000             ---------------------------------------------------------------
5001             --  AUTO_ENRT_MTHD_RL -----------------
5002             ---------------------------------------------------------------
5003 
5004             if to_char(l_lpr_rec.auto_enrt_mthd_rl) is not null then
5005             --
5006               ben_plan_design_program_module.create_formula_result
5007               (
5008                 p_validate                       =>  0
5009                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
5010                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
5011                 ,p_formula_id                     =>  l_lpr_rec.auto_enrt_mthd_rl
5012                 ,p_business_group_id              =>  l_lpr_rec.business_group_id
5013                 ,p_number_of_copies               =>  l_number_of_copies
5014                 ,p_object_version_number          =>  l_object_version_number
5015                 ,p_effective_date                 =>  p_effective_date
5016                );
5017              --
5018              end if;
5019 
5020             ---------------------------------------------------------------
5021             --  DFLT_ENRT__RL -----------------
5022             ---------------------------------------------------------------
5023 
5024             if to_char(l_lpr_rec.dflt_enrt_rl) is not null then
5025             --
5026               ben_plan_design_program_module.create_formula_result
5027               (
5028                 p_validate                       =>  0
5029                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
5030                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
5031                 ,p_formula_id                     =>  l_lpr_rec.dflt_enrt_rl
5032                 ,p_business_group_id              =>  l_lpr_rec.business_group_id
5033                 ,p_number_of_copies               =>  l_number_of_copies
5034                 ,p_object_version_number          =>  l_object_version_number
5035                 ,p_effective_date                 =>  p_effective_date
5036                );
5037              --
5038              end if;
5039 
5040              ---------------------------------------------------------------
5041             --  ENRT__RL -----------------
5042             ---------------------------------------------------------------
5043 
5044             if to_char(l_lpr_rec.enrt_rl) is not null then
5045             --
5046               ben_plan_design_program_module.create_formula_result
5047               (
5048                 p_validate                       =>  0
5049                 ,p_copy_entity_result_id          =>  l_copy_entity_result_id
5050                 ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
5051                 ,p_formula_id                     =>  l_lpr_rec.enrt_rl
5052                 ,p_business_group_id              =>  l_lpr_rec.business_group_id
5053                 ,p_number_of_copies               =>  l_number_of_copies
5054                 ,p_object_version_number          =>  l_object_version_number
5055                 ,p_effective_date                 =>  p_effective_date
5056                );
5057              --
5058              end if;
5059 
5060           end loop;
5061           --
5062           for l_lpr_rec in c_lpr_drp(l_parent_rec.ler_chg_plip_enrt_id,l_mirror_src_entity_result_id,'LPR1') loop
5063             ben_plan_design_plan_module.create_ler_result (
5064                      p_validate                       => p_validate
5065                     ,p_copy_entity_result_id          => l_out_lpr_result_id
5066                     ,p_copy_entity_txn_id             => p_copy_entity_txn_id
5067                     ,p_ler_id                         => l_lpr_rec.ler_id
5068                     ,p_business_group_id              => p_business_group_id
5069                     ,p_number_of_copies               => p_number_of_copies
5070                     ,p_object_version_number          => l_object_version_number
5071                     ,p_effective_date                 => p_effective_date
5072                     );
5073           end loop;
5074           --
5075         end loop;
5076         ---------------------------------------------------------------
5077         -- END OF BEN_LER_CHG_PLIP_ENRT_F ----------------------
5078         ---------------------------------------------------------------
5079         -- ------------------------------------------------------------------------
5080         -- Plans
5081         -- ------------------------------------------------------------------------
5082          ben_plan_design_plan_module.create_plan_result
5083          (p_copy_entity_result_id          => l_copy_entity_result_id
5084          ,p_copy_entity_txn_id             => p_copy_entity_txn_id
5085          ,p_pl_id                          => null
5086          ,p_plip_id                        => l_parent_rec.plip_id
5087          ,p_business_group_id              => p_business_group_id
5088          ,p_number_of_copies               => p_number_of_copies
5089          ,p_object_version_number          => l_object_version_number
5090          ,p_effective_date                 => p_effective_date
5091          ,p_no_dup_rslt                    => p_no_dup_rslt
5092          ) ;
5093          l_copy_entity_result_id := null ;
5094          l_object_version_number := null ;
5095         --
5096   end loop;
5097 
5098    ---------------------------------------------------------------
5099    -- END OF BEN_PLIP_F ----------------------
5100    ---------------------------------------------------------------
5101 
5102   ---------------------------------------------------------------
5103   -- START OF BEN_CMBN_PLIP_F ----------------------
5104   ---------------------------------------------------------------
5105   --
5106   for l_parent_rec  in c_cpl1_from_parent(l_PGM_ID) loop
5107     --
5108     l_mirror_src_entity_result_id := l_out_pgm_result_id;
5109 
5110     --
5111     l_cmbn_plip_id := l_parent_rec.cmbn_plip_id ;
5112     --
5113     for l_cpl_rec in c_cpl1(l_parent_rec.cmbn_plip_id,l_mirror_src_entity_result_id,'CPL' ) loop
5114       --
5115       l_table_route_id := null ;
5116       open g_table_route('CPL');
5117         fetch g_table_route into l_table_route_id ;
5118       close g_table_route ;
5119       --
5120       l_information5  := l_cpl_rec.name; --'Intersection';
5121       --
5122       if p_effective_date between l_cpl_rec.effective_start_date
5123          and l_cpl_rec.effective_end_date then
5124        --
5125          l_result_type_cd := 'DISPLAY';
5126       else
5127          l_result_type_cd := 'NO DISPLAY';
5128       end if;
5129         --
5130       l_copy_entity_result_id := null;
5131       l_object_version_number := null;
5132       ben_copy_entity_results_api.create_copy_entity_results(
5133         p_copy_entity_result_id          => l_copy_entity_result_id,
5134         p_copy_entity_txn_id             => p_copy_entity_txn_id,
5135         p_result_type_cd                 => l_result_type_cd,
5136         p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
5137         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
5138         p_number_of_copies               => l_number_of_copies,
5139         p_table_route_id                 => l_table_route_id,
5140         p_table_alias                    => 'CPL',
5141         p_information1     => l_cpl_rec.cmbn_plip_id,
5142         p_information2     => l_cpl_rec.EFFECTIVE_START_DATE,
5143         p_information3     => l_cpl_rec.EFFECTIVE_END_DATE,
5144         p_information4     => l_cpl_rec.business_group_id,
5145         p_information5     => l_information5 , -- 9999 put name for h-grid
5146             p_information111     => l_cpl_rec.cpl_attribute1,
5147             p_information120     => l_cpl_rec.cpl_attribute10,
5148             p_information121     => l_cpl_rec.cpl_attribute11,
5149             p_information122     => l_cpl_rec.cpl_attribute12,
5150             p_information123     => l_cpl_rec.cpl_attribute13,
5151             p_information124     => l_cpl_rec.cpl_attribute14,
5152             p_information125     => l_cpl_rec.cpl_attribute15,
5153             p_information126     => l_cpl_rec.cpl_attribute16,
5154             p_information127     => l_cpl_rec.cpl_attribute17,
5155             p_information128     => l_cpl_rec.cpl_attribute18,
5156             p_information129     => l_cpl_rec.cpl_attribute19,
5157             p_information112     => l_cpl_rec.cpl_attribute2,
5158             p_information130     => l_cpl_rec.cpl_attribute20,
5159             p_information131     => l_cpl_rec.cpl_attribute21,
5160             p_information132     => l_cpl_rec.cpl_attribute22,
5161             p_information133     => l_cpl_rec.cpl_attribute23,
5162             p_information134     => l_cpl_rec.cpl_attribute24,
5163             p_information135     => l_cpl_rec.cpl_attribute25,
5164             p_information136     => l_cpl_rec.cpl_attribute26,
5165             p_information137     => l_cpl_rec.cpl_attribute27,
5166             p_information138     => l_cpl_rec.cpl_attribute28,
5167             p_information139     => l_cpl_rec.cpl_attribute29,
5168             p_information113     => l_cpl_rec.cpl_attribute3,
5169             p_information140     => l_cpl_rec.cpl_attribute30,
5170             p_information114     => l_cpl_rec.cpl_attribute4,
5171             p_information115     => l_cpl_rec.cpl_attribute5,
5172             p_information116     => l_cpl_rec.cpl_attribute6,
5173             p_information117     => l_cpl_rec.cpl_attribute7,
5174             p_information118     => l_cpl_rec.cpl_attribute8,
5175             p_information119     => l_cpl_rec.cpl_attribute9,
5176             p_information110     => l_cpl_rec.cpl_attribute_category,
5177             p_information170     => l_cpl_rec.name,
5178             p_information260     => l_cpl_rec.pgm_id,
5179             p_information265     => l_cpl_rec.object_version_number,
5180             --
5181         p_object_version_number          => l_object_version_number,
5182         p_effective_date                 => p_effective_date       );
5183         --
5184 
5185         if l_out_cpl_result_id is null then
5186           l_out_cpl_result_id := l_copy_entity_result_id;
5187         end if;
5188 
5189         if l_result_type_cd = 'DISPLAY' then
5190            l_out_cpl_result_id := l_copy_entity_result_id ;
5191         end if;
5192         --
5193      end loop;
5194      --
5195           -- ------------------------------------------------------------------------
5196           -- Standard Rates ,Flex Credits at BEN_CMBN_PLIP_F level
5197           -- ------------------------------------------------------------------------
5198           ben_pd_rate_and_cvg_module.create_rate_results
5199             (
5200               p_validate                   => p_validate
5201              ,p_copy_entity_result_id      => l_out_cpl_result_id
5202              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
5203              ,p_pgm_id                     => null
5204              ,p_ptip_id                    => null
5205              ,p_plip_id                    => null
5206              ,p_pl_id                      => null
5207              ,p_oiplip_id                  => null
5208              ,p_cmbn_plip_id               => l_cmbn_plip_id
5209              ,p_cmbn_ptip_id               => null
5210              ,p_cmbn_ptip_opt_id           => null
5211              ,p_business_group_id          => p_business_group_id
5212              ,p_number_of_copies           => p_number_of_copies
5213              ,p_object_version_number      => l_object_version_number
5214              ,p_effective_date             => p_effective_date
5215              ,p_parent_entity_result_id    => l_out_cpl_result_id
5216              ) ;
5217             -- ------------------------------------------------------------------------
5218             -- Benefit Pools  BEN_CMBN_PLIP_F level
5219             -- ------------------------------------------------------------------------
5220           ben_pd_rate_and_cvg_module.create_bnft_pool_results
5221             (
5222               p_validate                   =>p_validate
5223              ,p_copy_entity_result_id      =>l_out_cpl_result_id
5224              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
5225              ,p_pgm_id                     => null
5226              ,p_ptip_id                    => null
5227              ,p_plip_id                    => null
5228              ,p_oiplip_id                  => null
5229              ,p_cmbn_plip_id               => l_cmbn_plip_id
5230              ,p_cmbn_ptip_id               => null
5231              ,p_cmbn_ptip_opt_id           => null
5232              ,p_business_group_id          => p_business_group_id
5233              ,p_number_of_copies             => p_number_of_copies
5234              ,p_object_version_number      => l_object_version_number
5235              ,p_effective_date             => p_effective_date
5236              ,p_parent_entity_result_id    => l_out_cpl_result_id
5237              ) ;
5238           --
5239    end loop;
5240 ---------------------------------------------------------------
5241 -- END OF BEN_CMBN_PLIP_F ----------------------
5242 ---------------------------------------------------------------
5243  ---------------------------------------------------------------
5244  -- START OF BEN_CMBN_PTIP_F ----------------------
5245  ---------------------------------------------------------------
5246  --
5247    for l_parent_rec  in c_cbp1_from_parent(l_PGM_ID) loop
5248     --
5249     l_mirror_src_entity_result_id := l_out_pgm_result_id ;
5250 
5251     --
5252     l_cmbn_ptip_id := l_parent_rec.cmbn_ptip_id ;
5253     --
5254     for l_cbp_rec in c_cbp1(l_parent_rec.cmbn_ptip_id,l_mirror_src_entity_result_id,'CBP' ) loop
5255       --
5256       l_table_route_id := null ;
5257       open g_table_route('CBP');
5258         fetch g_table_route into l_table_route_id ;
5259       close g_table_route ;
5260       --
5261       l_information5  := l_cbp_rec.name; --'Intersection';
5262       --
5263       if p_effective_date between l_cbp_rec.effective_start_date
5264          and l_cbp_rec.effective_end_date then
5265        --
5266          l_result_type_cd := 'DISPLAY';
5267       else
5268          l_result_type_cd := 'NO DISPLAY';
5269       end if;
5270         --
5271       l_copy_entity_result_id := null;
5272       l_object_version_number := null;
5273       ben_copy_entity_results_api.create_copy_entity_results(
5274         p_copy_entity_result_id           => l_copy_entity_result_id,
5275         p_copy_entity_txn_id             => p_copy_entity_txn_id,
5276         p_result_type_cd                 => l_result_type_cd,
5277         p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
5278         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
5279         p_number_of_copies               => l_number_of_copies,
5280         p_table_route_id                 => l_table_route_id,
5281         p_table_alias                    => 'CBP',
5282         p_information1     => l_cbp_rec.cmbn_ptip_id,
5283         p_information2     => l_cbp_rec.EFFECTIVE_START_DATE,
5284         p_information3     => l_cbp_rec.EFFECTIVE_END_DATE,
5285         p_information4     => l_cbp_rec.business_group_id,
5286         p_information5     => l_information5 , -- 9999 put name for h-grid
5287             p_information111     => l_cbp_rec.cbp_attribute1,
5288             p_information120     => l_cbp_rec.cbp_attribute10,
5289             p_information121     => l_cbp_rec.cbp_attribute11,
5290             p_information122     => l_cbp_rec.cbp_attribute12,
5291             p_information123     => l_cbp_rec.cbp_attribute13,
5292             p_information124     => l_cbp_rec.cbp_attribute14,
5293             p_information125     => l_cbp_rec.cbp_attribute15,
5294             p_information126     => l_cbp_rec.cbp_attribute16,
5295             p_information127     => l_cbp_rec.cbp_attribute17,
5296             p_information128     => l_cbp_rec.cbp_attribute18,
5297             p_information129     => l_cbp_rec.cbp_attribute19,
5298             p_information112     => l_cbp_rec.cbp_attribute2,
5299             p_information130     => l_cbp_rec.cbp_attribute20,
5300             p_information131     => l_cbp_rec.cbp_attribute21,
5301             p_information132     => l_cbp_rec.cbp_attribute22,
5302             p_information133     => l_cbp_rec.cbp_attribute23,
5303             p_information134     => l_cbp_rec.cbp_attribute24,
5304             p_information135     => l_cbp_rec.cbp_attribute25,
5305             p_information136     => l_cbp_rec.cbp_attribute26,
5306             p_information137     => l_cbp_rec.cbp_attribute27,
5307             p_information138     => l_cbp_rec.cbp_attribute28,
5308             p_information139     => l_cbp_rec.cbp_attribute29,
5309             p_information113     => l_cbp_rec.cbp_attribute3,
5310             p_information140     => l_cbp_rec.cbp_attribute30,
5311             p_information114     => l_cbp_rec.cbp_attribute4,
5312             p_information115     => l_cbp_rec.cbp_attribute5,
5313             p_information116     => l_cbp_rec.cbp_attribute6,
5314             p_information117     => l_cbp_rec.cbp_attribute7,
5315             p_information118     => l_cbp_rec.cbp_attribute8,
5316             p_information119     => l_cbp_rec.cbp_attribute9,
5317             p_information110     => l_cbp_rec.cbp_attribute_category,
5318             p_information170     => l_cbp_rec.name,
5319             p_information260     => l_cbp_rec.pgm_id,
5320             p_information265     => l_cbp_rec.object_version_number,
5321             --
5322         p_object_version_number          => l_object_version_number,
5323         p_effective_date                 => p_effective_date       );
5324         --
5325 
5326         if l_out_cbp_result_id is null then
5327           l_out_cbp_result_id := l_copy_entity_result_id;
5328         end if;
5329 
5330         if l_result_type_cd = 'DISPLAY' then
5331            l_out_cbp_result_id := l_copy_entity_result_id ;
5332         end if;
5333         --
5334      end loop;
5335      --
5336           -- ------------------------------------------------------------------------
5337           -- Standard Rates ,Flex Credits at BEN_CMBN_PTIP_F level
5338           -- ------------------------------------------------------------------------
5339           ben_pd_rate_and_cvg_module.create_rate_results
5340             (
5341               p_validate                   => p_validate
5342              ,p_copy_entity_result_id      => l_out_cbp_result_id
5343              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
5344              ,p_pgm_id                     => null
5345              ,p_ptip_id                    => null
5346              ,p_plip_id                    => null
5347              ,p_pl_id                      => null
5348              ,p_oiplip_id                  => null
5349              ,p_cmbn_plip_id               => null
5350              ,p_cmbn_ptip_id               => l_cmbn_ptip_id
5351              ,p_cmbn_ptip_opt_id           => null
5352              ,p_business_group_id          => p_business_group_id
5353              ,p_number_of_copies           => p_number_of_copies
5354              ,p_object_version_number      => l_object_version_number
5355              ,p_effective_date             => p_effective_date
5356              ,p_parent_entity_result_id   => l_out_cbp_result_id
5357              ) ;
5358             -- ------------------------------------------------------------------------
5359             -- Benefit Pools BEN_CMBN_PTIP_F level
5360             -- ------------------------------------------------------------------------
5361           ben_pd_rate_and_cvg_module.create_bnft_pool_results
5362             (
5363               p_validate                   =>p_validate
5364              ,p_copy_entity_result_id      =>l_out_cbp_result_id
5365              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
5366              ,p_pgm_id                     => null
5367              ,p_ptip_id                    => null
5368              ,p_plip_id                    => null
5369              ,p_oiplip_id                  => null
5370              ,p_cmbn_plip_id               => null
5371              ,p_cmbn_ptip_id               => l_cmbn_ptip_id
5372              ,p_cmbn_ptip_opt_id           => null
5373              ,p_business_group_id          => p_business_group_id
5374              ,p_number_of_copies           => p_number_of_copies
5375              ,p_object_version_number      => l_object_version_number
5376              ,p_effective_date             => p_effective_date
5377              ,p_parent_entity_result_id    => l_out_cbp_result_id
5378              ) ;
5379 
5380    end loop;
5381 ---------------------------------------------------------------
5382 -- END OF BEN_CMBN_PTIP_F ----------------------
5383 ---------------------------------------------------------------
5384  ---------------------------------------------------------------
5385  -- START OF BEN_CMBN_PTIP_OPT_F ----------------------
5386  ---------------------------------------------------------------
5387  --
5388  for l_parent_rec  in c_cpt1_from_parent(l_PGM_ID) loop
5389     --
5390     l_mirror_src_entity_result_id := l_out_pgm_result_id ;
5391 
5392     --
5393     l_cmbn_ptip_opt_id := l_parent_rec.cmbn_ptip_opt_id ;
5394     --
5395     for l_cpt_rec in c_cpt1(l_parent_rec.cmbn_ptip_opt_id,l_mirror_src_entity_result_id,'CPT' ) loop
5396       --
5397       l_table_route_id := null ;
5398       open g_table_route('CPT');
5399       fetch g_table_route into l_table_route_id ;
5400       close g_table_route ;
5401       --
5402       l_information5  := l_cpt_rec.name; --'Intersection';
5403       --
5404       if p_effective_date between l_cpt_rec.effective_start_date
5405          and l_cpt_rec.effective_end_date then
5406        --
5407          l_result_type_cd := 'DISPLAY';
5408       else
5409          l_result_type_cd := 'NO DISPLAY';
5410       end if;
5411         --
5412       l_copy_entity_result_id := null;
5413       l_object_version_number := null;
5414       ben_copy_entity_results_api.create_copy_entity_results(
5415         p_copy_entity_result_id          => l_copy_entity_result_id,
5416         p_copy_entity_txn_id             => p_copy_entity_txn_id,
5417         p_result_type_cd                 => l_result_type_cd,
5418         p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
5419         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
5420         p_number_of_copies               => l_number_of_copies,
5421         p_table_route_id                 => l_table_route_id,
5422         p_table_alias                    => 'CPT',
5423         p_information1     => l_cpt_rec.cmbn_ptip_opt_id,
5424         p_information2     => l_cpt_rec.EFFECTIVE_START_DATE,
5425         p_information3     => l_cpt_rec.EFFECTIVE_END_DATE,
5426         p_information4     => l_cpt_rec.business_group_id,
5427         p_information5     => l_information5 , -- 9999 put name for h-grid
5428             p_information111     => l_cpt_rec.cpt_attribute1,
5429             p_information120     => l_cpt_rec.cpt_attribute10,
5430             p_information121     => l_cpt_rec.cpt_attribute11,
5431             p_information122     => l_cpt_rec.cpt_attribute12,
5432             p_information123     => l_cpt_rec.cpt_attribute13,
5433             p_information124     => l_cpt_rec.cpt_attribute14,
5434             p_information125     => l_cpt_rec.cpt_attribute15,
5435             p_information126     => l_cpt_rec.cpt_attribute16,
5436             p_information127     => l_cpt_rec.cpt_attribute17,
5437             p_information128     => l_cpt_rec.cpt_attribute18,
5438             p_information129     => l_cpt_rec.cpt_attribute19,
5439             p_information112     => l_cpt_rec.cpt_attribute2,
5440             p_information130     => l_cpt_rec.cpt_attribute20,
5441             p_information131     => l_cpt_rec.cpt_attribute21,
5442             p_information132     => l_cpt_rec.cpt_attribute22,
5443             p_information133     => l_cpt_rec.cpt_attribute23,
5444             p_information134     => l_cpt_rec.cpt_attribute24,
5445             p_information135     => l_cpt_rec.cpt_attribute25,
5446             p_information136     => l_cpt_rec.cpt_attribute26,
5447             p_information137     => l_cpt_rec.cpt_attribute27,
5448             p_information138     => l_cpt_rec.cpt_attribute28,
5449             p_information139     => l_cpt_rec.cpt_attribute29,
5450             p_information113     => l_cpt_rec.cpt_attribute3,
5451             p_information140     => l_cpt_rec.cpt_attribute30,
5452             p_information114     => l_cpt_rec.cpt_attribute4,
5453             p_information115     => l_cpt_rec.cpt_attribute5,
5454             p_information116     => l_cpt_rec.cpt_attribute6,
5455             p_information117     => l_cpt_rec.cpt_attribute7,
5456             p_information118     => l_cpt_rec.cpt_attribute8,
5457             p_information119     => l_cpt_rec.cpt_attribute9,
5458             p_information110     => l_cpt_rec.cpt_attribute_category,
5459             p_information170     => l_cpt_rec.name,
5460             p_information247     => l_cpt_rec.opt_id,
5461             p_information260     => l_cpt_rec.pgm_id,
5462             p_information259     => l_cpt_rec.ptip_id,
5463             p_information265     => l_cpt_rec.object_version_number,
5464             --
5465         p_object_version_number          => l_object_version_number,
5466         p_effective_date                 => p_effective_date       );
5467         --
5468 
5469         if l_out_cpt_result_id is null then
5470           l_out_cpt_result_id := l_copy_entity_result_id;
5471         end if;
5472 
5473         if l_result_type_cd = 'DISPLAY' then
5474            l_out_cpt_result_id := l_copy_entity_result_id ;
5475         end if;
5476         --
5477      end loop;
5478      --
5479             -- ------------------------------------------------------------------------
5480             -- Standard Rates ,Flex Credits at BEN_CMBN_PTIP_OPT_F level
5481             -- ------------------------------------------------------------------------
5482           ben_pd_rate_and_cvg_module.create_rate_results
5483             (
5484               p_validate                   => p_validate
5485              ,p_copy_entity_result_id      => l_out_cpt_result_id
5486              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
5487              ,p_pgm_id                     => null
5488              ,p_ptip_id                    => null
5489              ,p_plip_id                    => null
5490              ,p_pl_id                      => null
5491              ,p_oiplip_id                  => null
5492              ,p_cmbn_plip_id               => null
5493              ,p_cmbn_ptip_id               => null
5494              ,p_cmbn_ptip_opt_id           => l_cmbn_ptip_opt_id
5495              ,p_business_group_id          => p_business_group_id
5496              ,p_number_of_copies           => p_number_of_copies
5497              ,p_object_version_number      => l_object_version_number
5498              ,p_effective_date             => p_effective_date
5499              ,p_parent_entity_result_id   => l_out_cpt_result_id
5500              ) ;
5501             -- ------------------------------------------------------------------------
5502             -- Benefit Pools  BEN_CMBN_PTIP_OPT_F level
5503             -- ------------------------------------------------------------------------
5504           ben_pd_rate_and_cvg_module.create_bnft_pool_results
5505             (
5506               p_validate                   =>p_validate
5507              ,p_copy_entity_result_id      =>l_out_cpt_result_id
5508              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
5509              ,p_pgm_id                     => null
5510              ,p_ptip_id                    => null
5511              ,p_plip_id                    => null
5512              ,p_oiplip_id                  => null
5513              ,p_cmbn_plip_id               => null
5514              ,p_cmbn_ptip_id               => null
5515              ,p_cmbn_ptip_opt_id           => l_cmbn_ptip_opt_id
5516              ,p_business_group_id          => p_business_group_id
5517              ,p_number_of_copies           => p_number_of_copies
5518              ,p_object_version_number      => l_object_version_number
5519              ,p_effective_date             => p_effective_date
5520              ,p_parent_entity_result_id    => l_out_cpt_result_id
5521              ) ;
5522 
5523    end loop;
5524 ---------------------------------------------------------------
5525 -- END OF BEN_CMBN_PTIP_OPT_F ----------------------
5526 ---------------------------------------------------------------
5527  ---------------------------------------------------------------
5528  -- START OF BEN_OIPLIP_F ----------------------
5529  ---------------------------------------------------------------
5530  --
5531  for l_parent_rec  in c_opp1_from_parent(l_PGM_ID,'COP' ) loop
5532     --
5533     l_mirror_src_entity_result_id := l_parent_rec.copy_entity_result_id ;
5534 
5535     --
5536     l_oiplip_id := l_parent_rec.oiplip_id ;
5537     --
5538     for l_opp_rec in c_opp1(l_parent_rec.oiplip_id,l_parent_rec.copy_entity_result_id,'OPP' ) loop
5539       --
5540       l_table_route_id := null ;
5541       open g_table_route('OPP');
5542         fetch g_table_route into l_table_route_id ;
5543       close g_table_route ;
5544       --
5545       l_information5  := get_oiplip_name(l_opp_rec.oipl_id,l_opp_rec.plip_id,p_effective_date); --'Intersection';
5546       --
5547       if p_effective_date between l_opp_rec.effective_start_date
5548          and l_opp_rec.effective_end_date then
5549        --
5550          l_result_type_cd := 'DISPLAY';
5551       else
5552          l_result_type_cd := 'NO DISPLAY';
5553       end if;
5554         --
5555       l_copy_entity_result_id := null;
5556       l_object_version_number := null;
5557       ben_copy_entity_results_api.create_copy_entity_results(
5558         p_copy_entity_result_id          => l_copy_entity_result_id,
5559         p_copy_entity_txn_id             => p_copy_entity_txn_id,
5560         p_result_type_cd                 => l_result_type_cd,
5561         p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
5562         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
5563         p_number_of_copies               => l_number_of_copies,
5564         p_table_route_id                 => l_table_route_id,
5565         p_table_alias                    => 'OPP',
5566         p_information1     => l_opp_rec.oiplip_id,
5567         p_information2     => l_opp_rec.EFFECTIVE_START_DATE,
5568         p_information3     => l_opp_rec.EFFECTIVE_END_DATE,
5569         p_information4     => l_opp_rec.business_group_id,
5570         p_information5     => l_information5 , -- 9999 put name for h-grid
5571             p_information258     => l_opp_rec.oipl_id,
5572             p_information111     => l_opp_rec.opp_attribute1,
5573             p_information120     => l_opp_rec.opp_attribute10,
5574             p_information121     => l_opp_rec.opp_attribute11,
5575             p_information122     => l_opp_rec.opp_attribute12,
5576             p_information123     => l_opp_rec.opp_attribute13,
5577             p_information124     => l_opp_rec.opp_attribute14,
5578             p_information125     => l_opp_rec.opp_attribute15,
5579             p_information126     => l_opp_rec.opp_attribute16,
5580             p_information127     => l_opp_rec.opp_attribute17,
5581             p_information128     => l_opp_rec.opp_attribute18,
5582             p_information129     => l_opp_rec.opp_attribute19,
5583             p_information112     => l_opp_rec.opp_attribute2,
5584             p_information130     => l_opp_rec.opp_attribute20,
5585             p_information131     => l_opp_rec.opp_attribute21,
5586             p_information132     => l_opp_rec.opp_attribute22,
5587             p_information133     => l_opp_rec.opp_attribute23,
5588             p_information134     => l_opp_rec.opp_attribute24,
5589             p_information135     => l_opp_rec.opp_attribute25,
5590             p_information136     => l_opp_rec.opp_attribute26,
5591             p_information137     => l_opp_rec.opp_attribute27,
5592             p_information138     => l_opp_rec.opp_attribute28,
5593             p_information139     => l_opp_rec.opp_attribute29,
5594             p_information113     => l_opp_rec.opp_attribute3,
5595             p_information140     => l_opp_rec.opp_attribute30,
5596             p_information114     => l_opp_rec.opp_attribute4,
5597             p_information115     => l_opp_rec.opp_attribute5,
5598             p_information116     => l_opp_rec.opp_attribute6,
5599             p_information117     => l_opp_rec.opp_attribute7,
5600             p_information118     => l_opp_rec.opp_attribute8,
5601             p_information119     => l_opp_rec.opp_attribute9,
5602             p_information110     => l_opp_rec.opp_attribute_category,
5603             p_information256     => l_opp_rec.plip_id,
5604             p_information265     => l_opp_rec.object_version_number,
5605             --
5606         p_object_version_number          => l_object_version_number,
5607         p_effective_date                 => p_effective_date       );
5608         --
5609 
5610         if l_out_opp_result_id is null then
5611           l_out_opp_result_id := l_copy_entity_result_id;
5612         end if;
5613 
5614         if l_result_type_cd = 'DISPLAY' then
5615            l_out_opp_result_id := l_copy_entity_result_id ;
5616         end if;
5617         --
5618      end loop;
5619      --
5620             -- ------------------------------------------------------------------------
5621             -- Standard Rates ,Flex Credits at OiPlip level
5622             -- ------------------------------------------------------------------------
5623           ben_pd_rate_and_cvg_module.create_rate_results
5624             (
5625               p_validate                   => p_validate
5626              ,p_copy_entity_result_id      => l_out_opp_result_id
5627              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
5628              ,p_pgm_id                     => null
5629              ,p_ptip_id                    => null
5630              ,p_plip_id                    => null
5631              ,p_pl_id                      => null
5632              ,p_oiplip_id                  => l_oiplip_id
5633              ,p_cmbn_plip_id               => null
5634              ,p_cmbn_ptip_id               => null
5635              ,p_cmbn_ptip_opt_id           => null
5636              ,p_business_group_id          => p_business_group_id
5637              ,p_number_of_copies           => p_number_of_copies
5638              ,p_object_version_number      => l_object_version_number
5639              ,p_effective_date             => p_effective_date
5640              ,p_parent_entity_result_id    => l_out_opp_result_id
5641              ) ;
5642             -- ------------------------------------------------------------------------
5643             -- Benefit Pools  Oiplip Level
5644             -- ------------------------------------------------------------------------
5645           ben_pd_rate_and_cvg_module.create_bnft_pool_results
5646             (
5647               p_validate                   =>p_validate
5648              ,p_copy_entity_result_id      =>l_out_opp_result_id
5649              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
5650              ,p_pgm_id                     => null
5651              ,p_ptip_id                    => null
5652              ,p_plip_id                    => null
5653              ,p_oiplip_id                  => l_oiplip_id
5654              ,p_cmbn_plip_id               => null
5655              ,p_cmbn_ptip_id               => null
5656              ,p_cmbn_ptip_opt_id           => null
5657              ,p_business_group_id          => p_business_group_id
5658              ,p_number_of_copies           => p_number_of_copies
5659              ,p_object_version_number      => l_object_version_number
5660              ,p_effective_date             => p_effective_date
5661              ,p_parent_entity_result_id    => l_out_opp_result_id
5662              ) ;
5663 
5664    end loop;
5665 ---------------------------------------------------------------
5666 -- END OF BEN_OIPLIP_F ----------------------
5667 ---------------------------------------------------------------
5668 /* NOT REQUIRED FOR COPY
5669  -- Only required for Rows Copied count in Log
5670  -- To be uncommented after create_OTP_rows is fixed
5671  ---------------------------------------------------------------
5672  -- START OF BEN_OPTIP_F ----------------------
5673  ---------------------------------------------------------------
5674  --
5675  for l_parent_rec  in c_otp1_from_parent(l_PGM_ID,'OPT') loop
5676     --
5677     l_mirror_src_entity_result_id := l_parent_rec.copy_entity_result_id ;
5678 
5679     --
5680     l_optip_id := l_parent_rec.optip_id ;
5681     --
5682     for l_otp_rec in c_otp1(l_parent_rec.optip_id,l_parent_rec.copy_entity_result_id,'OTP' ) loop
5683       --
5684       l_table_route_id := null ;
5685       open g_table_route('OTP');
5686         fetch g_table_route into l_table_route_id ;
5687       close g_table_route ;
5688       --
5689       l_information5  := get_optip_name(l_otp_rec.opt_id,l_otp_rec.pl_typ_id,p_effective_date); --'Intersection';
5690       --
5691       if p_effective_date between l_otp_rec.effective_start_date
5692          and l_otp_rec.effective_end_date then
5693        --
5694          l_result_type_cd := 'DISPLAY';
5695       else
5696          l_result_type_cd := 'NO DISPLAY';
5697       end if;
5698         --
5699       l_copy_entity_result_id := null;
5700       l_object_version_number := null;
5701       ben_copy_entity_results_api.create_copy_entity_results(
5702         p_copy_entity_result_id          => l_copy_entity_result_id,
5703         p_copy_entity_txn_id             => p_copy_entity_txn_id,
5704         p_result_type_cd                 => l_result_type_cd,
5705         p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
5706         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
5707         p_number_of_copies               => l_number_of_copies,
5708         p_table_route_id                 => l_table_route_id,
5709         p_table_alias                    => 'OTP',
5710         p_information1     => l_otp_rec.optip_id,
5711         p_information2     => l_otp_rec.EFFECTIVE_START_DATE,
5712         p_information3     => l_otp_rec.EFFECTIVE_END_DATE,
5713         p_information4     => l_otp_rec.business_group_id,
5714         p_information5     => l_information5 , -- 9999 put name for h-grid
5715 */
5716 /*
5717             p_information249     => l_otp_rec.cmbn_ptip_opt_id,
5718             p_information247     => l_otp_rec.opt_id,
5719             p_information111     => l_otp_rec.otp_attribute1,
5720             p_information120     => l_otp_rec.otp_attribute10,
5721             p_information121     => l_otp_rec.otp_attribute11,
5722             p_information122     => l_otp_rec.otp_attribute12,
5723             p_information123     => l_otp_rec.otp_attribute13,
5724             p_information124     => l_otp_rec.otp_attribute14,
5725             p_information125     => l_otp_rec.otp_attribute15,
5726             p_information126     => l_otp_rec.otp_attribute16,
5727             p_information127     => l_otp_rec.otp_attribute17,
5728             p_information128     => l_otp_rec.otp_attribute18,
5729             p_information129     => l_otp_rec.otp_attribute19,
5730             p_information112     => l_otp_rec.otp_attribute2,
5731             p_information130     => l_otp_rec.otp_attribute20,
5732             p_information131     => l_otp_rec.otp_attribute21,
5733             p_information132     => l_otp_rec.otp_attribute22,
5734             p_information133     => l_otp_rec.otp_attribute23,
5735             p_information134     => l_otp_rec.otp_attribute24,
5736             p_information135     => l_otp_rec.otp_attribute25,
5737             p_information136     => l_otp_rec.otp_attribute26,
5738             p_information137     => l_otp_rec.otp_attribute27,
5739             p_information138     => l_otp_rec.otp_attribute28,
5740             p_information139     => l_otp_rec.otp_attribute29,
5741             p_information113     => l_otp_rec.otp_attribute3,
5742             p_information140     => l_otp_rec.otp_attribute30,
5743             p_information114     => l_otp_rec.otp_attribute4,
5744             p_information115     => l_otp_rec.otp_attribute5,
5745             p_information116     => l_otp_rec.otp_attribute6,
5746             p_information117     => l_otp_rec.otp_attribute7,
5747             p_information118     => l_otp_rec.otp_attribute8,
5748             p_information119     => l_otp_rec.otp_attribute9,
5749             p_information110     => l_otp_rec.otp_attribute_category,
5750             p_information260     => l_otp_rec.pgm_id,
5751             p_information248     => l_otp_rec.pl_typ_id,
5752             p_information259     => l_otp_rec.ptip_id,
5753             p_information265     => l_otp_rec.object_version_number,
5754 */
5755 /*
5756             --
5757         p_object_version_number          => l_object_version_number,
5758         p_effective_date                 => p_effective_date       );
5759         --
5760 
5761         if l_out_otp_result_id is null then
5762           l_out_otp_result_id := l_copy_entity_result_id;
5763         end if;
5764 
5765         if l_result_type_cd = 'DISPLAY' then
5766            l_out_otp_result_id := l_copy_entity_result_id ;
5767         end if;
5768         --
5769      end loop;
5770      --
5771    end loop;
5772 */
5773 ---------------------------------------------------------------
5774 -- END OF BEN_OPTIP_F ----------------------
5775 ---------------------------------------------------------------
5776   end if;
5777 end  create_program_result ;
5778 --
5779 procedure create_formula_result
5780   (
5781    p_validate                       in  number     default 0 -- false
5782   ,p_copy_entity_result_id          in  number
5783   ,p_copy_entity_txn_id             in  number
5784   ,p_formula_id                     in  number
5785   ,p_business_group_id              in  number    default null
5786   ,p_copy_to_clob                   in  varchar2  default 'N'
5787   ,p_number_of_copies               in  number    default 0
5788   ,p_object_version_number          out nocopy number
5789   ,p_effective_date                 in  date
5790   ) is
5791   --
5792   l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
5793   l_proc varchar2(72) := g_package||'create_formula_result';
5794   l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
5795   --
5796   l_cv_result_type_cd   varchar2(30) :=  'DISPLAY' ;
5797    --
5798    -- Bug : 3752407 : Global cursor g_table_route will now be used
5799    --
5800    -- Cursor to get table_route_id
5801    -- cursor c_table_route(c_parent_table_name varchar2) is
5802    -- cursor c_table_route(c_parent_table_alias varchar2) is
5803    -- select table_route_id
5804    -- from pqh_table_route trt
5805    -- where trt.table_alias = c_parent_table_alias ;
5806    --
5807    -- Cursor to get mirror_src_entity_result_id
5808    cursor c_parent_result(c_parent_pk_id number,
5809                     c_parent_table_alias  varchar2,
5810                     c_copy_entity_txn_id number) is
5811    select copy_entity_result_id mirror_src_entity_result_id
5812    from ben_copy_entity_results cpe
5813     -- ,pqh_table_route trt
5814    where cpe.information1= c_parent_pk_id
5815    and   cpe.result_type_cd = l_cv_result_type_cd
5816    and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
5817 --   and   cpe.table_route_id = trt.table_route_id
5818    and   cpe.table_alias = c_parent_table_alias ;
5819    ---
5820    ---------------------------------------------------------------
5821    -- START OF FF_FORMULAS_F ----------------------
5822    ---------------------------------------------------------------
5823    -- We get the only the formula
5824    cursor c_fff(c_formula_id number,c_mirror_src_entity_result_id number ,
5825                 c_table_alias varchar2) is
5826    select  fff.*,fff.formula_text ff_text,ft.formula_type_name formula_type_name
5827    from FF_FORMULAS_F fff,FF_FORMULA_TYPES ft
5828    where  fff.formula_id = c_formula_id
5829    and fff.formula_type_id = ft.formula_type_id
5830    and ( fff.business_group_id = p_business_group_id or fff.business_group_id is null )
5831    and not exists (
5832      select /* */ null
5833      from ben_copy_entity_results cpe
5834           -- ,pqh_table_route trt
5835      where copy_entity_txn_id = p_copy_entity_txn_id
5836 --     and trt.table_route_id = cpe.table_route_id
5837      and mirror_src_entity_result_id = c_mirror_src_entity_result_id
5838      and cpe.table_alias  = c_table_alias
5839      and information1 = c_FORMULA_ID
5840        and information2 = fff.effective_start_date
5841        and information3 = fff.effective_end_date
5842     );
5843    l_FORMULA_ID                 number(15);
5844    l_out_fff_result_id   number(15);
5845    ---------------------------------------------------------------
5846    -- END OF FF_FORMULAS_F ----------------------
5847    ---------------------------------------------------------------
5848 
5849   cursor c_object_exists(c_pk_id                number,
5850                          c_table_alias          varchar2) is
5851   select null
5852   from ben_copy_entity_results cpe
5853        -- ,pqh_table_route trt
5854   where copy_entity_txn_id = p_copy_entity_txn_id
5855 --  and trt.table_route_id = cpe.table_route_id
5856   and cpe.table_alias = c_table_alias
5857   and information1 = c_pk_id;
5858 
5859   l_dummy                        varchar2(1);
5860 
5861   l_table_route_id                number(15);
5862   l_mirror_src_entity_result_id     number(15);
5863   l_result_type_cd                varchar2(30);
5864   l_information5                  ben_copy_entity_results.information5%type;
5865   l_ler_id                        number(15);
5866   l_number_of_copies              number(15);
5867 
5868   l_ff_formula_text_clob			clob;
5869   l_ff_formula_text_long			long;
5870   l_copy_to_clob		varchar2(10);
5871 
5872   --Bug 4945193 Cursor to retreive the transaction category
5873      cursor c_trasaction_categories is
5874 	select ptc.short_name
5875 	from PQH_COPY_ENTITY_TXNS pcet,
5876 	     PQH_TRANSACTION_CATEGORIES ptc
5877 	where pcet.COPY_ENTITY_TXN_ID= p_copy_entity_txn_id
5878 	and ptc.TRANSACTION_CATEGORY_ID = pcet.TRANSACTION_CATEGORY_ID;
5879 
5880 	l_trasaction_category     PQH_TRANSACTION_CATEGORIES.SHORT_NAME%type;
5881 -- End Bug 4945193
5882 
5883   begin
5884   --
5885   l_number_of_copies := p_number_of_copies ;
5886     --
5887   --Bug 4945193 Set the p_copy_to_clob to 'Y' is the transaction category
5888   -- is GSP/PDW
5889      open c_trasaction_categories ;
5890      fetch  c_trasaction_categories into l_trasaction_category;
5891      close c_trasaction_categories;
5892 
5893    if p_copy_to_clob = 'Y' or l_trasaction_category in ('PQHGSP','BEN_PDCRWZ') then
5894 	l_copy_to_clob := 'Y';
5895    end if;
5896 --End Bug 4945193
5897 
5898  ---------------------------------------------------------------
5899  -- START OF FF_FORMULAS_F ----------------------
5900  ---------------------------------------------------------------
5901     --
5902     l_mirror_src_entity_result_id := p_copy_entity_result_id ;
5903     --
5904     l_FORMULA_ID := p_formula_id ;
5905     --
5906     if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
5907       open c_object_exists(l_FORMULA_ID,'FFF');
5908       fetch c_object_exists into l_dummy;
5909       if c_object_exists%found then
5910         close c_object_exists;
5911         return;
5912       end if;
5913       close c_object_exists;
5914     end if;
5915 
5916     for l_fff_rec in c_fff(l_FORMULA_ID,l_mirror_src_entity_result_id,'FFF' ) loop
5917       --
5918       l_table_route_id := null ;
5919       open g_table_route('FFF');
5920       fetch g_table_route into l_table_route_id ;
5921       close g_table_route ;
5922       --
5923       l_information5 := l_fff_rec.formula_name; -- 'Intersection';
5924       --
5925       if p_effective_date between l_fff_rec.effective_start_date
5926          and l_fff_rec.effective_end_date then
5927        --
5928          l_result_type_cd := 'DISPLAY';
5929       else
5930          l_result_type_cd := 'NO DISPLAY';
5931       end if;
5932         --
5933       l_copy_entity_result_id := null;
5934       l_object_version_number := null;
5935 
5936       ben_copy_entity_results_api.create_copy_entity_results(
5937         p_copy_entity_result_id          => l_copy_entity_result_id,
5938         p_copy_entity_txn_id             => p_copy_entity_txn_id,
5939         p_result_type_cd                 => l_result_type_cd,
5940         p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
5941         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
5942         p_number_of_copies               => l_number_of_copies,
5943         p_table_route_id                 => l_table_route_id,
5944         p_information1     => l_fff_rec.FORMULA_ID,
5945         p_information2     => l_fff_rec.EFFECTIVE_START_DATE,
5946         p_information3     => l_fff_rec.EFFECTIVE_END_DATE,
5947         p_information4     => l_fff_rec.business_group_id,
5948         p_information5     => l_information5 , -- 9999 put name for h-grid
5949             p_information12     => l_fff_rec.compile_flag,
5950             p_information151     => l_fff_rec.description,
5951             p_information112     => l_fff_rec.formula_name,
5952             p_information323     => l_fff_rec.ff_text,
5953             p_information160     => l_fff_rec.formula_type_id,
5954             p_information113     => l_fff_rec.formula_type_name,
5955             p_information13     => l_fff_rec.legislation_code,
5956             p_information11     => l_fff_rec.sticky_flag,
5957         --
5958         p_object_version_number          => l_object_version_number,
5959         p_effective_date                 => p_effective_date       );
5960         --
5961 
5962 
5963 		if l_copy_to_clob = 'Y' then
5964 			-- RKG Placeholder for copying formula text to clob column
5965 
5966 
5967 		select fff.formula_text into l_ff_formula_text_long from
5968 		  ff_formulas_f fff
5969 		where fff.formula_id =  l_fff_rec.FORMULA_ID
5970 		and   fff.effective_start_Date = l_fff_rec.EFFECTIVE_START_DATE
5971 		and fff.effective_end_date = l_fff_rec.EFFECTIVE_END_DATE
5972 		--and fff.business_Group_id = l_fff_rec.business_group_id;
5973 		and nvl(fff.business_Group_id,-1) = nvl(l_fff_rec.business_group_id,-1); --Bug 13340133
5974 
5975 		l_ff_formula_text_clob := RTrim(to_char(l_ff_formula_text_long));
5976 
5977 		update ben_copy_entity_results cped
5978 		set cped.INFORMATION325 = l_ff_formula_text_clob
5979 		where cped.COPY_ENTITY_RESULT_ID = l_copy_entity_result_id
5980 		and cped.copy_entity_txn_id = p_copy_entity_txn_id;
5981 
5982 
5983 			-- RKG End Placeholder
5984 		end if;
5985 
5986 
5987         if l_out_fff_result_id is null then
5988           l_out_fff_result_id := l_copy_entity_result_id;
5989         end if;
5990 
5991         if l_result_type_cd = 'DISPLAY' then
5992            l_out_fff_result_id := l_copy_entity_result_id ;
5993         end if;
5994         --
5995      end loop;
5996      --
5997 ---------------------------------------------------------------
5998 -- END OF FF_FORMULAS_F ----------------------
5999 ---------------------------------------------------------------
6000 end create_formula_result;
6001 --
6002 procedure create_actn_typ_result
6003   (
6004    p_validate                       in  number     default 0 -- false
6005   ,p_copy_entity_txn_id             in  number
6006   ,p_business_group_id              in  number    default null
6007   ,p_number_of_copies               in  number    default 0
6008   ,p_effective_date                 in  date
6009   ) is
6010     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
6011     l_proc varchar2(72) := g_package||'create_actn_typ_result';
6012     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
6013     --
6014     l_cv_result_type_cd   varchar2(30) :=  'DISPLAY' ;
6015     --
6016     cursor c_parent_result(c_parent_pk_id number,
6017                      --   c_parent_table_name varchar2,
6018                         c_parent_table_alias varchar2,
6019                         c_copy_entity_txn_id number) is
6020      select copy_entity_result_id mirror_src_entity_result_id
6021      from ben_copy_entity_results cpe
6022         -- ,pqh_table_route trt
6023      where cpe.information1= c_parent_pk_id
6024      and   cpe.result_type_cd = l_cv_result_type_cd
6025      and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
6026 --     and   cpe.table_route_id = trt.table_route_id
6027      and   cpe.table_alias = c_parent_table_alias ;
6028      ---
6029      --
6030      -- Bug : 3752407 : Global cursor g_table_route will now be used
6031      --
6032      -- Cursor to get table_route_id
6033      -- cursor c_table_route(c_parent_table_name varchar2) is
6034      -- cursor c_table_route(c_parent_table_alias varchar2) is
6035      -- select table_route_id
6036      -- from pqh_table_route trt
6037      -- where trt.table_alias = c_parent_table_alias ;
6038      ---
6039      l_mirror_src_entity_result_id    number(15);
6040      l_table_route_id               number(15);
6041      l_result_type_cd               varchar2(30);
6042      l_information5                 ben_copy_entity_results.information5%type;
6043      l_number_of_copies             number(15);
6044    ---------------------------------------------------------------
6045    -- START OF BEN_ACTN_TYP ----------------------
6046    ---------------------------------------------------------------
6047    cursor c_eat(c_mirror_src_entity_result_id number ,
6048                 c_table_alias varchar2) is
6049    select  eat.*
6050    from BEN_ACTN_TYP eat
6051    where  eat.business_group_id = p_business_group_id
6052      and not exists (
6053          select /* */ null
6054          from ben_copy_entity_results cpe
6055               -- ,pqh_table_route trt
6056          where copy_entity_txn_id = p_copy_entity_txn_id
6057 --         and trt.table_route_id = cpe.table_route_id
6058          and cpe.table_alias  = c_table_alias
6059          and information1 = eat.actn_typ_id
6060         );
6061     l_actn_typ_id                 number(15);
6062     l_out_eat_result_id   number(15);
6063    ---------------------------------------------------------------
6064    -- END OF BEN_ACTN_TYP ----------------------
6065    ---------------------------------------------------------------
6066  begin
6067      ---------------------------------------------------------------
6068      -- START OF BEN_ACTN_TYP ----------------------
6069      ---------------------------------------------------------------
6070         --
6071         l_mirror_src_entity_result_id := null ; -- Hide in HGrid
6072         l_number_of_copies := p_number_of_copies;
6073         --
6074         l_table_route_id := null ;
6075         open g_table_route('EAT');
6076         fetch g_table_route into l_table_route_id ;
6077         close g_table_route ;
6078 
6079         for l_eat_rec in c_eat(l_mirror_src_entity_result_id,'EAT' ) loop
6080         --
6081           --
6082           l_information5  := l_eat_rec.name;
6083           --
6084           l_result_type_cd := 'DISPLAY';
6085           --
6086           l_copy_entity_result_id := null;
6087           l_object_version_number := null;
6088           ben_copy_entity_results_api.create_copy_entity_results(
6089             p_copy_entity_result_id           => l_copy_entity_result_id,
6090             p_copy_entity_txn_id             => p_copy_entity_txn_id,
6091             p_result_type_cd                 => l_result_type_cd,
6092             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
6093             p_parent_entity_result_id      => l_mirror_src_entity_result_id,
6094             p_number_of_copies               => l_number_of_copies,
6095             p_table_route_id                 => l_table_route_id,
6096             p_information1     => l_eat_rec.actn_typ_id,
6097             p_information2     => null,
6098             p_information3     => null,
6099             p_information4     => l_eat_rec.business_group_id,
6100             p_information5     => l_information5 , -- 9999 put name for h-grid
6101             p_information185     => l_eat_rec.description,
6102             p_information111     => l_eat_rec.eat_attribute1,
6103             p_information120     => l_eat_rec.eat_attribute10,
6104             p_information121     => l_eat_rec.eat_attribute11,
6105             p_information122     => l_eat_rec.eat_attribute12,
6106             p_information123     => l_eat_rec.eat_attribute13,
6107             p_information124     => l_eat_rec.eat_attribute14,
6108             p_information125     => l_eat_rec.eat_attribute15,
6109             p_information126     => l_eat_rec.eat_attribute16,
6110             p_information127     => l_eat_rec.eat_attribute17,
6111             p_information128     => l_eat_rec.eat_attribute18,
6112             p_information129     => l_eat_rec.eat_attribute19,
6113             p_information112     => l_eat_rec.eat_attribute2,
6114             p_information130     => l_eat_rec.eat_attribute20,
6115             p_information131     => l_eat_rec.eat_attribute21,
6116             p_information132     => l_eat_rec.eat_attribute22,
6117             p_information133     => l_eat_rec.eat_attribute23,
6118             p_information134     => l_eat_rec.eat_attribute24,
6119             p_information135     => l_eat_rec.eat_attribute25,
6120             p_information136     => l_eat_rec.eat_attribute26,
6121             p_information137     => l_eat_rec.eat_attribute27,
6122             p_information138     => l_eat_rec.eat_attribute28,
6123             p_information139     => l_eat_rec.eat_attribute29,
6124             p_information113     => l_eat_rec.eat_attribute3,
6125             p_information140     => l_eat_rec.eat_attribute30,
6126             p_information114     => l_eat_rec.eat_attribute4,
6127             p_information115     => l_eat_rec.eat_attribute5,
6128             p_information116     => l_eat_rec.eat_attribute6,
6129             p_information117     => l_eat_rec.eat_attribute7,
6130             p_information118     => l_eat_rec.eat_attribute8,
6131             p_information119     => l_eat_rec.eat_attribute9,
6132             p_information110     => l_eat_rec.eat_attribute_category,
6133             p_information170     => l_eat_rec.name,
6134             p_information11     => l_eat_rec.type_cd,
6135             p_information265     => l_eat_rec.object_version_number,
6136             --
6137             p_object_version_number          => l_object_version_number,
6138             p_effective_date                 => p_effective_date       );
6139             --
6140 
6141             if l_out_eat_result_id is null then
6142               l_out_eat_result_id := l_copy_entity_result_id;
6143             end if;
6144 
6145             if l_result_type_cd = 'DISPLAY' then
6146                l_out_eat_result_id := l_copy_entity_result_id ;
6147             end if;
6148             --
6149          end loop;
6150     ---------------------------------------------------------------
6151     -- END OF BEN_ACTN_TYP ----------------------
6152     ---------------------------------------------------------------
6153  end create_actn_typ_result ;
6154 ---------------------------------------------------------------
6155 -- START OF INTERSECTION NAME FUNCTIONS ----------------------
6156 ---------------------------------------------------------------
6157 
6158 function get_ler_name
6159   (
6160    p_ler_id               in  number
6161   ,p_effective_date       in  date
6162   ) return varchar2 is
6163 
6164    cursor c_ler_name is
6165    select ler.name
6166    from   ben_ler_f ler
6167    where  ler.ler_id = p_ler_id
6168    and    p_effective_date between ler.effective_start_date
6169    and    ler.effective_end_date;
6170 
6171   l_ler_name ben_ler_f.name%type := null;
6172 
6173 begin
6174   open c_ler_name;
6175   fetch c_ler_name into l_ler_name;
6176   close c_ler_name;
6177 
6178   return l_ler_name;
6179 end get_ler_name;
6180 --
6181 
6182 function get_pgm_name
6183   (
6184    p_pgm_id               in  number
6185   ,p_effective_date       in  date
6186   ) return varchar2 is
6187 
6188   l_pgm_name ben_pgm_f.name%type := null;
6189 
6190   cursor c_pgm_name is
6191   select pgm.name
6192   from   ben_pgm_f pgm
6193   where  pgm.pgm_id = p_pgm_id
6194   and    p_effective_date between pgm.effective_start_date
6195   and    pgm.effective_end_date;
6196 
6197 begin
6198   open c_pgm_name;
6199   fetch c_pgm_name into l_pgm_name;
6200   close c_pgm_name;
6201 
6202   return l_pgm_name;
6203 end get_pgm_name;
6204 --
6205 
6206 function get_pl_typ_name
6207   (
6208    p_pl_typ_id            in  number
6209   ,p_effective_date       in  date
6210   ) return varchar2 is
6211 
6212   l_pl_typ_name ben_pl_typ_f.name%type := null;
6213 
6214   cursor c_pl_typ_name is
6215   select ptp.name
6216   from   ben_pl_typ_f ptp
6217   where  ptp.pl_typ_id = p_pl_typ_id
6218   and    p_effective_date between ptp.effective_start_date
6219   and    ptp.effective_end_date;
6220 
6221 begin
6222   open c_pl_typ_name;
6223   fetch c_pl_typ_name into l_pl_typ_name;
6224   close c_pl_typ_name;
6225 
6226   return l_pl_typ_name;
6227 end get_pl_typ_name;
6228 --
6229 
6230 function get_pl_name
6231   (
6232    p_pl_id                in  number
6233   ,p_effective_date       in  date
6234   ) return varchar2 is
6235 
6236   l_pl_name ben_pl_f.name%type := null;
6237 
6238   cursor c_pl_name is
6239   select pln.name
6240   from   ben_pl_f pln
6241   where  pln.pl_id = p_pl_id
6242   and    p_effective_date between pln.effective_start_date
6243   and    pln.effective_end_date;
6244 
6245 begin
6246   open c_pl_name;
6247   fetch c_pl_name into l_pl_name;
6248   close c_pl_name;
6249 
6250   return l_pl_name;
6251 end get_pl_name;
6252 --
6253 
6254 function get_ptip_name
6255   (
6256    p_ptip_id              in  number
6257   ,p_effective_date       in  date
6258   ) return varchar2 is
6259 
6260   cursor c_ptip is
6261   select pgm_id,pl_typ_id
6262   from   ben_ptip_f ctp
6263   where ctp.ptip_id = p_ptip_id
6264   and   p_effective_date between ctp.effective_start_date
6265         and ctp.effective_end_date;
6266 
6267   l_pgm_id     ben_pgm_f.pgm_id%type;
6268   l_pl_typ_id  ben_pl_typ_f.pl_typ_id%type;
6269   l_ptip_name  varchar2(500);
6270 
6271 begin
6272 
6273   open c_ptip;
6274   fetch c_ptip into l_pgm_id, l_pl_typ_id;
6275   close c_ptip;
6276 
6277   l_ptip_name := get_pgm_name(l_pgm_id,p_effective_date) ||' - '||
6278                  get_pl_typ_name(l_pl_typ_id,p_effective_date);
6279 
6280   return l_ptip_name;
6281 end get_ptip_name;
6282 --
6283 
6284 function get_plip_name
6285   (
6286    p_plip_id              in  number
6287   ,p_effective_date       in  date
6288   ) return varchar2 is
6289 
6290   cursor c_plip is
6291   select pgm_id,pl_id
6292   from   ben_plip_f cpp
6293   where cpp.plip_id = p_plip_id
6294   and   p_effective_date between cpp.effective_start_date
6295         and cpp.effective_end_date;
6296 
6297   l_pgm_id ben_pgm_f.pgm_id%type;
6298   l_pl_id  ben_pl_f.pl_id%type;
6299   l_plip_name varchar2(500);
6300 
6301 begin
6302 
6303   open c_plip;
6304   fetch c_plip into l_pgm_id, l_pl_id;
6305   close c_plip;
6306 
6307   l_plip_name := get_pgm_name(l_pgm_id,p_effective_date) ||' - '||
6308                  get_pl_name(l_pl_id,p_effective_date);
6309 
6310   return l_plip_name;
6311 end get_plip_name;
6312 --
6313 
6314 function get_oipl_name
6315   (
6316    p_oipl_id              in  number
6317   ,p_effective_date       in  date
6318   ) return varchar2 is
6319 
6320   cursor c_oipl is
6321   select opt_id,pl_id
6322   from   ben_oipl_f cop
6323   where cop.oipl_id = p_oipl_id
6324   and   p_effective_date between cop.effective_start_date
6325         and cop.effective_end_date;
6326 
6327   l_opt_id ben_opt_f.opt_id%type;
6328   l_pl_id  ben_pl_f.pl_id%type;
6329   l_oipl_name varchar2(500);
6330 
6331 begin
6332 
6333   open c_oipl;
6334   fetch c_oipl into l_opt_id, l_pl_id;
6335   close c_oipl;
6336 
6337   l_oipl_name := get_pl_name(l_pl_id,p_effective_date) ||' - '||
6338                  get_opt_name(l_opt_id,p_effective_date);
6339 
6340   return l_oipl_name;
6341 end get_oipl_name;
6342 --
6343 
6344 function get_opt_name
6345   (
6346    p_opt_id               in  number
6347   ,p_effective_date       in  date
6348   ) return varchar2 is
6349 
6350   l_opt_name ben_opt_f.name%type := null;
6351 
6352   cursor c_opt_name is
6353   select opt.name
6354   from   ben_opt_f opt
6355   where  opt.opt_id = p_opt_id
6356   and    p_effective_date between opt.effective_start_date
6357   and    opt.effective_end_date;
6358 
6359 begin
6360   open c_opt_name;
6361   fetch c_opt_name into l_opt_name;
6362   close c_opt_name;
6363 
6364   return l_opt_name;
6365 end get_opt_name;
6366 --
6367 
6368 function get_regn_name
6369   (
6370    p_regn_id              in  number
6371   ,p_effective_date       in  date
6372   ) return varchar2 is
6373 
6374   l_regn_name ben_regn_f.name%type := null;
6375 
6376   cursor c_regn_name is
6377   select reg.name
6378   from   ben_regn_f reg
6379   where  reg.regn_id = p_regn_id
6380   and    p_effective_date between reg.effective_start_date
6381   and    reg.effective_end_date;
6382 
6383 begin
6384   open c_regn_name;
6385   fetch c_regn_name into l_regn_name;
6386   close c_regn_name;
6387 
6388   return l_regn_name;
6389 end get_regn_name;
6390 --
6391 
6392 function get_gd_or_svc_typ_name
6393   (
6394    p_gd_or_svc_typ_id     in  number
6395   ) return varchar2 is
6396 
6397   l_gd_or_svc_typ_name ben_gd_or_svc_typ.name%type := null;
6398 
6399   cursor c_gd_or_svc_typ_name is
6400   select gos.name
6401   from   ben_gd_or_svc_typ gos
6402   where  gos.gd_or_svc_typ_id = p_gd_or_svc_typ_id;
6403 
6404 begin
6405   open c_gd_or_svc_typ_name;
6406   fetch c_gd_or_svc_typ_name into l_gd_or_svc_typ_name;
6407   close c_gd_or_svc_typ_name;
6408 
6409   return l_gd_or_svc_typ_name;
6410 end get_gd_or_svc_typ_name;
6411 --
6412 
6413 function get_actn_typ_name
6414   (
6415    p_actn_typ_id     in  number
6416   ) return varchar2 is
6417 
6418   l_actn_typ_name ben_actn_typ.name%type := null;
6419 
6420   cursor c_actn_typ_name is
6421   select eat.name
6422   from   ben_actn_typ eat
6423   where  eat.actn_typ_id = p_actn_typ_id;
6424 
6425 begin
6426   open c_actn_typ_name;
6427   fetch c_actn_typ_name into l_actn_typ_name;
6428   close c_actn_typ_name;
6429 
6430   return l_actn_typ_name;
6431 end get_actn_typ_name;
6432 --
6433 
6434 function get_formula_name
6435   (
6436    p_formula_id       in  number
6437   ,p_effective_date   in date
6438   ) return varchar2 is
6439 
6440   l_formula_name ff_formulas_f.formula_name%type := null;
6441 
6442   cursor c_formula_name is
6443   select ff.formula_name
6444   from   ff_formulas_f ff
6445   where  ff.formula_id = p_formula_id
6446   and    p_effective_date between ff.effective_start_date
6447   and    ff.effective_end_date;
6448 begin
6449   open c_formula_name;
6450   fetch c_formula_name into l_formula_name;
6451   close c_formula_name;
6452 
6453   return l_formula_name;
6454 end get_formula_name;
6455 --
6456 
6457 function get_organization_name
6458   (
6459    p_organization_id       in  number
6460   ) return varchar2 is
6461 
6462   l_organization_name hr_all_organization_units_vl.name%type := null;
6463 
6464   cursor c_organization_name is
6465   select org.name
6466   from   hr_all_organization_units_vl org
6467   where  org.organization_id = p_organization_id;
6468 
6469 begin
6470   open c_organization_name;
6471   fetch c_organization_name into l_organization_name;
6472   close c_organization_name;
6473 
6474   return l_organization_name;
6475 end get_organization_name;
6476 --
6477 
6478 function get_yr_perd_name
6479   (
6480    p_yr_perd_id       in  number
6481   ) return varchar2 is
6482 
6483   l_yr_perd_name varchar2(50) := null;
6484 
6485   cursor c_yr_perd_name is
6486   select TO_CHAR(yrp.start_date,'DD-Mon-YYYY')||' -  '||
6487          TO_CHAR(yrp.end_date,'DD-Mon-YYYY')
6488   from   ben_yr_perd yrp
6489   where  yrp.yr_perd_id = p_yr_perd_id;
6490 
6491 begin
6492   open c_yr_perd_name;
6493   fetch c_yr_perd_name into l_yr_perd_name;
6494   close c_yr_perd_name;
6495 
6496   return l_yr_perd_name;
6497 end get_yr_perd_name;
6498 --
6499 
6500 function get_rptg_grp_name
6501   (
6502    p_rptg_grp_id     in  number
6503   ) return varchar2 is
6504 
6505   l_rptg_grp_name ben_rptg_grp.name%type := null;
6506 
6507   cursor c_rptg_grp_name is
6508   select bnr.name
6509   from   ben_rptg_grp bnr
6510   where  bnr.rptg_grp_id = p_rptg_grp_id;
6511 
6512 begin
6513   open c_rptg_grp_name;
6514   fetch c_rptg_grp_name into l_rptg_grp_name;
6515   close c_rptg_grp_name;
6516 
6517   return l_rptg_grp_name;
6518 end get_rptg_grp_name;
6519 --
6520 
6521 function get_per_info_chg_cs_ler_name
6522   (
6523    p_per_info_chg_cs_ler_id   in  number
6524   ,p_effective_date           in  date
6525   ) return varchar2 is
6526 
6527   l_per_info_chg_cs_ler_name ben_per_info_chg_cs_ler_f.name%type := null;
6528 
6529   cursor c_per_info_chg_cs_ler_name is
6530   select psl.name
6531   from   ben_per_info_chg_cs_ler_f psl
6532   where  psl.per_info_chg_cs_ler_id = p_per_info_chg_cs_ler_id
6533   and    p_effective_date between psl.effective_start_date
6534   and    psl.effective_end_date;
6535 
6536 begin
6537   open c_per_info_chg_cs_ler_name;
6538   fetch c_per_info_chg_cs_ler_name into l_per_info_chg_cs_ler_name;
6539   close c_per_info_chg_cs_ler_name;
6540 
6541   return l_per_info_chg_cs_ler_name;
6542 end get_per_info_chg_cs_ler_name;
6543 --
6544 
6545 function get_rltd_per_chg_cs_ler_name
6546   (
6547    p_rltd_per_chg_cs_ler_id   in  number
6548   ,p_effective_date           in  date
6549   ) return varchar2 is
6550 
6551   l_rltd_per_chg_cs_ler_name ben_rltd_per_chg_cs_ler_f.name%type := null;
6552 
6553   cursor c_rltd_per_chg_cs_ler_name is
6554   select rcl.name
6555   from   ben_rltd_per_chg_cs_ler_f rcl
6556   where  rcl.rltd_per_chg_cs_ler_id = p_rltd_per_chg_cs_ler_id
6557   and    p_effective_date between rcl.effective_start_date
6558   and    rcl.effective_end_date;
6559 
6560 begin
6561   open c_rltd_per_chg_cs_ler_name;
6562   fetch c_rltd_per_chg_cs_ler_name into l_rltd_per_chg_cs_ler_name;
6563   close c_rltd_per_chg_cs_ler_name;
6564 
6565   return l_rltd_per_chg_cs_ler_name;
6566 end get_rltd_per_chg_cs_ler_name;
6567 --
6568 
6569 function get_oiplip_name
6570   (
6571    p_oipl_id              in  number
6572   ,p_plip_id              in number
6573   ,p_effective_date       in  date
6574   ) return varchar2 is
6575 
6576   l_oipl_name varchar2(500) := null;
6577 
6578 begin
6579 
6580   l_oipl_name := get_oipl_name(p_oipl_id,p_effective_date);
6581   return l_oipl_name;
6582 
6583 end get_oiplip_name;
6584 --
6585 
6586 function get_optip_name
6587   (
6588    p_opt_id              in  number
6589   ,p_pl_typ_id           in number
6590   ,p_effective_date      in  date
6591   ) return varchar2 is
6592 
6593   l_pl_typ_name ben_pl_typ_f.name%type;
6594   l_opt_name    ben_opt_f.name%type;
6595 
6596 begin
6597   l_opt_name := get_opt_name(p_opt_id,p_effective_date);
6598   l_pl_typ_name := get_pl_typ_name(p_pl_typ_id,p_effective_date);
6599 
6600   return l_pl_typ_name ||' - '||l_opt_name;
6601 
6602 end get_optip_name;
6603 --
6604 
6605 function get_ptd_lmt_name
6606   (
6607    p_ptd_lmt_id           in  number
6608   ,p_effective_date       in  date
6609   ) return varchar2 is
6610 
6611   l_ptd_lmt_name ben_ptd_lmt_f.name%type := null;
6612 
6613   cursor c_ptd_lmt_name is
6614   select pdl.name
6615   from   ben_ptd_lmt_f pdl
6616   where  pdl.ptd_lmt_id = p_ptd_lmt_id
6617   and    p_effective_date between pdl.effective_start_date
6618   and    pdl.effective_end_date;
6619 
6620 begin
6621   open c_ptd_lmt_name;
6622   fetch c_ptd_lmt_name into l_ptd_lmt_name;
6623   close c_ptd_lmt_name;
6624 
6625   return l_ptd_lmt_name;
6626 end get_ptd_lmt_name;
6627 --
6628 
6629 function get_vrbl_rt_prfl_name
6630   (
6631    p_vrbl_rt_prfl_id      in  number
6632   ,p_effective_date       in  date
6633   ) return varchar2 is
6634 
6635   l_vrbl_rt_prfl_name ben_vrbl_rt_prfl_f.name%type := null;
6636 
6637   cursor c_vrbl_rt_prfl_name is
6638   select vpf.name
6639   from   ben_vrbl_rt_prfl_f vpf
6640   where  vpf.vrbl_rt_prfl_id = p_vrbl_rt_prfl_id
6641   and    p_effective_date between vpf.effective_start_date
6642   and    vpf.effective_end_date;
6643 
6644 begin
6645   open c_vrbl_rt_prfl_name;
6646   fetch c_vrbl_rt_prfl_name into l_vrbl_rt_prfl_name;
6647   close c_vrbl_rt_prfl_name;
6648 
6649   return l_vrbl_rt_prfl_name;
6650 end get_vrbl_rt_prfl_name;
6651 --
6652 
6653 function get_age_fctr_name
6654   (
6655    p_age_fctr_id     in  number
6656   ) return varchar2 is
6657 
6658   l_age_fctr_name ben_age_fctr.name%type := null;
6659 
6660   cursor c_age_fctr_name is
6661   select agf.name
6662   from   ben_age_fctr agf
6663   where  agf.age_fctr_id = p_age_fctr_id;
6664 
6665 begin
6666   open c_age_fctr_name;
6667   fetch c_age_fctr_name into l_age_fctr_name;
6668   close c_age_fctr_name;
6669 
6670   return l_age_fctr_name;
6671 end get_age_fctr_name;
6672 --
6673 
6674 function get_assignment_set_name
6675   (
6676    p_assignment_set_id     in  number
6677   ) return varchar2 is
6678 
6679   l_assignment_set_name hr_assignment_sets.assignment_set_name%type := null;
6680 
6681   cursor c_assignment_set_name is
6682   select ast.assignment_set_name
6683   from   hr_assignment_sets ast
6684   where  ast.assignment_set_id = p_assignment_set_id;
6685 
6686 begin
6687   open c_assignment_set_name;
6688   fetch c_assignment_set_name into l_assignment_set_name;
6689   close c_assignment_set_name;
6690 
6691   return l_assignment_set_name;
6692 end get_assignment_set_name;
6693 --
6694 
6695 function get_benfts_grp_name
6696   (
6697    p_benfts_grp_id     in  number
6698   ) return varchar2 is
6699 
6700   l_benfts_grp_name ben_benfts_grp.name%type := null;
6701 
6702   cursor c_benfts_grp_name is
6703   select bng.name
6704   from   ben_benfts_grp bng
6705   where  bng.benfts_grp_id = p_benfts_grp_id;
6706 
6707 begin
6708   open c_benfts_grp_name;
6709   fetch c_benfts_grp_name into l_benfts_grp_name;
6710   close c_benfts_grp_name;
6711 
6712   return l_benfts_grp_name;
6713 end get_benfts_grp_name;
6714 --
6715 
6716 function get_cmbn_age_los_fctr_name
6717   (
6718    p_cmbn_age_los_fctr_id     in  number
6719   ) return varchar2 is
6720 
6721   l_cmbn_age_los_fctr_name ben_cmbn_age_los_fctr.name%type := null;
6722 
6723   cursor c_cmbn_age_los_fctr_name is
6724   select cla.name
6725   from   ben_cmbn_age_los_fctr cla
6726   where  cla.cmbn_age_los_fctr_id = p_cmbn_age_los_fctr_id;
6727 
6728 begin
6729   open c_cmbn_age_los_fctr_name;
6730   fetch c_cmbn_age_los_fctr_name into l_cmbn_age_los_fctr_name;
6731   close c_cmbn_age_los_fctr_name;
6732 
6733   return l_cmbn_age_los_fctr_name;
6734 end get_cmbn_age_los_fctr_name;
6735 --
6736 
6737 function get_comp_lvl_fctr_name
6738   (
6739    p_comp_lvl_fctr_id     in  number
6740   ) return varchar2 is
6741 
6742   l_comp_lvl_fctr_name ben_comp_lvl_fctr.name%type := null;
6743 
6744   cursor c_comp_lvl_fctr_name is
6745   select clf.name
6746   from   ben_comp_lvl_fctr clf
6747   where  clf.comp_lvl_fctr_id = p_comp_lvl_fctr_id;
6748 
6749 begin
6750   open c_comp_lvl_fctr_name;
6751   fetch c_comp_lvl_fctr_name into l_comp_lvl_fctr_name;
6752   close c_comp_lvl_fctr_name;
6753 
6754   return l_comp_lvl_fctr_name;
6755 end get_comp_lvl_fctr_name;
6756 --
6757 --BUG 4156088
6758 --
6759 function get_assignment_sts_type_name
6760   (
6761    p_assignment_status_type_id     in  number
6762   ) return varchar2 is
6763   --
6764   l_assignment_status_type_name per_assignment_status_types_tl.user_status%type := null;
6765   --
6766   cursor c_assignment_status_type_name is
6767   select nvl(atl.user_status,stl.user_status) user_status
6768   from   per_assignment_status_types s,
6769          per_ass_status_type_amends a ,
6770          per_assignment_status_types_tl stl,
6771          per_ass_status_type_amends_tl atl
6772   where  s.assignment_status_type_id = p_assignment_status_type_id
6773   and    a.assignment_status_type_id (+) = s.assignment_status_type_id
6774   and    s.active_flag = 'Y'
6775   and    a.active_flag(+) = 'Y'
6776   and    atl.ass_status_type_amend_id (+) = a.ass_status_type_amend_id
6777   and    atl.language (+) = userenv('LANG')
6778   and    stl.assignment_status_type_id = s.assignment_status_type_id
6779   and    stl.language  = userenv('LANG');
6780   --
6781 begin
6782   open c_assignment_status_type_name;
6783   fetch c_assignment_status_type_name into l_assignment_status_type_name;
6784   close c_assignment_status_type_name;
6785 
6786   return l_assignment_status_type_name;
6787 end get_assignment_sts_type_name;
6788 --
6789 
6790 function get_grade_name
6791   (
6792    p_grade_id     in  number
6793   ) return varchar2 is
6794 
6795   l_grade_name per_grades_vl.name%type := null;
6796 
6797   cursor c_grade_name is
6798   select grd.name
6799   from   per_grades_vl grd
6800   where  grd.grade_id = p_grade_id;
6801 
6802 begin
6803   open c_grade_name;
6804   fetch c_grade_name into l_grade_name;
6805   close c_grade_name;
6806 
6807   return l_grade_name;
6808 end get_grade_name;
6809 --
6810 
6811 function get_hrs_wkd_in_perd_fctr_name
6812   (
6813    p_hrs_wkd_in_perd_fctr_id     in  number
6814   ) return varchar2 is
6815 
6816   l_hrs_wkd_in_perd_fctr_name ben_hrs_wkd_in_perd_fctr.name%type := null;
6817 
6818   cursor c_hrs_wkd_in_perd_fctr_name is
6819   select hwf.name
6820   from   ben_hrs_wkd_in_perd_fctr hwf
6821   where  hwf.hrs_wkd_in_perd_fctr_id = p_hrs_wkd_in_perd_fctr_id;
6822 
6823 begin
6824   open c_hrs_wkd_in_perd_fctr_name;
6825   fetch c_hrs_wkd_in_perd_fctr_name into l_hrs_wkd_in_perd_fctr_name;
6826   close c_hrs_wkd_in_perd_fctr_name;
6827 
6828   return l_hrs_wkd_in_perd_fctr_name;
6829 end get_hrs_wkd_in_perd_fctr_name;
6830 --
6831 
6832 function get_lbr_mmbr_name
6833   (
6834    p_lbr_mmbr_flag     in  varchar2
6835   ) return varchar2 is
6836 
6837   l_lbr_mmbr_name hr_lookups.meaning%type;
6838 
6839 begin
6840 
6841   l_lbr_mmbr_name := hr_general.decode_lookup('YES_NO',p_lbr_mmbr_flag);
6842 
6843   return l_lbr_mmbr_name;
6844 
6845 end get_lbr_mmbr_name;
6846 --
6847 
6848 function get_absence_type_name
6849   (
6850    p_absence_attendance_type_id     in  number
6851   ) return varchar2 is
6852 
6853   l_absence_type_name per_absence_attendance_types.name%type := null;
6854 
6855   cursor c_absence_type_name is
6856   select aat.name
6857   from   per_absence_attendance_types aat
6858   where  aat.absence_attendance_type_id = p_absence_attendance_type_id;
6859 
6860 begin
6861   open c_absence_type_name;
6862   fetch c_absence_type_name into l_absence_type_name;
6863   close c_absence_type_name;
6864 
6865   return l_absence_type_name;
6866 end get_absence_type_name;
6867 --
6868 
6869 function get_los_fctr_name
6870   (
6871    p_los_fctr_id     in  number
6872   ) return varchar2 is
6873 
6874   l_los_fctr_name ben_los_fctr.name%type := null;
6875 
6876   cursor c_los_fctr_name is
6877   select lsf.name
6878   from   ben_los_fctr lsf
6879   where  lsf.los_fctr_id = p_los_fctr_id;
6880 
6881 begin
6882   open c_los_fctr_name;
6883   fetch c_los_fctr_name into l_los_fctr_name;
6884   close c_los_fctr_name;
6885 
6886   return l_los_fctr_name;
6887 end get_los_fctr_name;
6888 --
6889 
6890 function get_pct_fl_tm_fctr_name
6891   (
6892    p_pct_fl_tm_fctr_id     in  number
6893   ) return varchar2 is
6894 
6895   l_pct_fl_tm_fctr_name ben_pct_fl_tm_fctr.name%type := null;
6896 
6897   cursor c_pct_fl_tm_fctr_name is
6898   select pff.name
6899   from   ben_pct_fl_tm_fctr pff
6900   where  pff.pct_fl_tm_fctr_id = p_pct_fl_tm_fctr_id;
6901 
6902 begin
6903   open c_pct_fl_tm_fctr_name;
6904   fetch c_pct_fl_tm_fctr_name into l_pct_fl_tm_fctr_name;
6905   close c_pct_fl_tm_fctr_name;
6906 
6907   return l_pct_fl_tm_fctr_name;
6908 end get_pct_fl_tm_fctr_name;
6909 --
6910 
6911 function get_person_type_name
6912   (
6913    p_person_type_id     in  number
6914   ) return varchar2 is
6915 
6916   l_person_type_name per_person_types_tl.user_person_type%type := null;
6917 
6918   cursor c_person_type_name is
6919   select pty.user_person_type
6920   from   per_person_types_tl pty
6921   where  pty.person_type_id = p_person_type_id
6922   and    pty.language = userenv('LANG');
6923 
6924 begin
6925   open c_person_type_name;
6926   fetch c_person_type_name into l_person_type_name;
6927   close c_person_type_name;
6928 
6929   return l_person_type_name;
6930 end get_person_type_name;
6931 --
6932 
6933 function get_people_group_name
6934   (
6935    p_people_group_id     in  number
6936   ) return varchar2 is
6937 
6938   l_people_group_name pay_people_groups.group_name%type := null;
6939 
6940   cursor c_people_group_name is
6941   select nvl(ppg.group_name,segment1) name
6942   from   pay_people_groups ppg
6943   where  ppg.people_group_id = p_people_group_id;
6944 
6945 begin
6946   open c_people_group_name;
6947   fetch c_people_group_name into l_people_group_name;
6948   close c_people_group_name;
6949 
6950   return l_people_group_name;
6951 end get_people_group_name;
6952 --
6953 
6954 function get_pstl_zip_rng_name
6955   (
6956    p_pstl_zip_rng_id     in  number
6957   ,p_effective_date      in date
6958   ) return varchar2 is
6959 
6960   l_pstl_zip_rng_name varchar2(200):= null;
6961 
6962   cursor c_pstl_zip_rng_name is
6963   select rzr.from_value ||' - '||rzr.to_value
6964   from   ben_pstl_zip_rng_f rzr
6965   where  rzr.pstl_zip_rng_id = p_pstl_zip_rng_id
6966   and    p_effective_date between rzr.effective_start_date
6967   and    rzr.effective_end_date;
6968 
6969 begin
6970   open c_pstl_zip_rng_name;
6971   fetch c_pstl_zip_rng_name into l_pstl_zip_rng_name;
6972   close c_pstl_zip_rng_name;
6973 
6974   return l_pstl_zip_rng_name;
6975 end get_pstl_zip_rng_name;
6976 --
6977 
6978 function get_payroll_name
6979   (
6980    p_payroll_id          in  number
6981   ,p_effective_date      in date
6982   ) return varchar2 is
6983 
6984   l_payroll_name pay_all_payrolls_f.payroll_name%type := null;
6985 
6986   cursor c_payroll_name is
6987   select prl.payroll_name
6988   from   pay_all_payrolls_f prl
6989   where  prl.payroll_id = p_payroll_id
6990   and    p_effective_date between prl.effective_start_date
6991   and    prl.effective_end_date;
6992 
6993 begin
6994   open c_payroll_name;
6995   fetch c_payroll_name into l_payroll_name;
6996   close c_payroll_name;
6997 
6998   return l_payroll_name;
6999 end get_payroll_name;
7000 --
7001 
7002 function get_pay_basis_name
7003   (
7004    p_pay_basis_id          in  number
7005   ) return varchar2 is
7006 
7007   l_pay_basis_name per_pay_bases.name%type := null;
7008 
7009   cursor c_pay_basis_name is
7010   select pba.name
7011   from   per_pay_bases pba
7012   where  pba.pay_basis_id = p_pay_basis_id;
7013 
7014 begin
7015   open c_pay_basis_name;
7016   fetch c_pay_basis_name into l_pay_basis_name;
7017   close c_pay_basis_name;
7018 
7019   return l_pay_basis_name;
7020 end get_pay_basis_name;
7021 --
7022 
7023 function get_svc_area_name
7024   (
7025    p_svc_area_id          in  number
7026   ,p_effective_date       in  date
7027   ) return varchar2 is
7028 
7029   l_svc_area_name ben_svc_area_f.name%type := null;
7030 
7031   cursor c_svc_area_name is
7032   select sva.name
7033   from   ben_svc_area_f sva
7034   where  sva.svc_area_id = p_svc_area_id
7035   and    p_effective_date between sva.effective_start_date
7036   and    sva.effective_end_date;
7037 
7038 begin
7039   open c_svc_area_name;
7040   fetch c_svc_area_name into l_svc_area_name;
7041   close c_svc_area_name;
7042 
7043   return l_svc_area_name;
7044 end get_svc_area_name;
7045 --
7046 
7047 function get_location_name
7048   (
7049    p_location_id          in  number
7050   ) return varchar2 is
7051 
7052   l_location_name hr_locations.location_code%type := null;
7053 
7054   cursor c_location_name is
7055   select loc.location_code
7056   from   hr_locations loc
7057   where  loc.location_id = p_location_id;
7058 
7059 begin
7060   open c_location_name;
7061   fetch c_location_name into l_location_name;
7062   close c_location_name;
7063 
7064   return l_location_name;
7065 end get_location_name;
7066 --
7067 
7068 function get_acty_base_rt_name
7069   (
7070    p_acty_base_rt_id      in  number
7071   ,p_effective_date       in  date
7072   ) return varchar2 is
7073 
7074   l_acty_base_rt_name ben_acty_base_rt_f.name%type := null;
7075 
7076   cursor c_acty_base_rt_name is
7077   select abr.name
7078   from   ben_acty_base_rt_f abr
7079   where  abr.acty_base_rt_id = p_acty_base_rt_id
7080   and    p_effective_date between abr.effective_start_date
7081   and    abr.effective_end_date;
7082 
7083 begin
7084   open c_acty_base_rt_name;
7085   fetch c_acty_base_rt_name into l_acty_base_rt_name;
7086   close c_acty_base_rt_name;
7087 
7088   return l_acty_base_rt_name;
7089 end get_acty_base_rt_name;
7090 --
7091 
7092 function get_eligy_prfl_name
7093   (
7094    p_eligy_prfl_id        in  number
7095   ,p_effective_date       in  date
7096   ) return varchar2 is
7097 
7098   l_eligy_prfl_name ben_eligy_prfl_f.name%type := null;
7099 
7100   cursor c_eligy_prfl_name is
7101   select elp.name
7102   from   ben_eligy_prfl_f elp
7103   where  elp.eligy_prfl_id = p_eligy_prfl_id
7104   and    p_effective_date between elp.effective_start_date
7105   and    elp.effective_end_date;
7106 
7107 begin
7108   open c_eligy_prfl_name;
7109   fetch c_eligy_prfl_name into l_eligy_prfl_name;
7110   close c_eligy_prfl_name;
7111 
7112   return l_eligy_prfl_name;
7113 end get_eligy_prfl_name;
7114 --
7115 
7116 function get_cbr_quald_bnf_name
7117   (
7118    p_ptip_id              in  number
7119   ,p_pgm_id               in  number
7120   ,p_effective_date       in  date
7121   ) return varchar2 is
7122 
7123   l_name      varchar2(500) := null;
7124 
7125 begin
7126 
7127   if p_ptip_id is not null then
7128     l_name := get_ptip_name(p_ptip_id,p_effective_date);
7129 
7130   elsif p_pgm_id is not null then
7131      l_name := get_pgm_name(p_pgm_id,p_effective_date);
7132 
7133   end if;
7134   return l_name;
7135 end get_cbr_quald_bnf_name;
7136 --
7137 
7138 function get_job_name
7139   (
7140    p_job_id        in  number
7141   ) return varchar2 is
7142 
7143   l_job_name per_jobs_vl.name%type := null;
7144 
7145   cursor c_job_name is
7146   select job.name
7147   from   per_jobs_vl job
7148   where  job.job_id = p_job_id;
7149 
7150 begin
7151   open c_job_name;
7152   fetch c_job_name into l_job_name;
7153   close c_job_name;
7154 
7155   return l_job_name;
7156 end get_job_name;
7157 --
7158 
7159 function get_sp_clng_step_name
7160   (
7161    p_special_ceiling_step_id   in  number
7162   ,p_effective_date            in date
7163   ) return varchar2 is
7164 
7165   l_sp_clng_step_name   varchar2(800) := null;
7166 
7167   cursor c_sp_clng_step_name is
7168   select a.name ||b.name ||c.spinal_point name
7169   from per_grades_vl a, per_parent_spines b, per_spinal_points c,
7170        per_spinal_point_steps_f d, per_grade_spines e
7171   where d.step_id = p_special_ceiling_step_id
7172   and   d.spinal_point_id = c.spinal_point_id
7173   and   d.grade_spine_id  = e.grade_spine_id
7174   and   e.grade_id  = a.grade_id
7175   and   e.parent_spine_id = b.parent_spine_id
7176   and   p_effective_date between d.effective_start_date
7177         and d.effective_end_date;
7178 
7179 begin
7180   open c_sp_clng_step_name;
7181   fetch c_sp_clng_step_name into l_sp_clng_step_name;
7182   close c_sp_clng_step_name;
7183 
7184   return l_sp_clng_step_name;
7185 end get_sp_clng_step_name;
7186 --
7187 
7188 function get_position_name
7189   (
7190    p_position_id        in  number
7191   ) return varchar2 is
7192 
7193   l_position_name per_positions.name%type := null;
7194 
7195   cursor c_position_name is
7196   select pos.name
7197   from   per_positions pos
7198   where  pos.position_id = p_position_id;
7199 
7200 begin
7201   open c_position_name;
7202   fetch c_position_name into l_position_name;
7203   close c_position_name;
7204 
7205   return l_position_name;
7206 end get_position_name;
7207 --
7208 
7209 function get_qual_type_name
7210   (
7211    p_qualification_type_id         in  number
7212   ) return varchar2 is
7213 
7214   l_qual_type_name per_qualification_types_vl.name%type := null;
7215 
7216   cursor c_qual_type_name is
7217   select pqt.name
7218   from   per_qualification_types_vl pqt
7219   where  pqt.qualification_type_id = p_qualification_type_id;
7220 
7221 begin
7222   open c_qual_type_name;
7223   fetch c_qual_type_name into l_qual_type_name;
7224   close c_qual_type_name;
7225 
7226   return l_qual_type_name;
7227 end get_qual_type_name;
7228 --
7229 
7230 function get_dpnt_cvg_eligy_prfl_name
7231   (
7232    p_dpnt_cvg_eligy_prfl_id        in  number
7233   ,p_effective_date                in  date
7234   ) return varchar2 is
7235 
7236   l_dpnt_cvg_eligy_prfl_name ben_dpnt_cvg_eligy_prfl_f.name%type := null;
7237 
7238   cursor c_dpnt_cvg_eligy_prfl_name is
7239   select dce.name
7240   from   ben_dpnt_cvg_eligy_prfl_f dce
7241   where  dce.dpnt_cvg_eligy_prfl_id = p_dpnt_cvg_eligy_prfl_id
7242   and    p_effective_date between dce.effective_start_date
7243   and    dce.effective_end_date;
7244 
7245 begin
7246   open c_dpnt_cvg_eligy_prfl_name;
7247   fetch c_dpnt_cvg_eligy_prfl_name into l_dpnt_cvg_eligy_prfl_name;
7248   close c_dpnt_cvg_eligy_prfl_name;
7249 
7250   return l_dpnt_cvg_eligy_prfl_name;
7251 end get_dpnt_cvg_eligy_prfl_name;
7252 --
7253 function get_competence_rating_name
7254   (
7255    p_competence_id        in  number
7256   ,p_rating_level_id      in number
7257   ) return varchar2 is
7258 
7259   l_competence_name per_competences_vl.name%type := null;
7260   l_rating_level_name per_rating_levels_vl.name%type := null;
7261 
7262   cursor c_competence_name is
7263   select pco.name
7264   from   per_competences_vl pco
7265   where  pco.competence_id = p_competence_id;
7266 
7267   cursor c_rating_level_name is
7268   select rtl.name
7269   from   per_rating_levels_vl rtl
7270   where  rtl.rating_level_id = p_rating_level_id;
7271 begin
7272   open c_competence_name;
7273   fetch c_competence_name into l_competence_name;
7274   close c_competence_name;
7275 
7276   open c_rating_level_name;
7277   fetch c_rating_level_name into l_rating_level_name;
7278   close c_rating_level_name;
7279 
7280   return l_competence_name ||' - '||l_rating_level_name;
7281 end get_competence_rating_name;
7282 --
7283 
7284 function get_hlth_cvg_name
7285   (
7286    p_pl_typ_opt_typ_id   in  number
7287   ,p_oipl_id             in  number
7288   ,p_effective_date      in  date
7289   ) return varchar2 is
7290 
7291   cursor c_pl_typ_opt_typ is
7292   select pon.pl_typ_id
7293         ,pon.opt_id
7294   from   ben_pl_typ_opt_typ_f pon
7295   where  pon.pl_typ_opt_typ_id = p_pl_typ_opt_typ_id
7296   and    p_effective_date between pon.effective_start_date
7297   and    pon.effective_end_date;
7298 
7299   cursor c_oipl is
7300   select pl_id
7301   from ben_oipl_f cop
7302   where cop.oipl_id = p_oipl_id
7303   and   p_effective_date between cop.effective_start_date
7304   and   cop.effective_end_date;
7305 
7306   l_pl_typ_name ben_pl_typ_f.name%type;
7307   l_opt_name    ben_opt_f.name%type;
7308   l_pl_name     ben_pl_f.name%type;
7309   l_pl_typ_id   ben_pl_typ_f.pl_typ_id%type;
7310   l_opt_id      ben_opt_f.opt_id%type;
7311   l_pl_id       ben_pl_f.pl_id%type;
7312 
7313 begin
7314 
7315   open c_pl_typ_opt_typ;
7316   fetch c_pl_typ_opt_typ into l_pl_typ_id, l_opt_id;
7317   close c_pl_typ_opt_typ;
7318 
7319   open c_oipl;
7320   fetch c_oipl into l_pl_id;
7321   close c_oipl;
7322 
7323   l_opt_name := get_opt_name(l_opt_id,p_effective_date);
7324   l_pl_typ_name := get_pl_typ_name(l_pl_typ_id,p_effective_date);
7325   l_pl_name := get_pl_name(l_pl_id,p_effective_date);
7326 
7327   return l_pl_typ_name ||' - '||l_opt_name ||' - '||l_pl_name;
7328 
7329 end get_hlth_cvg_name;
7330 --
7331 -- Bug 4169120 : Rate By Criteria
7332 --
7333 function get_eligy_criteria_name
7334           (
7335            p_eligy_criteria_id   in  number
7336           ) return varchar2 is
7337   --
7338   cursor c_egl is
7339      select egl.name
7340        from ben_eligy_criteria egl
7341       where egl.eligy_criteria_id = p_eligy_criteria_id;
7342   --
7343   l_eligy_criteria_name       varchar2(240);
7344   --
7345 begin
7346   --
7347   open c_egl;
7348     --
7349     fetch c_egl into l_eligy_criteria_name;
7350     --
7351   close c_egl;
7352   --
7353   return l_eligy_criteria_name;
7354   --
7355 end;
7356 --
7357 
7358 function get_exclude_message
7359   (
7360    p_excld_flag in varchar2
7361   ) return varchar2 is
7362   l_exclude_message fnd_new_messages.message_text%type := null;
7363 begin
7364 
7365   if p_excld_flag = 'Y' then
7366    l_exclude_message := fnd_message.get_string('BEN','BEN_93294_PDC_EXCLUDE_FLAG');
7367   end if;
7368 
7369   return l_exclude_message;
7370 end get_exclude_message;
7371 
7372 ---------------------------------------------------------------
7373 -- END OF INTERSECTION NAME FUNCTIONS ----------------------
7374 ---------------------------------------------------------------
7375 end ben_plan_design_program_module;