DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PLAN_DESIGN_PLAN_MODULE

Source


1 Package Body ben_plan_design_plan_module as
2 /* $Header: bepdcpln.pkb 120.5 2006/12/04 09:49:35 vborkar noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  ben_plan_design_plan_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 
15 procedure create_plan_result
16   (
17    p_validate                       in number        default 0 -- false
18   ,p_copy_entity_result_id          out nocopy number
19   ,p_copy_entity_txn_id             in  number    default null
20   ,p_pl_id                          in  number    default null
21   ,p_plip_id                        in  number    default null
22   ,p_business_group_id              in  number    default null
23   ,p_number_of_copies               in  number    default 0
24   ,p_object_version_number          out nocopy number
25   ,p_effective_date                 in date
26   ,p_no_dup_rslt                    in varchar2   default null
27   ) is
28   --
29   -- Declare cursors and local variables
30   --
31   l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
32   l_proc varchar2(72) := g_package||'create_copy_entity_result';
33   l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
34    --
35 
36   cursor c_pln_from_parent(c_PLIP_ID number,c_pl_id number ) is
37    select  distinct pln.pl_id,
38            null  Information8
39    from BEN_PLIP_F plip,
40         BEN_PL_F PLN
41    where ( C_PLIP_ID is not null and plip.PLIP_ID = C_PLIP_ID )
42    and   plip.pl_id=pln.pl_id
43    union
44    select  distinct pln.pl_id,
45            'PLNIP' Information8
46    from BEN_PL_F PLN
47    where ( C_PL_ID is not null and pln.PL_ID = C_PL_ID);
48 
49 /*
50    cursor c_pln_from_parent(c_PLIP_ID number,c_pl_id number ) is
51    select  pln.pl_id,
52            ptp.name pl_typ_name,
53            hl.meaning Plan_Usage,
54            null  Information8
55    from BEN_PLIP_F plip,
56         BEN_PL_F PLN,
57         ben_pl_typ_f ptp,
58         hr_lookups hl
59    where ( C_PLIP_ID is not null and plip.PLIP_ID = C_PLIP_ID )
60    and   plip.pl_id=pln.pl_id
61    and   pln.pl_typ_id = ptp.pl_typ_id
62    and   pln.pl_cd = hl.lookup_code
63    and   hl.lookup_type = 'BEN_PL'
64    union
65    select  pln.pl_id,
66            ptp.name pl_typ_name,
67            hl.meaning Plan_Usage,
68            'PLNIP' Information8
69    from BEN_PL_F PLN,
70         ben_pl_typ_f ptp,
71         hr_lookups hl
72    where ( C_PL_ID is not null and pln.PL_ID = C_PL_ID )
73    and   pln.pl_typ_id = ptp.pl_typ_id
74    and   pln.pl_cd = hl.lookup_code
75    and   hl.lookup_type = 'BEN_PL' ;
76   */
77    --
78    cursor c_pln(c_pl_id number,c_mirror_src_entity_result_id number,
79                 c_table_alias varchar2) is
80    select  pln.*
81    from BEN_PL_F pln
82    where  pln.pl_id = c_pl_id
83      -- and pln.business_group_id = p_business_group_id
84      and not exists (
85          select /*+  */ null
86          from ben_copy_entity_results cpe
87 --         	  ,pqh_table_route trt
88          where copy_entity_txn_id = p_copy_entity_txn_id
89 --           and trt.table_route_id = cpe.table_route_id
90            and ( c_mirror_src_entity_result_id is null or
91                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
92            -- and trt.where_clause = 'BEN_PL_F'
93            and cpe.table_alias = c_table_alias
94            and information1 = c_pl_id
95            -- and information4 = pln.business_group_id
96            and information2 = pln.effective_start_date
97            and information3 = pln.effective_end_date
98      );
99 
100    l_cv_result_type_cd   varchar2(30) :=  'DISPLAY' ;
101    --
102    -- Cursor to get mirror_src_entity_result_id
103    cursor c_parent_result(c_parent_pk_id number,
104                         -- c_parent_table_name varchar2,
105                         c_parent_table_alias varchar2,
106                         c_copy_entity_txn_id number) is
107    select copy_entity_result_id mirror_src_entity_result_id
108    from ben_copy_entity_results cpe
109 --        ,pqh_table_route trt
110    where cpe.information1= c_parent_pk_id
111    and   cpe.result_type_cd = l_cv_result_type_cd
112    and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
113 --   and   cpe.table_route_id = trt.table_route_id
114    -- and   trt.from_clause = 'OAB'
115    -- and   trt.where_clause = upper(c_parent_table_name)
116    and   cpe.table_alias = c_parent_table_alias ;
117    ---
118 
119    cursor c_parent_result1(c_parent_pk_id number,
120                            c_parent_table_alias varchar2,
121                            c_copy_entity_txn_id number) is
122    select min(copy_entity_result_id) mirror_src_entity_result_id
123    from ben_copy_entity_results cpe
124  --       ,pqh_table_route trt
125    where cpe.information1= c_parent_pk_id
126    and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
127 --   and   cpe.table_route_id = trt.table_route_id
128    and   cpe.table_alias = c_parent_table_alias ;
129 
130    --
131    -- Bug : 3752407 : Global cursor g_table_route will now be used
132    --
133    -- Cursor to get table_route_id
134    -- cursor c_table_route(c_parent_table_alias varchar2)is
135    -- select table_route_id
136    -- from pqh_table_route trt
137    -- where  trt.table_alias = c_parent_table_alias;
138    -- trt.from_clause = 'OAB'
139    -- and   trt.where_clause = upper(c_parent_table_name) ;
140    ---
141 
142    -- Cursor to get parent record's effective_start_date
143    -- to be stored for non date-tracked child records
144    cursor c_parent_esd(c_parent_pk_id number,
145                        -- c_parent_table_name varchar2,
146                        c_parent_table_alias varchar2,
147                        c_copy_entity_txn_id number) is
148    select min(cpe.information2) min_esd
149    from   ben_copy_entity_results cpe
150 --          ,pqh_table_route trt
151    where  cpe.information1= c_parent_pk_id
152    and    cpe.copy_entity_txn_id = c_copy_entity_txn_id
153 --   and    cpe.table_route_id = trt.table_route_id
154    -- and    trt.from_clause = 'OAB'
155    -- and    trt.where_clause = upper(c_parent_table_name);
156    and    cpe.table_alias = c_parent_table_alias;
157 
158    --
159    --Mapping for CWB Group_pl_id
160    --
161    cursor c_grp_pl_name (p_group_pl_id in number) is
162    select name group_pl_name
163    from ben_pl_f
164    where pl_id = p_group_pl_id
165      and p_effective_date between effective_start_date and effective_end_date;
166 
167    l_mapping_id         number;
168    l_mapping_name       varchar2(600);
169    l_mapping_column_name1 pqh_attributes.attribute_name%type;
170    l_mapping_column_name2 pqh_attributes.attribute_name%type;
171 
172    -- Mapping end for CWB
173 
174    l_pln_esd ben_pl_f.effective_start_date%type;
175 
176    ---------------------------------------------------------------
177    -- START OF BEN_PL_TYP_F ----------------------
178    ---------------------------------------------------------------
179    cursor c_ptp_from_parent(c_PL_ID number) is
180    select  pl_typ_id
181    from BEN_PL_F
182    where  PL_ID = c_PL_ID ;
183    --
184 
185    l_pl_typ_id                 number(15);
186    l_out_ptp_result_id   number(15);
187    ---------------------------------------------------------------
188    -- END OF BEN_PL_TYP_F ----------------------
189    ---------------------------------------------------------------
190    cursor c_vgs_from_parent(c_PL_ID number) is
191    select  pl_gd_or_svc_id
192    from BEN_PL_GD_OR_SVC_F
193    where  PL_ID = c_PL_ID ;
194    --
195    cursor c_vgs(c_pl_gd_or_svc_id number,c_mirror_src_entity_result_id number,
196                 c_table_alias varchar2) is
197    select  vgs.*
198    from BEN_PL_GD_OR_SVC_F vgs
199    where  vgs.pl_gd_or_svc_id = c_pl_gd_or_svc_id
200      -- and vgs.business_group_id = p_business_group_id
201      and not exists (
202          select /*+  */ null
203          from ben_copy_entity_results cpe
204 --              ,pqh_table_route trt
205          where copy_entity_txn_id = p_copy_entity_txn_id
206 --           and trt.table_route_id = cpe.table_route_id
207            and ( -- c_mirror_src_entity_result_id is null or
208                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
209            -- and trt.where_clause = 'BEN_PL_GD_OR_SVC_F'
210            and cpe.table_alias = c_table_alias
211            and information1 = c_pl_gd_or_svc_id
212            -- and information4 = vgs.business_group_id
213            and information2 = vgs.effective_start_date
214            and information3 = vgs.effective_end_date
215      );
216 
217    l_out_vgs_result_id   number(15);
218    --
219 ---------------------------------------------------------------
220 -- START OF BEN_CWB_WKSHT_GRP ----------------------
221 ---------------------------------------------------------------
222    cursor c_cwg_from_parent(c_PL_ID number) is
223    select  cwb_wksht_grp_id
224    from BEN_CWB_WKSHT_GRP
225    where  PL_ID = c_PL_ID ;
226    --
227    cursor c_cwg(c_cwb_wksht_grp_id number,c_mirror_src_entity_result_id number,
228                 c_table_alias varchar2) is
229    select  cwg.*
230    from BEN_CWB_WKSHT_GRP cwg
231    where  cwg.cwb_wksht_grp_id = c_cwb_wksht_grp_id
232      and cwg.business_group_id = p_business_group_id
233      and not exists (
234          select /*+  */ null
235          from ben_copy_entity_results cpe
236 --              ,pqh_table_route trt
237          where copy_entity_txn_id = p_copy_entity_txn_id
238 --         and trt.table_route_id = cpe.table_route_id
239          and ( --c_mirror_src_entity_result_id is null or
240                c_mirror_src_entity_result_id = c_mirror_src_entity_result_id )
241          -- and trt.where_clause = 'BEN_CWB_WKSHT_GRP'
242          and cpe.table_alias = c_table_alias
243          and information1 = c_cwb_wksht_grp_id
244          --and information4 = cwg.business_group_id
245         );
246 
247 cursor c_cri(c_cwb_wksht_grp_id number, c_mirror_src_entity_result_id number,
248                 c_table_alias varchar2) is
249 select cri.*
250 from BEN_CUSTOM_REGION_ITEMS cri
251 where cri.custom_key = to_char(c_cwb_wksht_grp_id)
252   and cri.custom_type like 'Cwb%PG'
253   and not exists (
254 	select /*+  */ null
255          from ben_copy_entity_results cpe
256          where copy_entity_txn_id = p_copy_entity_txn_id
257          and (c_mirror_src_entity_result_id = c_mirror_src_entity_result_id )
258          and cpe.table_alias = c_table_alias
259          and information1 = c_cwb_wksht_grp_id
260         );
261 
262     l_cwb_wksht_grp_id                 number(15);
263     l_cri_information5              ben_copy_entity_results.information5%type;
264     l_cri_result_type_cd            varchar2(30);
265     l_out_cri_result_id   number(15);
266     l_out_cwg_result_id   number(15);
267 ---------------------------------------------------------------
268 -- END OF BEN_CWB_WKSHT_GRP ----------------------
269 ---------------------------------------------------------------
270 
271 ---------------------------------------------------------------
272 -- START OF BEN_VALD_RLSHP_FOR_REIMB_F ----------------------
273 ---------------------------------------------------------------
274    cursor c_vrp_from_parent(c_PL_ID number) is
275    select  vald_rlshp_for_reimb_id
276    from BEN_VALD_RLSHP_FOR_REIMB_F
277    where  PL_ID = c_PL_ID ;
278    --
279    cursor c_vrp(c_vald_rlshp_for_reimb_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
280    select  vrp.*
281    from BEN_VALD_RLSHP_FOR_REIMB_F vrp
282    where  vrp.vald_rlshp_for_reimb_id = c_vald_rlshp_for_reimb_id
283      -- and vrp.business_group_id = p_business_group_id
284      and not exists (
285          select /*+  */ null
286          from ben_copy_entity_results cpe
287 --              ,pqh_table_route trt
288          where copy_entity_txn_id = p_copy_entity_txn_id
289 --           and trt.table_route_id = cpe.table_route_id
290            and ( -- c_mirror_src_entity_result_id is null or
291                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
292            -- and trt.where_clause ='BEN_VALD_RLSHP_FOR_REIMB_F'
293            and cpe.table_alias = c_table_alias
294            and information1 = c_vald_rlshp_for_reimb_id
295            -- and information4 = vrp.business_group_id
296            and information2 = vrp.effective_start_date
297            and information3 = vrp.effective_end_date
298      );
299 
300     l_out_vrp_result_id   number(15);
301 ---------------------------------------------------------------
302 -- END OF BEN_VALD_RLSHP_FOR_REIMB_F ----------------------
303 ---------------------------------------------------------------
304 ---------------------------------------------------------------
305 -- START OF BEN_WV_PRTN_RSN_PL_F ----------------------
306 ---------------------------------------------------------------
307    cursor c_wpn_from_parent(c_PL_ID number) is
308    select  wv_prtn_rsn_pl_id
309    from BEN_WV_PRTN_RSN_PL_F
310    where  PL_ID = c_PL_ID ;
311    --
312    cursor c_wpn(c_wv_prtn_rsn_pl_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
313    select  wpn.*
314    from BEN_WV_PRTN_RSN_PL_F wpn
315    where  wpn.wv_prtn_rsn_pl_id = c_wv_prtn_rsn_pl_id
316      -- and wpn.business_group_id = p_business_group_id
317      and not exists (
318          select /*+  */ null
319          from ben_copy_entity_results cpe
320 --              ,pqh_table_route trt
321          where copy_entity_txn_id = p_copy_entity_txn_id
322 --           and trt.table_route_id = cpe.table_route_id
323            and ( -- c_mirror_src_entity_result_id is null or
324                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
325            -- and trt.where_clause = 'BEN_WV_PRTN_RSN_PL_F'
326            and cpe.table_alias = c_table_alias
327            and information1 = c_wv_prtn_rsn_pl_id
328            -- and information4 = wpn.business_group_id
329            and information2 = wpn.effective_start_date
330            and information3 = wpn.effective_end_date
331      );
332 
333     l_out_wpn_result_id   number(15);
334 ---------------------------------------------------------------
335 -- END OF BEN_WV_PRTN_RSN_PL_F ----------------------
336 ---------------------------------------------------------------
337 
338 ---------------------------------------------------------------
339 -- START OF BEN_BNFT_RSTRN_CTFN_F ----------------------
340 ---------------------------------------------------------------
341    cursor c_brc_from_parent(c_PL_ID number) is
342    select  bnft_rstrn_ctfn_id
343    from BEN_BNFT_RSTRN_CTFN_F
344    where  PL_ID = c_PL_ID ;
345    --
346    cursor c_brc(c_bnft_rstrn_ctfn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
347    select  brc.*
348    from BEN_BNFT_RSTRN_CTFN_F brc
349    where  brc.bnft_rstrn_ctfn_id = c_bnft_rstrn_ctfn_id
350      -- and brc.business_group_id = p_business_group_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 ( -- c_mirror_src_entity_result_id is null or
358                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
359            -- and trt.where_clause = 'BEN_BNFT_RSTRN_CTFN_F'
360            and cpe.table_alias = c_table_alias
361            and information1 = c_bnft_rstrn_ctfn_id
362            -- and information4 = brc.business_group_id
363            and information2 = brc.effective_start_date
364            and information3 = brc.effective_end_date
365      );
366 
367     l_out_brc_result_id   number(15);
368 ---------------------------------------------------------------
369 -- END OF BEN_BNFT_RSTRN_CTFN_F ----------------------
370 ---------------------------------------------------------------
371    ---
372 ---------------------------------------------------------------
373 -- START OF BEN_LER_BNFT_RSTRN_F ----------------------
374 ---------------------------------------------------------------
375    cursor c_lbr_from_parent(c_PL_ID number) is
376    select distinct ler_bnft_rstrn_id
377    from BEN_LER_BNFT_RSTRN_F
378    where  PL_ID = c_PL_ID ;
379    --
380    cursor c_lbr(c_ler_bnft_rstrn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
381    select  lbr.*
382    from BEN_LER_BNFT_RSTRN_F lbr
383    where  lbr.ler_bnft_rstrn_id = c_ler_bnft_rstrn_id
384      -- and lbr.business_group_id = p_business_group_id
385      and not exists (
386          select /*+  */ null
387          from ben_copy_entity_results cpe
388 --              ,pqh_table_route trt
389          where copy_entity_txn_id = p_copy_entity_txn_id
390 --           and trt.table_route_id = cpe.table_route_id
391            and ( -- c_mirror_src_entity_result_id is null or
392                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
393            -- and trt.where_clause = 'BEN_LER_BNFT_RSTRN_F'
394            and cpe.table_alias = c_table_alias
395            and information1 = c_ler_bnft_rstrn_id
396            -- and information4 = lbr.business_group_id
397            and information2 = lbr.effective_start_date
398            and information3 = lbr.effective_end_date
399      );
400    cursor c_lbr_drp(c_ler_bnft_rstrn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
401    select distinct cpe.information257 ler_id
402          from ben_copy_entity_results cpe
403 --              ,pqh_table_route trt
404          where copy_entity_txn_id = p_copy_entity_txn_id
405 --         and trt.table_route_id = cpe.table_route_id
406          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
407          -- and trt.where_clause = 'BEN_LER_BNFT_RSTRN_F'
408          and cpe.table_alias = c_table_alias
409          and information1 = c_ler_bnft_rstrn_id
410          -- and information4 = p_business_group_id
411         ;
412   l_out_lbr_result_id   number(15);
413 ---------------------------------------------------------------
414 -- END OF BEN_LER_BNFT_RSTRN_F ----------------------
415 ---------------------------------------------------------------
416    ---
417 ---------------------------------------------------------------
418 -- START OF BEN_ENRT_CTFN_F ----------------------
419 ---------------------------------------------------------------
420    cursor c_ecf_from_parent(c_PL_ID number) is
421    select  enrt_ctfn_id
422    from BEN_ENRT_CTFN_F
423    where  PL_ID = c_PL_ID ;
424    --
425    cursor c_ecf(c_enrt_ctfn_id number,c_mirror_src_entity_result_id number,
426                 c_table_alias varchar2) is
427    select  ecf.*
428    from BEN_ENRT_CTFN_F ecf
429    where  ecf.enrt_ctfn_id = c_enrt_ctfn_id
430      -- and ecf.business_group_id = p_business_group_id
431      and not exists (
432          select /*+  */ null
433          from ben_copy_entity_results cpe
434 --              ,pqh_table_route trt
435          where copy_entity_txn_id = p_copy_entity_txn_id
436 --           and trt.table_route_id = cpe.table_route_id
437            and ( -- c_mirror_src_entity_result_id is null or
438                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
439            -- and trt.where_clause = 'BEN_ENRT_CTFN_F'
440            and cpe.table_alias = c_table_alias
441            and information1 = c_enrt_ctfn_id
442            -- and information4 = ecf.business_group_id
443            and information2 = ecf.effective_start_date
444            and information3 = ecf.effective_end_date
445      );
446 
447     l_out_ecf_result_id   number(15);
448 ---------------------------------------------------------------
449 -- END OF BEN_ENRT_CTFN_F ----------------------
450 ---------------------------------------------------------------
451 ---------------------------------------------------------------
452 -- START OF BEN_LER_CHG_DPNT_CVG_F ----------------------
453 ---------------------------------------------------------------
454    cursor c_ldc_from_parent(c_PL_ID number) is
455    select distinct ler_chg_dpnt_cvg_id
456    from BEN_LER_CHG_DPNT_CVG_F
457    where  PL_ID = c_PL_ID ;
458    --
459    cursor c_ldc(c_ler_chg_dpnt_cvg_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
460    select  ldc.*
461    from BEN_LER_CHG_DPNT_CVG_F ldc
462    where  ldc.ler_chg_dpnt_cvg_id = c_ler_chg_dpnt_cvg_id
463      -- and ldc.business_group_id = p_business_group_id
464      and not exists (
465          select /*+  */ null
466          from ben_copy_entity_results cpe
467 --              ,pqh_table_route trt
468          where copy_entity_txn_id = p_copy_entity_txn_id
469 --           and trt.table_route_id = cpe.table_route_id
470            and ( -- c_mirror_src_entity_result_id is null or
471                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
472            -- and trt.where_clause = 'BEN_LER_CHG_DPNT_CVG_F'
473            and cpe.table_alias = c_table_alias
474            and information1 = c_ler_chg_dpnt_cvg_id
475            -- and information4 = ldc.business_group_id
476            and information2 = ldc.effective_start_date
477            and information3 = ldc.effective_end_date
478      );
479    cursor c_ldc_drp(c_ler_chg_dpnt_cvg_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
480    select distinct cpe.information257 ler_id
481          from ben_copy_entity_results cpe
482 --              ,pqh_table_route trt
483          where copy_entity_txn_id = p_copy_entity_txn_id
484 --         and trt.table_route_id = cpe.table_route_id
485          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
486          -- and trt.where_clause = 'BEN_LER_CHG_DPNT_CVG_F'
487          and cpe.table_alias = c_table_alias
488          and information1 = c_ler_chg_dpnt_cvg_id
489          -- and information4 = p_business_group_id
490         ;
491 
492     l_out_ldc_result_id   number(15);
493 ---------------------------------------------------------------
494 -- END OF BEN_LER_CHG_DPNT_CVG_F ----------------------
495 ---------------------------------------------------------------
496    ---
497 ---------------------------------------------------------------
498 -- START OF BEN_LER_CHG_PL_NIP_ENRT_F ----------------------
499 ---------------------------------------------------------------
500    cursor c_lpe_from_parent(c_PL_ID number) is
501    select distinct ler_chg_pl_nip_enrt_id
502    from BEN_LER_CHG_PL_NIP_ENRT_F
503    where  PL_ID = c_PL_ID ;
504    --
505    cursor c_lpe(c_ler_chg_pl_nip_enrt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
506    select  lpe.*
507    from BEN_LER_CHG_PL_NIP_ENRT_F lpe
508    where  lpe.ler_chg_pl_nip_enrt_id = c_ler_chg_pl_nip_enrt_id
509      -- and lpe.business_group_id = p_business_group_id
510      and not exists (
511          select /*+  */ null
512          from ben_copy_entity_results cpe
513 --              ,pqh_table_route trt
514          where copy_entity_txn_id = p_copy_entity_txn_id
515 --           and trt.table_route_id = cpe.table_route_id
516            and ( -- c_mirror_src_entity_result_id is null or
517                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
518            -- and trt.where_clause = 'BEN_LER_CHG_PL_NIP_ENRT_F'
519            and cpe.table_alias = c_table_alias
520            and information1 = c_ler_chg_pl_nip_enrt_id
521            -- and information4 = lpe.business_group_id
522            and information2 = lpe.effective_start_date
523            and information3 = lpe.effective_end_date
524      );
525    cursor c_lpe_drp(c_ler_chg_pl_nip_enrt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
526    select distinct cpe.information257 ler_id
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 trt.where_clause = 'BEN_LER_CHG_PL_NIP_ENRT_F'
533          and cpe.table_alias = c_table_alias
534          and information1 = c_ler_chg_pl_nip_enrt_id
535          -- and information4 = p_business_group_id
536         ;
537 
538    l_out_lpe_result_id   number(15);
539 ---------------------------------------------------------------
540 -- END OF BEN_LER_CHG_PL_NIP_ENRT_F ----------------------
541 ---------------------------------------------------------------
542    ---
543 ---------------------------------------------------------------
544 -- START OF BEN_LER_RQRS_ENRT_CTFN_F ----------------------
545 ---------------------------------------------------------------
546    cursor c_lre_from_parent(c_PL_ID number) is
547    select distinct ler_rqrs_enrt_ctfn_id
548    from BEN_LER_RQRS_ENRT_CTFN_F
549    where  PL_ID = c_PL_ID ;
550    --
551    cursor c_lre(c_ler_rqrs_enrt_ctfn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
552    select  lre.*
553    from BEN_LER_RQRS_ENRT_CTFN_F lre
554    where  lre.ler_rqrs_enrt_ctfn_id = c_ler_rqrs_enrt_ctfn_id
555      -- and lre.business_group_id = p_business_group_id
556      and not exists (
557          select /*+  */ null
558          from ben_copy_entity_results cpe
559 --              ,pqh_table_route trt
560          where copy_entity_txn_id = p_copy_entity_txn_id
561 --           and trt.table_route_id = cpe.table_route_id
562            and ( -- c_mirror_src_entity_result_id is null or
563                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
564            -- and trt.where_clause = 'BEN_LER_RQRS_ENRT_CTFN_F'
565            and cpe.table_alias = c_table_alias
566            and information1 = c_ler_rqrs_enrt_ctfn_id
567            -- and information4 = lre.business_group_id
568            and information2 = lre.effective_start_date
569            and information3 = lre.effective_end_date
570      );
571    cursor c_lre_drp(c_ler_rqrs_enrt_ctfn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
572    select distinct cpe.information257 ler_id
573          from ben_copy_entity_results cpe
574 --              ,pqh_table_route trt
575          where copy_entity_txn_id = p_copy_entity_txn_id
576 --         and trt.table_route_id = cpe.table_route_id
577          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
578          -- and trt.where_clause = 'BEN_LER_RQRS_ENRT_CTFN_F'
579          and cpe.table_alias = c_table_alias
580          and information1 = c_ler_rqrs_enrt_ctfn_id
581          -- and information4 = p_business_group_id
582         ;
583 
584    l_out_lre_result_id   number(15);
585 ---------------------------------------------------------------
586 -- END OF BEN_LER_RQRS_ENRT_CTFN_F ----------------------
587 ---------------------------------------------------------------
588 ---------------------------------------------------------------
589 -- START OF BEN_PL_PCP ----------------------
590 ---------------------------------------------------------------
591    cursor c_pcp_from_parent(c_PL_ID number) is
592    select  pl_pcp_id
593    from BEN_PL_PCP
594    where  PL_ID = c_PL_ID ;
595    --
596    cursor c_pcp(c_pl_pcp_id number,c_mirror_src_entity_result_id number,
597                 c_table_alias varchar2) is
598    select  pcp.*
599    from BEN_PL_PCP pcp
600    where  pcp.pl_pcp_id = c_pl_pcp_id
601      -- and pcp.business_group_id = p_business_group_id
602      and not exists (
603          select /*+  */ null
604          from ben_copy_entity_results cpe
605 --              ,pqh_table_route trt
606          where copy_entity_txn_id = p_copy_entity_txn_id
607 --           and trt.table_route_id = cpe.table_route_id
608            and ( -- c_mirror_src_entity_result_id is null or
609                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
610            -- and trt.where_clause = 'BEN_PL_PCP'
611            and cpe.table_alias = c_table_alias
612            and information1 = c_pl_pcp_id
613            -- and information4 = pcp.business_group_id
614     );
615 
616    l_out_pcp_result_id number(15);
617 ---------------------------------------------------------------
618 -- END OF BEN_PL_PCP ----------------------
619 ---------------------------------------------------------------
620 ---------------------------------------------------------------
621 -- START OF BEN_PL_PCP_TYP ----------------------
622 ---------------------------------------------------------------
623    cursor c_pty_from_parent(c_PL_PCP_ID number) is
624    select  pl_pcp_typ_id
625    from BEN_PL_PCP_TYP
626    where  PL_PCP_ID = c_PL_PCP_ID ;
627    --
628    cursor c_pty(c_pl_pcp_typ_id number,c_mirror_src_entity_result_id number,
629                 c_table_alias varchar2) is
630    select  pty.*
631    from BEN_PL_PCP_TYP pty
632    where  pty.pl_pcp_typ_id = c_pl_pcp_typ_id
633      -- and pty.business_group_id = p_business_group_id
634      and not exists (
635          select /*+  */ null
636          from ben_copy_entity_results cpe
637 --              pqh_table_route trt
638          where copy_entity_txn_id = p_copy_entity_txn_id
639 --         and trt.table_route_id = cpe.table_route_id
640          and ( -- c_mirror_src_entity_result_id is null or
641                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
642          -- and trt.where_clause = 'BEN_PL_PCP_TYP'
643          and cpe.table_alias = c_table_alias
644          and information1 = c_pl_pcp_typ_id
645          -- and information4 = pty.business_group_id
646         );
647     l_pl_pcp_typ_id                 number(15);
648     l_out_pty_result_id   number(15);
649 ---------------------------------------------------------------
650 -- END OF BEN_PL_PCP_TYP ----------------------
651 ---------------------------------------------------------------
652 ---------------------------------------------------------------
653 -- START OF BEN_PL_BNF_CTFN_F ----------------------
654 ---------------------------------------------------------------
655    cursor c_pcx_from_parent(c_PL_ID number) is
656    select  pl_bnf_ctfn_id
657    from BEN_PL_BNF_CTFN_F
658    where  PL_ID = c_PL_ID ;
659    --
660    cursor c_pcx(c_pl_bnf_ctfn_id number,c_mirror_src_entity_result_id number,
661                 c_table_alias varchar2) is
662    select  pcx.*
663    from BEN_PL_BNF_CTFN_F pcx
664    where  pcx.pl_bnf_ctfn_id = c_pl_bnf_ctfn_id
665      -- and pcx.business_group_id = p_business_group_id
666      and not exists (
667          select /*+  */ null
668          from ben_copy_entity_results cpe
669 --              ,pqh_table_route trt
670          where copy_entity_txn_id = p_copy_entity_txn_id
671 --           and trt.table_route_id = cpe.table_route_id
672            and ( -- c_mirror_src_entity_result_id is null or
673                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
674            -- and trt.where_clause = 'BEN_PL_BNF_CTFN_F'
675            and cpe.table_alias = c_table_alias
676            and information1 = c_pl_bnf_ctfn_id
677            -- and information4 = pcx.business_group_id
678            and information2 = pcx.effective_start_date
679            and information3 = pcx.effective_end_date
680      );
681 
682    l_out_pcx_result_id   number(15);
683 ---------------------------------------------------------------
684 -- END OF BEN_PL_BNF_CTFN_F ----------------------
685 ---------------------------------------------------------------
686 ---------------------------------------------------------------
687 -- START OF BEN_PL_DPNT_CVG_CTFN_F ----------------------
688 ---------------------------------------------------------------
689    cursor c_pnd_from_parent(c_PL_ID number) is
690    select  pl_dpnt_cvg_ctfn_id
691    from BEN_PL_DPNT_CVG_CTFN_F
692    where  PL_ID = c_PL_ID ;
693    --
694    cursor c_pnd(c_pl_dpnt_cvg_ctfn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
695    select  pnd.*
696    from BEN_PL_DPNT_CVG_CTFN_F pnd
697    where  pnd.pl_dpnt_cvg_ctfn_id = c_pl_dpnt_cvg_ctfn_id
698      -- and pnd.business_group_id = p_business_group_id
699      and not exists (
700          select /*+  */ null
701          from ben_copy_entity_results cpe
702 --              ,pqh_table_route trt
703          where copy_entity_txn_id = p_copy_entity_txn_id
704 --           and trt.table_route_id = cpe.table_route_id
705            and ( -- c_mirror_src_entity_result_id is null or
706                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
707            -- and trt.where_clause = 'BEN_PL_DPNT_CVG_CTFN_F'
708            and cpe.table_alias = c_table_alias
709            and information1 = c_pl_dpnt_cvg_ctfn_id
710            -- and information4 = pnd.business_group_id
711            and information2 = pnd.effective_start_date
712            and information3 = pnd.effective_end_date
713      );
714 
715    l_out_pnd_result_id   number(15);
716 ---------------------------------------------------------------
717 -- END OF BEN_PL_DPNT_CVG_CTFN_F ----------------------
718 ---------------------------------------------------------------
719 ---------------------------------------------------------------
720 -- START OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
721 ---------------------------------------------------------------
722    cursor c_peo_from_parent(c_PL_ID number) is
723    select  elig_to_prte_rsn_id
724    from BEN_ELIG_TO_PRTE_RSN_F
725    where  PL_ID = c_PL_ID ;
726    --
727    cursor c_peo(c_elig_to_prte_rsn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
728    select  peo.*
729    from BEN_ELIG_TO_PRTE_RSN_F peo
730    where  peo.elig_to_prte_rsn_id = c_elig_to_prte_rsn_id
731      -- and peo.business_group_id = p_business_group_id
732      and not exists (
733          select /*+  */ null
734          from ben_copy_entity_results cpe
735 --              ,pqh_table_route trt
736          where copy_entity_txn_id = p_copy_entity_txn_id
737 --           and trt.table_route_id = cpe.table_route_id
738            and ( -- c_mirror_src_entity_result_id is null or
739                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
740            -- and trt.where_clause = 'BEN_ELIG_TO_PRTE_RSN_F'
741            and cpe.table_alias = c_table_alias
742            and information1 = c_elig_to_prte_rsn_id
743            -- and information4 = peo.business_group_id
744            and information2 = peo.effective_start_date
745            and information3 = peo.effective_end_date
746      );
747 
748     l_out_peo_result_id   number(15);
749 ---------------------------------------------------------------
750 -- END OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
751 ---------------------------------------------------------------
752 ---------------------------------------------------------------
753 -- START OF BEN_GD_OR_SVC_TYP ----------------------
754 ---------------------------------------------------------------
755    cursor c_gos_from_parent(c_PL_GD_OR_SVC_ID number) is
756    select  gd_or_svc_typ_id
757    from BEN_PL_GD_OR_SVC_F
758    where  PL_GD_OR_SVC_ID = c_PL_GD_OR_SVC_ID ;
759    --
760    cursor c_gos(c_gd_or_svc_typ_id number,c_mirror_src_entity_result_id number,
761                 c_table_alias varchar2) is
762    select  gos.*
763    from BEN_GD_OR_SVC_TYP gos
764    where  gos.gd_or_svc_typ_id = c_gd_or_svc_typ_id
765      -- and gos.business_group_id = p_business_group_id
766      and not exists (
767          select /*+  */ null
768          from ben_copy_entity_results cpe
769 --              ,pqh_table_route trt
770          where copy_entity_txn_id = p_copy_entity_txn_id
771 --           and trt.table_route_id = cpe.table_route_id
772            and ( -- c_mirror_src_entity_result_id is null or
773                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
774            -- and trt.where_clause = 'BEN_GD_OR_SVC_TYP'
775            and cpe.table_alias = c_table_alias
776            and information1 = c_gd_or_svc_typ_id
777            -- and information4 = gos.business_group_id
778     );
779 
780     l_out_gos_result_id   number(15);
781 ---------------------------------------------------------------
782 -- END OF BEN_GD_OR_SVC_TYP ----------------------
783 ---------------------------------------------------------------
784 ---------------------------------------------------------------
785 -- START OF BEN_PL_GD_R_SVC_CTFN_F ----------------------
786 ---------------------------------------------------------------
787    cursor c_pct_from_parent(c_PL_GD_OR_SVC_ID number) is
788    select  pl_gd_r_svc_ctfn_id
789    from BEN_PL_GD_R_SVC_CTFN_F
790    where  PL_GD_OR_SVC_ID = c_PL_GD_OR_SVC_ID ;
791    --
792    cursor c_pct(c_pl_gd_r_svc_ctfn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
793    select  pct.*
794    from BEN_PL_GD_R_SVC_CTFN_F pct
795    where  pct.pl_gd_r_svc_ctfn_id = c_pl_gd_r_svc_ctfn_id
796      -- and pct.business_group_id = p_business_group_id
797      and not exists (
798          select /*+  */ null
799          from ben_copy_entity_results cpe
800 --              pqh_table_route trt
801          where copy_entity_txn_id = p_copy_entity_txn_id
802 --           and trt.table_route_id = cpe.table_route_id
803            and ( -- c_mirror_src_entity_result_id is null or
804                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
805            -- and trt.where_clause = 'BEN_PL_GD_R_SVC_CTFN_F'
806            and cpe.table_alias = c_table_alias
807            and information1 = c_pl_gd_r_svc_ctfn_id
808            -- and information4 = pct.business_group_id
809            and information2 = pct.effective_start_date
810            and information3 = pct.effective_end_date
811      );
812 
813     l_out_pct_result_id   number(15);
814 ---------------------------------------------------------------
815 -- END OF BEN_PL_GD_R_SVC_CTFN_F ----------------------
816 ---------------------------------------------------------------
817   ---------------------------------------------------------------
818   -- START OF BEN_PL_REGN_F ----------------------
819   ---------------------------------------------------------------
820    cursor c_prg_from_parent(c_PL_ID number) is
821    select  pl_regn_id
822    from BEN_PL_REGN_F
823    where  PL_ID = c_PL_ID ;
824    --
825    cursor c_prg(c_pl_regn_id number,c_mirror_src_entity_result_id number,
826                 c_table_alias varchar2) is
827    select  prg.*
828    from BEN_PL_REGN_F prg
829    where  prg.pl_regn_id = c_pl_regn_id
830      -- and prg.business_group_id = p_business_group_id
831      and not exists (
832          select /*+  */ null
833          from ben_copy_entity_results cpe
834 --              ,pqh_table_route trt
835          where copy_entity_txn_id = p_copy_entity_txn_id
836 --           and trt.table_route_id = cpe.table_route_id
837            and ( -- c_mirror_src_entity_result_id is null or
838                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
839            -- and trt.where_clause = 'BEN_PL_REGN_F'
840            and cpe.table_alias = c_table_alias
841            and information1 = c_pl_regn_id
842            -- and information4 = prg.business_group_id
843            and information2 = prg.effective_start_date
844            and information3 = prg.effective_end_date
845      );
846     l_out_prg_result_id      number ;
847   ---------------------------------------------------------------
848   -- END OF BEN_PL_REGN_F ----------------------
849   ---------------------------------------------------------------
850   ---------------------------------------------------------------
851   -- START OF BEN_REGN_F ----------------------
852   ---------------------------------------------------------------
853    cursor c_reg_from_parent(c_PL_REGN_ID number) is
854    select  regn_id
855    from BEN_PL_REGN_F
856    where  PL_REGN_ID = c_PL_REGN_ID ;
857    --
858    cursor c_reg(c_regn_id number,c_mirror_src_entity_result_id number,
859                 c_table_alias varchar2) is
860    select  reg.*
861    from BEN_REGN_F reg
862    where  reg.regn_id = c_regn_id
863      -- and reg.business_group_id = p_business_group_id
864      and not exists (
865          select /*+  */ null
866          from ben_copy_entity_results cpe
867 --              ,pqh_table_route trt
868          where copy_entity_txn_id = p_copy_entity_txn_id
869 --           and trt.table_route_id = cpe.table_route_id
870            and ( -- c_mirror_src_entity_result_id is null or
871                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
872            -- and trt.where_clause = 'BEN_REGN_F'
873            and cpe.table_alias = c_table_alias
874            and information1 = c_regn_id
875            -- and information4 = reg.business_group_id
876            and information2 = reg.effective_start_date
877            and information3 = reg.effective_end_date
878      );
879 
880      l_out_reg_result_id   number(15);
881  ---------------------------------------------------------------
882   -- END OF BEN_REGN_F ----------------------
883   ---------------------------------------------------------------
884   ---------------------------------------------------------------
885   -- START OF BEN_RPTG_GRP ----------------------
886   ---------------------------------------------------------------
887    cursor c_bnr_from_parent(c_PL_REGN_ID number) is
888    select  rptg_grp_id
889    from BEN_PL_REGN_F
890    where  PL_REGN_ID = c_PL_REGN_ID ;
891    --
892    cursor c_bnr(c_rptg_grp_id number,c_mirror_src_entity_result_id number,
893                 c_table_alias varchar2) is
894    select  bnr.*
895    from BEN_RPTG_GRP bnr
896    where  bnr.rptg_grp_id = c_rptg_grp_id
897      -- and bnr.business_group_id = p_business_group_id
898      and not exists (
899          select /*+  */ null
900          from ben_copy_entity_results cpe
901 --              ,pqh_table_route trt
902          where copy_entity_txn_id = p_copy_entity_txn_id
903 --           and trt.table_route_id = cpe.table_route_id
904            and ( -- c_mirror_src_entity_result_id is null or
905                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
906            -- and trt.where_clause = 'BEN_RPTG_GRP'
907            and cpe.table_alias = c_table_alias
908            and information1 = c_rptg_grp_id
909            -- and information4 = bnr.business_group_id
910      );
911   l_out_bnr_result_id   number(15);
912   ---------------------------------------------------------------
913   -- END OF BEN_RPTG_GRP ----------------------
914   ---------------------------------------------------------------
915   ---------------------------------------------------------------
916   -- START OF BEN_WV_PRTN_RSN_CTFN_PL_F ----------------------
917   ---------------------------------------------------------------
918    cursor c_wcn_from_parent(c_WV_PRTN_RSN_PL_ID number) is
919    select  wv_prtn_rsn_ctfn_pl_id
920    from BEN_WV_PRTN_RSN_CTFN_PL_F
921    where  WV_PRTN_RSN_PL_ID = c_WV_PRTN_RSN_PL_ID ;
922    --
923    cursor c_wcn(c_wv_prtn_rsn_ctfn_pl_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
924    select  wcn.*
925    from BEN_WV_PRTN_RSN_CTFN_PL_F wcn
926    where  wcn.wv_prtn_rsn_ctfn_pl_id = c_wv_prtn_rsn_ctfn_pl_id
927      -- and wcn.business_group_id = p_business_group_id
928      and not exists (
929          select /*+  */ null
930          from ben_copy_entity_results cpe
931 --              ,pqh_table_route trt
932          where copy_entity_txn_id = p_copy_entity_txn_id
933 --           and trt.table_route_id = cpe.table_route_id
934            and ( -- c_mirror_src_entity_result_id is null or
935                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
936            -- and trt.where_clause = 'BEN_WV_PRTN_RSN_CTFN_PL_F'
937            and cpe.table_alias = c_table_alias
938            and information1 = c_wv_prtn_rsn_ctfn_pl_id
939            -- and information4 = wcn.business_group_id
940            and information2 = wcn.effective_start_date
941            and information3 = wcn.effective_end_date
942      );
943 
944     l_out_wcn_result_id   number(15);
945   ---------------------------------------------------------------
946   -- END OF BEN_WV_PRTN_RSN_CTFN_PL_F ----------------------
947   ---------------------------------------------------------------
948   ---------------------------------------------------------------
949   -- START OF BEN_LER_BNFT_RSTRN_CTFN_F ----------------------
950   ---------------------------------------------------------------
951    cursor c_lbc_from_parent(c_LER_BNFT_RSTRN_ID number) is
952    select  ler_bnft_rstrn_ctfn_id
953    from BEN_LER_BNFT_RSTRN_CTFN_F
954    where  LER_BNFT_RSTRN_ID = c_LER_BNFT_RSTRN_ID ;
955    --
956    cursor c_lbc(c_ler_bnft_rstrn_ctfn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
957    select  lbc.*
958    from BEN_LER_BNFT_RSTRN_CTFN_F lbc
959    where  lbc.ler_bnft_rstrn_ctfn_id = c_ler_bnft_rstrn_ctfn_id
960      -- and lbc.business_group_id = p_business_group_id
961      and not exists (
962          select /*+  */ null
963          from ben_copy_entity_results cpe
964 --              ,pqh_table_route trt
965          where copy_entity_txn_id = p_copy_entity_txn_id
966 --           and trt.table_route_id = cpe.table_route_id
967            and ( -- c_mirror_src_entity_result_id is null or
968                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
969            -- and trt.where_clause = 'BEN_LER_BNFT_RSTRN_CTFN_F'
970            and cpe.table_alias = c_table_alias
971            and information1 = c_ler_bnft_rstrn_ctfn_id
972            -- and information4 = lbc.business_group_id
973            and information2 = lbc.effective_start_date
974            and information3 = lbc.effective_end_date
975      );
976 
977     l_out_lbc_result_id   number(15);
978   ---------------------------------------------------------------
979   -- END OF BEN_LER_BNFT_RSTRN_CTFN_F ----------------------
980   ---------------------------------------------------------------
981   ---------------------------------------------------------------
982   -- START OF BEN_LER_ENRT_CTFN_F ----------------------
983   ---------------------------------------------------------------
984    cursor c_lnc_from_parent(c_LER_RQRS_ENRT_CTFN_ID number) is
985    select  ler_enrt_ctfn_id
986    from BEN_LER_ENRT_CTFN_F
987    where  LER_RQRS_ENRT_CTFN_ID = c_LER_RQRS_ENRT_CTFN_ID ;
988    --
989    cursor c_lnc(c_ler_enrt_ctfn_id number,c_mirror_src_entity_result_id number,
990                 c_table_alias varchar2) is
991    select  lnc.*
992    from BEN_LER_ENRT_CTFN_F lnc
993    where  lnc.ler_enrt_ctfn_id = c_ler_enrt_ctfn_id
994      -- and lnc.business_group_id = p_business_group_id
995      and not exists (
996          select /*+  */ null
997          from ben_copy_entity_results cpe
998 --              ,pqh_table_route trt
999          where copy_entity_txn_id = p_copy_entity_txn_id
1000 --           and trt.table_route_id = cpe.table_route_id
1001            and ( -- c_mirror_src_entity_result_id is null or
1002                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
1003            -- and trt.where_clause = 'BEN_LER_ENRT_CTFN_F'
1004            and cpe.table_alias = c_table_alias
1005            and information1 = c_ler_enrt_ctfn_id
1006            -- and information4 = lnc.business_group_id
1007            and information2 = lnc.effective_start_date
1008            and information3 = lnc.effective_end_date
1009      );
1010 
1011     l_out_lnc_result_id   number(15);
1012   ---------------------------------------------------------------
1013   -- END OF BEN_LER_ENRT_CTFN_F ----------------------
1014   ---------------------------------------------------------------
1015   ---------------------------------------------------------------
1016   -- START OF BEN_LER_CHG_DPNT_CVG_CTFN_F ----------------------
1017   ---------------------------------------------------------------
1018    cursor c_lcc_from_parent(c_LER_CHG_DPNT_CVG_ID number) is
1019    select  ler_chg_dpnt_cvg_ctfn_id
1020    from BEN_LER_CHG_DPNT_CVG_CTFN_F
1021    where  LER_CHG_DPNT_CVG_ID = c_LER_CHG_DPNT_CVG_ID ;
1022    --
1023    cursor c_lcc(c_ler_chg_dpnt_cvg_ctfn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
1024    select  lcc.*
1025    from BEN_LER_CHG_DPNT_CVG_CTFN_F lcc
1026    where  lcc.ler_chg_dpnt_cvg_ctfn_id = c_ler_chg_dpnt_cvg_ctfn_id
1027      -- and lcc.business_group_id = p_business_group_id
1028      and not exists (
1029          select /*+  */ null
1030          from ben_copy_entity_results cpe
1031 --              ,pqh_table_route trt
1032          where copy_entity_txn_id = p_copy_entity_txn_id
1033 --           and trt.table_route_id = cpe.table_route_id
1034            and ( -- c_mirror_src_entity_result_id is null or
1035                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
1036            -- and trt.where_clause = 'BEN_LER_CHG_DPNT_CVG_CTFN_F'
1037            and cpe.table_alias = c_table_alias
1038            and information1 = c_ler_chg_dpnt_cvg_ctfn_id
1039            -- and information4 = lcc.business_group_id
1040            and information2 = lcc.effective_start_date
1041            and information3 = lcc.effective_end_date
1042      );
1043 
1044     l_out_lcc_result_id   number(15);
1045   ---------------------------------------------------------------
1046   -- END OF BEN_LER_CHG_DPNT_CVG_CTFN_F ----------------------
1047   ---------------------------------------------------------------
1048   ---------------------------------------------------------------
1049   -- START OF BEN_DSGN_RQMT_F ----------------------
1050   ---------------------------------------------------------------
1051    cursor c_ddr3_from_parent(c_PL_ID number) is
1052    select  dsgn_rqmt_id
1053    from BEN_DSGN_RQMT_F
1054    where  PL_ID = c_PL_ID ;
1055    --
1056    cursor c_ddr3(c_dsgn_rqmt_id number,c_mirror_src_entity_result_id number,
1057                  c_table_alias varchar2) is
1058    select  ddr.*
1059    from BEN_DSGN_RQMT_F ddr
1060    where  ddr.dsgn_rqmt_id = c_dsgn_rqmt_id
1061      -- and ddr.business_group_id = p_business_group_id
1062      and not exists (
1063          select /*+  */ null
1064          from ben_copy_entity_results cpe
1065 --              pqh_table_route trt
1066          where copy_entity_txn_id = p_copy_entity_txn_id
1067 --         and trt.table_route_id = cpe.table_route_id
1068          and ( -- c_mirror_src_entity_result_id is null or
1069                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
1070          -- and trt.where_clause = 'BEN_DSGN_RQMT_F'
1071          and cpe.table_alias = c_table_alias
1072          and information1 = c_dsgn_rqmt_id
1073          -- and information4 = ddr.business_group_id
1074            and information2 = ddr.effective_start_date
1075            and information3 = ddr.effective_end_date
1076         );
1077 
1078    l_ddr3_dsgn_rqmt_esd ben_dsgn_rqmt_f.effective_start_date%type;
1079 
1080    ---------------------------------------------------------------
1081    -- END OF BEN_DSGN_RQMT_F ----------------------
1082    ---------------------------------------------------------------
1083    ---------------------------------------------------------------
1084    -- START OF BEN_DSGN_RQMT_RLSHP_TYP ----------------------
1085    ---------------------------------------------------------------
1086    cursor c_drr3_from_parent(c_DSGN_RQMT_ID number) is
1087    select  dsgn_rqmt_rlshp_typ_id
1088    from BEN_DSGN_RQMT_RLSHP_TYP
1089    where  DSGN_RQMT_ID = c_DSGN_RQMT_ID ;
1090    --
1091    cursor c_drr3(c_dsgn_rqmt_rlshp_typ_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
1092    select  drr.*
1093    from BEN_DSGN_RQMT_RLSHP_TYP drr
1094    where  drr.dsgn_rqmt_rlshp_typ_id = c_dsgn_rqmt_rlshp_typ_id
1095      -- and drr.business_group_id = p_business_group_id
1096      and not exists (
1097          select /*+  */ null
1098          from ben_copy_entity_results cpe
1099 --              pqh_table_route trt
1100          where copy_entity_txn_id = p_copy_entity_txn_id
1101 --         and trt.table_route_id = cpe.table_route_id
1102          and ( -- c_mirror_src_entity_result_id is null or
1103                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
1104          -- and trt.where_clause = 'BEN_DSGN_RQMT_RLSHP_TYP'
1105          and cpe.table_alias = c_table_alias
1106          and information1 = c_dsgn_rqmt_rlshp_typ_id
1107          -- and information4 = drr.business_group_id
1108         );
1109 
1110    ---------------------------------------------------------------
1111    -- END OF BEN_DSGN_RQMT_RLSHP_TYP ----------------------
1112    ---------------------------------------------------------------
1113    ---------------------------------------------------------------
1114    -- START OF BEN_OIPL_F ----------------------
1115    ---------------------------------------------------------------
1116    cursor c_cop1_from_parent(c_PL_ID number) is
1117    select  distinct oipl_id
1118    from BEN_OIPL_F
1119    where  PL_ID = c_PL_ID ;
1120    ---------------------------------------------------------------
1121    ---------------------------------------------------------------
1122    -- START OF BEN_PL_REGN_F ----------------------
1123    ---------------------------------------------------------------
1124    cursor c_prg1_from_parent(c_RPTG_GRP_ID number) is
1125    select  pl_regn_id
1126    from BEN_PL_REGN_F
1127    where  RPTG_GRP_ID = c_RPTG_GRP_ID ;
1128    --
1129    cursor c_prg1(c_pl_regn_id number,c_mirror_src_entity_result_id number,
1130                  c_table_alias varchar2) is
1131    select  prg.*
1132    from BEN_PL_REGN_F prg
1133    where  prg.pl_regn_id = c_pl_regn_id
1134      -- and prg.business_group_id = p_business_group_id
1135      and not exists (
1136          select /*+  */ null
1137          from ben_copy_entity_results cpe
1138 --              pqh_table_route trt
1139          where copy_entity_txn_id = p_copy_entity_txn_id
1140 --         and trt.table_route_id = cpe.table_route_id
1141          and ( -- c_mirror_src_entity_result_id is null or
1142                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
1143          -- and trt.where_clause = 'BEN_PL_REGN_F'
1144          and cpe.table_alias = c_table_alias
1145          and information1 = c_pl_regn_id
1146          -- and information4 = prg.business_group_id
1147            and information2 = prg.effective_start_date
1148            and information3 = prg.effective_end_date
1149         );
1150 
1151    l_out_prg1_result_id      number ;
1152    ---------------------------------------------------------------
1153    -- END OF BEN_PL_REGN_F ----------------------
1154    ---------------------------------------------------------------
1155    ---------------------------------------------------------------
1156    -- START OF BEN_PL_REGY_BOD_F ----------------------
1157    ---------------------------------------------------------------
1158    cursor c_prb_from_parent(c_RPTG_GRP_ID number) is
1159    select  pl_regy_bod_id
1160    from BEN_PL_REGY_BOD_F
1161    where  RPTG_GRP_ID = c_RPTG_GRP_ID ;
1162    --
1163    cursor c_prb(c_pl_regy_bod_id number,c_mirror_src_entity_result_id number,
1164                 c_table_alias varchar2) is
1165    select  prb.*
1166    from BEN_PL_REGY_BOD_F prb
1167    where  prb.pl_regy_bod_id = c_pl_regy_bod_id
1168      -- and prb.business_group_id = p_business_group_id
1169      and not exists (
1170          select /*+  */ null
1171          from ben_copy_entity_results cpe
1172 --              pqh_table_route trt
1173          where copy_entity_txn_id = p_copy_entity_txn_id
1174 --         and trt.table_route_id = cpe.table_route_id
1175          and ( -- c_mirror_src_entity_result_id is null or
1176                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
1177          -- and trt.where_clause = 'BEN_PL_REGY_BOD_F'
1178          and cpe.table_alias = c_table_alias
1179          and information1 = c_pl_regy_bod_id
1180          -- and information4 = prb.business_group_id
1181            and information2 = prb.effective_start_date
1182            and information3 = prb.effective_end_date
1183         );
1184     l_pl_regy_bod_id                 number(15);
1185     l_out_prb_result_id   number(15);
1186    ---------------------------------------------------------------
1187    -- END OF BEN_PL_REGY_BOD_F ----------------------
1188    ---------------------------------------------------------------
1189    ---------------------------------------------------------------
1190    -- START OF BEN_PL_REGY_PRP_F ----------------------
1191    ---------------------------------------------------------------
1192    cursor c_prp_from_parent(c_PL_REGY_BOD_ID number) is
1193    select  pl_regy_prps_id
1194    from BEN_PL_REGY_PRP_F
1195    where  PL_REGY_BOD_ID = c_PL_REGY_BOD_ID ;
1196    --
1197    cursor c_prp(c_pl_regy_prps_id number,c_mirror_src_entity_result_id number,
1198                 c_table_alias varchar2) is
1199    select  prp.*
1200    from BEN_PL_REGY_PRP_F prp
1201    where  prp.pl_regy_prps_id = c_pl_regy_prps_id
1202      -- and prp.business_group_id = p_business_group_id
1203      and not exists (
1204          select /*+  */ null
1205          from ben_copy_entity_results cpe
1206 --              pqh_table_route trt
1207          where copy_entity_txn_id = p_copy_entity_txn_id
1208 --         and trt.table_route_id = cpe.table_route_id
1209          and ( -- c_mirror_src_entity_result_id is null or
1210                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
1211          -- and trt.where_clause = 'BEN_PL_REGY_PRP_F'
1212          and cpe.table_alias = c_table_alias
1213          and information1 = c_pl_regy_prps_id
1214          -- and information4 = prp.business_group_id
1215            and information2 = prp.effective_start_date
1216            and information3 = prp.effective_end_date
1217         );
1218     l_pl_regy_prps_id                 number(15);
1219     l_out_prp_result_id   number(15);
1220    ---------------------------------------------------------------
1221    -- END OF BEN_PL_REGY_PRP_F ----------------------
1222    ---------------------------------------------------------------
1223    ---------------------------------------------------------------
1224    -- START OF BEN_POPL_RPTG_GRP_F ----------------------
1225    ---------------------------------------------------------------
1226    cursor c_rgr1_from_parent(c_RPTG_GRP_ID number) is
1227    select  popl_rptg_grp_id
1228    from BEN_POPL_RPTG_GRP_F
1229    where  RPTG_GRP_ID = c_RPTG_GRP_ID ;
1230    --
1231    cursor c_rgr1(c_popl_rptg_grp_id number,c_mirror_src_entity_result_id number,
1232                  c_table_alias varchar2) is
1233    select  rgr.*
1234    from BEN_POPL_RPTG_GRP_F rgr
1235    where  rgr.popl_rptg_grp_id = c_popl_rptg_grp_id
1236      -- and rgr.business_group_id = p_business_group_id
1237      and not exists (
1238          select /*+  */ null
1239          from ben_copy_entity_results cpe
1240 --              pqh_table_route trt
1241          where copy_entity_txn_id = p_copy_entity_txn_id
1242 --         and trt.table_route_id = cpe.table_route_id
1243          and ( -- c_mirror_src_entity_result_id is null or
1244                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
1245          -- and trt.where_clause = 'BEN_POPL_RPTG_GRP_F'
1246          and cpe.table_alias = c_table_alias
1247          and information1 = c_popl_rptg_grp_id
1248          -- and information4 = rgr.business_group_id
1249            and information2 = rgr.effective_start_date
1250            and information3 = rgr.effective_end_date
1251         );
1252     l_popl_rptg_grp_id                 number(15);
1253    ---------------------------------------------------------------
1254    -- END OF BEN_POPL_RPTG_GRP_F ----------------------
1255    ---------------------------------------------------------------
1256    ---------------------------------------------------------------
1257    -- START OF BEN_REGN_F ----------------------
1258    ---------------------------------------------------------------
1259    cursor c_reg1_from_parent(c_PL_REGN_ID number) is
1260    select  regn_id
1261    from BEN_PL_REGN_F
1262    where  PL_REGN_ID = c_PL_REGN_ID ;
1263    --
1264    cursor c_reg1(c_regn_id number,c_mirror_src_entity_result_id number,
1265                  c_table_alias varchar2) is
1266    select  reg.*
1267    from BEN_REGN_F reg
1268    where  reg.regn_id = c_regn_id
1269      -- and reg.business_group_id = p_business_group_id
1270      and not exists (
1271          select /*+  */ null
1272          from ben_copy_entity_results cpe
1273 ---              pqh_table_route trt
1274          where copy_entity_txn_id = p_copy_entity_txn_id
1275 --         and trt.table_route_id = cpe.table_route_id
1276          and ( -- c_mirror_src_entity_result_id is null or
1277                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
1278          -- and trt.where_clause = 'BEN_REGN_F'
1279          and cpe.table_alias = c_table_alias
1280          and information1 = c_regn_id
1281          -- and information4 = reg.business_group_id
1282            and information2 = reg.effective_start_date
1283            and information3 = reg.effective_end_date
1284         );
1285     l_out_reg1_result_id   number(15);
1286    ---------------------------------------------------------------
1287    -- END OF BEN_REGN_F ----------------------
1288    ---------------------------------------------------------------
1289 
1290    cursor c_object_exists(c_pk_id                number,
1291                           c_table_alias          varchar2) is
1292     select null
1293     from ben_copy_entity_results cpe
1294 --         pqh_table_route trt
1295     where copy_entity_txn_id = p_copy_entity_txn_id
1296 --    and trt.table_route_id = cpe.table_route_id
1297     and cpe.table_alias = c_table_alias
1298     and information1 = c_pk_id;
1299 
1300    l_dummy                     varchar2(1);
1301 
1302    l_table_route_id            number(15);
1303    l_mirror_src_entity_result_id number(15);
1304    l_result_type_cd            varchar2(30);
1305    l_information5              ben_copy_entity_results.information5%type;
1306    l_regn_name                 ben_regn_f.name%type;
1307    --
1308    l_pl_id                     number(15);
1309    l_popl_yr_perd_id           number(15);
1310    l_yr_perd_id                number(15);
1311    l_wthn_yr_perd_id           number(15);
1312    l_popl_org_id               number(15);
1313    l_popl_org_role_id          number(15);
1314    l_pl_gd_or_svc_id           number(15);
1315    l_gd_or_svc_typ_id          number(15);
1316    l_pl_gd_r_svc_ctfn_id       number(15);
1317    l_number_of_copies          number(15);
1318    l_pl_regn_id                number(15);
1319    l_pl_regn_id1               number(15);
1320    l_regn_id                   number(15);
1321    l_rptg_grp_id               number(15);
1322    l_wv_prtn_rsn_ctfn_pl_id    number(15);
1323    l_wv_prtn_rsn_pl_id         number(15);
1324    l_ler_bnft_rstrn_ctfn_id    number(15);
1325    l_ler_bnft_rstrn_id         number(15);
1326    l_ler_enrt_ctfn_id          number(15);
1327    l_ler_rqrs_enrt_ctfn_id     number(15);
1328    l_ler_chg_dpnt_cvg_ctfn_id  number(15);
1329    l_ler_chg_dpnt_cvg_id       number(15);
1330    l_child_exists              boolean default false ;
1331    l_vald_rlshp_for_reimb_id   number(15);
1332    l_bnft_rstrn_ctfn_id        number(15);
1333    l_enrt_ctfn_id              number(15);
1334    l_ler_chg_pl_nip_enrt_id    number(15);
1335    l_pl_pcp_id                 number(15);
1336    l_pl_bnf_ctfn_id            number(15);
1337    l_pl_dpnt_cvg_ctfn_id       number(15);
1338    l_elig_to_prte_rsn_id       number(15);
1339    --
1340    --
1341    l_out_cpp_result_id         number(15);
1342    l_out_pln_result_id         number(15);
1343    l_out_pln_cpp_result_id     number(15);
1344    l_parent_entity_result_id   number(15);
1345    --
1346    L_DSGN_RQMT_ID              number(15);
1347    L_OUT_DDR_RESULT_ID         number(15);
1348    L_DSGN_RQMT_RLSHP_TYP_ID    number(15);
1349    L_OUT_DRR_RESULT_ID         number(15);
1350    --
1351    l_pl_typ_name               ben_pl_typ_f.name%type;
1352    l_pl_usage                  hr_lookups.meaning%type;
1353    l_group_pl_id              number (15);
1354 begin
1355    --
1356    --
1357    l_number_of_copies := p_number_of_copies ;
1358    --
1359 
1360    for l_parent_rec  in c_pln_from_parent(p_PLIP_ID,p_pl_id) loop
1361    --
1362    --
1363      l_pl_id := l_parent_rec.pl_id ;
1364      --
1365 
1366      if p_no_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
1367        ben_plan_design_program_module.g_pdw_allow_dup_rslt := ben_plan_design_program_module.g_pdw_no_dup_rslt;
1368      else
1369        ben_plan_design_program_module.g_pdw_allow_dup_rslt := null;
1370      end if;
1371 
1372      if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
1373        open c_object_exists(l_pl_id,'PLN');
1374        fetch c_object_exists into l_dummy;
1375        if c_object_exists%found then
1376          close c_object_exists;
1377          return;
1378        end if;
1379        close c_object_exists;
1380      end if;
1381 
1382      l_mirror_src_entity_result_id := null ;
1383 
1384      if p_plip_id is not null then
1385        open c_parent_result(P_PLIP_ID,'CPP',p_copy_entity_txn_id);
1386        fetch c_parent_result into l_mirror_src_entity_result_id ;
1387 
1388        if c_parent_result%notfound  then
1389 
1390          -- If PLIP does not exist as of process effective date
1391          -- then fetch the PLIP result record with min copy_entity_result_id
1392 
1393          open c_parent_result1(P_PLIP_ID,'CPP',p_copy_entity_txn_id);
1394          fetch c_parent_result1 into l_mirror_src_entity_result_id ;
1395          close c_parent_result1;
1396        end if;
1397 
1398        close c_parent_result ;
1399 
1400        l_out_cpp_result_id := l_mirror_src_entity_result_id; -- Added for HGrid Hierarchy
1401      end if;
1402      --
1403      l_pln_esd := null;
1404      --
1405 
1406      for l_pln_rec in c_pln(l_parent_rec.pl_id,l_mirror_src_entity_result_id,
1407                             'PLN') loop
1408        --
1409        savepoint create_copy_entity_result;
1410        --
1411        l_table_route_id := null ;
1412        open ben_plan_design_program_module.g_table_route('PLN');
1413        fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
1414        close ben_plan_design_program_module.g_table_route ;
1415        --
1416        l_information5  := l_pln_rec.name; --'Intersection';
1417        --
1418        l_pl_typ_name := ben_plan_design_program_module.get_pl_typ_name(l_pln_rec.pl_typ_id,p_effective_date);
1419        l_pl_usage    := hr_general.decode_lookup('BEN_PL',l_pln_rec.pl_cd);
1420        --
1421        if p_effective_date between l_pln_rec.effective_start_date
1422            and l_pln_rec.effective_end_date then
1423            --
1424            l_result_type_cd := 'DISPLAY';
1425        else
1426            l_result_type_cd := 'NO DISPLAY';
1427        end if;
1428        --
1429        -- mapping for CWB plan
1430        --
1431        -- Bug 4665663 - Map only if it is not a Group Plan
1432        --
1433        l_group_pl_id := NULL;
1434 
1435        if (l_pln_rec.group_pl_id IS NOT NULL and
1436                   l_pln_rec.pl_id <> l_pln_rec.group_pl_id) then
1437            --
1438            open c_grp_pl_name(l_pln_rec.group_pl_id);
1439            fetch c_grp_pl_name into l_mapping_name;
1440            close c_grp_pl_name;
1441            --
1442            l_group_pl_id := l_pln_rec.group_pl_id; -- 4665663
1443            --
1444            --To set user friendly labels on the mapping page
1445            --
1446            l_mapping_column_name1 := null;
1447            l_mapping_column_name2 :=null;
1448            BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
1449                                       l_mapping_column_name1,
1450                                       l_mapping_column_name2,
1451                                       p_copy_entity_txn_id);
1452            --
1453         end if;
1454         --
1455        l_copy_entity_result_id := null;
1456        l_object_version_number := null;
1457        ben_copy_entity_results_api.create_copy_entity_results(
1458             p_copy_entity_result_id           => l_copy_entity_result_id,
1459             p_copy_entity_txn_id             => p_copy_entity_txn_id,
1460             p_result_type_cd                 => l_result_type_cd,
1461             p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
1462             p_parent_entity_result_id        => null, -- Hide BEN_PL_F for HGrid
1463             p_number_of_copies               => l_number_of_copies,
1464             p_table_alias					 => 'PLN',
1465             p_table_route_id                 => l_table_route_id,
1466             p_information1     => l_pln_rec.pl_id,
1467             p_information2     => l_pln_rec.EFFECTIVE_START_DATE,
1468             p_information3     => l_pln_rec.EFFECTIVE_END_DATE,
1469             p_information4     => l_pln_rec.business_group_id,
1470             p_information5     => l_information5 , -- 9999 put name for h-grid
1471             p_information6     => l_pl_typ_name,
1472             p_information7     => l_pl_usage,
1473             p_information8     => l_parent_rec.information8,
1474             p_information250     => l_pln_rec.actl_prem_id,
1475             p_information36     => l_pln_rec.alws_qdro_flag,
1476             p_information37     => l_pln_rec.alws_qmcso_flag,
1477             p_information51     => l_pln_rec.alws_reimbmts_flag,
1478             p_information24     => l_pln_rec.alws_tmpry_id_crd_flag,
1479             p_information52     => l_pln_rec.alws_unrstrctd_enrt_flag,
1480             p_information281     => l_pln_rec.auto_enrt_mthd_rl,
1481             p_information101     => l_pln_rec.bndry_perd_cd,
1482             p_information53     => l_pln_rec.bnf_addl_instn_txt_alwd_flag,
1483             p_information54     => l_pln_rec.bnf_adrs_rqd_flag,
1484             p_information56     => l_pln_rec.bnf_cntngt_bnfs_alwd_flag,
1485             p_information55     => l_pln_rec.bnf_ctfn_rqd_flag,
1486             p_information82     => l_pln_rec.bnf_dflt_bnf_cd,
1487             p_information66     => l_pln_rec.bnf_dob_rqd_flag,
1488             p_information60     => l_pln_rec.bnf_dsge_mnr_ttee_rqd_flag,
1489             p_information89     => l_pln_rec.bnf_dsgn_cd,
1490             p_information302     => l_pln_rec.bnf_incrmt_amt,
1491             p_information57     => l_pln_rec.bnf_legv_id_rqd_flag,
1492             p_information58     => l_pln_rec.bnf_may_dsgt_org_flag,
1493             p_information303     => l_pln_rec.bnf_mn_dsgntbl_amt,
1494             p_information290     => l_pln_rec.bnf_mn_dsgntbl_pct_val,
1495             p_information83     => l_pln_rec.bnf_pct_amt_alwd_cd,
1496             p_information293     => l_pln_rec.bnf_pct_incrmt_val,
1497             p_information59     => l_pln_rec.bnf_qdro_rl_apls_flag,
1498             p_information77     => l_pln_rec.bnft_or_option_rstrctn_cd,
1499             p_information235     => l_pln_rec.bnft_prvdr_pool_id,
1500             p_information84     => l_pln_rec.cmpr_clms_to_cvg_or_bal_cd,
1501             p_information285     => l_pln_rec.cobra_pymt_due_dy_num,
1502             p_information287     => l_pln_rec.cost_alloc_keyflex_1_id,
1503             p_information288     => l_pln_rec.cost_alloc_keyflex_2_id,
1504             p_information263     => l_pln_rec.cr_dstr_bnft_prvdr_pool_id,
1505             p_information68     => l_pln_rec.cvg_incr_r_decr_only_cd,
1506             p_information91     => l_pln_rec.dflt_to_asn_pndg_ctfn_cd,
1507             p_information272     => l_pln_rec.dflt_to_asn_pndg_ctfn_rl,
1508             p_information30     => l_pln_rec.dpnt_adrs_rqd_flag,
1509             p_information29     => l_pln_rec.dpnt_cvd_by_othr_apls_flag,
1510             p_information85     => l_pln_rec.dpnt_cvg_end_dt_cd,
1511             p_information258     => l_pln_rec.dpnt_cvg_end_dt_rl,
1512             p_information86     => l_pln_rec.dpnt_cvg_strt_dt_cd,
1513             p_information259     => l_pln_rec.dpnt_cvg_strt_dt_rl,
1514             p_information32     => l_pln_rec.dpnt_dob_rqd_flag,
1515             p_information87     => l_pln_rec.dpnt_dsgn_cd,
1516             p_information31     => l_pln_rec.dpnt_leg_id_rqd_flag,
1517             p_information27     => l_pln_rec.dpnt_no_ctfn_rqd_flag,
1518             p_information25     => l_pln_rec.drvbl_dpnt_elig_flag,
1519             p_information33     => l_pln_rec.drvbl_fctr_apls_rts_flag,
1520             p_information26     => l_pln_rec.drvbl_fctr_prtn_elig_flag,
1521             p_information34     => l_pln_rec.elig_apls_flag,
1522             p_information17     => l_pln_rec.enrt_cd,
1523             p_information21     => l_pln_rec.enrt_cvg_end_dt_cd,
1524             p_information260     => l_pln_rec.enrt_cvg_end_dt_rl,
1525             p_information20     => l_pln_rec.enrt_cvg_strt_dt_cd,
1526             p_information262     => l_pln_rec.enrt_cvg_strt_dt_rl,
1527             p_information92     => l_pln_rec.enrt_mthd_cd,
1528             p_information39     => l_pln_rec.enrt_pl_opt_flag,
1529             p_information274     => l_pln_rec.enrt_rl,
1530             p_information40     => l_pln_rec.frfs_aply_flag,
1531             p_information96     => l_pln_rec.frfs_cntr_det_cd,
1532             p_information97     => l_pln_rec.frfs_distr_det_cd,
1533             p_information13     => l_pln_rec.frfs_distr_mthd_cd,
1534             p_information257     => l_pln_rec.frfs_distr_mthd_rl,
1535             p_information304     => l_pln_rec.frfs_mx_cryfwd_val,
1536             p_information100     => l_pln_rec.frfs_portion_det_cd,
1537             p_information99     => l_pln_rec.frfs_val_det_cd,
1538             p_information95     => l_pln_rec.function_code,
1539              -- tilak cwb pl copy fix
1540             p_information160    => l_pln_rec.group_pl_id,
1541             -- Data for MAPPING columns.
1542             p_information173     => l_mapping_name,
1543             p_information174     => l_group_pl_id,
1544             p_information181     => l_mapping_column_name1,
1545             p_information182     => l_mapping_column_name2,
1546             -- END other product Mapping columns.
1547             p_information47     => l_pln_rec.hc_pl_subj_hcfa_aprvl_flag,
1548             p_information15     => l_pln_rec.hc_svc_typ_cd,
1549             p_information38     => l_pln_rec.hghly_cmpd_rl_apls_flag,
1550             p_information73     => l_pln_rec.imptd_incm_calc_cd,
1551             p_information306     => l_pln_rec.incptn_dt,
1552             p_information50     => l_pln_rec.invk_dcln_prtn_pl_flag,
1553             p_information49     => l_pln_rec.invk_flx_cr_pl_flag,
1554             p_information142     => l_pln_rec.ivr_ident,
1555             p_information141     => l_pln_rec.mapping_table_name,
1556             p_information294     => l_pln_rec.mapping_table_pk_id,
1557             p_information28     => l_pln_rec.may_enrl_pl_n_oipl_flag,
1558             p_information296     => l_pln_rec.mn_cvg_alwd_amt,
1559             p_information283     => l_pln_rec.mn_cvg_rl,
1560             p_information300     => l_pln_rec.mn_cvg_rqd_amt,
1561             p_information269     => l_pln_rec.mn_opts_rqd_num,
1562             p_information299     => l_pln_rec.mx_cvg_alwd_amt,
1563             p_information297     => l_pln_rec.mx_cvg_incr_alwd_amt,
1564             p_information298     => l_pln_rec.mx_cvg_incr_wcf_alwd_amt,
1565             p_information271     => l_pln_rec.mx_cvg_mlt_incr_num,
1566             p_information273     => l_pln_rec.mx_cvg_mlt_incr_wcf_num,
1567             p_information284     => l_pln_rec.mx_cvg_rl,
1568             p_information295     => l_pln_rec.mx_cvg_wcfn_amt,
1569             p_information267     => l_pln_rec.mx_cvg_wcfn_mlt_num,
1570             p_information270     => l_pln_rec.mx_opts_alwd_num,
1571             p_information80     => l_pln_rec.mx_wtg_dt_to_use_cd,
1572             p_information275     => l_pln_rec.mx_wtg_dt_to_use_rl,
1573             p_information79     => l_pln_rec.mx_wtg_perd_prte_uom,
1574             p_information289     => l_pln_rec.mx_wtg_perd_prte_val,
1575             p_information282     => l_pln_rec.mx_wtg_perd_rl,
1576             p_information170     => l_pln_rec.name,
1577             p_information16     => l_pln_rec.nip_acty_ref_perd_cd,
1578             p_information88     => l_pln_rec.nip_dflt_enrt_cd,
1579             p_information286     => l_pln_rec.nip_dflt_enrt_det_rl,
1580             p_information12     => l_pln_rec.nip_dflt_flag,
1581             p_information22     => l_pln_rec.nip_enrt_info_rt_freq_cd,
1582             p_information81     => l_pln_rec.nip_pl_uom,
1583             p_information61     => l_pln_rec.no_mn_cvg_amt_apls_flag,
1584             p_information63     => l_pln_rec.no_mn_cvg_incr_apls_flag,
1585             p_information65     => l_pln_rec.no_mn_opts_num_apls_flag,
1586             p_information62     => l_pln_rec.no_mx_cvg_amt_apls_flag,
1587             p_information64     => l_pln_rec.no_mx_cvg_incr_apls_flag,
1588             p_information35     => l_pln_rec.no_mx_opts_num_apls_flag,
1589             p_information266     => l_pln_rec.ordr_num,
1590             p_information78     => l_pln_rec.pcp_cd,
1591             p_information76     => l_pln_rec.per_cvrd_cd,
1592             p_information67     => l_pln_rec.pl_cd,
1593             p_information19     => l_pln_rec.pl_stat_cd,
1594             p_information248     => l_pln_rec.pl_typ_id,
1595             p_information14     => l_pln_rec.pl_yr_not_applcbl_flag,
1596             p_information111     => l_pln_rec.pln_attribute1,
1597             p_information120     => l_pln_rec.pln_attribute10,
1598             p_information121     => l_pln_rec.pln_attribute11,
1599             p_information122     => l_pln_rec.pln_attribute12,
1600             p_information123     => l_pln_rec.pln_attribute13,
1601             p_information124     => l_pln_rec.pln_attribute14,
1602             p_information125     => l_pln_rec.pln_attribute15,
1603             p_information126     => l_pln_rec.pln_attribute16,
1604             p_information127     => l_pln_rec.pln_attribute17,
1605             p_information128     => l_pln_rec.pln_attribute18,
1606             p_information129     => l_pln_rec.pln_attribute19,
1607             p_information112     => l_pln_rec.pln_attribute2,
1608             p_information130     => l_pln_rec.pln_attribute20,
1609             p_information131     => l_pln_rec.pln_attribute21,
1610             p_information132     => l_pln_rec.pln_attribute22,
1611             p_information133     => l_pln_rec.pln_attribute23,
1612             p_information134     => l_pln_rec.pln_attribute24,
1613             p_information135     => l_pln_rec.pln_attribute25,
1614             p_information136     => l_pln_rec.pln_attribute26,
1615             p_information137     => l_pln_rec.pln_attribute27,
1616             p_information138     => l_pln_rec.pln_attribute28,
1617             p_information139     => l_pln_rec.pln_attribute29,
1618             p_information113     => l_pln_rec.pln_attribute3,
1619             p_information140     => l_pln_rec.pln_attribute30,
1620             p_information114     => l_pln_rec.pln_attribute4,
1621             p_information115     => l_pln_rec.pln_attribute5,
1622             p_information116     => l_pln_rec.pln_attribute6,
1623             p_information117     => l_pln_rec.pln_attribute7,
1624             p_information118     => l_pln_rec.pln_attribute8,
1625             p_information119     => l_pln_rec.pln_attribute9,
1626             p_information110     => l_pln_rec.pln_attribute_category,
1627             p_information280     => l_pln_rec.pln_mn_cvg_alwd_amt,
1628             p_information98     => l_pln_rec.post_to_gl_flag,
1629             p_information279     => l_pln_rec.postelcn_edit_rl,
1630             p_information90     => l_pln_rec.prmry_fndg_mthd_cd,
1631             p_information18     => l_pln_rec.prort_prtl_yr_cvg_rstrn_cd,
1632             p_information268     => l_pln_rec.prort_prtl_yr_cvg_rstrn_rl,
1633             p_information46     => l_pln_rec.prtn_elig_ovrid_alwd_flag,
1634             p_information276     => l_pln_rec.rqd_perd_enrt_nenrt_rl,
1635             p_information69     => l_pln_rec.rqd_perd_enrt_nenrt_uom,
1636             p_information301     => l_pln_rec.rqd_perd_enrt_nenrt_val,
1637             p_information74     => l_pln_rec.rt_end_dt_cd,
1638             p_information277     => l_pln_rec.rt_end_dt_rl,
1639             p_information75     => l_pln_rec.rt_strt_dt_cd,
1640             p_information278     => l_pln_rec.rt_strt_dt_rl,
1641             p_information93     => l_pln_rec.short_code,
1642             p_information94     => l_pln_rec.short_name,
1643             p_information70     => l_pln_rec.subj_to_imptd_incm_cd,
1644             p_information71     => l_pln_rec.subj_to_imptd_incm_typ_cd,
1645             p_information41     => l_pln_rec.svgs_pl_flag,
1646             p_information42     => l_pln_rec.trk_inelig_per_flag,
1647             p_information72     => l_pln_rec.unsspnd_enrt_cd,
1648             p_information185     => l_pln_rec.url_ref_name,
1649             p_information43     => l_pln_rec.use_all_asnts_elig_flag,
1650             p_information44     => l_pln_rec.use_all_asnts_for_rt_flag,
1651             p_information23     => l_pln_rec.vrfy_fmly_mmbr_cd,
1652             p_information264     => l_pln_rec.vrfy_fmly_mmbr_rl,
1653             p_information45     => l_pln_rec.vstg_apls_flag,
1654             p_information48     => l_pln_rec.wvbl_flag,
1655             p_INFORMATION198    => l_pln_rec.SUSP_IF_CTFN_NOT_PRVD_FLAG,
1656             p_INFORMATION197    => l_pln_rec.CTFN_DETERMINE_CD,
1657             p_INFORMATION196    => l_pln_rec.SUSP_IF_DPNT_SSN_NT_PRV_CD,
1658             p_INFORMATION190    => l_pln_rec.SUSP_IF_DPNT_DOB_NT_PRV_CD,
1659             p_INFORMATION191    => l_pln_rec.SUSP_IF_DPNT_ADR_NT_PRV_CD,
1660             p_INFORMATION192    => l_pln_rec.SUSP_IF_CTFN_NOT_DPNT_FLAG,
1661             p_INFORMATION193    => l_pln_rec.DPNT_CTFN_DETERMINE_CD,
1662             p_INFORMATION194    => l_pln_rec.SUSP_IF_BNF_SSN_NT_PRV_CD,
1663             p_INFORMATION195    => l_pln_rec.SUSP_IF_BNF_DOB_NT_PRV_CD,
1664             p_INFORMATION104    => l_pln_rec.BNF_CTFN_DETERMINE_CD,
1665             p_INFORMATION105    => l_pln_rec.SUSP_IF_CTFN_NOT_BNF_FLAG,
1666             p_INFORMATION106    => l_pln_rec.SUSP_IF_BNF_ADR_NT_PRV_CD,
1667             p_information107    => l_pln_rec.legislation_code,              /* Bug 3939490 */
1668             p_information108    => l_pln_rec.legislation_subgroup,          /* Bug 3939490 */
1669             p_information109    => l_pln_rec.use_csd_rsd_prccng_cd,         /* Bug 3939490 */
1670             p_information265    => l_pln_rec.object_version_number,
1671 
1672             p_object_version_number  => l_object_version_number,
1673             p_effective_date         => p_effective_date       );
1674             --
1675 
1676             if l_out_pln_result_id is null then
1677               l_out_pln_result_id := l_copy_entity_result_id;
1678             end if;
1679 
1680             if l_result_type_cd = 'DISPLAY' and  p_number_of_copies = 1 then
1681               -- ------------------------------------------------------------------------
1682 
1683               -- For Plans in Program, BEN_PL_F will be hidden in the HGrid
1684               -- All children of BEN_PL_F will have the copy_entity_result_id of
1685               -- BEN_PLIP_F as their parent_entity_result_id
1686 
1687               -- For Plans Not in Program or when Plan is the Top Node in the HGrid
1688               -- BEN_PL_F will be displayed
1689               -- All children of BEN_PL_F will have the copy_entity_result_id of
1690               -- BEN_PL_F as their parent_entity_result_id
1691 
1692               --
1693               -- All children of BEN_PL_F will have the copy_entity_result_id of
1694               -- BEN_PL_F as their mirror_src_entity_result_id
1695               --
1696 
1697               l_out_pln_result_id := l_copy_entity_result_id;     -- Copy_entity_result_id of Ben_Pl_f
1698 
1699               if p_pl_id is not null then                         -- Plan is Top Node
1700                 l_out_pln_cpp_result_id := l_out_pln_result_id;   -- Copy_entity_result_id of Ben_Pl_f
1701               else                          -- Plan in Program
1702                 l_out_pln_cpp_result_id := l_out_cpp_result_id;   -- Copy_entity_result_id of Ben_Plip_f
1703               end if;
1704 
1705               -- ------------------------------------------------------------------------
1706             end if;
1707             --
1708 
1709             -- To pass as effective date while creating the
1710             -- non date-tracked child records
1711             if l_pln_esd is null then
1712               l_pln_esd := l_pln_rec.EFFECTIVE_START_DATE;
1713             end if;
1714 
1715 			if (l_pln_rec.auto_enrt_mthd_rl is not null) then
1716 			   ben_plan_design_program_module.create_formula_result(
1717 					p_validate                       => p_validate
1718 					,p_copy_entity_result_id  => l_copy_entity_result_id
1719 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1720 					,p_formula_id                  => l_pln_rec.auto_enrt_mthd_rl
1721 					,p_business_group_id        => l_pln_rec.business_group_id
1722 					,p_number_of_copies         =>  l_number_of_copies
1723 					,p_object_version_number  => l_object_version_number
1724 					,p_effective_date             => p_effective_date);
1725 			end if;
1726 
1727 			if (l_pln_rec.dflt_to_asn_pndg_ctfn_rl is not null) then
1728 			   ben_plan_design_program_module.create_formula_result(
1729 					p_validate                       => p_validate
1730 					,p_copy_entity_result_id  => l_copy_entity_result_id
1731 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1732 					,p_formula_id                  => l_pln_rec.dflt_to_asn_pndg_ctfn_rl
1733 					,p_business_group_id        => l_pln_rec.business_group_id
1734 					,p_number_of_copies         =>  l_number_of_copies
1735 					,p_object_version_number  => l_object_version_number
1736 					,p_effective_date             => p_effective_date);
1737 			end if;
1738 
1739 			if (l_pln_rec.dpnt_cvg_end_dt_rl is not null) then
1740 			   ben_plan_design_program_module.create_formula_result(
1741 					p_validate                       => p_validate
1742 					,p_copy_entity_result_id  => l_copy_entity_result_id
1743 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1744 					,p_formula_id                  => l_pln_rec.dpnt_cvg_end_dt_rl
1745 					,p_business_group_id        => l_pln_rec.business_group_id
1746 					,p_number_of_copies         =>  l_number_of_copies
1747 					,p_object_version_number  => l_object_version_number
1748 					,p_effective_date             => p_effective_date);
1749 			end if;
1750 
1751 			if (l_pln_rec.dpnt_cvg_strt_dt_rl is not null) then
1752 			   ben_plan_design_program_module.create_formula_result(
1753 					p_validate                       => p_validate
1754 					,p_copy_entity_result_id  => l_copy_entity_result_id
1755 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1756 					,p_formula_id                  => l_pln_rec.dpnt_cvg_strt_dt_rl
1757 					,p_business_group_id        => l_pln_rec.business_group_id
1758 					,p_number_of_copies         =>  l_number_of_copies
1759 					,p_object_version_number  => l_object_version_number
1760 					,p_effective_date             => p_effective_date);
1761 			end if;
1762 
1763 			if (l_pln_rec.enrt_cvg_end_dt_rl is not null) then
1764 			   ben_plan_design_program_module.create_formula_result(
1765 					p_validate                       => p_validate
1766 					,p_copy_entity_result_id  => l_copy_entity_result_id
1767 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1768 					,p_formula_id                  => l_pln_rec.enrt_cvg_end_dt_rl
1769 					,p_business_group_id        => l_pln_rec.business_group_id
1770 					,p_number_of_copies         =>  l_number_of_copies
1771 					,p_object_version_number  => l_object_version_number
1772 					,p_effective_date             => p_effective_date);
1773 			end if;
1774 
1775 			if (l_pln_rec.enrt_cvg_strt_dt_rl is not null) then
1776 			   ben_plan_design_program_module.create_formula_result(
1777 					p_validate                       => p_validate
1778 					,p_copy_entity_result_id  => l_copy_entity_result_id
1779 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1780 					,p_formula_id                  => l_pln_rec.enrt_cvg_strt_dt_rl
1781 					,p_business_group_id        => l_pln_rec.business_group_id
1782 					,p_number_of_copies         =>  l_number_of_copies
1783 					,p_object_version_number  => l_object_version_number
1784 					,p_effective_date             => p_effective_date);
1785 			end if;
1786 
1787 			if (l_pln_rec.enrt_rl is not null) then
1788 			   ben_plan_design_program_module.create_formula_result(
1789 					p_validate                       => p_validate
1790 					,p_copy_entity_result_id  => l_copy_entity_result_id
1791 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1792 					,p_formula_id                  => l_pln_rec.enrt_rl
1793 					,p_business_group_id        => l_pln_rec.business_group_id
1794 					,p_number_of_copies         =>  l_number_of_copies
1795 					,p_object_version_number  => l_object_version_number
1796 					,p_effective_date             => p_effective_date);
1797 			end if;
1798 
1799 			if (l_pln_rec.frfs_distr_mthd_rl is not null) then
1800 			   ben_plan_design_program_module.create_formula_result(
1801 					p_validate                       => p_validate
1802 					,p_copy_entity_result_id  => l_copy_entity_result_id
1803 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1804 					,p_formula_id                  => l_pln_rec.frfs_distr_mthd_rl
1805 					,p_business_group_id        => l_pln_rec.frfs_distr_mthd_rl
1806 					,p_number_of_copies         =>  l_number_of_copies
1807 					,p_object_version_number  => l_object_version_number
1808 					,p_effective_date             => p_effective_date);
1809 			end if;
1810 
1811 			if (l_pln_rec.mn_cvg_rl is not null) then
1812 			   ben_plan_design_program_module.create_formula_result(
1813 					p_validate                       => p_validate
1814 					,p_copy_entity_result_id  => l_copy_entity_result_id
1815 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1816 					,p_formula_id                  => l_pln_rec.mn_cvg_rl
1817 					,p_business_group_id        => l_pln_rec.business_group_id
1818 					,p_number_of_copies         =>  l_number_of_copies
1819 					,p_object_version_number  => l_object_version_number
1820 					,p_effective_date             => p_effective_date);
1821 			end if;
1822 
1823 			if (l_pln_rec.mx_cvg_rl is not null) then
1824 			   ben_plan_design_program_module.create_formula_result(
1825 					p_validate                       => p_validate
1826 					,p_copy_entity_result_id  => l_copy_entity_result_id
1827 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1828 					,p_formula_id                  => l_pln_rec.mx_cvg_rl
1829 					,p_business_group_id        => l_pln_rec.business_group_id
1830 					,p_number_of_copies         =>  l_number_of_copies
1831 					,p_object_version_number  => l_object_version_number
1832 					,p_effective_date             => p_effective_date);
1833 			end if;
1834 
1835 			if (l_pln_rec.mx_wtg_dt_to_use_rl is not null) then
1836 			   ben_plan_design_program_module.create_formula_result(
1837 					p_validate                       => p_validate
1838 					,p_copy_entity_result_id  => l_copy_entity_result_id
1839 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1840 					,p_formula_id                  => l_pln_rec.mx_wtg_dt_to_use_rl
1841 					,p_business_group_id        => l_pln_rec.business_group_id
1842 					,p_number_of_copies         =>  l_number_of_copies
1843 					,p_object_version_number  => l_object_version_number
1844 					,p_effective_date             => p_effective_date);
1845 			end if;
1846 
1847 			if (l_pln_rec.mx_wtg_perd_rl is not null) then
1848 			   ben_plan_design_program_module.create_formula_result(
1849 					p_validate                       => p_validate
1850 					,p_copy_entity_result_id  => l_copy_entity_result_id
1851 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1852 					,p_formula_id                  => l_pln_rec.mx_wtg_perd_rl
1853 					,p_business_group_id        => l_pln_rec.business_group_id
1854 					,p_number_of_copies         =>  l_number_of_copies
1855 					,p_object_version_number  => l_object_version_number
1856 					,p_effective_date             => p_effective_date);
1857 			end if;
1858 
1859 			if (l_pln_rec.nip_dflt_enrt_det_rl is not null) then
1860 			   ben_plan_design_program_module.create_formula_result(
1861 					p_validate                       => p_validate
1862 					,p_copy_entity_result_id  => l_copy_entity_result_id
1863 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1864 					,p_formula_id                  => l_pln_rec.nip_dflt_enrt_det_rl
1865 					,p_business_group_id        => l_pln_rec.business_group_id
1866 					,p_number_of_copies         =>  l_number_of_copies
1867 					,p_object_version_number  => l_object_version_number
1868 					,p_effective_date             => p_effective_date);
1869 			end if;
1870 
1871 			if (l_pln_rec.postelcn_edit_rl is not null) then
1872 			   ben_plan_design_program_module.create_formula_result(
1873 					p_validate                       => p_validate
1874 					,p_copy_entity_result_id  => l_copy_entity_result_id
1875 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1876 					,p_formula_id                  => l_pln_rec.postelcn_edit_rl
1877 					,p_business_group_id        => l_pln_rec.business_group_id
1878 					,p_number_of_copies         =>  l_number_of_copies
1879 					,p_object_version_number  => l_object_version_number
1880 					,p_effective_date             => p_effective_date);
1881 			end if;
1882 
1883 			if (l_pln_rec.prort_prtl_yr_cvg_rstrn_rl is not null) then
1884 			   ben_plan_design_program_module.create_formula_result(
1885 					p_validate                       => p_validate
1886 					,p_copy_entity_result_id  => l_copy_entity_result_id
1887 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1888 					,p_formula_id                  => l_pln_rec.prort_prtl_yr_cvg_rstrn_rl
1889 					,p_business_group_id        => l_pln_rec.business_group_id
1890 					,p_number_of_copies         =>  l_number_of_copies
1891 					,p_object_version_number  => l_object_version_number
1892 					,p_effective_date             => p_effective_date);
1893 			end if;
1894 
1895 			if (l_pln_rec.rqd_perd_enrt_nenrt_rl is not null) then
1896 			   ben_plan_design_program_module.create_formula_result(
1897 					p_validate                       => p_validate
1898 					,p_copy_entity_result_id  => l_copy_entity_result_id
1899 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1900 					,p_formula_id                  => l_pln_rec.rqd_perd_enrt_nenrt_rl
1901 					,p_business_group_id        => l_pln_rec.business_group_id
1902 					,p_number_of_copies         =>  l_number_of_copies
1903 					,p_object_version_number  => l_object_version_number
1904 					,p_effective_date             => p_effective_date);
1905 			end if;
1906 
1907 			if (l_pln_rec.rt_end_dt_rl is not null) then
1908 			   ben_plan_design_program_module.create_formula_result(
1909 					p_validate                       => p_validate
1910 					,p_copy_entity_result_id  => l_copy_entity_result_id
1911 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1912 					,p_formula_id                  => l_pln_rec.rt_end_dt_rl
1913 					,p_business_group_id        => l_pln_rec.business_group_id
1914 					,p_number_of_copies         =>  l_number_of_copies
1915 					,p_object_version_number  => l_object_version_number
1916 					,p_effective_date             => p_effective_date);
1917 			end if;
1918 
1919 			if (l_pln_rec.rt_strt_dt_rl is not null) then
1920 			   ben_plan_design_program_module.create_formula_result(
1921 					p_validate                       => p_validate
1922 					,p_copy_entity_result_id  => l_copy_entity_result_id
1923 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1924 					,p_formula_id                  => l_pln_rec.rt_strt_dt_rl
1925 					,p_business_group_id        => l_pln_rec.business_group_id
1926 					,p_number_of_copies         =>  l_number_of_copies
1927 					,p_object_version_number  => l_object_version_number
1928 					,p_effective_date             => p_effective_date);
1929 			end if;
1930 
1931 			if (l_pln_rec.vrfy_fmly_mmbr_rl is not null) then
1932 			   ben_plan_design_program_module.create_formula_result(
1933 					p_validate                       => p_validate
1934 					,p_copy_entity_result_id  => l_copy_entity_result_id
1935 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
1936 					,p_formula_id                  => l_pln_rec.vrfy_fmly_mmbr_rl
1937 					,p_business_group_id        => l_pln_rec.business_group_id
1938 					,p_number_of_copies         =>  l_number_of_copies
1939 					,p_object_version_number  => l_object_version_number
1940 					,p_effective_date             => p_effective_date);
1941 			end if;
1942 
1943 
1944        end loop ;
1945        --
1946        if p_number_of_copies = 1 then
1947 
1948          if l_out_pln_result_id is null then -- Plan created earlier with number_copies as 0
1949           --
1950            open c_parent_result(l_pl_id,'PLN',p_copy_entity_txn_id);
1951            fetch c_parent_result into l_out_pln_result_id ;
1952 
1953            if c_parent_result%notfound  then
1954              -- If PLN does not exist as of process effective date
1955              -- then fetch the PLN result record with min copy_entity_result_id
1956 
1957              open c_parent_result1(l_pl_id,'PLN',p_copy_entity_txn_id);
1958              fetch c_parent_result1 into l_out_pln_result_id ;
1959              close c_parent_result1;
1960            end if;
1961            close c_parent_result;
1962 
1963            if p_pl_id is not null then                         -- Plan is Top Node
1964              l_out_pln_cpp_result_id := l_out_pln_result_id;   -- Copy_entity_result_id of Ben_Pl_f
1965            else                          -- Plan in Program
1966              l_out_pln_cpp_result_id := l_out_cpp_result_id;   -- Copy_entity_result_id of Ben_Plip_f
1967            end if;
1968 
1969            -- To pass as effective date while creating the
1970            -- non date-tracked child records
1971            open c_parent_esd(p_pl_id,'PLN',p_copy_entity_txn_id);
1972            fetch c_parent_esd into l_pln_esd;
1973            close c_parent_esd;
1974 
1975          end if;
1976 
1977          l_mirror_src_entity_result_id :=  l_out_pln_result_id;  -- Copy_entity_result_id of Ben_Pl_f
1978          l_parent_entity_result_id :=    l_out_pln_cpp_result_id;
1979 
1980          -- ------------------------------------------------------------------------
1981          -- Eligibility Profiles
1982          -- ------------------------------------------------------------------------
1983          ben_plan_design_elpro_module.create_elpro_results
1984             (
1985               p_validate                     => p_validate
1986              ,p_copy_entity_result_id        => l_mirror_src_entity_result_id
1987              ,p_copy_entity_txn_id           => p_copy_entity_txn_id
1988              ,p_pgm_id                       => null
1989              ,p_ptip_id                      => null
1990              ,p_plip_id                      => null
1991              ,p_pl_id                        => l_pl_id
1992              ,p_oipl_id                      => null
1993              ,p_business_group_id            => p_business_group_id
1994              ,p_number_of_copies             => p_number_of_copies
1995              ,p_object_version_number        => l_object_version_number
1996              ,p_effective_date               => p_effective_date
1997              ,p_parent_entity_result_id      => l_parent_entity_result_id
1998             );
1999            -- ------------------------------------------------------------------------
2000            -- Dependent Eligibility Profiles
2001            -- ------------------------------------------------------------------------
2002            ben_plan_design_elpro_module.create_dep_elpro_result
2003               (
2004                   p_validate                   => p_validate
2005                  ,p_copy_entity_result_id      => l_mirror_src_entity_result_id
2006                  ,p_copy_entity_txn_id         => p_copy_entity_txn_id
2007                  ,p_pgm_id                     => null
2008                  ,p_ptip_id                    => null
2009                  ,p_pl_id                      => l_pl_id
2010                  ,p_business_group_id          => p_business_group_id
2011                  ,p_number_of_copies           => p_number_of_copies
2012                  ,p_object_version_number      => l_object_version_number
2013                  ,p_effective_date             => p_effective_date
2014                  ,p_parent_entity_result_id    => l_parent_entity_result_id
2015                );
2016            -- ------------------------------------------------------------------------
2017            -- Standard Rates ,Flex Credits at Plan level
2018            -- ------------------------------------------------------------------------
2019            ben_pd_rate_and_cvg_module.create_rate_results
2020                 (
2021                   p_validate                   => p_validate
2022                  ,p_copy_entity_result_id      => l_mirror_src_entity_result_id
2023                  ,p_copy_entity_txn_id         => p_copy_entity_txn_id
2024                  ,p_pgm_id                     => null
2025                  ,p_ptip_id                    => null
2026                  ,p_plip_id                    => null
2027                  ,p_pl_id                      => l_pl_id
2028                  ,p_oipl_id                    => null
2029                  ,p_oiplip_id                  => null
2030                  ,p_cmbn_plip_id               => null
2031                  ,p_cmbn_ptip_id               => null
2032                  ,p_cmbn_ptip_opt_id           => null
2033                  ,p_business_group_id          => p_business_group_id
2034                  ,p_number_of_copies           => p_number_of_copies
2035                  ,p_object_version_number      => l_object_version_number
2036                  ,p_effective_date             => p_effective_date
2037                  ,p_parent_entity_result_id    => l_parent_entity_result_id
2038                  ) ;
2039 
2040             -- ------------------------------------------------------------------------
2041             -- Coverage Calculations - Plan Level
2042             -- ------------------------------------------------------------------------
2043 
2044             ben_pd_rate_and_cvg_module.create_coverage_results
2045             (
2046               p_validate                   => p_validate
2047              ,p_copy_entity_result_id      => l_mirror_src_entity_result_id
2048              ,p_copy_entity_txn_id         => p_copy_entity_txn_id
2049              ,p_plip_id                    => null
2050              ,p_pl_id                      => l_pl_id
2051              ,p_oipl_id                    => null
2052              ,p_business_group_id          => p_business_group_id
2053              ,p_number_of_copies           => p_number_of_copies
2054              ,p_object_version_number      => l_object_version_number
2055              ,p_effective_date             => p_effective_date
2056              ,p_parent_entity_result_id    => l_parent_entity_result_id
2057            ) ;
2058 
2059            -- ------------------------------------------------------------------------
2060            -- Actual Premiums - Plan Level
2061            -- ------------------------------------------------------------------------
2062 
2063             ben_pd_rate_and_cvg_module.create_premium_results
2064             (
2065                p_validate                => p_validate
2066               ,p_copy_entity_result_id   => l_mirror_src_entity_result_id
2067               ,p_copy_entity_txn_id      => p_copy_entity_txn_id
2068               ,p_pl_id                   => l_pl_id
2069               ,p_oipl_id                 => null
2070               ,p_business_group_id       => p_business_group_id
2071               ,p_number_of_copies        => p_number_of_copies
2072               ,p_object_version_number   => l_object_version_number
2073               ,p_effective_date          => p_effective_date
2074               ,p_parent_entity_result_id => l_parent_entity_result_id
2075            ) ;
2076 
2077 
2078          -- ------------------------------------------------------------------------
2079          -- POPL Genenation call
2080          -- ------------------------------------------------------------------------
2081          -- ------------------------------------------------------------------------
2082          --
2083          create_popl_result
2084            (
2085              p_validate                     => p_validate
2086             ,p_copy_entity_result_id        => l_mirror_src_entity_result_id
2087             ,p_copy_entity_txn_id           => p_copy_entity_txn_id
2088             ,p_pgm_id                       => null
2089             ,p_pl_id                        => l_pl_id
2090             ,p_business_group_id            => p_business_group_id
2091             ,p_number_of_copies             => p_number_of_copies
2092             ,p_object_version_number        => l_object_version_number
2093             ,p_effective_date               => p_effective_date
2094             ,p_parent_entity_result_id      => l_parent_entity_result_id
2095            );
2096      ---------------------------------------------------------------
2097      -- START OF BEN_CWB_WKSHT_GRP ----------------------
2098      ---------------------------------------------------------------
2099      --
2100 
2101      for l_parent_rec  in c_cwg_from_parent(l_PL_ID) loop
2102         --
2103         l_mirror_src_entity_result_id := l_out_pln_result_id ;
2104         l_parent_entity_result_id := l_out_pln_cpp_result_id;
2105         --
2106         l_cwb_wksht_grp_id := l_parent_rec.cwb_wksht_grp_id ;
2107         --
2108         for l_cwg_rec in c_cwg(l_parent_rec.cwb_wksht_grp_id,l_mirror_src_entity_result_id,'CWG') loop
2109           --
2110           l_table_route_id := null ;
2111           open ben_plan_design_program_module.g_table_route('CWG');
2112             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2113           close ben_plan_design_program_module.g_table_route ;
2114           --
2115           l_information5  := l_cwg_rec.label;
2116           --
2117           l_result_type_cd := 'DISPLAY';
2118             --
2119           l_copy_entity_result_id := null;
2120           l_object_version_number := null;
2121           ben_copy_entity_results_api.create_copy_entity_results(
2122             p_copy_entity_result_id           => l_copy_entity_result_id,
2123             p_copy_entity_txn_id             => p_copy_entity_txn_id,
2124             p_result_type_cd                 => l_result_type_cd,
2125             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2126             p_parent_entity_result_id        => l_parent_entity_result_id,
2127             p_number_of_copies               => l_number_of_copies,
2128             p_table_alias					 => 'CWG',
2129             p_table_route_id                 => l_table_route_id,
2130             p_information1     => l_cwg_rec.cwb_wksht_grp_id,
2131             p_information2     => null,
2132             p_information3     => null,
2133             p_information4     => l_cwg_rec.business_group_id,
2134             p_information5     => l_information5 , -- 9999 put name for h-grid
2135             p_information111     => l_cwg_rec.cwg_attribute1,
2136             p_information120     => l_cwg_rec.cwg_attribute10,
2137             p_information121     => l_cwg_rec.cwg_attribute11,
2138             p_information122     => l_cwg_rec.cwg_attribute12,
2139             p_information123     => l_cwg_rec.cwg_attribute13,
2140             p_information124     => l_cwg_rec.cwg_attribute14,
2141             p_information125     => l_cwg_rec.cwg_attribute15,
2142             p_information126     => l_cwg_rec.cwg_attribute16,
2143             p_information127     => l_cwg_rec.cwg_attribute17,
2144             p_information128     => l_cwg_rec.cwg_attribute18,
2145             p_information129     => l_cwg_rec.cwg_attribute19,
2146             p_information112     => l_cwg_rec.cwg_attribute2,
2147             p_information130     => l_cwg_rec.cwg_attribute20,
2148             p_information131     => l_cwg_rec.cwg_attribute21,
2149             p_information132     => l_cwg_rec.cwg_attribute22,
2150             p_information133     => l_cwg_rec.cwg_attribute23,
2151             p_information134     => l_cwg_rec.cwg_attribute24,
2152             p_information135     => l_cwg_rec.cwg_attribute25,
2153             p_information136     => l_cwg_rec.cwg_attribute26,
2154             p_information137     => l_cwg_rec.cwg_attribute27,
2155             p_information138     => l_cwg_rec.cwg_attribute28,
2156             p_information139     => l_cwg_rec.cwg_attribute29,
2157             p_information113     => l_cwg_rec.cwg_attribute3,
2158             p_information140     => l_cwg_rec.cwg_attribute30,
2159             p_information114     => l_cwg_rec.cwg_attribute4,
2160             p_information115     => l_cwg_rec.cwg_attribute5,
2161             p_information116     => l_cwg_rec.cwg_attribute6,
2162             p_information117     => l_cwg_rec.cwg_attribute7,
2163             p_information118     => l_cwg_rec.cwg_attribute8,
2164             p_information119     => l_cwg_rec.cwg_attribute9,
2165             p_information110     => l_cwg_rec.cwg_attribute_category,
2166             p_information141     => l_cwg_rec.label,
2167             p_information260     => l_cwg_rec.ordr_num,
2168             p_information261     => l_cwg_rec.pl_id,
2169             p_information11     => l_cwg_rec.wksht_grp_cd,
2170             p_information12     => l_cwg_rec.hidden_cd,
2171             p_information13     => l_cwg_rec.status_cd,
2172             p_information265    => l_cwg_rec.object_version_number,
2173             p_object_version_number          => l_object_version_number,
2174             p_effective_date                 => p_effective_date       );
2175             --
2176 
2177 	    if l_out_cwg_result_id is null then
2178               l_out_cwg_result_id := l_copy_entity_result_id;
2179             end if;
2180 
2181             if l_result_type_cd = 'DISPLAY' then
2182                l_out_cwg_result_id := l_copy_entity_result_id ;
2183             end if;
2184             --
2185 -- RKG CWB Plan Personalization
2186 
2187 
2188 	l_mirror_src_entity_result_id := l_copy_entity_result_id ;
2189 	l_parent_entity_result_id := l_copy_entity_result_id;
2190 
2191 	    --
2192 	  for l_cri_rec in c_cri(l_parent_rec.cwb_wksht_grp_id,l_mirror_src_entity_result_id,'CRI') loop
2193           --
2194 
2195           l_table_route_id := null ;
2196           open ben_plan_design_program_module.g_table_route('CRI');
2197             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2198           close ben_plan_design_program_module.g_table_route ;
2199           --
2200           l_cri_information5  := l_cri_rec.label;
2201           --
2202 	  --Bug 5018205 DO NOT Display personalizations if the Label is NULL
2203 	  if l_cri_information5 is null then
2204 	     l_cri_result_type_cd := 'NODISPLAY';
2205 	  else
2206 	     l_cri_result_type_cd := 'DISPLAY';
2207 	  end if;
2208             --
2209           l_copy_entity_result_id := null;
2210           l_object_version_number := null;
2211 
2212           ben_copy_entity_results_api.create_copy_entity_results(
2213             p_copy_entity_result_id           => l_copy_entity_result_id,
2214             p_copy_entity_txn_id             => p_copy_entity_txn_id,
2215             p_result_type_cd                 => l_cri_result_type_cd,
2216             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2217             p_parent_entity_result_id        => l_parent_entity_result_id,
2218             p_number_of_copies               => l_number_of_copies,
2219             p_table_alias			 => 'CRI',
2220             p_table_route_id                 => l_table_route_id,
2221             p_information1     => null,
2222             p_information2     => null,
2223             p_information3     => null,
2224             p_information4     => null,
2225             p_information5     => l_cri_information5 , -- 9999 put name for h-grid
2226 	    p_information11	=>l_cri_rec.region_code,
2227 	    p_information12	=>l_cri_rec.custom_key,
2228 	    p_information13	=>l_cri_rec.custom_type,
2229 	    p_information14	=>l_cri_rec.item_name,
2230 	    p_information15	=>l_cri_rec.display_flag,
2231 	    p_information16	=>l_cri_rec.update_attr,
2232 	    p_information17	=>l_cri_rec.monetary,
2233     	    p_information141	=>l_cri_rec.label,
2234 	    p_information265	=>l_cri_rec.object_version_number,
2235 	    p_information266	=>l_cri_rec.ordr_num,
2236             p_object_version_number          => l_object_version_number,
2237             p_effective_date                 => p_effective_date       );
2238             --
2239 
2240             if l_out_cri_result_id is null then
2241               l_out_cri_result_id := l_copy_entity_result_id;
2242             end if;
2243 
2244             if l_cri_result_type_cd = 'DISPLAY' then
2245                l_out_cri_result_id := l_copy_entity_result_id ;
2246             end if;
2247             --
2248          end loop;
2249 	    --
2250 -- RKG CWB Plan Personalization
2251 
2252 
2253          end loop;
2254          --
2255        end loop;
2256 
2257     ---------------------------------------------------------------
2258     -- END OF BEN_CWB_WKSHT_GRP ----------------------
2259     ---------------------------------------------------------------
2260 
2261      ---------------------------------------------------------------
2262      -- START OF BEN_PL_TYP_F ----------------------
2263      ---------------------------------------------------------------
2264      --
2265      for l_parent_rec  in c_ptp_from_parent(l_PL_ID) loop
2266        create_pl_typ_result
2267        ( p_validate                       => p_validate
2268         ,p_copy_entity_result_id          => l_out_pln_result_id
2269         ,p_copy_entity_txn_id             => p_copy_entity_txn_id
2270         ,p_pl_typ_id                      => l_parent_rec.pl_typ_id
2271         ,p_business_group_id              => p_business_group_id
2272         ,p_number_of_copies               => p_number_of_copies
2273         ,p_object_version_number          => l_object_version_number
2274         ,p_effective_date                 => p_effective_date
2275         ,p_parent_entity_result_id        => l_out_pln_cpp_result_id
2276        );
2277      end loop;
2278     ---------------------------------------------------------------
2279     -- END OF BEN_PL_TYP_F ----------------------
2280     ---------------------------------------------------------------
2281          ---------------------------------------------------------------
2282          -- START OF BEN_PL_REGN_F ----------------------
2283          ---------------------------------------------------------------
2284           --
2285           for l_parent_rec  in c_prg_from_parent(l_PL_ID) loop
2286           --
2287             l_mirror_src_entity_result_id := l_out_pln_result_id;
2288             l_parent_entity_result_id := l_out_pln_cpp_result_id;
2289 
2290             l_pl_regn_id := l_parent_rec.pl_regn_id ;
2291 
2292             if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
2293               open c_object_exists(l_pl_regn_id,'PRG');
2294               fetch c_object_exists into l_dummy;
2295               if c_object_exists%found then
2296                 close c_object_exists;
2297                 exit;
2298               end if;
2299               close c_object_exists;
2300             end if;
2301 
2302             --
2303             for l_prg_rec in c_prg(l_parent_rec.pl_regn_id,l_mirror_src_entity_result_id,'PRG') loop
2304             --
2305                l_table_route_id := null ;
2306                open ben_plan_design_program_module.g_table_route('PRG');
2307                fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2308                close ben_plan_design_program_module.g_table_route ;
2309                 --
2310               l_information5  := ben_plan_design_program_module.get_regn_name(l_prg_rec.regn_id,p_effective_date); --'Intersection';
2311                 --
2312                 if p_effective_date between l_prg_rec.effective_start_date
2313                     and l_prg_rec.effective_end_date then
2314                     --
2315                     l_result_type_cd := 'DISPLAY';
2316                 else
2317                     l_result_type_cd := 'NO DISPLAY';
2318                 end if;
2319 
2320                 /* NOT REQUIRED AS create_REG_rows will handle this
2321                 --
2322                 -- Store the Regulation name in information185
2323                 -- Records for Regulations (BEN_REGN_F) will not created in the Target Business Group
2324                 -- The copy process will try and map the Regulation name to the ones existing in the
2325                 -- Target Business Group and if a match is found, then that Regulation Id will be used
2326                 -- for creating Plan Regulation (BEN_PL_REGN) records.
2327 
2328                 l_regn_name :=  ben_plan_design_program_module.get_regn_name(l_prg_rec.regn_id,l_prg_rec.effective_start_date);
2329                 --
2330                 */
2331 
2332                 l_copy_entity_result_id := null;
2333                 l_object_version_number := null;
2334                 ben_copy_entity_results_api.create_copy_entity_results(
2335                      p_copy_entity_result_id           => l_copy_entity_result_id,
2336                      p_copy_entity_txn_id             => p_copy_entity_txn_id,
2337                      p_result_type_cd                 => l_result_type_cd,
2338                      p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
2339                      p_parent_entity_result_id        => l_parent_entity_result_id,
2340                      p_number_of_copies               => l_number_of_copies,
2341                      p_table_alias					 => 'PRG',
2342                      p_table_route_id                 => l_table_route_id,
2343                      p_information1     => l_prg_rec.pl_regn_id,
2344                      p_information2     => l_prg_rec.EFFECTIVE_START_DATE,
2345                      p_information3     => l_prg_rec.EFFECTIVE_END_DATE,
2346                      p_information4     => l_prg_rec.business_group_id,
2347                      p_information5     => l_information5 , -- 9999 put name for h-grid
2348                      p_information259     => l_prg_rec.cntr_nndscrn_rl,
2349                      p_information260     => l_prg_rec.cvg_nndscrn_rl,
2350                      p_information262     => l_prg_rec.five_pct_ownr_rl,
2351                      p_information257     => l_prg_rec.hghly_compd_det_rl,
2352                      p_information258     => l_prg_rec.key_ee_det_rl,
2353                      p_information261     => l_prg_rec.pl_id,
2354                      p_information111     => l_prg_rec.prg_attribute1,
2355                      p_information120     => l_prg_rec.prg_attribute10,
2356                      p_information121     => l_prg_rec.prg_attribute11,
2357                      p_information122     => l_prg_rec.prg_attribute12,
2358                      p_information123     => l_prg_rec.prg_attribute13,
2359                      p_information124     => l_prg_rec.prg_attribute14,
2360                      p_information125     => l_prg_rec.prg_attribute15,
2361                      p_information126     => l_prg_rec.prg_attribute16,
2362                      p_information127     => l_prg_rec.prg_attribute17,
2363                      p_information128     => l_prg_rec.prg_attribute18,
2364                      p_information129     => l_prg_rec.prg_attribute19,
2365                      p_information112     => l_prg_rec.prg_attribute2,
2366                      p_information130     => l_prg_rec.prg_attribute20,
2367                      p_information131     => l_prg_rec.prg_attribute21,
2368                      p_information132     => l_prg_rec.prg_attribute22,
2369                      p_information133     => l_prg_rec.prg_attribute23,
2370                      p_information134     => l_prg_rec.prg_attribute24,
2371                      p_information135     => l_prg_rec.prg_attribute25,
2372                      p_information136     => l_prg_rec.prg_attribute26,
2373                      p_information137     => l_prg_rec.prg_attribute27,
2374                      p_information138     => l_prg_rec.prg_attribute28,
2375                      p_information139     => l_prg_rec.prg_attribute29,
2376                      p_information113     => l_prg_rec.prg_attribute3,
2377                      p_information140     => l_prg_rec.prg_attribute30,
2378                      p_information114     => l_prg_rec.prg_attribute4,
2379                      p_information115     => l_prg_rec.prg_attribute5,
2380                      p_information116     => l_prg_rec.prg_attribute6,
2381                      p_information117     => l_prg_rec.prg_attribute7,
2382                      p_information118     => l_prg_rec.prg_attribute8,
2383                      p_information119     => l_prg_rec.prg_attribute9,
2384                      p_information110     => l_prg_rec.prg_attribute_category,
2385                      p_information231     => l_prg_rec.regn_id,
2386                      p_information11      => l_prg_rec.regy_pl_typ_cd,
2387                      p_information242     => l_prg_rec.rptg_grp_id,
2388                      -- p_information185     => l_regn_name, -- NOT REQUIRED AS create_REG_rows will handle this
2389                      p_information265     => l_prg_rec.object_version_number,
2390                      p_object_version_number          => l_object_version_number,
2391                      p_effective_date                 => p_effective_date       );
2392               --
2393 
2394                      if l_out_prg_result_id is null then
2395                        l_out_prg_result_id := l_copy_entity_result_id;
2396                      end if;
2397 
2398                      if l_result_type_cd = 'DISPLAY' then
2399                        l_out_prg_result_id := l_copy_entity_result_id ;
2400                      end if;
2401 
2402                       if (l_prg_rec.cntr_nndscrn_rl is not null) then
2403 						   ben_plan_design_program_module.create_formula_result(
2404 								p_validate                       => p_validate
2405 								,p_copy_entity_result_id  => l_copy_entity_result_id
2406 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
2407 								,p_formula_id                  => l_prg_rec.cntr_nndscrn_rl
2408 								,p_business_group_id        => l_prg_rec.business_group_id
2409 								,p_number_of_copies         =>  l_number_of_copies
2410 								,p_object_version_number  => l_object_version_number
2411 								,p_effective_date             => p_effective_date);
2412 						end if;
2413 
2414                       if (l_prg_rec.cvg_nndscrn_rl is not null) then
2415 						   ben_plan_design_program_module.create_formula_result(
2416 								p_validate                       => p_validate
2417 								,p_copy_entity_result_id  => l_copy_entity_result_id
2418 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
2419 								,p_formula_id                  => l_prg_rec.cvg_nndscrn_rl
2420 								,p_business_group_id        => l_prg_rec.business_group_id
2421 								,p_number_of_copies         =>  l_number_of_copies
2422 								,p_object_version_number  => l_object_version_number
2423 								,p_effective_date             => p_effective_date);
2424 						end if;
2425 
2426                       if (l_prg_rec.five_pct_ownr_rl is not null) then
2427 						   ben_plan_design_program_module.create_formula_result(
2428 								p_validate                       => p_validate
2429 								,p_copy_entity_result_id  => l_copy_entity_result_id
2430 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
2431 								,p_formula_id                  => l_prg_rec.five_pct_ownr_rl
2432 								,p_business_group_id        => l_prg_rec.business_group_id
2433 								,p_number_of_copies         =>  l_number_of_copies
2434 								,p_object_version_number  => l_object_version_number
2435 								,p_effective_date             => p_effective_date);
2436 						end if;
2437 
2438                       if (l_prg_rec.hghly_compd_det_rl is not null) then
2439 						   ben_plan_design_program_module.create_formula_result(
2440 								p_validate                       => p_validate
2441 								,p_copy_entity_result_id  => l_copy_entity_result_id
2442 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
2443 								,p_formula_id                  => l_prg_rec.hghly_compd_det_rl
2444 								,p_business_group_id        => l_prg_rec.business_group_id
2445 								,p_number_of_copies         =>  l_number_of_copies
2446 								,p_object_version_number  => l_object_version_number
2447 								,p_effective_date             => p_effective_date);
2448 						end if;
2449 
2450                       if (l_prg_rec.key_ee_det_rl is not null) then
2451 						   ben_plan_design_program_module.create_formula_result(
2452 								p_validate                       => p_validate
2453 								,p_copy_entity_result_id  => l_copy_entity_result_id
2454 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
2455 								,p_formula_id                  => l_prg_rec.key_ee_det_rl
2456 								,p_business_group_id        => l_prg_rec.business_group_id
2457 								,p_number_of_copies         =>  l_number_of_copies
2458 								,p_object_version_number  => l_object_version_number
2459 								,p_effective_date             => p_effective_date);
2460 						end if;
2461 				--
2462               end loop;
2463 
2464         ---------------------------------------------------------------
2465         -- START OF BEN_REGN_F ----------------------
2466         ---------------------------------------------------------------
2467          --
2468          for l_parent_rec  in c_reg_from_parent(l_PL_REGN_ID) loop
2469          --
2470            l_mirror_src_entity_result_id := l_out_prg_result_id;
2471 
2472            l_regn_id := l_parent_rec.regn_id ;
2473 
2474            if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
2475              open c_object_exists(l_regn_id,'REG');
2476              fetch c_object_exists into l_dummy;
2477              if c_object_exists%found then
2478                close c_object_exists;
2479                exit;
2480              end if;
2481              close c_object_exists;
2482            end if;
2483            --
2484            for l_reg_rec in c_reg(l_parent_rec.regn_id,l_mirror_src_entity_result_id,'REG') loop
2485            --
2486                l_table_route_id := null ;
2487                open ben_plan_design_program_module.g_table_route('REG');
2488                fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2489                close ben_plan_design_program_module.g_table_route ;
2490                --
2491                l_information5  := l_reg_rec.name; --'Intersection';
2492                --
2493                l_regn_id := l_reg_rec.regn_id ;
2494                if p_effective_date between l_reg_rec.effective_start_date
2495                    and l_reg_rec.effective_end_date then
2496                    --
2497                    l_result_type_cd := 'DISPLAY';
2498                else
2499                    l_result_type_cd := 'NO DISPLAY';
2500                end if;
2501                --
2502                l_copy_entity_result_id := null;
2503                l_object_version_number := null;
2504                ben_copy_entity_results_api.create_copy_entity_results(
2505                     p_copy_entity_result_id           => l_copy_entity_result_id,
2506                     p_copy_entity_txn_id             => p_copy_entity_txn_id,
2507                     p_result_type_cd                 => l_result_type_cd,
2508                     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
2509                     p_parent_entity_result_id        => l_mirror_src_entity_result_id,
2510                     p_number_of_copies               => l_number_of_copies,
2511                     p_table_alias					 => 'REG',
2512                     p_table_route_id                 => l_table_route_id,
2513                     p_information1     => l_reg_rec.regn_id,
2514                     p_information2     => l_reg_rec.EFFECTIVE_START_DATE,
2515                     p_information3     => l_reg_rec.EFFECTIVE_END_DATE,
2516                     p_information4     => l_reg_rec.business_group_id,
2517                     p_information5     => l_information5 , -- 9999 put name for h-grid
2518                     p_information170     => l_reg_rec.name,
2519                     p_information252     => l_reg_rec.organization_id,
2520                     p_information111     => l_reg_rec.reg_attribute1,
2521                     p_information120     => l_reg_rec.reg_attribute10,
2522                     p_information121     => l_reg_rec.reg_attribute11,
2523                     p_information122     => l_reg_rec.reg_attribute12,
2524                     p_information123     => l_reg_rec.reg_attribute13,
2525                     p_information124     => l_reg_rec.reg_attribute14,
2526                     p_information125     => l_reg_rec.reg_attribute15,
2527                     p_information126     => l_reg_rec.reg_attribute16,
2528                     p_information127     => l_reg_rec.reg_attribute17,
2529                     p_information128     => l_reg_rec.reg_attribute18,
2530                     p_information129     => l_reg_rec.reg_attribute19,
2531                     p_information112     => l_reg_rec.reg_attribute2,
2532                     p_information130     => l_reg_rec.reg_attribute20,
2533                     p_information131     => l_reg_rec.reg_attribute21,
2534                     p_information132     => l_reg_rec.reg_attribute22,
2535                     p_information133     => l_reg_rec.reg_attribute23,
2536                     p_information134     => l_reg_rec.reg_attribute24,
2537                     p_information135     => l_reg_rec.reg_attribute25,
2538                     p_information136     => l_reg_rec.reg_attribute26,
2539                     p_information137     => l_reg_rec.reg_attribute27,
2540                     p_information138     => l_reg_rec.reg_attribute28,
2541                     p_information139     => l_reg_rec.reg_attribute29,
2542                     p_information113     => l_reg_rec.reg_attribute3,
2543                     p_information140     => l_reg_rec.reg_attribute30,
2544                     p_information114     => l_reg_rec.reg_attribute4,
2545                     p_information115     => l_reg_rec.reg_attribute5,
2546                     p_information116     => l_reg_rec.reg_attribute6,
2547                     p_information117     => l_reg_rec.reg_attribute7,
2548                     p_information118     => l_reg_rec.reg_attribute8,
2549                     p_information119     => l_reg_rec.reg_attribute9,
2550                     p_information110     => l_reg_rec.reg_attribute_category,
2551                     p_information185     => l_reg_rec.sttry_citn_name,
2552                     p_information265     => l_reg_rec.object_version_number,
2553                     p_object_version_number          => l_object_version_number,
2554                     p_effective_date                 => p_effective_date       );
2555              --
2556 
2557                if l_out_reg_result_id is null then
2558                  l_out_reg_result_id := l_copy_entity_result_id;
2559                end if;
2560 
2561                if l_result_type_cd = 'DISPLAY' then
2562                  l_out_reg_result_id := l_copy_entity_result_id ;
2563                end if;
2564 
2565              end loop;
2566            --
2567            end loop;
2568         ---------------------------------------------------------------
2569         -- END OF BEN_REGN_F ----------------------
2570         ---------------------------------------------------------------
2571             --
2572        ---------------------------------------------------------------
2573        -- START OF BEN_RPTG_GRP ----------------------
2574        ---------------------------------------------------------------
2575         --
2576         for l_parent_rec  in c_bnr_from_parent(l_PL_REGN_ID) loop
2577         --
2578 
2579           l_mirror_src_entity_result_id := l_out_prg_result_id ;
2580 
2581           l_rptg_grp_id := l_parent_rec.rptg_grp_id ;
2582 
2583           if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
2584             open c_object_exists(l_rptg_grp_id,'BNR');
2585             fetch c_object_exists into l_dummy;
2586             if c_object_exists%found then
2587               close c_object_exists;
2588               exit;
2589             end if;
2590             close c_object_exists;
2591           end if;
2592 
2593           --
2594           for l_bnr_rec in c_bnr(l_parent_rec.rptg_grp_id,l_mirror_src_entity_result_id,'BNR') loop
2595           --
2596              l_table_route_id := null ;
2597              open ben_plan_design_program_module.g_table_route('BNR');
2598              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2599              close ben_plan_design_program_module.g_table_route ;
2600               --
2601               l_information5  := l_bnr_rec.name; --'Intersection';
2602               --
2603               l_rptg_grp_id := l_bnr_rec.rptg_grp_id ;
2604               l_result_type_cd := 'DISPLAY';
2605               --
2606               l_copy_entity_result_id := null;
2607               l_object_version_number := null;
2608               ben_copy_entity_results_api.create_copy_entity_results(
2609                    p_copy_entity_result_id           => l_copy_entity_result_id,
2610                    p_copy_entity_txn_id             => p_copy_entity_txn_id,
2611                    p_result_type_cd                 => l_result_type_cd,
2612                    p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
2613                    p_parent_entity_result_id        => l_mirror_src_entity_result_id,
2614                    p_number_of_copies               => l_number_of_copies,
2615                    p_table_alias					 => 'BNR',
2616                    p_table_route_id                 => l_table_route_id,
2617                    p_information1     => l_bnr_rec.rptg_grp_id,
2618                    p_information2     => null,
2619                    p_information3     => null,
2620                    p_information4     => l_bnr_rec.business_group_id,
2621                    p_information5     => l_information5 , -- 9999 put name for h-grid
2622                    p_information111     => l_bnr_rec.bnr_attribute1,
2623                    p_information120     => l_bnr_rec.bnr_attribute10,
2624                    p_information121     => l_bnr_rec.bnr_attribute11,
2625                    p_information122     => l_bnr_rec.bnr_attribute12,
2626                    p_information123     => l_bnr_rec.bnr_attribute13,
2627                    p_information124     => l_bnr_rec.bnr_attribute14,
2628                    p_information125     => l_bnr_rec.bnr_attribute15,
2629                    p_information126     => l_bnr_rec.bnr_attribute16,
2630                    p_information127     => l_bnr_rec.bnr_attribute17,
2631                    p_information128     => l_bnr_rec.bnr_attribute18,
2632                    p_information129     => l_bnr_rec.bnr_attribute19,
2633                    p_information112     => l_bnr_rec.bnr_attribute2,
2634                    p_information130     => l_bnr_rec.bnr_attribute20,
2635                    p_information131     => l_bnr_rec.bnr_attribute21,
2636                    p_information132     => l_bnr_rec.bnr_attribute22,
2637                    p_information133     => l_bnr_rec.bnr_attribute23,
2638                    p_information134     => l_bnr_rec.bnr_attribute24,
2639                    p_information135     => l_bnr_rec.bnr_attribute25,
2640                    p_information136     => l_bnr_rec.bnr_attribute26,
2641                    p_information137     => l_bnr_rec.bnr_attribute27,
2642                    p_information138     => l_bnr_rec.bnr_attribute28,
2643                    p_information139     => l_bnr_rec.bnr_attribute29,
2644                    p_information113     => l_bnr_rec.bnr_attribute3,
2645                    p_information140     => l_bnr_rec.bnr_attribute30,
2646                    p_information114     => l_bnr_rec.bnr_attribute4,
2647                    p_information115     => l_bnr_rec.bnr_attribute5,
2648                    p_information116     => l_bnr_rec.bnr_attribute6,
2649                    p_information117     => l_bnr_rec.bnr_attribute7,
2650                    p_information118     => l_bnr_rec.bnr_attribute8,
2651                    p_information119     => l_bnr_rec.bnr_attribute9,
2652                    p_information110     => l_bnr_rec.bnr_attribute_category,
2653                    p_information11     => l_bnr_rec.function_code,
2654                    p_information12     => l_bnr_rec.legislation_code,
2655                    p_information170     => l_bnr_rec.name,
2656                    p_information185     => l_bnr_rec.rpg_desc,
2657                    p_information13     => l_bnr_rec.rptg_prps_cd,
2658                    p_information265    => l_bnr_rec.object_version_number,
2659                    p_object_version_number          => l_object_version_number,
2660                    p_effective_date                 => p_effective_date       );
2661                --
2662 
2663                if l_out_bnr_result_id is null then
2664                  l_out_bnr_result_id := l_copy_entity_result_id;
2665                end if;
2666 
2667                if l_result_type_cd = 'DISPLAY' then
2668                  l_out_bnr_result_id := l_copy_entity_result_id ;
2669                end if;
2670 
2671             end loop;
2672 
2673                ---------------------------------------------------------------
2674                -- START OF BEN_PL_REGN_F ----------------------
2675                ---------------------------------------------------------------
2676                --
2677                for l_parent_rec  in c_prg1_from_parent(l_RPTG_GRP_ID) loop
2678                   --
2679                   l_mirror_src_entity_result_id := l_out_bnr_result_id ;
2680                   --
2681                   l_pl_regn_id1 := l_parent_rec.pl_regn_id ;
2682 
2683                   if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
2684                     open c_object_exists(l_pl_regn_id1,'PRG');
2685                     fetch c_object_exists into l_dummy;
2686                     if c_object_exists%found then
2687                       close c_object_exists;
2688                       exit;
2689                     end if;
2690                     close c_object_exists;
2691                   end if;
2692 
2693                   --
2694                   for l_prg_rec in c_prg1(l_parent_rec.pl_regn_id,l_mirror_src_entity_result_id,'PRG') loop
2695                     --
2696                     l_table_route_id := null ;
2697                     open ben_plan_design_program_module.g_table_route('PRG');
2698                       fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2699                     close ben_plan_design_program_module.g_table_route ;
2700                     --
2701                     l_information5  := ben_plan_design_program_module.get_regn_name(l_prg_rec.regn_id,
2702                                                               p_effective_date);
2703                     --
2704                     if p_effective_date between l_prg_rec.effective_start_date
2705                        and l_prg_rec.effective_end_date then
2706                      --
2707                        l_result_type_cd := 'DISPLAY';
2708                     else
2709                        l_result_type_cd := 'NO DISPLAY';
2710                     end if;
2711 
2712                     /* NOT REQUIRED AS create_REG_rows will handle this
2713                     --
2714                     -- Store the Regulation name in information185
2715                     -- Records for Regulations (BEN_REGN_F) will not created in the Target Business Group
2716                     -- The copy process will try and map the Regulation name to the ones existing in the
2717                     -- Target Business Group and if a match is found, then that Regulation Id will be used
2718                     -- for creating Plan Regulation (BEN_PL_REGN) records.
2719 
2720                     l_regn_name :=  ben_plan_design_program_module.get_regn_name(l_prg_rec.regn_id,l_prg_rec.effective_start_date);
2721                     --
2722                     */
2723 
2724                     l_copy_entity_result_id := null;
2725                     l_object_version_number := null;
2726                     ben_copy_entity_results_api.create_copy_entity_results(
2727                       p_copy_entity_result_id           => l_copy_entity_result_id,
2728                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
2729                       p_result_type_cd                 => l_result_type_cd,
2730                       p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2731                       p_parent_entity_result_id      => l_mirror_src_entity_result_id,
2732                       p_number_of_copies               => l_number_of_copies,
2733                       p_table_alias					 => 'PRG',
2734                       p_table_route_id                 => l_table_route_id,
2735                       p_information1     => l_prg_rec.pl_regn_id,
2736                       p_information2     => l_prg_rec.EFFECTIVE_START_DATE,
2737                       p_information3     => l_prg_rec.EFFECTIVE_END_DATE,
2738                       p_information4     => l_prg_rec.business_group_id,
2739                       p_information5     => l_information5 , -- 9999 put name for h-grid
2740                       p_information259     => l_prg_rec.cntr_nndscrn_rl,
2741                       p_information260     => l_prg_rec.cvg_nndscrn_rl,
2742                       p_information262     => l_prg_rec.five_pct_ownr_rl,
2743                       p_information257     => l_prg_rec.hghly_compd_det_rl,
2744                       p_information258     => l_prg_rec.key_ee_det_rl,
2745                       p_information261     => l_prg_rec.pl_id,
2746                       p_information111     => l_prg_rec.prg_attribute1,
2747                       p_information120     => l_prg_rec.prg_attribute10,
2748                       p_information121     => l_prg_rec.prg_attribute11,
2749                       p_information122     => l_prg_rec.prg_attribute12,
2750                       p_information123     => l_prg_rec.prg_attribute13,
2751                       p_information124     => l_prg_rec.prg_attribute14,
2752                       p_information125     => l_prg_rec.prg_attribute15,
2753                       p_information126     => l_prg_rec.prg_attribute16,
2754                       p_information127     => l_prg_rec.prg_attribute17,
2755                       p_information128     => l_prg_rec.prg_attribute18,
2756                       p_information129     => l_prg_rec.prg_attribute19,
2757                       p_information112     => l_prg_rec.prg_attribute2,
2758                       p_information130     => l_prg_rec.prg_attribute20,
2759                       p_information131     => l_prg_rec.prg_attribute21,
2760                       p_information132     => l_prg_rec.prg_attribute22,
2761                       p_information133     => l_prg_rec.prg_attribute23,
2762                       p_information134     => l_prg_rec.prg_attribute24,
2763                       p_information135     => l_prg_rec.prg_attribute25,
2764                       p_information136     => l_prg_rec.prg_attribute26,
2765                       p_information137     => l_prg_rec.prg_attribute27,
2766                       p_information138     => l_prg_rec.prg_attribute28,
2767                       p_information139     => l_prg_rec.prg_attribute29,
2768                       p_information113     => l_prg_rec.prg_attribute3,
2769                       p_information140     => l_prg_rec.prg_attribute30,
2770                       p_information114     => l_prg_rec.prg_attribute4,
2771                       p_information115     => l_prg_rec.prg_attribute5,
2772                       p_information116     => l_prg_rec.prg_attribute6,
2773                       p_information117     => l_prg_rec.prg_attribute7,
2774                       p_information118     => l_prg_rec.prg_attribute8,
2775                       p_information119     => l_prg_rec.prg_attribute9,
2776                       p_information110     => l_prg_rec.prg_attribute_category,
2777                       p_information231     => l_prg_rec.regn_id,
2778                       p_information11     => l_prg_rec.regy_pl_typ_cd,
2779                       p_information242     => l_prg_rec.rptg_grp_id,
2780                       -- p_information185     => l_regn_name, -- NOT REQUIRED AS create_REG_rows will handle this
2781                       p_information265     => l_prg_rec.object_version_number,
2782                       p_object_version_number          => l_object_version_number,
2783                       p_effective_date                 => p_effective_date       );
2784                       --
2785 
2786                       if l_out_prg1_result_id is null then
2787                         l_out_prg1_result_id := l_copy_entity_result_id;
2788                       end if;
2789 
2790                       if l_result_type_cd = 'DISPLAY' then
2791                          l_out_prg1_result_id := l_copy_entity_result_id ;
2792                       end if;
2793                       --
2794                    end loop;
2795                    --
2796                    ---------------------------------------------------------------
2797                    -- START OF BEN_REGN_F ----------------------
2798                    ---------------------------------------------------------------
2799                    --
2800                    for l_parent_rec  in c_reg_from_parent(l_PL_REGN_ID1) loop
2801                       --
2802                       l_mirror_src_entity_result_id := l_out_prg1_result_id ;
2803                       --
2804                       l_regn_id := l_parent_rec.regn_id ;
2805 
2806                       if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
2807                         open c_object_exists(l_regn_id,'REG');
2808                         fetch c_object_exists into l_dummy;
2809                         if c_object_exists%found then
2810                           close c_object_exists;
2811                           exit;
2812                         end if;
2813                         close c_object_exists;
2814                       end if;
2815                       --
2816                       for l_reg_rec in c_reg(l_parent_rec.regn_id,l_mirror_src_entity_result_id,'REG') loop
2817                         --
2818                         l_table_route_id := null ;
2819                         open ben_plan_design_program_module.g_table_route('REG');
2820                           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2821                         close ben_plan_design_program_module.g_table_route ;
2822                         --
2823                         l_information5  := l_reg_rec.name ;
2824                         --
2825                         if p_effective_date between l_reg_rec.effective_start_date
2826                            and l_reg_rec.effective_end_date then
2827                          --
2828                            l_result_type_cd := 'DISPLAY';
2829                         else
2830                            l_result_type_cd := 'NO DISPLAY';
2831                         end if;
2832                           --
2833                         l_copy_entity_result_id := null;
2834                         l_object_version_number := null;
2835                         ben_copy_entity_results_api.create_copy_entity_results(
2836                           p_copy_entity_result_id           => l_copy_entity_result_id,
2837                           p_copy_entity_txn_id             => p_copy_entity_txn_id,
2838                           p_result_type_cd                 => l_result_type_cd,
2839                           p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2840                           p_parent_entity_result_id      => l_mirror_src_entity_result_id,
2841                           p_number_of_copies               => l_number_of_copies,
2842                           p_table_alias					 => 'REG',
2843                           p_table_route_id                 => l_table_route_id,
2844                           p_information1     => l_reg_rec.regn_id,
2845                           p_information2     => l_reg_rec.EFFECTIVE_START_DATE,
2846                           p_information3     => l_reg_rec.EFFECTIVE_END_DATE,
2847                           p_information4     => l_reg_rec.business_group_id,
2848                           p_information5     => l_information5 , -- 9999 put name for h-grid
2849                           p_information170     => l_reg_rec.name,
2850                           p_information252     => l_reg_rec.organization_id,
2851                           p_information111     => l_reg_rec.reg_attribute1,
2852                           p_information120     => l_reg_rec.reg_attribute10,
2853                           p_information121     => l_reg_rec.reg_attribute11,
2854                           p_information122     => l_reg_rec.reg_attribute12,
2855                           p_information123     => l_reg_rec.reg_attribute13,
2856                           p_information124     => l_reg_rec.reg_attribute14,
2857                           p_information125     => l_reg_rec.reg_attribute15,
2858                           p_information126     => l_reg_rec.reg_attribute16,
2859                           p_information127     => l_reg_rec.reg_attribute17,
2860                           p_information128     => l_reg_rec.reg_attribute18,
2861                           p_information129     => l_reg_rec.reg_attribute19,
2862                           p_information112     => l_reg_rec.reg_attribute2,
2863                           p_information130     => l_reg_rec.reg_attribute20,
2864                           p_information131     => l_reg_rec.reg_attribute21,
2865                           p_information132     => l_reg_rec.reg_attribute22,
2866                           p_information133     => l_reg_rec.reg_attribute23,
2867                           p_information134     => l_reg_rec.reg_attribute24,
2868                           p_information135     => l_reg_rec.reg_attribute25,
2869                           p_information136     => l_reg_rec.reg_attribute26,
2870                           p_information137     => l_reg_rec.reg_attribute27,
2871                           p_information138     => l_reg_rec.reg_attribute28,
2872                           p_information139     => l_reg_rec.reg_attribute29,
2873                           p_information113     => l_reg_rec.reg_attribute3,
2874                           p_information140     => l_reg_rec.reg_attribute30,
2875                           p_information114     => l_reg_rec.reg_attribute4,
2876                           p_information115     => l_reg_rec.reg_attribute5,
2877                           p_information116     => l_reg_rec.reg_attribute6,
2878                           p_information117     => l_reg_rec.reg_attribute7,
2879                           p_information118     => l_reg_rec.reg_attribute8,
2880                           p_information119     => l_reg_rec.reg_attribute9,
2881                           p_information110     => l_reg_rec.reg_attribute_category,
2882                           p_information185     => l_reg_rec.sttry_citn_name,
2883                           p_information265     => l_reg_rec.object_version_number,
2884                           p_object_version_number          => l_object_version_number,
2885                           p_effective_date                 => p_effective_date       );
2886                           --
2887 
2888                           if l_out_reg1_result_id is null then
2889                             l_out_reg1_result_id := l_copy_entity_result_id;
2890                           end if;
2891 
2892                           if l_result_type_cd = 'DISPLAY' then
2893                              l_out_reg1_result_id := l_copy_entity_result_id ;
2894                           end if;
2895                           --
2896                        end loop;
2897                        --
2898                      end loop;
2899                   ---------------------------------------------------------------
2900                   -- END OF BEN_REGN_F ----------------------
2901                   ---------------------------------------------------------------
2902                  end loop;
2903               ---------------------------------------------------------------
2904               -- END OF BEN_PL_REGN_F ----------------------
2905               ---------------------------------------------------------------
2906                ---------------------------------------------------------------
2907                -- START OF BEN_PL_REGY_BOD_F ----------------------
2908                ---------------------------------------------------------------
2909                --
2910                for l_parent_rec  in c_prb_from_parent(l_RPTG_GRP_ID) loop
2911                   --
2912                   l_mirror_src_entity_result_id := l_out_bnr_result_id ;
2913                   --
2914                   l_pl_regy_bod_id := l_parent_rec.pl_regy_bod_id ;
2915                   --
2916                   for l_prb_rec in c_prb(l_parent_rec.pl_regy_bod_id,l_mirror_src_entity_result_id,'PRB') loop
2917                     --
2918                     l_table_route_id := null ;
2919                     open ben_plan_design_program_module.g_table_route('PRB');
2920                       fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
2921                     close ben_plan_design_program_module.g_table_route ;
2922                     --
2923                     l_information5  := l_prb_rec.regy_pl_name ;
2924                     --
2925                     if p_effective_date between l_prb_rec.effective_start_date
2926                        and l_prb_rec.effective_end_date then
2927                      --
2928                        l_result_type_cd := 'DISPLAY';
2929                     else
2930                        l_result_type_cd := 'NO DISPLAY';
2931                     end if;
2932                       --
2933                     l_copy_entity_result_id := null;
2934                     l_object_version_number := null;
2935                     ben_copy_entity_results_api.create_copy_entity_results(
2936                       p_copy_entity_result_id           => l_copy_entity_result_id,
2937                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
2938                       p_result_type_cd                 => l_result_type_cd,
2939                       p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
2940                       p_parent_entity_result_id      => l_mirror_src_entity_result_id,
2941                       p_number_of_copies               => l_number_of_copies,
2942                       p_table_alias					 => 'PRB',
2943                       p_table_route_id                 => l_table_route_id,
2944                       p_information1     => l_prb_rec.pl_regy_bod_id,
2945                       p_information2     => l_prb_rec.EFFECTIVE_START_DATE,
2946                       p_information3     => l_prb_rec.EFFECTIVE_END_DATE,
2947                       p_information4     => l_prb_rec.business_group_id,
2948                       p_information5     => l_information5 , -- 9999 put name for h-grid
2949                       p_information306     => l_prb_rec.aprvd_trmn_dt,
2950                       p_information252     => l_prb_rec.organization_id,
2951                       p_information261     => l_prb_rec.pl_id,
2952                       p_information111     => l_prb_rec.prb_attribute1,
2953                       p_information120     => l_prb_rec.prb_attribute10,
2954                       p_information121     => l_prb_rec.prb_attribute11,
2955                       p_information122     => l_prb_rec.prb_attribute12,
2956                       p_information123     => l_prb_rec.prb_attribute13,
2957                       p_information124     => l_prb_rec.prb_attribute14,
2958                       p_information125     => l_prb_rec.prb_attribute15,
2959                       p_information126     => l_prb_rec.prb_attribute16,
2960                       p_information127     => l_prb_rec.prb_attribute17,
2961                       p_information128     => l_prb_rec.prb_attribute18,
2962                       p_information129     => l_prb_rec.prb_attribute19,
2963                       p_information112     => l_prb_rec.prb_attribute2,
2964                       p_information130     => l_prb_rec.prb_attribute20,
2965                       p_information131     => l_prb_rec.prb_attribute21,
2966                       p_information132     => l_prb_rec.prb_attribute22,
2967                       p_information133     => l_prb_rec.prb_attribute23,
2968                       p_information134     => l_prb_rec.prb_attribute24,
2969                       p_information135     => l_prb_rec.prb_attribute25,
2970                       p_information136     => l_prb_rec.prb_attribute26,
2971                       p_information137     => l_prb_rec.prb_attribute27,
2972                       p_information138     => l_prb_rec.prb_attribute28,
2973                       p_information139     => l_prb_rec.prb_attribute29,
2974                       p_information113     => l_prb_rec.prb_attribute3,
2975                       p_information140     => l_prb_rec.prb_attribute30,
2976                       p_information114     => l_prb_rec.prb_attribute4,
2977                       p_information115     => l_prb_rec.prb_attribute5,
2978                       p_information116     => l_prb_rec.prb_attribute6,
2979                       p_information117     => l_prb_rec.prb_attribute7,
2980                       p_information118     => l_prb_rec.prb_attribute8,
2981                       p_information119     => l_prb_rec.prb_attribute9,
2982                       p_information110     => l_prb_rec.prb_attribute_category,
2983                       p_information309     => l_prb_rec.quald_dt,
2984                       p_information11      => l_prb_rec.quald_flag,
2985                       p_information185     => l_prb_rec.regy_pl_name,
2986                       p_information242     => l_prb_rec.rptg_grp_id,
2987                       p_information265     => l_prb_rec.object_version_number,
2988                       p_object_version_number          => l_object_version_number,
2989                       p_effective_date                 => p_effective_date       );
2990                       --
2991 
2992                       if l_out_prb_result_id is null then
2993                         l_out_prb_result_id := l_copy_entity_result_id;
2994                       end if;
2995 
2996                       if l_result_type_cd = 'DISPLAY' then
2997                          l_out_prb_result_id := l_copy_entity_result_id ;
2998                       end if;
2999                       --
3000                    end loop;
3001                    --
3002                    ---------------------------------------------------------------
3003                    -- START OF BEN_PL_REGY_PRP_F ----------------------
3004                    ---------------------------------------------------------------
3005                    --
3006                    for l_parent_rec  in c_prp_from_parent(l_PL_REGY_BOD_ID) loop
3007                       --
3008                       l_mirror_src_entity_result_id := l_out_prb_result_id ;
3009                       --
3010                       l_pl_regy_prps_id := l_parent_rec.pl_regy_prps_id ;
3011                       --
3012                       for l_prp_rec in c_prp(l_parent_rec.pl_regy_prps_id,l_mirror_src_entity_result_id,'PRP') loop
3013                         --
3014                         l_table_route_id := null ;
3015                         open ben_plan_design_program_module.g_table_route('PRP');
3016                           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3017                         close ben_plan_design_program_module.g_table_route ;
3018                         --
3019                         l_information5  := hr_general.decode_lookup('BEN_REGY_PRPS',l_prp_rec.pl_regy_prps_cd);
3020                         --
3021                         if p_effective_date between l_prp_rec.effective_start_date
3022                            and l_prp_rec.effective_end_date then
3023                          --
3024                            l_result_type_cd := 'DISPLAY';
3025                         else
3026                            l_result_type_cd := 'NO DISPLAY';
3027                         end if;
3028                           --
3029                         l_copy_entity_result_id := null;
3030                         l_object_version_number := null;
3031                         ben_copy_entity_results_api.create_copy_entity_results(
3032                           p_copy_entity_result_id           => l_copy_entity_result_id,
3033                           p_copy_entity_txn_id             => p_copy_entity_txn_id,
3034                           p_result_type_cd                 => l_result_type_cd,
3035                           p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
3036                           p_parent_entity_result_id      => l_mirror_src_entity_result_id,
3037                           p_number_of_copies               => l_number_of_copies,
3038                           p_table_alias					 => 'PRP',
3039                           p_table_route_id                 => l_table_route_id,
3040                           p_information1     => l_prp_rec.pl_regy_prps_id,
3041                           p_information2     => l_prp_rec.EFFECTIVE_START_DATE,
3042                           p_information3     => l_prp_rec.EFFECTIVE_END_DATE,
3043                           p_information4     => l_prp_rec.business_group_id,
3044                           p_information5     => l_information5 , -- 9999 put name for h-grid
3045                           p_information258     => l_prp_rec.pl_regy_bod_id,
3046                           p_information11     => l_prp_rec.pl_regy_prps_cd,
3047                           p_information257     => l_prp_rec.pl_regy_prps_id,
3048                           p_information111     => l_prp_rec.prp_attribute1,
3049                           p_information120     => l_prp_rec.prp_attribute10,
3050                           p_information121     => l_prp_rec.prp_attribute11,
3051                           p_information122     => l_prp_rec.prp_attribute12,
3052                           p_information123     => l_prp_rec.prp_attribute13,
3053                           p_information124     => l_prp_rec.prp_attribute14,
3054                           p_information125     => l_prp_rec.prp_attribute15,
3055                           p_information126     => l_prp_rec.prp_attribute16,
3056                           p_information127     => l_prp_rec.prp_attribute17,
3057                           p_information128     => l_prp_rec.prp_attribute18,
3058                           p_information129     => l_prp_rec.prp_attribute19,
3059                           p_information112     => l_prp_rec.prp_attribute2,
3060                           p_information130     => l_prp_rec.prp_attribute20,
3061                           p_information131     => l_prp_rec.prp_attribute21,
3062                           p_information132     => l_prp_rec.prp_attribute22,
3063                           p_information133     => l_prp_rec.prp_attribute23,
3064                           p_information134     => l_prp_rec.prp_attribute24,
3065                           p_information135     => l_prp_rec.prp_attribute25,
3066                           p_information136     => l_prp_rec.prp_attribute26,
3067                           p_information137     => l_prp_rec.prp_attribute27,
3068                           p_information138     => l_prp_rec.prp_attribute28,
3069                           p_information139     => l_prp_rec.prp_attribute29,
3070                           p_information113     => l_prp_rec.prp_attribute3,
3071                           p_information140     => l_prp_rec.prp_attribute30,
3072                           p_information114     => l_prp_rec.prp_attribute4,
3073                           p_information115     => l_prp_rec.prp_attribute5,
3074                           p_information116     => l_prp_rec.prp_attribute6,
3075                           p_information117     => l_prp_rec.prp_attribute7,
3076                           p_information118     => l_prp_rec.prp_attribute8,
3077                           p_information119     => l_prp_rec.prp_attribute9,
3078                           p_information110     => l_prp_rec.prp_attribute_category,
3079                           p_information265     => l_prp_rec.object_version_number,
3080                           p_object_version_number          => l_object_version_number,
3081                           p_effective_date                 => p_effective_date       );
3082                           --
3083 
3084                           if l_out_prp_result_id is null then
3085                             l_out_prp_result_id := l_copy_entity_result_id;
3086                           end if;
3087 
3088                           if l_result_type_cd = 'DISPLAY' then
3089                              l_out_prp_result_id := l_copy_entity_result_id ;
3090                           end if;
3091                           --
3092                        end loop;
3093                        --
3094                      end loop;
3095                   ---------------------------------------------------------------
3096                   -- END OF BEN_PL_REGY_PRP_F ----------------------
3097                   ---------------------------------------------------------------
3098                  end loop;
3099               ---------------------------------------------------------------
3100               -- END OF BEN_PL_REGY_BOD_F ----------------------
3101               ---------------------------------------------------------------
3102                ---------------------------------------------------------------
3103                -- START OF BEN_POPL_RPTG_GRP_F ----------------------
3104                ---------------------------------------------------------------
3105                --
3106                /* NOT REQUIRED HERE
3107 
3108                */
3109               ---------------------------------------------------------------
3110               -- END OF BEN_POPL_RPTG_GRP_F ----------------------
3111               ---------------------------------------------------------------
3112           --
3113           end loop;
3114        ---------------------------------------------------------------
3115        -- END OF BEN_RPTG_GRP ----------------------
3116        ---------------------------------------------------------------
3117        end loop;
3118        ---------------------------------------------------------------
3119        -- END OF BEN_PL_REGN_F ----------------------
3120        ---------------------------------------------------------------
3121        -- ------------------------------------------------------------------------
3122        -- BEN_PL_GD_SVC_F
3123        -- -------------------------------------------------------------------------
3124        --
3125        for l_parent_rec  in c_vgs_from_parent(L_PL_ID) loop
3126        --
3127          l_mirror_src_entity_result_id := l_out_pln_result_id;
3128          l_parent_entity_result_id := l_out_pln_cpp_result_id;
3129 
3130          l_pl_gd_or_svc_id           := l_parent_rec.pl_gd_or_svc_id ;
3131 
3132          --
3133          for l_vgs_rec in c_vgs(l_parent_rec.pl_gd_or_svc_id,l_mirror_src_entity_result_id,'VGS') loop
3134          --
3135            l_table_route_id := null ;
3136            open ben_plan_design_program_module.g_table_route('VGS');
3137            fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3138            close ben_plan_design_program_module.g_table_route ;
3139            --
3140            l_information5 := ben_plan_design_program_module.get_gd_or_svc_typ_name(l_vgs_rec.gd_or_svc_typ_id); --'Intersection'
3141            --
3142            if p_effective_date between l_vgs_rec.effective_start_date
3143                and l_vgs_rec.effective_end_date then
3144                --
3145                l_result_type_cd := 'DISPLAY';
3146            else
3147                l_result_type_cd := 'NO DISPLAY';
3148            end if;
3149            --
3150            l_copy_entity_result_id := null;
3151            l_object_version_number := null;
3152            ben_copy_entity_results_api.create_copy_entity_results(
3153                 p_copy_entity_result_id           => l_copy_entity_result_id,
3154                 p_copy_entity_txn_id             => p_copy_entity_txn_id,
3155                 p_result_type_cd                 => l_result_type_cd,
3156                 p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
3157                 p_parent_entity_result_id        => l_parent_entity_result_id,
3158                 p_number_of_copies               => l_number_of_copies,
3159                 p_table_alias					 => 'VGS',
3160                 p_table_route_id                 => l_table_route_id,
3161                 p_information1     => l_vgs_rec.pl_gd_or_svc_id,
3162                 p_information2     => l_vgs_rec.EFFECTIVE_START_DATE,
3163                 p_information3     => l_vgs_rec.EFFECTIVE_END_DATE,
3164                 p_information4     => l_vgs_rec.business_group_id,
3165                 p_information5     => l_information5 , -- 9999 put name for h-grid
3166                 p_information13     => l_vgs_rec.alw_rcrrg_clms_flag,
3167                 p_information262     => l_vgs_rec.gd_or_svc_typ_id,
3168                 p_information12     => l_vgs_rec.gd_or_svc_usg_cd,
3169                 p_information11     => l_vgs_rec.gd_svc_recd_basis_cd,
3170                 p_information306     => l_vgs_rec.gd_svc_recd_basis_dt,
3171                 p_information257     => l_vgs_rec.gd_svc_recd_basis_mo,
3172                 p_information261     => l_vgs_rec.pl_id,
3173                 p_information111     => l_vgs_rec.vgs_attribute1,
3174                 p_information120     => l_vgs_rec.vgs_attribute10,
3175                 p_information121     => l_vgs_rec.vgs_attribute11,
3176                 p_information122     => l_vgs_rec.vgs_attribute12,
3177                 p_information123     => l_vgs_rec.vgs_attribute13,
3178                 p_information124     => l_vgs_rec.vgs_attribute14,
3179                 p_information125     => l_vgs_rec.vgs_attribute15,
3180                 p_information126     => l_vgs_rec.vgs_attribute16,
3181                 p_information127     => l_vgs_rec.vgs_attribute17,
3182                 p_information128     => l_vgs_rec.vgs_attribute18,
3183                 p_information129     => l_vgs_rec.vgs_attribute19,
3184                 p_information112     => l_vgs_rec.vgs_attribute2,
3185                 p_information130     => l_vgs_rec.vgs_attribute20,
3186                 p_information131     => l_vgs_rec.vgs_attribute21,
3187                 p_information132     => l_vgs_rec.vgs_attribute22,
3188                 p_information133     => l_vgs_rec.vgs_attribute23,
3189                 p_information134     => l_vgs_rec.vgs_attribute24,
3190                 p_information135     => l_vgs_rec.vgs_attribute25,
3191                 p_information136     => l_vgs_rec.vgs_attribute26,
3192                 p_information137     => l_vgs_rec.vgs_attribute27,
3193                 p_information138     => l_vgs_rec.vgs_attribute28,
3194                 p_information139     => l_vgs_rec.vgs_attribute29,
3195                 p_information113     => l_vgs_rec.vgs_attribute3,
3196                 p_information140     => l_vgs_rec.vgs_attribute30,
3197                 p_information114     => l_vgs_rec.vgs_attribute4,
3198                 p_information115     => l_vgs_rec.vgs_attribute5,
3199                 p_information116     => l_vgs_rec.vgs_attribute6,
3200                 p_information117     => l_vgs_rec.vgs_attribute7,
3201                 p_information118     => l_vgs_rec.vgs_attribute8,
3202                 p_information119     => l_vgs_rec.vgs_attribute9,
3203                 p_information110     => l_vgs_rec.vgs_attribute_category,
3204                 p_information265     => l_vgs_rec.object_version_number,
3205                 p_object_version_number          => l_object_version_number,
3206                 p_effective_date                 => p_effective_date       );
3207          --
3208 
3209            if l_out_vgs_result_id is null then
3210              l_out_vgs_result_id := l_copy_entity_result_id;
3211            end if;
3212 
3213            if l_result_type_cd = 'DISPLAY' then
3214              l_out_vgs_result_id := l_copy_entity_result_id ;
3215            end if;
3216 
3217          end loop;
3218 
3219           ---------------------------------------------------------------
3220           -- START OF BEN_GD_OR_SVC_TYP ----------------------
3221           ---------------------------------------------------------------
3222            --
3223            for l_parent_rec  in c_gos_from_parent(l_PL_GD_OR_SVC_ID) loop
3224            --
3225              l_mirror_src_entity_result_id := l_out_vgs_result_id;
3226 
3227              l_gd_or_svc_typ_id :=  l_parent_rec.gd_or_svc_typ_id ;
3228 
3229              if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
3230                open c_object_exists(l_gd_or_svc_typ_id,'GOS');
3231                fetch c_object_exists into l_dummy;
3232                if c_object_exists%found then
3233                  close c_object_exists;
3234                  exit;
3235                end if;
3236                close c_object_exists;
3237              end if;
3238 
3239              --
3240              for l_gos_rec in c_gos(l_parent_rec.gd_or_svc_typ_id,l_mirror_src_entity_result_id,'GOS') loop
3241              --
3242                  l_table_route_id := null ;
3243                  open ben_plan_design_program_module.g_table_route('GOS');
3244                  fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3245                  close ben_plan_design_program_module.g_table_route ;
3246                  --
3247                  l_information5  := l_gos_rec.name; --'Intersection';
3248                  --
3249                  l_gd_or_svc_typ_id := l_gos_rec.gd_or_svc_typ_id ;
3250                  l_result_type_cd := 'DISPLAY';
3251                  --
3252                  l_copy_entity_result_id := null;
3253                  l_object_version_number := null;
3254                  ben_copy_entity_results_api.create_copy_entity_results(
3255                       p_copy_entity_result_id           => l_copy_entity_result_id,
3256                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
3257                       p_result_type_cd                 => l_result_type_cd,
3258                       p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
3259                       p_parent_entity_result_id        => l_mirror_src_entity_result_id,
3260                       p_number_of_copies               => l_number_of_copies,
3261                       p_table_alias					 => 'GOS',
3262                       p_table_route_id                 => l_table_route_id,
3263                       p_information1     => l_gos_rec.gd_or_svc_typ_id,
3264                       p_information2     => null,
3265                       p_information3     => null,
3266                       p_information4     => l_gos_rec.business_group_id,
3267                       p_information5     => l_information5 , -- 9999 put name for h-grid
3268                       p_information185     => l_gos_rec.description,
3269                       p_information111     => l_gos_rec.gos_attribute1,
3270                       p_information120     => l_gos_rec.gos_attribute10,
3271                       p_information121     => l_gos_rec.gos_attribute11,
3272                       p_information122     => l_gos_rec.gos_attribute12,
3273                       p_information123     => l_gos_rec.gos_attribute13,
3274                       p_information124     => l_gos_rec.gos_attribute14,
3275                       p_information125     => l_gos_rec.gos_attribute15,
3276                       p_information126     => l_gos_rec.gos_attribute16,
3277                       p_information127     => l_gos_rec.gos_attribute17,
3278                       p_information128     => l_gos_rec.gos_attribute18,
3279                       p_information129     => l_gos_rec.gos_attribute19,
3280                       p_information112     => l_gos_rec.gos_attribute2,
3281                       p_information130     => l_gos_rec.gos_attribute20,
3282                       p_information131     => l_gos_rec.gos_attribute21,
3283                       p_information132     => l_gos_rec.gos_attribute22,
3284                       p_information133     => l_gos_rec.gos_attribute23,
3285                       p_information134     => l_gos_rec.gos_attribute24,
3286                       p_information135     => l_gos_rec.gos_attribute25,
3287                       p_information136     => l_gos_rec.gos_attribute26,
3288                       p_information137     => l_gos_rec.gos_attribute27,
3289                       p_information138     => l_gos_rec.gos_attribute28,
3290                       p_information139     => l_gos_rec.gos_attribute29,
3291                       p_information113     => l_gos_rec.gos_attribute3,
3292                       p_information140     => l_gos_rec.gos_attribute30,
3293                       p_information114     => l_gos_rec.gos_attribute4,
3294                       p_information115     => l_gos_rec.gos_attribute5,
3295                       p_information116     => l_gos_rec.gos_attribute6,
3296                       p_information117     => l_gos_rec.gos_attribute7,
3297                       p_information118     => l_gos_rec.gos_attribute8,
3298                       p_information119     => l_gos_rec.gos_attribute9,
3299                       p_information110     => l_gos_rec.gos_attribute_category,
3300                       p_information170     => l_gos_rec.name,
3301                       p_information11     => l_gos_rec.typ_cd,
3302                       p_information265    => l_gos_rec.object_version_number,
3303                       p_object_version_number          => l_object_version_number,
3304                       p_effective_date                 => p_effective_date       );
3305                --
3306 
3307                  if l_out_gos_result_id is null then
3308                    l_out_gos_result_id := l_copy_entity_result_id;
3309                  end if;
3310 
3311                  if l_result_type_cd = 'DISPLAY' then
3312                    l_out_gos_result_id := l_copy_entity_result_id ;
3313                  end if;
3314 
3315                end loop;
3316              --
3317              end loop;
3318           ---------------------------------------------------------------
3319           -- END OF BEN_GD_OR_SVC_TYP ----------------------
3320           ---------------------------------------------------------------
3321           ---------------------------------------------------------------
3322           -- START OF BEN_PL_GD_R_SVC_CTFN_F ----------------------
3323           ---------------------------------------------------------------
3324            --
3325            for l_parent_rec  in c_pct_from_parent(l_PL_GD_OR_SVC_ID) loop
3326            --
3327              l_mirror_src_entity_result_id := l_out_vgs_result_id;
3328 
3329              l_pl_gd_r_svc_ctfn_id := l_parent_rec.pl_gd_r_svc_ctfn_id ;
3330              --
3331              for l_pct_rec in c_pct(l_parent_rec.pl_gd_r_svc_ctfn_id,l_mirror_src_entity_result_id,'PCT') loop
3332              --
3333                  l_table_route_id := null ;
3334                  open ben_plan_design_program_module.g_table_route('PCT');
3335                  fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3336                  close ben_plan_design_program_module.g_table_route ;
3337                  --
3338                  l_information5 := hr_general.decode_lookup('BEN_REIMBMT_CTFN_TYP',l_pct_rec.rmbmt_ctfn_typ_cd); --'Intersection
3339                  --
3340                  l_pl_gd_r_svc_ctfn_id := l_pct_rec.pl_gd_r_svc_ctfn_id ;
3341                  if p_effective_date between l_pct_rec.effective_start_date
3342                      and l_pct_rec.effective_end_date then
3343                      --
3344                      l_result_type_cd := 'DISPLAY';
3345                  else
3346                      l_result_type_cd := 'NO DISPLAY';
3347                  end if;
3348                  --
3349                  l_copy_entity_result_id := null;
3350                  l_object_version_number := null;
3351                  ben_copy_entity_results_api.create_copy_entity_results(
3352                       p_copy_entity_result_id           => l_copy_entity_result_id,
3353                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
3354                       p_result_type_cd                 => l_result_type_cd,
3355                       p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
3356                       p_parent_entity_result_id        => l_mirror_src_entity_result_id,
3357                       p_number_of_copies               => l_number_of_copies,
3358                       p_table_alias					 => 'PCT',
3359                       p_table_route_id                 => l_table_route_id,
3360                       p_information1     => l_pct_rec.pl_gd_r_svc_ctfn_id,
3361                       p_information2     => l_pct_rec.EFFECTIVE_START_DATE,
3362                       p_information3     => l_pct_rec.EFFECTIVE_END_DATE,
3363                       p_information4     => l_pct_rec.business_group_id,
3364                       p_information5     => l_information5 , -- 9999 put name for h-grid
3365                       p_information257     => l_pct_rec.ctfn_rqd_when_rl,
3366                       p_information14     => l_pct_rec.lack_ctfn_deny_rmbmt_flag,
3367                       p_information259     => l_pct_rec.lack_ctfn_deny_rmbmt_rl,
3368                       p_information111     => l_pct_rec.pct_attribute1,
3369                       p_information120     => l_pct_rec.pct_attribute10,
3370                       p_information121     => l_pct_rec.pct_attribute11,
3371                       p_information122     => l_pct_rec.pct_attribute12,
3372                       p_information123     => l_pct_rec.pct_attribute13,
3373                       p_information124     => l_pct_rec.pct_attribute14,
3374                       p_information125     => l_pct_rec.pct_attribute15,
3375                       p_information126     => l_pct_rec.pct_attribute16,
3376                       p_information127     => l_pct_rec.pct_attribute17,
3377                       p_information128     => l_pct_rec.pct_attribute18,
3378                       p_information129     => l_pct_rec.pct_attribute19,
3379                       p_information112     => l_pct_rec.pct_attribute2,
3380                       p_information130     => l_pct_rec.pct_attribute20,
3381                       p_information131     => l_pct_rec.pct_attribute21,
3382                       p_information132     => l_pct_rec.pct_attribute22,
3383                       p_information133     => l_pct_rec.pct_attribute23,
3384                       p_information134     => l_pct_rec.pct_attribute24,
3385                       p_information135     => l_pct_rec.pct_attribute25,
3386                       p_information136     => l_pct_rec.pct_attribute26,
3387                       p_information137     => l_pct_rec.pct_attribute27,
3388                       p_information138     => l_pct_rec.pct_attribute28,
3389                       p_information139     => l_pct_rec.pct_attribute29,
3390                       p_information113     => l_pct_rec.pct_attribute3,
3391                       p_information140     => l_pct_rec.pct_attribute30,
3392                       p_information114     => l_pct_rec.pct_attribute4,
3393                       p_information115     => l_pct_rec.pct_attribute5,
3394                       p_information116     => l_pct_rec.pct_attribute6,
3395                       p_information117     => l_pct_rec.pct_attribute7,
3396                       p_information118     => l_pct_rec.pct_attribute8,
3397                       p_information119     => l_pct_rec.pct_attribute9,
3398                       p_information110     => l_pct_rec.pct_attribute_category,
3399                       p_information13     => l_pct_rec.pfd_flag,
3400                       p_information258     => l_pct_rec.pl_gd_or_svc_id,
3401                       p_information12     => l_pct_rec.rmbmt_ctfn_typ_cd,
3402                       p_information11     => l_pct_rec.rqd_flag,
3403                       p_information265    => l_pct_rec.object_version_number,
3404                       p_object_version_number          => l_object_version_number,
3405                       p_effective_date                 => p_effective_date       );
3406                    --
3407 
3408                    if l_out_pct_result_id is null then
3409                      l_out_pct_result_id := l_copy_entity_result_id;
3410                    end if;
3411 
3412                    if l_result_type_cd = 'DISPLAY' then
3413                      l_out_pct_result_id := l_copy_entity_result_id ;
3414                    end if;
3415 
3416                       if (l_pct_rec.ctfn_rqd_when_rl is not null) then
3417 						   ben_plan_design_program_module.create_formula_result(
3418 								p_validate                       => p_validate
3419 								,p_copy_entity_result_id  => l_copy_entity_result_id
3420 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
3421 								,p_formula_id                  => l_pct_rec.ctfn_rqd_when_rl
3422 								,p_business_group_id        => l_pct_rec.business_group_id
3423 								,p_number_of_copies         =>  l_number_of_copies
3424 								,p_object_version_number  => l_object_version_number
3425 								,p_effective_date             => p_effective_date);
3426 						end if;
3427 
3428                       if (l_pct_rec.lack_ctfn_deny_rmbmt_rl is not null) then
3429 						   ben_plan_design_program_module.create_formula_result(
3430 								p_validate                       => p_validate
3431 								,p_copy_entity_result_id  => l_copy_entity_result_id
3432 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
3433 								,p_formula_id                  => l_pct_rec.lack_ctfn_deny_rmbmt_rl
3434 								,p_business_group_id        => l_pct_rec.business_group_id
3435 								,p_number_of_copies         =>  l_number_of_copies
3436 								,p_object_version_number  => l_object_version_number
3437 								,p_effective_date             => p_effective_date);
3438 						end if;
3439 
3440 				 --
3441                end loop;
3442              --
3443              end loop;
3444        ---------------------------------------------------------------
3445        -- END OF BEN_PL_GD_R_SVC_CTFN_F ----------------------
3446        ---------------------------------------------------------------
3447        end loop;
3448 
3449 	 ---------------------------------------------------------------
3450 	 -- START OF BEN_VALD_RLSHP_FOR_REIMB_F ----------------------
3451 	 ---------------------------------------------------------------
3452 	 --
3453 	 for l_parent_rec  in c_vrp_from_parent(l_PL_ID) loop
3454 	 --
3455            l_mirror_src_entity_result_id := l_out_pln_result_id;
3456            l_parent_entity_result_id := l_out_pln_cpp_result_id;
3457 
3458            l_vald_rlshp_for_reimb_id := l_parent_rec.vald_rlshp_for_reimb_id ;
3459 	     --
3460 	     for l_vrp_rec in c_vrp(l_parent_rec.vald_rlshp_for_reimb_id,l_mirror_src_entity_result_id,'VRP') loop
3461 	     --
3462              l_table_route_id := null ;
3463              open ben_plan_design_program_module.g_table_route('VRP');
3464              fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3465              close ben_plan_design_program_module.g_table_route ;
3466              --
3467              l_information5 := hr_general.decode_lookup('CONTACT',l_vrp_rec.rlshp_typ_cd); --'Intersection
3468              --
3469 	       if p_effective_date between l_vrp_rec.effective_start_date
3470 	           and l_vrp_rec.effective_end_date then
3471 	           --
3472 	           l_result_type_cd := 'DISPLAY';
3473 	       else
3474 	           l_result_type_cd := 'NO DISPLAY';
3475 	       end if;
3476 	       --
3477 	       l_copy_entity_result_id := null;
3478 	       l_object_version_number := null;
3479 	       ben_copy_entity_results_api.create_copy_entity_results(
3480 	            p_copy_entity_result_id           => l_copy_entity_result_id,
3481 	            p_copy_entity_txn_id             => p_copy_entity_txn_id,
3482 	            p_result_type_cd                 => l_result_type_cd,
3483                   p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
3484                   p_parent_entity_result_id        => l_parent_entity_result_id,
3485 	            p_number_of_copies               => l_number_of_copies,
3486 	            p_table_alias					 => 'VRP',
3487                   p_table_route_id                 => l_table_route_id,
3488 	            p_information1     => l_vrp_rec.vald_rlshp_for_reimb_id,
3489 	            p_information2     => l_vrp_rec.EFFECTIVE_START_DATE,
3490 	            p_information3     => l_vrp_rec.EFFECTIVE_END_DATE,
3491 	            p_information4     => l_vrp_rec.business_group_id,
3492 	            p_information5     => l_information5 , -- 9999 put name for h-grid
3493 	            p_information261     => l_vrp_rec.pl_id,
3494 	            p_information11     => l_vrp_rec.rlshp_typ_cd,
3495 	            p_information111     => l_vrp_rec.vrp_attribute1,
3496 	            p_information120     => l_vrp_rec.vrp_attribute10,
3497 	            p_information121     => l_vrp_rec.vrp_attribute11,
3498 	            p_information122     => l_vrp_rec.vrp_attribute12,
3499 	            p_information123     => l_vrp_rec.vrp_attribute13,
3500 	            p_information124     => l_vrp_rec.vrp_attribute14,
3501 	            p_information125     => l_vrp_rec.vrp_attribute15,
3502 	            p_information126     => l_vrp_rec.vrp_attribute16,
3503 	            p_information127     => l_vrp_rec.vrp_attribute17,
3504 	            p_information128     => l_vrp_rec.vrp_attribute18,
3505 	            p_information129     => l_vrp_rec.vrp_attribute19,
3506 	            p_information112     => l_vrp_rec.vrp_attribute2,
3507 	            p_information130     => l_vrp_rec.vrp_attribute20,
3508 	            p_information131     => l_vrp_rec.vrp_attribute21,
3509 	            p_information132     => l_vrp_rec.vrp_attribute22,
3510 	            p_information133     => l_vrp_rec.vrp_attribute23,
3511 	            p_information134     => l_vrp_rec.vrp_attribute24,
3512 	            p_information135     => l_vrp_rec.vrp_attribute25,
3513 	            p_information136     => l_vrp_rec.vrp_attribute26,
3514 	            p_information137     => l_vrp_rec.vrp_attribute27,
3515 	            p_information138     => l_vrp_rec.vrp_attribute28,
3516 	            p_information139     => l_vrp_rec.vrp_attribute29,
3517 	            p_information113     => l_vrp_rec.vrp_attribute3,
3518 	            p_information140     => l_vrp_rec.vrp_attribute30,
3519 	            p_information114     => l_vrp_rec.vrp_attribute4,
3520 	            p_information115     => l_vrp_rec.vrp_attribute5,
3521 	            p_information116     => l_vrp_rec.vrp_attribute6,
3522 	            p_information117     => l_vrp_rec.vrp_attribute7,
3523 	            p_information118     => l_vrp_rec.vrp_attribute8,
3524 	            p_information119     => l_vrp_rec.vrp_attribute9,
3525 	            p_information110     => l_vrp_rec.vrp_attribute_category,
3526                     p_information265     => l_vrp_rec.object_version_number,
3527 	            p_object_version_number          => l_object_version_number,
3528 	            p_effective_date                 => p_effective_date       );
3529 	     --
3530 
3531                   if l_out_vrp_result_id is null then
3532                    l_out_vrp_result_id := l_copy_entity_result_id;
3533                  end if;
3534 
3535                  if l_result_type_cd = 'DISPLAY' then
3536                    l_out_vrp_result_id := l_copy_entity_result_id ;
3537                  end if;
3538 	     end loop;
3539 	   --
3540 	   end loop;
3541 	---------------------------------------------------------------
3542 	-- END OF BEN_VALD_RLSHP_FOR_REIMB_F ----------------------
3543 	---------------------------------------------------------------
3544 
3545 	---------------------------------------------------------------
3546 	-- START OF BEN_WV_PRTN_RSN_PL_F ----------------------
3547 	---------------------------------------------------------------
3548 	   --
3549 	   --
3550 	   for l_parent_rec  in c_wpn_from_parent(l_PL_ID) loop
3551 	   --
3552            l_mirror_src_entity_result_id := l_out_pln_result_id;
3553            l_parent_entity_result_id := l_out_pln_cpp_result_id;
3554 
3555            l_wv_prtn_rsn_pl_id := l_parent_rec.wv_prtn_rsn_pl_id ;
3556 	     --
3557 	     for l_wpn_rec in c_wpn(l_parent_rec.wv_prtn_rsn_pl_id,l_mirror_src_entity_result_id,'WPN') loop
3558 	     --
3559               l_table_route_id := null ;
3560               open ben_plan_design_program_module.g_table_route('WPN');
3561         	  fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3562               close ben_plan_design_program_module.g_table_route ;
3563               --
3564               l_information5 := hr_general.decode_lookup('BEN_WV_PRTN_RSN',l_wpn_rec.wv_prtn_rsn_cd); --'Intersection';
3565               --
3566               l_wv_prtn_rsn_pl_id := l_wpn_rec.wv_prtn_rsn_pl_id ;
3567               --
3568               if p_effective_date between l_wpn_rec.effective_start_date
3569     	           and l_wpn_rec.effective_end_date then
3570 	           --
3571 	           l_result_type_cd := 'DISPLAY';
3572 	       else
3573 	           l_result_type_cd := 'NO DISPLAY';
3574 	       end if;
3575 	       --
3576 	       l_copy_entity_result_id := null;
3577 	       l_object_version_number := null;
3578 	       ben_copy_entity_results_api.create_copy_entity_results(
3579 	            p_copy_entity_result_id           => l_copy_entity_result_id,
3580 	            p_copy_entity_txn_id             => p_copy_entity_txn_id,
3581 	            p_result_type_cd                 => l_result_type_cd,
3582 		      p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
3583                   p_parent_entity_result_id        => l_parent_entity_result_id,
3584 	            p_number_of_copies               => l_number_of_copies,
3585 	            p_table_alias					 => 'WPN',
3586                   p_table_route_id                 => l_table_route_id,
3587 	            p_information1     => l_wpn_rec.wv_prtn_rsn_pl_id,
3588 	            p_information2     => l_wpn_rec.EFFECTIVE_START_DATE,
3589 	            p_information3     => l_wpn_rec.EFFECTIVE_END_DATE,
3590 	            p_information4     => l_wpn_rec.business_group_id,
3591 	            p_information5     => l_information5 , -- 9999 put name for h-grid
3592 	            p_information11     => l_wpn_rec.dflt_flag,
3593 	            p_information261     => l_wpn_rec.pl_id,
3594 	            p_information111     => l_wpn_rec.wpn_attribute1,
3595 	            p_information120     => l_wpn_rec.wpn_attribute10,
3596 	            p_information121     => l_wpn_rec.wpn_attribute11,
3597 	            p_information122     => l_wpn_rec.wpn_attribute12,
3598 	            p_information123     => l_wpn_rec.wpn_attribute13,
3599 	            p_information124     => l_wpn_rec.wpn_attribute14,
3600 	            p_information125     => l_wpn_rec.wpn_attribute15,
3601 	            p_information126     => l_wpn_rec.wpn_attribute16,
3602 	            p_information127     => l_wpn_rec.wpn_attribute17,
3603 	            p_information128     => l_wpn_rec.wpn_attribute18,
3604 	            p_information129     => l_wpn_rec.wpn_attribute19,
3605 	            p_information112     => l_wpn_rec.wpn_attribute2,
3606 	            p_information130     => l_wpn_rec.wpn_attribute20,
3607 	            p_information131     => l_wpn_rec.wpn_attribute21,
3608 	            p_information132     => l_wpn_rec.wpn_attribute22,
3609 	            p_information133     => l_wpn_rec.wpn_attribute23,
3610 	            p_information134     => l_wpn_rec.wpn_attribute24,
3611 	            p_information135     => l_wpn_rec.wpn_attribute25,
3612 	            p_information136     => l_wpn_rec.wpn_attribute26,
3613 	            p_information137     => l_wpn_rec.wpn_attribute27,
3614 	            p_information138     => l_wpn_rec.wpn_attribute28,
3615 	            p_information139     => l_wpn_rec.wpn_attribute29,
3616 	            p_information113     => l_wpn_rec.wpn_attribute3,
3617 	            p_information140     => l_wpn_rec.wpn_attribute30,
3618 	            p_information114     => l_wpn_rec.wpn_attribute4,
3619 	            p_information115     => l_wpn_rec.wpn_attribute5,
3620 	            p_information116     => l_wpn_rec.wpn_attribute6,
3621 	            p_information117     => l_wpn_rec.wpn_attribute7,
3622 	            p_information118     => l_wpn_rec.wpn_attribute8,
3623 	            p_information119     => l_wpn_rec.wpn_attribute9,
3624 	            p_information110     => l_wpn_rec.wpn_attribute_category,
3625 	            p_information12     => l_wpn_rec.wv_prtn_rsn_cd,
3626                     p_information265    => l_wpn_rec.object_version_number,
3627 	            p_object_version_number          => l_object_version_number,
3628 	            p_effective_date                 => p_effective_date       );
3629 	    --
3630 
3631                   if l_out_wpn_result_id is null then
3632                    l_out_wpn_result_id := l_copy_entity_result_id;
3633                  end if;
3634 
3635                  if l_result_type_cd = 'DISPLAY' then
3636                    l_out_wpn_result_id := l_copy_entity_result_id ;
3637                  end if;
3638 
3639 	    end loop;
3640 	    --
3641          ---------------------------------------------------------------
3642          -- START OF BEN_WV_PRTN_RSN_CTFN_PL_F ----------------------
3643          ---------------------------------------------------------------
3644           --
3645           for l_parent_rec  in c_wcn_from_parent(l_WV_PRTN_RSN_PL_ID) loop
3646           --
3647             l_mirror_src_entity_result_id := l_out_wpn_result_id ;
3648 
3649             l_wv_prtn_rsn_ctfn_pl_id := l_parent_rec.wv_prtn_rsn_ctfn_pl_id ;
3650             --
3651             for l_wcn_rec in c_wcn(l_parent_rec.wv_prtn_rsn_ctfn_pl_id,l_mirror_src_entity_result_id,'WCN') loop
3652             --
3653                 l_table_route_id := null ;
3654                 open ben_plan_design_program_module.g_table_route('WCN');
3655                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3656                 close ben_plan_design_program_module.g_table_route ;
3657                 --
3658                 l_information5  := hr_general.decode_lookup('BEN_WV_PRTN_CTFN_TYP',l_wcn_rec.wv_prtn_ctfn_typ_cd); --'Intersection';
3659                 --
3660                 l_wv_prtn_rsn_ctfn_pl_id := l_wcn_rec.wv_prtn_rsn_ctfn_pl_id ;
3661                 if p_effective_date between l_wcn_rec.effective_start_date
3662                     and l_wcn_rec.effective_end_date then
3663                     --
3664                     l_result_type_cd := 'DISPLAY';
3665                 else
3666                     l_result_type_cd := 'NO DISPLAY';
3667                 end if;
3668                 --
3669                 l_copy_entity_result_id := null;
3670                 l_object_version_number := null;
3671                 ben_copy_entity_results_api.create_copy_entity_results(
3672                      p_copy_entity_result_id           => l_copy_entity_result_id,
3673                      p_copy_entity_txn_id             => p_copy_entity_txn_id,
3674                      p_result_type_cd                 => l_result_type_cd,
3675                      p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
3676                      p_parent_entity_result_id        => l_mirror_src_entity_result_id,
3677                      p_number_of_copies               => l_number_of_copies,
3678                      p_table_alias					 => 'WCN',
3679                      p_table_route_id                 => l_table_route_id,
3680                      p_information1     => l_wcn_rec.wv_prtn_rsn_ctfn_pl_id,
3681                      p_information2     => l_wcn_rec.EFFECTIVE_START_DATE,
3682                      p_information3     => l_wcn_rec.EFFECTIVE_END_DATE,
3683                      p_information4     => l_wcn_rec.business_group_id,
3684                      p_information5     => l_information5 , -- 9999 put name for h-grid
3685                      p_information261     => l_wcn_rec.ctfn_rqd_when_rl,
3686                      p_information12     => l_wcn_rec.lack_ctfn_sspnd_wvr_flag,
3687                      p_information11     => l_wcn_rec.pfd_flag,
3688                      p_information13     => l_wcn_rec.rqd_flag,
3689                      p_information111     => l_wcn_rec.wcn_attribute1,
3690                      p_information120     => l_wcn_rec.wcn_attribute10,
3691                      p_information121     => l_wcn_rec.wcn_attribute11,
3692                      p_information122     => l_wcn_rec.wcn_attribute12,
3693                      p_information123     => l_wcn_rec.wcn_attribute13,
3694                      p_information124     => l_wcn_rec.wcn_attribute14,
3695                      p_information125     => l_wcn_rec.wcn_attribute15,
3696                      p_information126     => l_wcn_rec.wcn_attribute16,
3697                      p_information127     => l_wcn_rec.wcn_attribute17,
3698                      p_information128     => l_wcn_rec.wcn_attribute18,
3699                      p_information129     => l_wcn_rec.wcn_attribute19,
3700                      p_information112     => l_wcn_rec.wcn_attribute2,
3701                      p_information130     => l_wcn_rec.wcn_attribute20,
3702                      p_information131     => l_wcn_rec.wcn_attribute21,
3703                      p_information132     => l_wcn_rec.wcn_attribute22,
3704                      p_information133     => l_wcn_rec.wcn_attribute23,
3705                      p_information134     => l_wcn_rec.wcn_attribute24,
3706                      p_information135     => l_wcn_rec.wcn_attribute25,
3707                      p_information136     => l_wcn_rec.wcn_attribute26,
3708                      p_information137     => l_wcn_rec.wcn_attribute27,
3709                      p_information138     => l_wcn_rec.wcn_attribute28,
3710                      p_information139     => l_wcn_rec.wcn_attribute29,
3711                      p_information113     => l_wcn_rec.wcn_attribute3,
3712                      p_information140     => l_wcn_rec.wcn_attribute30,
3713                      p_information114     => l_wcn_rec.wcn_attribute4,
3714                      p_information115     => l_wcn_rec.wcn_attribute5,
3715                      p_information116     => l_wcn_rec.wcn_attribute6,
3716                      p_information117     => l_wcn_rec.wcn_attribute7,
3717                      p_information118     => l_wcn_rec.wcn_attribute8,
3718                      p_information119     => l_wcn_rec.wcn_attribute9,
3719                      p_information110     => l_wcn_rec.wcn_attribute_category,
3720                      p_information14     => l_wcn_rec.wv_prtn_ctfn_typ_cd,
3721                      p_information257     => l_wcn_rec.wv_prtn_rsn_pl_id,
3722                      p_information265    => l_wcn_rec.object_version_number,
3723                      p_object_version_number          => l_object_version_number,
3724                      p_effective_date                 => p_effective_date       );
3725               --
3726 
3727                      if l_out_wcn_result_id is null then
3728                        l_out_wcn_result_id := l_copy_entity_result_id;
3729                      end if;
3730 
3731                      if l_result_type_cd = 'DISPLAY' then
3732                        l_out_wcn_result_id := l_copy_entity_result_id ;
3733                      end if;
3734 
3735 					  if (l_wcn_rec.ctfn_rqd_when_rl is not null) then
3736 						   ben_plan_design_program_module.create_formula_result(
3737 								p_validate                       => p_validate
3738 								,p_copy_entity_result_id  => l_copy_entity_result_id
3739 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
3740 								,p_formula_id                  => l_wcn_rec.ctfn_rqd_when_rl
3741 								,p_business_group_id        => l_wcn_rec.business_group_id
3742 								,p_number_of_copies         =>  l_number_of_copies
3743 								,p_object_version_number  => l_object_version_number
3744 								,p_effective_date             => p_effective_date);
3745 						end if;
3746 
3747               --
3748               end loop;
3749             --
3750             end loop;
3751          ---------------------------------------------------------------
3752          -- END OF BEN_WV_PRTN_RSN_CTFN_PL_F ----------------------
3753          ---------------------------------------------------------------
3754 	   end loop;
3755 	---------------------------------------------------------------
3756 	-- END OF BEN_WV_PRTN_RSN_PL_F ----------------------
3757 	---------------------------------------------------------------
3758 
3759      ---------------------------------------------------------------
3760      -- START OF BEN_BNFT_RSTRN_CTFN_F ----------------------
3761      ---------------------------------------------------------------
3762       --
3763       --
3764       for l_parent_rec  in c_brc_from_parent(l_PL_ID) loop
3765       --
3766         l_mirror_src_entity_result_id := l_out_pln_result_id;
3767         l_parent_entity_result_id := l_out_pln_cpp_result_id;
3768 
3769         l_bnft_rstrn_ctfn_id := l_parent_rec.bnft_rstrn_ctfn_id ;
3770         --
3771         for l_brc_rec in c_brc(l_parent_rec.bnft_rstrn_ctfn_id,l_mirror_src_entity_result_id,'BRC') loop
3772         --
3773             l_table_route_id := null ;
3774             open ben_plan_design_program_module.g_table_route('BRC');
3775             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3776             close ben_plan_design_program_module.g_table_route ;
3777             --
3778             l_information5 := hr_general.decode_lookup('BEN_ENRT_CTFN_TYP',l_brc_rec.enrt_ctfn_typ_cd); --'Intersection';
3779             --
3780             if p_effective_date between l_brc_rec.effective_start_date
3781                 and l_brc_rec.effective_end_date then
3782                 --
3783                 l_result_type_cd := 'DISPLAY';
3784             else
3785                 l_result_type_cd := 'NO DISPLAY';
3786             end if;
3787             --
3788             l_copy_entity_result_id := null;
3789             l_object_version_number := null;
3790             ben_copy_entity_results_api.create_copy_entity_results(
3791                  p_copy_entity_result_id           => l_copy_entity_result_id,
3792                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
3793                  p_result_type_cd                 => l_result_type_cd,
3794 		     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
3795                  p_parent_entity_result_id        => l_parent_entity_result_id,
3796                  p_number_of_copies               => l_number_of_copies,
3797                  p_table_alias					 => 'BRC',
3798                  p_table_route_id                 => l_table_route_id,
3799                  p_information1     => l_brc_rec.bnft_rstrn_ctfn_id,
3800                  p_information2     => l_brc_rec.EFFECTIVE_START_DATE,
3801                  p_information3     => l_brc_rec.EFFECTIVE_END_DATE,
3802                  p_information4     => l_brc_rec.business_group_id,
3803                  p_information5     => l_information5 , -- 9999 put name for h-grid
3804                  p_information111     => l_brc_rec.brc_attribute1,
3805                  p_information120     => l_brc_rec.brc_attribute10,
3806                  p_information121     => l_brc_rec.brc_attribute11,
3807                  p_information122     => l_brc_rec.brc_attribute12,
3808                  p_information123     => l_brc_rec.brc_attribute13,
3809                  p_information124     => l_brc_rec.brc_attribute14,
3810                  p_information125     => l_brc_rec.brc_attribute15,
3811                  p_information126     => l_brc_rec.brc_attribute16,
3812                  p_information127     => l_brc_rec.brc_attribute17,
3813                  p_information128     => l_brc_rec.brc_attribute18,
3814                  p_information129     => l_brc_rec.brc_attribute19,
3815                  p_information112     => l_brc_rec.brc_attribute2,
3816                  p_information130     => l_brc_rec.brc_attribute20,
3817                  p_information131     => l_brc_rec.brc_attribute21,
3818                  p_information132     => l_brc_rec.brc_attribute22,
3819                  p_information133     => l_brc_rec.brc_attribute23,
3820                  p_information134     => l_brc_rec.brc_attribute24,
3821                  p_information135     => l_brc_rec.brc_attribute25,
3822                  p_information136     => l_brc_rec.brc_attribute26,
3823                  p_information137     => l_brc_rec.brc_attribute27,
3824                  p_information138     => l_brc_rec.brc_attribute28,
3825                  p_information139     => l_brc_rec.brc_attribute29,
3826                  p_information113     => l_brc_rec.brc_attribute3,
3827                  p_information140     => l_brc_rec.brc_attribute30,
3828                  p_information114     => l_brc_rec.brc_attribute4,
3829                  p_information115     => l_brc_rec.brc_attribute5,
3830                  p_information116     => l_brc_rec.brc_attribute6,
3831                  p_information117     => l_brc_rec.brc_attribute7,
3832                  p_information118     => l_brc_rec.brc_attribute8,
3833                  p_information119     => l_brc_rec.brc_attribute9,
3834                  p_information110     => l_brc_rec.brc_attribute_category,
3835                  p_information257     => l_brc_rec.ctfn_rqd_when_rl,
3836                  p_information12     => l_brc_rec.enrt_ctfn_typ_cd,
3837                  p_information261     => l_brc_rec.pl_id,
3838                  p_information11     => l_brc_rec.rqd_flag,
3839                  p_information265     => l_brc_rec.object_version_number,
3840                  p_object_version_number          => l_object_version_number,
3841                  p_effective_date                 => p_effective_date       );
3842           --
3843 
3844                  if l_out_brc_result_id is null then
3845                    l_out_brc_result_id := l_copy_entity_result_id;
3846                  end if;
3847 
3848                  if l_result_type_cd = 'DISPLAY' then
3849                    l_out_brc_result_id := l_copy_entity_result_id ;
3850                  end if;
3851 
3852      			 if (l_brc_rec.ctfn_rqd_when_rl is not null) then
3853 	 			   ben_plan_design_program_module.create_formula_result(
3854 	 					p_validate                       => p_validate
3855 	 					,p_copy_entity_result_id  => l_copy_entity_result_id
3856 	 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
3857 	 					,p_formula_id                  => l_brc_rec.ctfn_rqd_when_rl
3858 	 					,p_business_group_id        => l_brc_rec.business_group_id
3859 	 					,p_number_of_copies         =>  l_number_of_copies
3860 	 					,p_object_version_number  => l_object_version_number
3861 	 					,p_effective_date             => p_effective_date);
3862 	 			end if;
3863 	 		--
3864      	    end loop;
3865           --
3866 
3867       end loop;
3868      ---------------------------------------------------------------
3869      -- END OF BEN_BNFT_RSTRN_CTFN_F ----------------------
3870      ---------------------------------------------------------------
3871 
3872      ---------------------------------------------------------------
3873      -- START OF BEN_LER_BNFT_RSTRN_F ----------------------
3874      ---------------------------------------------------------------
3875       --
3876       --
3877       for l_parent_rec  in c_lbr_from_parent(l_PL_ID) loop
3878       --
3879         l_mirror_src_entity_result_id := l_out_pln_result_id;
3880         l_parent_entity_result_id := l_out_pln_cpp_result_id;
3881 
3882         l_ler_bnft_rstrn_id := l_parent_rec.ler_bnft_rstrn_id ;
3883         --
3884         for l_lbr_rec in c_lbr(l_parent_rec.ler_bnft_rstrn_id,l_mirror_src_entity_result_id,'LBR') loop
3885         --
3886             l_table_route_id := null ;
3887             open ben_plan_design_program_module.g_table_route('LBR');
3888             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
3889             close ben_plan_design_program_module.g_table_route ;
3890             --
3891             l_information5 := ben_plan_design_program_module.get_ler_name(l_lbr_rec.ler_id,p_effective_date); --'Intersection';
3892             --
3893             l_ler_bnft_rstrn_id := l_lbr_rec.ler_bnft_rstrn_id ;
3894             --
3895             if p_effective_date between l_lbr_rec.effective_start_date
3896                 and l_lbr_rec.effective_end_date then
3897                 --
3898                 l_result_type_cd := 'DISPLAY';
3899             else
3900                 l_result_type_cd := 'NO DISPLAY';
3901             end if;
3902             --
3903             l_copy_entity_result_id := null;
3904             l_object_version_number := null;
3905             ben_copy_entity_results_api.create_copy_entity_results(
3906                  p_copy_entity_result_id           => l_copy_entity_result_id,
3907                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
3908                  p_result_type_cd                 => l_result_type_cd,
3909 		     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
3910                  p_parent_entity_result_id        => l_parent_entity_result_id,
3911                  p_number_of_copies               => l_number_of_copies,
3912                  p_table_alias					 => 'LBR',
3913                  p_table_route_id                 => l_table_route_id,
3914                  p_information1     => l_lbr_rec.ler_bnft_rstrn_id,
3915                  p_information2     => l_lbr_rec.EFFECTIVE_START_DATE,
3916                  p_information3     => l_lbr_rec.EFFECTIVE_END_DATE,
3917                  p_information4     => l_lbr_rec.business_group_id,
3918                  p_information5     => l_information5 , -- 9999 put name for h-grid
3919                  p_information12     => l_lbr_rec.cvg_incr_r_decr_only_cd,
3920                  p_information11     => l_lbr_rec.dflt_to_asn_pndg_ctfn_cd,
3921                  p_information262     => l_lbr_rec.dflt_to_asn_pndg_ctfn_rl,
3922                  p_information111     => l_lbr_rec.lbr_attribute1,
3923                  p_information120     => l_lbr_rec.lbr_attribute10,
3924                  p_information121     => l_lbr_rec.lbr_attribute11,
3925                  p_information122     => l_lbr_rec.lbr_attribute12,
3926                  p_information123     => l_lbr_rec.lbr_attribute13,
3927                  p_information124     => l_lbr_rec.lbr_attribute14,
3928                  p_information125     => l_lbr_rec.lbr_attribute15,
3929                  p_information126     => l_lbr_rec.lbr_attribute16,
3930                  p_information127     => l_lbr_rec.lbr_attribute17,
3931                  p_information128     => l_lbr_rec.lbr_attribute18,
3932                  p_information129     => l_lbr_rec.lbr_attribute19,
3933                  p_information112     => l_lbr_rec.lbr_attribute2,
3934                  p_information130     => l_lbr_rec.lbr_attribute20,
3935                  p_information131     => l_lbr_rec.lbr_attribute21,
3936                  p_information132     => l_lbr_rec.lbr_attribute22,
3937                  p_information133     => l_lbr_rec.lbr_attribute23,
3938                  p_information134     => l_lbr_rec.lbr_attribute24,
3939                  p_information135     => l_lbr_rec.lbr_attribute25,
3940                  p_information136     => l_lbr_rec.lbr_attribute26,
3941                  p_information137     => l_lbr_rec.lbr_attribute27,
3942                  p_information138     => l_lbr_rec.lbr_attribute28,
3943                  p_information139     => l_lbr_rec.lbr_attribute29,
3944                  p_information113     => l_lbr_rec.lbr_attribute3,
3945                  p_information140     => l_lbr_rec.lbr_attribute30,
3946                  p_information114     => l_lbr_rec.lbr_attribute4,
3947                  p_information115     => l_lbr_rec.lbr_attribute5,
3948                  p_information116     => l_lbr_rec.lbr_attribute6,
3949                  p_information117     => l_lbr_rec.lbr_attribute7,
3950                  p_information118     => l_lbr_rec.lbr_attribute8,
3951                  p_information119     => l_lbr_rec.lbr_attribute9,
3952                  p_information110     => l_lbr_rec.lbr_attribute_category,
3953                  p_information257     => l_lbr_rec.ler_id,
3954                  p_information297     => l_lbr_rec.mn_cvg_amt,
3955                  p_information268     => l_lbr_rec.mn_cvg_rl,
3956                  p_information295     => l_lbr_rec.mx_cvg_alwd_amt,
3957                  p_information294     => l_lbr_rec.mx_cvg_incr_alwd_amt,
3958                  p_information293     => l_lbr_rec.mx_cvg_incr_wcf_alwd_amt,
3959                  p_information263     => l_lbr_rec.mx_cvg_mlt_incr_num,
3960                  p_information264     => l_lbr_rec.mx_cvg_mlt_incr_wcf_num,
3961                  p_information266     => l_lbr_rec.mx_cvg_rl,
3962                  p_information296     => l_lbr_rec.mx_cvg_wcfn_amt,
3963                  p_information267     => l_lbr_rec.mx_cvg_wcfn_mlt_num,
3964                  p_information14      => l_lbr_rec.no_mn_cvg_incr_apls_flag,
3965                  p_information15      => l_lbr_rec.no_mx_cvg_amt_apls_flag,
3966                  p_information16      => l_lbr_rec.no_mx_cvg_incr_apls_flag,
3967                  p_information261     => l_lbr_rec.pl_id,
3968                  p_information256     => l_lbr_rec.plip_id,
3969                  p_information13      => l_lbr_rec.unsspnd_enrt_cd,
3970                  p_INFORMATION198     => l_lbr_rec.SUSP_IF_CTFN_NOT_PRVD_FLAG,
3971                  p_INFORMATION197     => l_lbr_rec.CTFN_DETERMINE_CD,
3972                  p_information265     => l_lbr_rec.object_version_number,
3973                  p_object_version_number          => l_object_version_number,
3974                  p_effective_date                 => p_effective_date       );
3975             --
3976 
3977                  if l_out_lbr_result_id is null then
3978                    l_out_lbr_result_id := l_copy_entity_result_id;
3979                  end if;
3980 
3981                  if l_result_type_cd = 'DISPLAY' then
3982                    l_out_lbr_result_id := l_copy_entity_result_id ;
3983                  end if;
3984             --
3985 			  if (l_lbr_rec.dflt_to_asn_pndg_ctfn_rl is not null) then
3986 				   ben_plan_design_program_module.create_formula_result(
3987 						p_validate                       => p_validate
3988 						,p_copy_entity_result_id  => l_copy_entity_result_id
3989 						,p_copy_entity_txn_id      => p_copy_entity_txn_id
3990 						,p_formula_id                  => l_lbr_rec.dflt_to_asn_pndg_ctfn_rl
3991 						,p_business_group_id        =>  l_lbr_rec.business_group_id
3992 						,p_number_of_copies         =>  l_number_of_copies
3993 						,p_object_version_number  => l_object_version_number
3994 						,p_effective_date             => p_effective_date);
3995 				end if;
3996 
3997 			  if (l_lbr_rec.mn_cvg_rl is not null) then
3998 				   ben_plan_design_program_module.create_formula_result(
3999 						p_validate                       => p_validate
4000 						,p_copy_entity_result_id  => l_copy_entity_result_id
4001 						,p_copy_entity_txn_id      => p_copy_entity_txn_id
4002 						,p_formula_id                  => l_lbr_rec.mn_cvg_rl
4003 						,p_business_group_id        => l_lbr_rec.business_group_id
4004 						,p_number_of_copies         =>  l_number_of_copies
4005 						,p_object_version_number  => l_object_version_number
4006 						,p_effective_date             => p_effective_date);
4007 				end if;
4008 
4009 			  if (l_lbr_rec.mx_cvg_rl is not null) then
4010 				   ben_plan_design_program_module.create_formula_result(
4011 						p_validate                       => p_validate
4012 						,p_copy_entity_result_id  => l_copy_entity_result_id
4013 						,p_copy_entity_txn_id      => p_copy_entity_txn_id
4014 						,p_formula_id                  => l_lbr_rec.mx_cvg_rl
4015 						,p_business_group_id        => l_lbr_rec.business_group_id
4016 						,p_number_of_copies         =>  l_number_of_copies
4017 						,p_object_version_number  => l_object_version_number
4018 						,p_effective_date             => p_effective_date);
4019 				end if;
4020 
4021             --
4022           end loop;
4023           --
4024           for l_lbr_rec in c_lbr_drp(l_parent_rec.ler_bnft_rstrn_id,l_mirror_src_entity_result_id,'LBR') loop
4025             --
4026             create_ler_result (
4027                  p_validate                       => p_validate
4028                 ,p_copy_entity_result_id          => l_out_lbr_result_id
4029                 ,p_copy_entity_txn_id             => p_copy_entity_txn_id
4030                 ,p_ler_id                         => l_lbr_rec.ler_id
4031                 ,p_business_group_id              => p_business_group_id
4032                 ,p_number_of_copies             => p_number_of_copies
4033                 ,p_object_version_number          => l_object_version_number
4034                 ,p_effective_date                 => p_effective_date
4035                 );
4036             --
4037           end loop;
4038           ---------------------------------------------------------------
4039           -- START OF BEN_LER_BNFT_RSTRN_CTFN_F ----------------------
4040           ---------------------------------------------------------------
4041           --
4042           for l_parent_rec  in c_lbc_from_parent(l_LER_BNFT_RSTRN_ID) loop
4043           --
4044               l_mirror_src_entity_result_id := l_out_lbr_result_id;
4045 
4046               l_ler_bnft_rstrn_ctfn_id := l_parent_rec.ler_bnft_rstrn_ctfn_id ;
4047               --
4048               for l_lbc_rec in c_lbc(l_parent_rec.ler_bnft_rstrn_ctfn_id,l_mirror_src_entity_result_id,'LBC') loop
4049               --
4050                   l_table_route_id := null ;
4051                   open ben_plan_design_program_module.g_table_route('LBC');
4052                   fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
4053                   close ben_plan_design_program_module.g_table_route ;
4054                   --
4055                   l_information5  := hr_general.decode_lookup('BEN_ENRT_CTFN_TYP',l_lbc_rec.enrt_ctfn_typ_cd); --'Intersection';
4056                   --
4057                   l_ler_bnft_rstrn_ctfn_id := l_lbc_rec.ler_bnft_rstrn_ctfn_id ;
4058                   if p_effective_date between l_lbc_rec.effective_start_date
4059                       and l_lbc_rec.effective_end_date then
4060                       --
4061                       l_result_type_cd := 'DISPLAY';
4062                   else
4063                       l_result_type_cd := 'NO DISPLAY';
4064                   end if;
4065                   --
4066                   l_copy_entity_result_id := null;
4067                   l_object_version_number := null;
4068                   ben_copy_entity_results_api.create_copy_entity_results(
4069                        p_copy_entity_result_id           => l_copy_entity_result_id,
4070                        p_copy_entity_txn_id             => p_copy_entity_txn_id,
4071                        p_result_type_cd                 => l_result_type_cd,
4072                        p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
4073                        p_parent_entity_result_id        => l_mirror_src_entity_result_id,
4074                        p_number_of_copies               => l_number_of_copies,
4075                        p_table_alias					 => 'LBC',
4076                        p_table_route_id                 => l_table_route_id,
4077                        p_information1     => l_lbc_rec.ler_bnft_rstrn_ctfn_id,
4078                        p_information2     => l_lbc_rec.EFFECTIVE_START_DATE,
4079                        p_information3     => l_lbc_rec.EFFECTIVE_END_DATE,
4080                        p_information4     => l_lbc_rec.business_group_id,
4081                        p_information5     => l_information5 , -- 9999 put name for h-grid
4082                       	p_information261     => l_lbc_rec.ctfn_rqd_when_rl,
4083                       	p_information12      => l_lbc_rec.enrt_ctfn_typ_cd,
4084                       	p_information111     => l_lbc_rec.lbc_attribute1,
4085                       	p_information120     => l_lbc_rec.lbc_attribute10,
4086                       	p_information121     => l_lbc_rec.lbc_attribute11,
4087                       	p_information122     => l_lbc_rec.lbc_attribute12,
4088                       	p_information123     => l_lbc_rec.lbc_attribute13,
4089                       	p_information124     => l_lbc_rec.lbc_attribute14,
4090                       	p_information125     => l_lbc_rec.lbc_attribute15,
4091                       	p_information126     => l_lbc_rec.lbc_attribute16,
4092                       	p_information127     => l_lbc_rec.lbc_attribute17,
4093                       	p_information128     => l_lbc_rec.lbc_attribute18,
4094                       	p_information129     => l_lbc_rec.lbc_attribute19,
4095                       	p_information112     => l_lbc_rec.lbc_attribute2,
4096                       	p_information130     => l_lbc_rec.lbc_attribute20,
4097                       	p_information131     => l_lbc_rec.lbc_attribute21,
4098                       	p_information132     => l_lbc_rec.lbc_attribute22,
4099                       	p_information133     => l_lbc_rec.lbc_attribute23,
4100                       	p_information134     => l_lbc_rec.lbc_attribute24,
4101                       	p_information135     => l_lbc_rec.lbc_attribute25,
4102                       	p_information136     => l_lbc_rec.lbc_attribute26,
4103                       	p_information137     => l_lbc_rec.lbc_attribute27,
4104                       	p_information138     => l_lbc_rec.lbc_attribute28,
4105                       	p_information139     => l_lbc_rec.lbc_attribute29,
4106                       	p_information113     => l_lbc_rec.lbc_attribute3,
4107                       	p_information140     => l_lbc_rec.lbc_attribute30,
4108                       	p_information114     => l_lbc_rec.lbc_attribute4,
4109                       	p_information115     => l_lbc_rec.lbc_attribute5,
4110                       	p_information116     => l_lbc_rec.lbc_attribute6,
4111                       	p_information117     => l_lbc_rec.lbc_attribute7,
4112                       	p_information118     => l_lbc_rec.lbc_attribute8,
4113                       	p_information119     => l_lbc_rec.lbc_attribute9,
4114                       	p_information110     => l_lbc_rec.lbc_attribute_category,
4115                       	p_information257     => l_lbc_rec.ler_bnft_rstrn_id,
4116                       	p_information11      => l_lbc_rec.rqd_flag,
4117                         p_information265     => l_lbc_rec.object_version_number,
4118                        p_object_version_number          => l_object_version_number,
4119                        p_effective_date                 => p_effective_date       );
4120                 --
4121 
4122                        if l_out_lbc_result_id is null then
4123                          l_out_lbc_result_id := l_copy_entity_result_id;
4124                        end if;
4125 
4126                       if l_result_type_cd = 'DISPLAY' then
4127                         l_out_lbc_result_id := l_copy_entity_result_id ;
4128                       end if;
4129 
4130                       if (l_lbc_rec.ctfn_rqd_when_rl is not null) then
4131 						   ben_plan_design_program_module.create_formula_result(
4132 								p_validate                       => p_validate
4133 								,p_copy_entity_result_id  => l_copy_entity_result_id
4134 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
4135 								,p_formula_id                  =>  l_lbc_rec.ctfn_rqd_when_rl
4136 								,p_business_group_id        =>  l_lbc_rec.business_group_id
4137 								,p_number_of_copies         =>  l_number_of_copies
4138 								,p_object_version_number  => l_object_version_number
4139 								,p_effective_date             => p_effective_date);
4140 						end if;
4141 
4142                 --
4143                 end loop;
4144               --
4145               end loop;
4146            ---------------------------------------------------------------
4147            -- END OF BEN_LER_BNFT_RSTRN_CTFN_F ----------------------
4148            ---------------------------------------------------------------
4149         end loop;
4150      ---------------------------------------------------------------
4151      -- END OF BEN_LER_BNFT_RSTRN_F ----------------------
4152      ---------------------------------------------------------------
4153 
4154      ---------------------------------------------------------------
4155      -- START OF BEN_ENRT_CTFN_F ----------------------
4156      ---------------------------------------------------------------
4157       --
4158       --
4159       for l_parent_rec  in c_ecf_from_parent(l_PL_ID) loop
4160       --
4161 
4162         l_mirror_src_entity_result_id := l_out_pln_result_id;
4163         l_parent_entity_result_id := l_out_pln_cpp_result_id;
4164 
4165         l_enrt_ctfn_id := l_parent_rec.enrt_ctfn_id ;
4166         --
4167         for l_ecf_rec in c_ecf(l_parent_rec.enrt_ctfn_id,l_mirror_src_entity_result_id,'ECF') loop
4168         --
4169             l_table_route_id := null ;
4170             open ben_plan_design_program_module.g_table_route('ECF');
4171             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
4172             close ben_plan_design_program_module.g_table_route ;
4173             --
4174             l_information5 := hr_general.decode_lookup('BEN_ENRT_CTFN_TYP',l_ecf_rec.enrt_ctfn_typ_cd); --'Intersection';
4175             --
4176             if p_effective_date between l_ecf_rec.effective_start_date
4177                 and l_ecf_rec.effective_end_date then
4178                 --
4179                 l_result_type_cd := 'DISPLAY';
4180             else
4181                 l_result_type_cd := 'NO DISPLAY';
4182             end if;
4183             --
4184             l_copy_entity_result_id := null;
4185             l_object_version_number := null;
4186             ben_copy_entity_results_api.create_copy_entity_results(
4187                  p_copy_entity_result_id           => l_copy_entity_result_id,
4188                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
4189                  p_result_type_cd                 => l_result_type_cd,
4190 		     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
4191                  p_parent_entity_result_id        => l_parent_entity_result_id,
4192                  p_number_of_copies               => l_number_of_copies,
4193                  p_table_alias					 => 'EFC',
4194                   p_table_route_id                 => l_table_route_id,
4195                  p_information1     => l_ecf_rec.enrt_ctfn_id,
4196                  p_information2     => l_ecf_rec.EFFECTIVE_START_DATE,
4197                  p_information3     => l_ecf_rec.EFFECTIVE_END_DATE,
4198                  p_information4     => l_ecf_rec.business_group_id,
4199                  p_information5     => l_information5 , -- 9999 put name for h-grid
4200                  p_information262     => l_ecf_rec.ctfn_rqd_when_rl,
4201                  p_information111     => l_ecf_rec.ecf_attribute1,
4202                  p_information120     => l_ecf_rec.ecf_attribute10,
4203                  p_information121     => l_ecf_rec.ecf_attribute11,
4204                  p_information122     => l_ecf_rec.ecf_attribute12,
4205                  p_information123     => l_ecf_rec.ecf_attribute13,
4206                  p_information124     => l_ecf_rec.ecf_attribute14,
4207                  p_information125     => l_ecf_rec.ecf_attribute15,
4208                  p_information126     => l_ecf_rec.ecf_attribute16,
4209                  p_information127     => l_ecf_rec.ecf_attribute17,
4210                  p_information128     => l_ecf_rec.ecf_attribute18,
4211                  p_information129     => l_ecf_rec.ecf_attribute19,
4212                  p_information112     => l_ecf_rec.ecf_attribute2,
4213                  p_information130     => l_ecf_rec.ecf_attribute20,
4214                  p_information131     => l_ecf_rec.ecf_attribute21,
4215                  p_information132     => l_ecf_rec.ecf_attribute22,
4216                  p_information133     => l_ecf_rec.ecf_attribute23,
4217                  p_information134     => l_ecf_rec.ecf_attribute24,
4218                  p_information135     => l_ecf_rec.ecf_attribute25,
4219                  p_information136     => l_ecf_rec.ecf_attribute26,
4220                  p_information137     => l_ecf_rec.ecf_attribute27,
4221                  p_information138     => l_ecf_rec.ecf_attribute28,
4222                  p_information139     => l_ecf_rec.ecf_attribute29,
4223                  p_information113     => l_ecf_rec.ecf_attribute3,
4224                  p_information140     => l_ecf_rec.ecf_attribute30,
4225                  p_information114     => l_ecf_rec.ecf_attribute4,
4226                  p_information115     => l_ecf_rec.ecf_attribute5,
4227                  p_information116     => l_ecf_rec.ecf_attribute6,
4228                  p_information117     => l_ecf_rec.ecf_attribute7,
4229                  p_information118     => l_ecf_rec.ecf_attribute8,
4230                  p_information119     => l_ecf_rec.ecf_attribute9,
4231                  p_information110     => l_ecf_rec.ecf_attribute_category,
4232                  p_information11     => l_ecf_rec.enrt_ctfn_typ_cd,
4233                  p_information258     => l_ecf_rec.oipl_id,
4234                  p_information261     => l_ecf_rec.pl_id,
4235                  p_information256     => l_ecf_rec.plip_id,
4236                  p_information12     => l_ecf_rec.rqd_flag,
4237                  p_information265     => l_ecf_rec.object_version_number,
4238                  p_object_version_number          => l_object_version_number,
4239                  p_effective_date                 => p_effective_date       );
4240           --
4241 
4242                  if l_out_ecf_result_id is null then
4243                    l_out_ecf_result_id := l_copy_entity_result_id;
4244                  end if;
4245 
4246                  if l_result_type_cd = 'DISPLAY' then
4247                    l_out_ecf_result_id := l_copy_entity_result_id ;
4248                  end if;
4249 
4250 				  if (l_ecf_rec.ctfn_rqd_when_rl is not null) then
4251 					   ben_plan_design_program_module.create_formula_result(
4252 							p_validate                       => p_validate
4253 							,p_copy_entity_result_id  => l_copy_entity_result_id
4254 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
4255 							,p_formula_id                  => l_ecf_rec.ctfn_rqd_when_rl
4256 							,p_business_group_id        => l_ecf_rec.business_group_id
4257 							,p_number_of_copies         =>  l_number_of_copies
4258 							,p_object_version_number  => l_object_version_number
4259 							,p_effective_date             => p_effective_date);
4260 					end if;
4261           --
4262 
4263           end loop;
4264         --
4265         end loop;
4266      ---------------------------------------------------------------
4267      -- END OF BEN_ENRT_CTFN_F ----------------------
4268      ---------------------------------------------------------------
4269 
4270      ---------------------------------------------------------------
4271      -- START OF BEN_LER_CHG_DPNT_CVG_F ----------------------
4272      ---------------------------------------------------------------
4273       --
4274       --
4275       for l_parent_rec  in c_ldc_from_parent(l_PL_ID) loop
4276       --
4277 
4278         l_mirror_src_entity_result_id := l_out_pln_result_id;
4279         l_parent_entity_result_id := l_out_pln_cpp_result_id;
4280 
4281         l_ler_chg_dpnt_cvg_id := l_parent_rec.ler_chg_dpnt_cvg_id ;
4282         --
4283         for l_ldc_rec in c_ldc(l_parent_rec.ler_chg_dpnt_cvg_id,l_mirror_src_entity_result_id,'LDC') loop
4284         --
4285             l_table_route_id := null ;
4286             open ben_plan_design_program_module.g_table_route('LDC');
4287             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
4288             close ben_plan_design_program_module.g_table_route ;
4289             --
4290             l_information5 := ben_plan_design_program_module.get_ler_name(l_ldc_rec.ler_id,p_effective_date); --'Intersection'
4291             --
4292             l_ler_chg_dpnt_cvg_id := l_ldc_rec.ler_chg_dpnt_cvg_id;
4293             if p_effective_date between l_ldc_rec.effective_start_date
4294                 and l_ldc_rec.effective_end_date then
4295                 --
4296                 l_result_type_cd := 'DISPLAY';
4297             else
4298                 l_result_type_cd := 'NO DISPLAY';
4299             end if;
4300             --
4301             l_copy_entity_result_id := null;
4302             l_object_version_number := null;
4303             ben_copy_entity_results_api.create_copy_entity_results(
4304                  p_copy_entity_result_id           => l_copy_entity_result_id,
4305                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
4306                  p_result_type_cd                 => l_result_type_cd,
4307 		     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
4308                  p_parent_entity_result_id        => l_parent_entity_result_id,
4309                  p_number_of_copies               => l_number_of_copies,
4310                  p_table_alias					 => 'LDC',
4311                  p_table_route_id                 => l_table_route_id,
4312                  p_information1     => l_ldc_rec.ler_chg_dpnt_cvg_id,
4313                  p_information2     => l_ldc_rec.EFFECTIVE_START_DATE,
4314                  p_information3     => l_ldc_rec.EFFECTIVE_END_DATE,
4315                  p_information4     => l_ldc_rec.business_group_id,
4316                  p_information5     => l_information5 , -- 9999 put name for h-grid
4317                  p_information11      => l_ldc_rec.add_rmv_cvg_cd,
4318                  p_information12      => l_ldc_rec.cvg_eff_end_cd,
4319                  p_information263     => l_ldc_rec.cvg_eff_end_rl,
4320                  p_information13      => l_ldc_rec.cvg_eff_strt_cd,
4321                  p_information262     => l_ldc_rec.cvg_eff_strt_rl,
4322                  p_information111     => l_ldc_rec.ldc_attribute1,
4323                  p_information120     => l_ldc_rec.ldc_attribute10,
4324                  p_information121     => l_ldc_rec.ldc_attribute11,
4325                  p_information122     => l_ldc_rec.ldc_attribute12,
4326                  p_information123     => l_ldc_rec.ldc_attribute13,
4327                  p_information124     => l_ldc_rec.ldc_attribute14,
4328                  p_information125     => l_ldc_rec.ldc_attribute15,
4329                  p_information126     => l_ldc_rec.ldc_attribute16,
4330                  p_information127     => l_ldc_rec.ldc_attribute17,
4331                  p_information128     => l_ldc_rec.ldc_attribute18,
4332                  p_information129     => l_ldc_rec.ldc_attribute19,
4333                  p_information112     => l_ldc_rec.ldc_attribute2,
4334                  p_information130     => l_ldc_rec.ldc_attribute20,
4335                  p_information131     => l_ldc_rec.ldc_attribute21,
4336                  p_information132     => l_ldc_rec.ldc_attribute22,
4337                  p_information133     => l_ldc_rec.ldc_attribute23,
4338                  p_information134     => l_ldc_rec.ldc_attribute24,
4339                  p_information135     => l_ldc_rec.ldc_attribute25,
4340                  p_information136     => l_ldc_rec.ldc_attribute26,
4341                  p_information137     => l_ldc_rec.ldc_attribute27,
4342                  p_information138     => l_ldc_rec.ldc_attribute28,
4343                  p_information139     => l_ldc_rec.ldc_attribute29,
4344                  p_information113     => l_ldc_rec.ldc_attribute3,
4345                  p_information140     => l_ldc_rec.ldc_attribute30,
4346                  p_information114     => l_ldc_rec.ldc_attribute4,
4347                  p_information115     => l_ldc_rec.ldc_attribute5,
4348                  p_information116     => l_ldc_rec.ldc_attribute6,
4349                  p_information117     => l_ldc_rec.ldc_attribute7,
4350                  p_information118     => l_ldc_rec.ldc_attribute8,
4351                  p_information119     => l_ldc_rec.ldc_attribute9,
4352                  p_information110     => l_ldc_rec.ldc_attribute_category,
4353                  p_information14      => l_ldc_rec.ler_chg_dpnt_cvg_cd,
4354                  p_information258     => l_ldc_rec.ler_chg_dpnt_cvg_rl,
4355                  p_information257     => l_ldc_rec.ler_id,
4356                  p_information260     => l_ldc_rec.pgm_id,
4357                  p_information261     => l_ldc_rec.pl_id,
4358                  p_information259     => l_ldc_rec.ptip_id,
4359                  p_INFORMATION198     => l_ldc_rec.SUSP_IF_CTFN_NOT_PRVD_FLAG,
4360                  p_INFORMATION197     => l_ldc_rec.CTFN_DETERMINE_CD,
4361                  p_information265     => l_ldc_rec.object_version_number,
4362                  p_object_version_number          => l_object_version_number,
4363                  p_effective_date                 => p_effective_date       );
4364                  --
4365 
4366                  if l_out_ldc_result_id is null then
4367                    l_out_ldc_result_id := l_copy_entity_result_id;
4368                  end if;
4369 
4370                  if l_result_type_cd = 'DISPLAY' then
4371                    l_out_ldc_result_id := l_copy_entity_result_id ;
4372                  end if;
4373                  --
4374 			  if (l_ldc_rec.cvg_eff_end_rl is not null) then
4375 				   ben_plan_design_program_module.create_formula_result(
4376 						p_validate                       => p_validate
4377 						,p_copy_entity_result_id  => l_copy_entity_result_id
4378 						,p_copy_entity_txn_id      => p_copy_entity_txn_id
4379 						,p_formula_id                  =>  l_ldc_rec.cvg_eff_end_rl
4380 						,p_business_group_id        =>  l_ldc_rec.business_group_id
4381 						,p_number_of_copies         =>  l_number_of_copies
4382 						,p_object_version_number  => l_object_version_number
4383 						,p_effective_date             => p_effective_date);
4384 				end if;
4385 
4386 			  if (l_ldc_rec.cvg_eff_strt_rl is not null) then
4387 				   ben_plan_design_program_module.create_formula_result(
4388 						p_validate                       => p_validate
4389 						,p_copy_entity_result_id  => l_copy_entity_result_id
4390 						,p_copy_entity_txn_id      => p_copy_entity_txn_id
4391 						,p_formula_id                  =>  l_ldc_rec.cvg_eff_strt_rl
4392 						,p_business_group_id        =>  l_ldc_rec.business_group_id
4393 						,p_number_of_copies         =>  l_number_of_copies
4394 						,p_object_version_number  => l_object_version_number
4395 						,p_effective_date             => p_effective_date);
4396 				end if;
4397 
4398 			  if (l_ldc_rec.ler_chg_dpnt_cvg_rl is not null) then
4399 				   ben_plan_design_program_module.create_formula_result(
4400 						p_validate                       => p_validate
4401 						,p_copy_entity_result_id  => l_copy_entity_result_id
4402 						,p_copy_entity_txn_id      => p_copy_entity_txn_id
4403 						,p_formula_id                  =>  l_ldc_rec.ler_chg_dpnt_cvg_rl
4404 						,p_business_group_id        =>  l_ldc_rec.business_group_id
4405 						,p_number_of_copies         =>  l_number_of_copies
4406 						,p_object_version_number  => l_object_version_number
4407 						,p_effective_date             => p_effective_date);
4408 				end if;
4409             --
4410           end loop;
4411           --
4412           for l_ldc_rec in c_ldc_drp(l_parent_rec.ler_chg_dpnt_cvg_id,l_mirror_src_entity_result_id,'LDC') loop
4413             create_ler_result (
4414                  p_validate                       => p_validate
4415                 ,p_copy_entity_result_id          => l_out_ldc_result_id
4416                 ,p_copy_entity_txn_id             => p_copy_entity_txn_id
4417                 ,p_ler_id                         => l_ldc_rec.ler_id
4418                 ,p_business_group_id              => p_business_group_id
4419                 ,p_number_of_copies               => p_number_of_copies
4420                 ,p_object_version_number          => l_object_version_number
4421                 ,p_effective_date                 => p_effective_date
4422                 );
4423           end loop;
4424           ---------------------------------------------------------------
4425           -- START OF BEN_LER_CHG_DPNT_CVG_CTFN_F ----------------------
4426           ---------------------------------------------------------------
4427            --
4428            for l_parent_rec  in c_lcc_from_parent(l_LER_CHG_DPNT_CVG_ID) loop
4429            --
4430              l_mirror_src_entity_result_id := l_out_ldc_result_id;
4431 
4432              l_ler_chg_dpnt_cvg_ctfn_id := l_parent_rec.ler_chg_dpnt_cvg_ctfn_id ;
4433              --
4434              for l_lcc_rec in c_lcc(l_parent_rec.ler_chg_dpnt_cvg_ctfn_id,l_mirror_src_entity_result_id,'LCC') loop
4435              --
4436                 l_table_route_id := null ;
4437                  open ben_plan_design_program_module.g_table_route('LCC');
4438                  fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
4439                  close ben_plan_design_program_module.g_table_route ;
4440                  --
4441                  l_information5  := hr_general.decode_lookup('BEN_DPNT_CVG_CTFN_TYP',l_lcc_rec.dpnt_cvg_ctfn_typ_cd); --'Intersection';
4442                  --
4443                  l_ler_chg_dpnt_cvg_ctfn_id := l_lcc_rec.ler_chg_dpnt_cvg_ctfn_id ;
4444                  if p_effective_date between l_lcc_rec.effective_start_date
4445                      and l_lcc_rec.effective_end_date then
4446                      --
4447                      l_result_type_cd := 'DISPLAY';
4448                  else
4449                      l_result_type_cd := 'NO DISPLAY';
4450                  end if;
4451                  --
4452                  l_copy_entity_result_id := null;
4453                  l_object_version_number := null;
4454                  ben_copy_entity_results_api.create_copy_entity_results(
4455                       p_copy_entity_result_id           => l_copy_entity_result_id,
4456                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
4457                       p_result_type_cd                 => l_result_type_cd,
4458                       p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
4459                       p_parent_entity_result_id        => l_mirror_src_entity_result_id,
4460                       p_number_of_copies               => l_number_of_copies,
4461                       p_table_alias					 => 'LCC',
4462                       p_table_route_id                 => l_table_route_id,
4463                       p_information1     => l_lcc_rec.ler_chg_dpnt_cvg_ctfn_id,
4464                       p_information2     => l_lcc_rec.EFFECTIVE_START_DATE,
4465                       p_information3     => l_lcc_rec.EFFECTIVE_END_DATE,
4466                       p_information4     => l_lcc_rec.business_group_id,
4467                       p_information5     => l_information5 , -- 9999 put name for h-grid
4468                       p_information261     => l_lcc_rec.ctfn_rqd_when_rl,
4469                       p_information12      => l_lcc_rec.dpnt_cvg_ctfn_typ_cd,
4470                       p_information13      => l_lcc_rec.lack_ctfn_sspnd_enrt_flag,
4471                       p_information111     => l_lcc_rec.lcc_attribute1,
4472                       p_information120     => l_lcc_rec.lcc_attribute10,
4473                       p_information121     => l_lcc_rec.lcc_attribute11,
4474                       p_information122     => l_lcc_rec.lcc_attribute12,
4475                       p_information123     => l_lcc_rec.lcc_attribute13,
4476                       p_information124     => l_lcc_rec.lcc_attribute14,
4477                       p_information125     => l_lcc_rec.lcc_attribute15,
4478                       p_information126     => l_lcc_rec.lcc_attribute16,
4479                       p_information127     => l_lcc_rec.lcc_attribute17,
4480                       p_information128     => l_lcc_rec.lcc_attribute18,
4481                       p_information129     => l_lcc_rec.lcc_attribute19,
4482                       p_information112     => l_lcc_rec.lcc_attribute2,
4483                       p_information130     => l_lcc_rec.lcc_attribute20,
4484                       p_information131     => l_lcc_rec.lcc_attribute21,
4485                       p_information132     => l_lcc_rec.lcc_attribute22,
4486                       p_information133     => l_lcc_rec.lcc_attribute23,
4487                       p_information134     => l_lcc_rec.lcc_attribute24,
4488                       p_information135     => l_lcc_rec.lcc_attribute25,
4489                       p_information136     => l_lcc_rec.lcc_attribute26,
4490                       p_information137     => l_lcc_rec.lcc_attribute27,
4491                       p_information138     => l_lcc_rec.lcc_attribute28,
4492                       p_information139     => l_lcc_rec.lcc_attribute29,
4493                       p_information113     => l_lcc_rec.lcc_attribute3,
4494                       p_information140     => l_lcc_rec.lcc_attribute30,
4495                       p_information114     => l_lcc_rec.lcc_attribute4,
4496                       p_information115     => l_lcc_rec.lcc_attribute5,
4497                       p_information116     => l_lcc_rec.lcc_attribute6,
4498                       p_information117     => l_lcc_rec.lcc_attribute7,
4499                       p_information118     => l_lcc_rec.lcc_attribute8,
4500                       p_information119     => l_lcc_rec.lcc_attribute9,
4501                       p_information110     => l_lcc_rec.lcc_attribute_category,
4502                       p_information260     => l_lcc_rec.ler_chg_dpnt_cvg_id,
4503                       p_information14      => l_lcc_rec.rlshp_typ_cd,
4504                       p_information11      => l_lcc_rec.rqd_flag,
4505                       p_information265     => l_lcc_rec.object_version_number,
4506                       p_object_version_number          => l_object_version_number,
4507                       p_effective_date                 => p_effective_date       );
4508                --
4509 
4510                       if l_out_lcc_result_id is null then
4511                         l_out_lcc_result_id := l_copy_entity_result_id;
4512                       end if;
4513 
4514                       if l_result_type_cd = 'DISPLAY' then
4515                         l_out_lcc_result_id := l_copy_entity_result_id ;
4516                       end if;
4517 
4518                       if (l_lcc_rec.ctfn_rqd_when_rl is not null) then
4519 						   ben_plan_design_program_module.create_formula_result(
4520 								p_validate                       => p_validate
4521 								,p_copy_entity_result_id  => l_copy_entity_result_id
4522 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
4523 								,p_formula_id                  =>  l_lcc_rec.ctfn_rqd_when_rl
4524 								,p_business_group_id        =>  l_lcc_rec.business_group_id
4525 								,p_number_of_copies         =>  l_number_of_copies
4526 								,p_object_version_number  => l_object_version_number
4527 								,p_effective_date             => p_effective_date);
4528 						end if;
4529 
4530 
4531                --
4532                end loop;
4533              --
4534              end loop;
4535           ---------------------------------------------------------------
4536           -- END OF BEN_LER_CHG_DPNT_CVG_CTFN_F ----------------------
4537           ---------------------------------------------------------------
4538         end loop;
4539      ---------------------------------------------------------------
4540      -- END OF BEN_LER_CHG_DPNT_CVG_F ----------------------
4541      ---------------------------------------------------------------
4542      ---------------------------------------------------------------
4543      -- START OF BEN_LER_CHG_PL_NIP_ENRT_F ----------------------
4544      ---------------------------------------------------------------
4545      --
4546      --
4547      for l_parent_rec  in c_lpe_from_parent(l_PL_ID) loop
4548      --
4549         l_mirror_src_entity_result_id := l_out_pln_result_id;
4550         l_parent_entity_result_id := l_out_pln_cpp_result_id;
4551 
4552         l_ler_chg_pl_nip_enrt_id := l_parent_rec.ler_chg_pl_nip_enrt_id ;
4553         --
4554         for l_lpe_rec in c_lpe(l_parent_rec.ler_chg_pl_nip_enrt_id,l_mirror_src_entity_result_id,'LPE') loop
4555         --
4556             l_table_route_id := null ;
4557             open ben_plan_design_program_module.g_table_route('LPE');
4558             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
4559             close ben_plan_design_program_module.g_table_route ;
4560             --
4561             l_information5 := ben_plan_design_program_module.get_ler_name(l_lpe_rec.ler_id,p_effective_date); --'Intersection';
4562             --
4563             if p_effective_date between l_lpe_rec.effective_start_date
4564                 and l_lpe_rec.effective_end_date then
4565                 --
4566                 l_result_type_cd := 'DISPLAY';
4567             else
4568                 l_result_type_cd := 'NO DISPLAY';
4569             end if;
4570             --
4571             l_copy_entity_result_id := null;
4572             l_object_version_number := null;
4573             ben_copy_entity_results_api.create_copy_entity_results(
4574                  p_copy_entity_result_id           => l_copy_entity_result_id,
4575                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
4576                  p_result_type_cd                 => l_result_type_cd,
4577 	 	     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
4578                  p_parent_entity_result_id        => l_parent_entity_result_id,
4579                  p_number_of_copies               => l_number_of_copies,
4580                  p_table_alias					 => 'LPE',
4581                  p_table_route_id                 => l_table_route_id,
4582                  p_information1     => l_lpe_rec.ler_chg_pl_nip_enrt_id,
4583                  p_information2     => l_lpe_rec.EFFECTIVE_START_DATE,
4584                  p_information3     => l_lpe_rec.EFFECTIVE_END_DATE,
4585                  p_information4     => l_lpe_rec.business_group_id,
4586                  p_information5     => l_information5 , -- 9999 put name for h-grid
4587                  p_information258     => l_lpe_rec.auto_enrt_mthd_rl,
4588                  p_information12     => l_lpe_rec.crnt_enrt_prclds_chg_flag,
4589                  p_information16     => l_lpe_rec.dflt_enrt_cd,
4590                  p_information263     => l_lpe_rec.dflt_enrt_rl,
4591                  p_information13     => l_lpe_rec.dflt_flag,
4592                  p_information17     => l_lpe_rec.enrt_cd,
4593                  p_information15     => l_lpe_rec.enrt_mthd_cd,
4594                  p_information264     => l_lpe_rec.enrt_rl,
4595                  p_information257     => l_lpe_rec.ler_id,
4596                  p_information111     => l_lpe_rec.lpe_attribute1,
4597                  p_information120     => l_lpe_rec.lpe_attribute10,
4598                  p_information121     => l_lpe_rec.lpe_attribute11,
4599                  p_information122     => l_lpe_rec.lpe_attribute12,
4600                  p_information123     => l_lpe_rec.lpe_attribute13,
4601                  p_information124     => l_lpe_rec.lpe_attribute14,
4602                  p_information125     => l_lpe_rec.lpe_attribute15,
4603                  p_information126     => l_lpe_rec.lpe_attribute16,
4604                  p_information127     => l_lpe_rec.lpe_attribute17,
4605                  p_information128     => l_lpe_rec.lpe_attribute18,
4606                  p_information129     => l_lpe_rec.lpe_attribute19,
4607                  p_information112     => l_lpe_rec.lpe_attribute2,
4608                  p_information130     => l_lpe_rec.lpe_attribute20,
4609                  p_information131     => l_lpe_rec.lpe_attribute21,
4610                  p_information132     => l_lpe_rec.lpe_attribute22,
4611                  p_information133     => l_lpe_rec.lpe_attribute23,
4612                  p_information134     => l_lpe_rec.lpe_attribute24,
4613                  p_information135     => l_lpe_rec.lpe_attribute25,
4614                  p_information136     => l_lpe_rec.lpe_attribute26,
4615                  p_information137     => l_lpe_rec.lpe_attribute27,
4616                  p_information138     => l_lpe_rec.lpe_attribute28,
4617                  p_information139     => l_lpe_rec.lpe_attribute29,
4618                  p_information113     => l_lpe_rec.lpe_attribute3,
4619                  p_information140     => l_lpe_rec.lpe_attribute30,
4620                  p_information114     => l_lpe_rec.lpe_attribute4,
4621                  p_information115     => l_lpe_rec.lpe_attribute5,
4622                  p_information116     => l_lpe_rec.lpe_attribute6,
4623                  p_information117     => l_lpe_rec.lpe_attribute7,
4624                  p_information118     => l_lpe_rec.lpe_attribute8,
4625                  p_information119     => l_lpe_rec.lpe_attribute9,
4626                  p_information110     => l_lpe_rec.lpe_attribute_category,
4627                  p_information261     => l_lpe_rec.pl_id,
4628                  p_information14     => l_lpe_rec.stl_elig_cant_chg_flag,
4629                  p_information11     => l_lpe_rec.tco_chg_enrt_cd,
4630                  p_information265     => l_lpe_rec.object_version_number,
4631                  p_object_version_number          => l_object_version_number,
4632                  p_effective_date                 => p_effective_date       );
4633                --
4634                 if l_out_lpe_result_id is null then
4635                   l_out_lpe_result_id := l_copy_entity_result_id;
4636                 end if;
4637 
4638                 if l_result_type_cd = 'DISPLAY' then
4639                   l_out_lpe_result_id := l_copy_entity_result_id ;
4640                 end if;
4641                --
4642 				  if (l_lpe_rec.auto_enrt_mthd_rl is not null) then
4643 					   ben_plan_design_program_module.create_formula_result(
4644 							p_validate                       => p_validate
4645 							,p_copy_entity_result_id  => l_copy_entity_result_id
4646 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
4647 							,p_formula_id                  => l_lpe_rec.auto_enrt_mthd_rl
4648 							,p_business_group_id        => l_lpe_rec.business_group_id
4649 							,p_number_of_copies         =>  l_number_of_copies
4650 							,p_object_version_number  => l_object_version_number
4651 							,p_effective_date             => p_effective_date);
4652 					end if;
4653 
4654 				  if (l_lpe_rec.dflt_enrt_rl is not null) then
4655 					   ben_plan_design_program_module.create_formula_result(
4656 							p_validate                       => p_validate
4657 							,p_copy_entity_result_id  => l_copy_entity_result_id
4658 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
4659 							,p_formula_id                  => l_lpe_rec.dflt_enrt_rl
4660 							,p_business_group_id        => l_lpe_rec.business_group_id
4661 							,p_number_of_copies         =>  l_number_of_copies
4662 							,p_object_version_number  => l_object_version_number
4663 							,p_effective_date             => p_effective_date);
4664 					end if;
4665 
4666 				  if (l_lpe_rec.enrt_rl is not null) then
4667 					   ben_plan_design_program_module.create_formula_result(
4668 							p_validate                       => p_validate
4669 							,p_copy_entity_result_id  => l_copy_entity_result_id
4670 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
4671 							,p_formula_id                  => l_lpe_rec.enrt_rl
4672 							,p_business_group_id        => l_lpe_rec.business_group_id
4673 							,p_number_of_copies         =>  l_number_of_copies
4674 							,p_object_version_number  => l_object_version_number
4675 							,p_effective_date             => p_effective_date);
4676 					end if;
4677 
4678           --
4679           end loop;
4680           --
4681           for l_lpe_rec in c_lpe_drp(l_parent_rec.ler_chg_pl_nip_enrt_id,l_mirror_src_entity_result_id,'LPE') loop
4682                 create_ler_result (
4683                       p_validate                       => p_validate
4684                      ,p_copy_entity_result_id          => l_out_lpe_result_id
4685                      ,p_copy_entity_txn_id             => p_copy_entity_txn_id
4686                      ,p_ler_id                         => l_lpe_rec.ler_id
4687                      ,p_business_group_id              => p_business_group_id
4688                      ,p_number_of_copies               => p_number_of_copies
4689                      ,p_object_version_number          => l_object_version_number
4690                      ,p_effective_date                 => p_effective_date
4691                      );
4692           end loop;
4693         end loop;
4694      ---------------------------------------------------------------
4695      -- END OF BEN_LER_CHG_PL_NIP_ENRT_F ----------------------
4696      ---------------------------------------------------------------
4697      ---------------------------------------------------------------
4698      -- START OF BEN_LER_RQRS_ENRT_CTFN_F ----------------------
4699      ---------------------------------------------------------------
4700       --
4701       --
4702       for l_parent_rec  in c_lre_from_parent(l_PL_ID) loop
4703       --
4704 
4705         l_mirror_src_entity_result_id := l_out_pln_result_id;
4706         l_parent_entity_result_id := l_out_pln_cpp_result_id;
4707 
4708         l_ler_rqrs_enrt_ctfn_id := l_parent_rec.ler_rqrs_enrt_ctfn_id ;
4709         --
4710         for l_lre_rec in c_lre(l_parent_rec.ler_rqrs_enrt_ctfn_id,l_mirror_src_entity_result_id,'LRE') loop
4711         --
4712             l_table_route_id := null ;
4713             open ben_plan_design_program_module.g_table_route('LRE');
4714             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
4715             close ben_plan_design_program_module.g_table_route ;
4716             --
4717             l_information5 := ben_plan_design_program_module.get_ler_name(l_lre_rec.ler_id,p_effective_date); --'Intersection';
4718             --
4719             if p_effective_date between l_lre_rec.effective_start_date
4720                 and l_lre_rec.effective_end_date then
4721                 --
4722                 l_result_type_cd := 'DISPLAY';
4723             else
4724                 l_result_type_cd := 'NO DISPLAY';
4725             end if;
4726             --
4727             l_copy_entity_result_id := null;
4728             l_object_version_number := null;
4729             ben_copy_entity_results_api.create_copy_entity_results(
4730                  p_copy_entity_result_id           => l_copy_entity_result_id,
4731                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
4732                  p_result_type_cd                 => l_result_type_cd,
4733 	 	     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
4734                  p_parent_entity_result_id        => l_parent_entity_result_id,
4735                  p_number_of_copies               => l_number_of_copies,
4736                  p_table_alias					 => 'LRE',
4737                  p_table_route_id                 => l_table_route_id,
4738                  p_information1     => l_lre_rec.ler_rqrs_enrt_ctfn_id,
4739                  p_information2     => l_lre_rec.EFFECTIVE_START_DATE,
4740                  p_information3     => l_lre_rec.EFFECTIVE_END_DATE,
4741                  p_information4     => l_lre_rec.business_group_id,
4742                  p_information5     => l_information5 , -- 9999 put name for h-grid
4743                  p_information263     => l_lre_rec.ctfn_rqd_when_rl,
4744                  p_information11     => l_lre_rec.excld_flag,
4745                  p_information257     => l_lre_rec.ler_id,
4746                  p_information111     => l_lre_rec.lre_attribute1,
4747                  p_information120     => l_lre_rec.lre_attribute10,
4748                  p_information121     => l_lre_rec.lre_attribute11,
4749                  p_information122     => l_lre_rec.lre_attribute12,
4750                  p_information123     => l_lre_rec.lre_attribute13,
4751                  p_information124     => l_lre_rec.lre_attribute14,
4752                  p_information125     => l_lre_rec.lre_attribute15,
4753                  p_information126     => l_lre_rec.lre_attribute16,
4754                  p_information127     => l_lre_rec.lre_attribute17,
4755                  p_information128     => l_lre_rec.lre_attribute18,
4756                  p_information129     => l_lre_rec.lre_attribute19,
4757                  p_information112     => l_lre_rec.lre_attribute2,
4758                  p_information130     => l_lre_rec.lre_attribute20,
4759                  p_information131     => l_lre_rec.lre_attribute21,
4760                  p_information132     => l_lre_rec.lre_attribute22,
4761                  p_information133     => l_lre_rec.lre_attribute23,
4762                  p_information134     => l_lre_rec.lre_attribute24,
4763                  p_information135     => l_lre_rec.lre_attribute25,
4764                  p_information136     => l_lre_rec.lre_attribute26,
4765                  p_information137     => l_lre_rec.lre_attribute27,
4766                  p_information138     => l_lre_rec.lre_attribute28,
4767                  p_information139     => l_lre_rec.lre_attribute29,
4768                  p_information113     => l_lre_rec.lre_attribute3,
4769                  p_information140     => l_lre_rec.lre_attribute30,
4770                  p_information114     => l_lre_rec.lre_attribute4,
4771                  p_information115     => l_lre_rec.lre_attribute5,
4772                  p_information116     => l_lre_rec.lre_attribute6,
4773                  p_information117     => l_lre_rec.lre_attribute7,
4774                  p_information118     => l_lre_rec.lre_attribute8,
4775                  p_information119     => l_lre_rec.lre_attribute9,
4776                  p_information110     => l_lre_rec.lre_attribute_category,
4777                  p_information258     => l_lre_rec.oipl_id,
4778                  p_information261     => l_lre_rec.pl_id,
4779                  p_information256     => l_lre_rec.plip_id,
4780                  p_INFORMATION198     => l_lre_rec.SUSP_IF_CTFN_NOT_PRVD_FLAG,
4781                  p_INFORMATION197     => l_lre_rec.CTFN_DETERMINE_CD,
4782                  p_information265     => l_lre_rec.object_version_number,
4783                  p_object_version_number          => l_object_version_number,
4784                  p_effective_date                 => p_effective_date       );
4785                  --
4786                  --
4787                 if l_out_lre_result_id is null then
4788                    l_out_lre_result_id := l_copy_entity_result_id;
4789                 end if;
4790 
4791                 if l_result_type_cd = 'DISPLAY' then
4792                   l_out_lre_result_id := l_copy_entity_result_id ;
4793                 end if;
4794                  --
4795 				  if (l_lre_rec.ctfn_rqd_when_rl is not null) then
4796 					   ben_plan_design_program_module.create_formula_result(
4797 							p_validate                       => p_validate
4798 							,p_copy_entity_result_id  => l_copy_entity_result_id
4799 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
4800 							,p_formula_id                  => l_lre_rec.ctfn_rqd_when_rl
4801 							,p_business_group_id        => l_lre_rec.business_group_id
4802 							,p_number_of_copies         =>  l_number_of_copies
4803 							,p_object_version_number  => l_object_version_number
4804 							,p_effective_date             => p_effective_date);
4805 					end if;
4806 
4807           --
4808           end loop;
4809           for l_lre_rec in c_lre_drp(l_parent_rec.ler_rqrs_enrt_ctfn_id,l_mirror_src_entity_result_id,'LRE') loop
4810                    create_ler_result (
4811                       p_validate                       => p_validate
4812                      ,p_copy_entity_result_id          => l_out_lre_result_id
4813                      ,p_copy_entity_txn_id             => p_copy_entity_txn_id
4814                      ,p_ler_id                         => l_lre_rec.ler_id
4815                      ,p_business_group_id              => p_business_group_id
4816                      ,p_number_of_copies               => p_number_of_copies
4817                      ,p_object_version_number          => l_object_version_number
4818                      ,p_effective_date                 => p_effective_date
4819                      );
4820           end loop;
4821           --
4822           ---------------------------------------------------------------
4823           -- START OF BEN_LER_ENRT_CTFN_F ----------------------
4824           ---------------------------------------------------------------
4825           --
4826           for l_parent_rec  in c_lnc_from_parent(l_LER_RQRS_ENRT_CTFN_ID) loop
4827           --
4828              l_mirror_src_entity_result_id := l_out_lre_result_id ;
4829 
4830              l_ler_enrt_ctfn_id := l_parent_rec.ler_enrt_ctfn_id ;
4831              --
4832              for l_lnc_rec in c_lnc(l_parent_rec.ler_enrt_ctfn_id,l_mirror_src_entity_result_id,'LNC') loop
4833              --
4834                  l_table_route_id := null ;
4835                  open ben_plan_design_program_module.g_table_route('LNC');
4836                  fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
4837                  close ben_plan_design_program_module.g_table_route ;
4838                  --
4839                  l_information5  := hr_general.decode_lookup('BEN_ENRT_CTFN_TYP',l_lnc_rec.enrt_ctfn_typ_cd); --'Intersection';
4840                  --
4841                  l_ler_enrt_ctfn_id := l_lnc_rec.ler_enrt_ctfn_id ;
4842                  if p_effective_date between l_lnc_rec.effective_start_date
4843                      and l_lnc_rec.effective_end_date then
4844                      --
4845                      l_result_type_cd := 'DISPLAY';
4846                  else
4847                      l_result_type_cd := 'NO DISPLAY';
4848                  end if;
4849                  --
4850                  l_copy_entity_result_id := null;
4851                  l_object_version_number := null;
4852                  ben_copy_entity_results_api.create_copy_entity_results(
4853                       p_copy_entity_result_id           => l_copy_entity_result_id,
4854                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
4855                       p_result_type_cd                 => l_result_type_cd,
4856                       p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
4857                       p_parent_entity_result_id        => l_mirror_src_entity_result_id,
4858                       p_number_of_copies               => l_number_of_copies,
4859                       p_table_alias					 => 'LNC',
4860                       p_table_route_id                 => l_table_route_id,
4861                       p_information1     => l_lnc_rec.ler_enrt_ctfn_id,
4862                       p_information2     => l_lnc_rec.EFFECTIVE_START_DATE,
4863                       p_information3     => l_lnc_rec.EFFECTIVE_END_DATE,
4864                       p_information4     => l_lnc_rec.business_group_id,
4865                       p_information5     => l_information5 , -- 9999 put name for h-grid
4866                       p_information258     => l_lnc_rec.ctfn_rqd_when_rl,
4867                       p_information12     => l_lnc_rec.enrt_ctfn_typ_cd,
4868                       p_information257     => l_lnc_rec.ler_rqrs_enrt_ctfn_id,
4869                       p_information111     => l_lnc_rec.lnc_attribute1,
4870                       p_information120     => l_lnc_rec.lnc_attribute10,
4871                       p_information121     => l_lnc_rec.lnc_attribute11,
4872                       p_information122     => l_lnc_rec.lnc_attribute12,
4873                       p_information123     => l_lnc_rec.lnc_attribute13,
4874                       p_information124     => l_lnc_rec.lnc_attribute14,
4875                       p_information125     => l_lnc_rec.lnc_attribute15,
4876                       p_information126     => l_lnc_rec.lnc_attribute16,
4877                       p_information127     => l_lnc_rec.lnc_attribute17,
4878                       p_information128     => l_lnc_rec.lnc_attribute18,
4879                       p_information129     => l_lnc_rec.lnc_attribute19,
4880                       p_information112     => l_lnc_rec.lnc_attribute2,
4881                       p_information130     => l_lnc_rec.lnc_attribute20,
4882                       p_information131     => l_lnc_rec.lnc_attribute21,
4883                       p_information132     => l_lnc_rec.lnc_attribute22,
4884                       p_information133     => l_lnc_rec.lnc_attribute23,
4885                       p_information134     => l_lnc_rec.lnc_attribute24,
4886                       p_information135     => l_lnc_rec.lnc_attribute25,
4887                       p_information136     => l_lnc_rec.lnc_attribute26,
4888                       p_information137     => l_lnc_rec.lnc_attribute27,
4889                       p_information138     => l_lnc_rec.lnc_attribute28,
4890                       p_information139     => l_lnc_rec.lnc_attribute29,
4891                       p_information113     => l_lnc_rec.lnc_attribute3,
4892                       p_information140     => l_lnc_rec.lnc_attribute30,
4893                       p_information114     => l_lnc_rec.lnc_attribute4,
4894                       p_information115     => l_lnc_rec.lnc_attribute5,
4895                       p_information116     => l_lnc_rec.lnc_attribute6,
4896                       p_information117     => l_lnc_rec.lnc_attribute7,
4897                       p_information118     => l_lnc_rec.lnc_attribute8,
4898                       p_information119     => l_lnc_rec.lnc_attribute9,
4899                       p_information110     => l_lnc_rec.lnc_attribute_category,
4900                       p_information11     => l_lnc_rec.rqd_flag,
4901                       p_information265     => l_lnc_rec.object_version_number,
4902                       p_object_version_number          => l_object_version_number,
4903                       p_effective_date                 => p_effective_date       );
4904                       --
4905 
4906                       if l_out_lnc_result_id is null then
4907                         l_out_lnc_result_id := l_copy_entity_result_id;
4908                       end if;
4909 
4910                       if l_result_type_cd = 'DISPLAY' then
4911                         l_out_lnc_result_id := l_copy_entity_result_id ;
4912                       end if;
4913 					  if (l_lnc_rec.ctfn_rqd_when_rl is not null) then
4914 						   ben_plan_design_program_module.create_formula_result(
4915 								p_validate                       => p_validate
4916 								,p_copy_entity_result_id  => l_copy_entity_result_id
4917 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
4918 								,p_formula_id                  => l_lnc_rec.ctfn_rqd_when_rl
4919 								,p_business_group_id        => l_lnc_rec.business_group_id
4920 								,p_number_of_copies         =>  l_number_of_copies
4921 								,p_object_version_number  => l_object_version_number
4922 								,p_effective_date             => p_effective_date);
4923 						end if;
4924 
4925                --
4926                end loop;
4927              --
4928              end loop;
4929           ---------------------------------------------------------------
4930           -- END OF BEN_LER_ENRT_CTFN_F ----------------------
4931           ---------------------------------------------------------------
4932       end loop;
4933      ---------------------------------------------------------------
4934      -- END OF BEN_LER_RQRS_ENRT_CTFN_F ----------------------
4935      ---------------------------------------------------------------
4936      ---------------------------------------------------------------
4937      -- START OF BEN_PL_PCP ----------------------
4938      ---------------------------------------------------------------
4939       --
4940       --
4941       for l_parent_rec  in c_pcp_from_parent(l_PL_ID) loop
4942       --
4943         l_mirror_src_entity_result_id := l_out_pln_result_id;
4944         l_parent_entity_result_id := l_out_pln_cpp_result_id;
4945 
4946         l_pl_pcp_id := l_parent_rec.pl_pcp_id ;
4947         --
4948         for l_pcp_rec in c_pcp(l_parent_rec.pl_pcp_id,l_mirror_src_entity_result_id,'PCP') loop
4949         --
4950             l_table_route_id := null ;
4951             open ben_plan_design_program_module.g_table_route('PCP');
4952             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
4953             close ben_plan_design_program_module.g_table_route ;
4954             --
4955             l_information5 := fnd_message.get_string('BEN','BEN_93292_PDC_PCP_DSGN_CD') ||' - '||
4956                               hr_general.decode_lookup('BEN_PCP_DSGN',l_pcp_rec.pcp_dsgn_cd) ||' - '||
4957                               fnd_message.get_string('BEN','BEN_93293_PDC_PCP_DPNT_DSGN_CD') ||' - '||
4958                               hr_general.decode_lookup('BEN_PCP_DSGN',l_pcp_rec.pcp_dpnt_dsgn_cd); --'Intersection
4959             --
4960             l_result_type_cd := 'DISPLAY';
4961             --
4962             l_copy_entity_result_id := null;
4963             l_object_version_number := null;
4964             ben_copy_entity_results_api.create_copy_entity_results(
4965                  p_copy_entity_result_id           => l_copy_entity_result_id,
4966                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
4967                  p_result_type_cd                 => l_result_type_cd,
4968 		 p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
4969                  p_parent_entity_result_id        => l_parent_entity_result_id,
4970                  p_number_of_copies               => l_number_of_copies,
4971                  p_table_alias					 => 'PCP',
4972                  p_table_route_id                 => l_table_route_id,
4973                  p_information1     => l_pcp_rec.pl_pcp_id,
4974                  p_information2     => null,
4975                  p_information3     => null,
4976                  p_information4     => l_pcp_rec.business_group_id,
4977                  p_information5     => l_information5 , -- 9999 put name for h-grid
4978                  p_information10     => l_pln_esd,
4979                  p_information111     => l_pcp_rec.pcp_attribute1,
4980                  p_information120     => l_pcp_rec.pcp_attribute10,
4981                  p_information121     => l_pcp_rec.pcp_attribute11,
4982                  p_information122     => l_pcp_rec.pcp_attribute12,
4983                  p_information123     => l_pcp_rec.pcp_attribute13,
4984                  p_information124     => l_pcp_rec.pcp_attribute14,
4985                  p_information125     => l_pcp_rec.pcp_attribute15,
4986                  p_information126     => l_pcp_rec.pcp_attribute16,
4987                  p_information127     => l_pcp_rec.pcp_attribute17,
4988                  p_information128     => l_pcp_rec.pcp_attribute18,
4989                  p_information129     => l_pcp_rec.pcp_attribute19,
4990                  p_information112     => l_pcp_rec.pcp_attribute2,
4991                  p_information130     => l_pcp_rec.pcp_attribute20,
4992                  p_information131     => l_pcp_rec.pcp_attribute21,
4993                  p_information132     => l_pcp_rec.pcp_attribute22,
4994                  p_information133     => l_pcp_rec.pcp_attribute23,
4995                  p_information134     => l_pcp_rec.pcp_attribute24,
4996                  p_information135     => l_pcp_rec.pcp_attribute25,
4997                  p_information136     => l_pcp_rec.pcp_attribute26,
4998                  p_information137     => l_pcp_rec.pcp_attribute27,
4999                  p_information138     => l_pcp_rec.pcp_attribute28,
5000                  p_information139     => l_pcp_rec.pcp_attribute29,
5001                  p_information113     => l_pcp_rec.pcp_attribute3,
5002                  p_information140     => l_pcp_rec.pcp_attribute30,
5003                  p_information114     => l_pcp_rec.pcp_attribute4,
5004                  p_information115     => l_pcp_rec.pcp_attribute5,
5005                  p_information116     => l_pcp_rec.pcp_attribute6,
5006                  p_information117     => l_pcp_rec.pcp_attribute7,
5007                  p_information118     => l_pcp_rec.pcp_attribute8,
5008                  p_information119     => l_pcp_rec.pcp_attribute9,
5009                  p_information110     => l_pcp_rec.pcp_attribute_category,
5010                  p_information15     => l_pcp_rec.pcp_can_keep_flag,
5011                  p_information13     => l_pcp_rec.pcp_dpnt_dsgn_cd,
5012                  p_information12     => l_pcp_rec.pcp_dsgn_cd,
5013                  p_information294     => l_pcp_rec.pcp_num_chgs,
5014                  p_information18     => l_pcp_rec.pcp_num_chgs_uom,
5015                  p_information293     => l_pcp_rec.pcp_radius,
5016                  p_information16     => l_pcp_rec.pcp_radius_uom,
5017                  p_information17     => l_pcp_rec.pcp_radius_warn_flag,
5018                  p_information14     => l_pcp_rec.pcp_rpstry_flag,
5019                  p_information11     => l_pcp_rec.pcp_strt_dt_cd,
5020                  p_information261     => l_pcp_rec.pl_id,
5021                  p_information265     => l_pcp_rec.object_version_number,
5022                  p_object_version_number          => l_object_version_number,
5023                  p_effective_date                 => p_effective_date       );
5024             --
5025 
5026             if l_out_pcp_result_id is null then
5027               l_out_pcp_result_id := l_copy_entity_result_id;
5028             end if;
5029 
5030             if l_result_type_cd = 'DISPLAY' then
5031               l_out_pcp_result_id := l_copy_entity_result_id ;
5032             end if;
5033             --
5034 
5035           end loop;
5036         --
5037         end loop;
5038      ---------------------------------------------------------------
5039      -- END OF BEN_PL_PCP ----------------------
5040      ---------------------------------------------------------------
5041      ---------------------------------------------------------------
5042      -- START OF BEN_PL_PCP_TYP ----------------------
5043      ---------------------------------------------------------------
5044      --
5045      for l_parent_rec  in c_pty_from_parent(l_PL_PCP_ID) loop
5046         --
5047         l_mirror_src_entity_result_id := l_out_pcp_result_id ;
5048         --
5049         l_pl_pcp_typ_id := l_parent_rec.pl_pcp_typ_id ;
5050         --
5051         for l_pty_rec in c_pty(l_parent_rec.pl_pcp_typ_id,l_mirror_src_entity_result_id,'PTY') loop
5052           --
5053           l_table_route_id := null ;
5054           open ben_plan_design_program_module.g_table_route('PTY');
5055             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
5056           close ben_plan_design_program_module.g_table_route ;
5057           --
5058           l_information5  := hr_general.decode_lookup('BEN_PCP_SPCLTY',l_pty_rec.pcp_typ_cd); --'Intersection
5059           --
5060           l_result_type_cd := 'DISPLAY';
5061             --
5062           l_copy_entity_result_id := null;
5063           l_object_version_number := null;
5064           ben_copy_entity_results_api.create_copy_entity_results(
5065             p_copy_entity_result_id           => l_copy_entity_result_id,
5066             p_copy_entity_txn_id             => p_copy_entity_txn_id,
5067             p_result_type_cd                 => l_result_type_cd,
5068             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
5069             p_parent_entity_result_id      => l_mirror_src_entity_result_id,
5070             p_number_of_copies               => l_number_of_copies,
5071             p_table_alias					 => 'PTY',
5072             p_table_route_id                 => l_table_route_id,
5073             p_information1     => l_pty_rec.pl_pcp_typ_id,
5074             p_information2     => null,
5075             p_information3     => null,
5076             p_information4     => l_pty_rec.business_group_id,
5077             p_information5     => l_information5 , -- 9999 put name for h-grid
5078             p_information12     => l_pty_rec.gndr_alwd_cd,
5079             p_information294     => l_pty_rec.max_age,
5080             p_information293     => l_pty_rec.min_age,
5081             p_information11     => l_pty_rec.pcp_typ_cd,
5082             p_information257     => l_pty_rec.pl_pcp_id,
5083             p_information111     => l_pty_rec.pty_attribute1,
5084             p_information120     => l_pty_rec.pty_attribute10,
5085             p_information121     => l_pty_rec.pty_attribute11,
5086             p_information122     => l_pty_rec.pty_attribute12,
5087             p_information123     => l_pty_rec.pty_attribute13,
5088             p_information124     => l_pty_rec.pty_attribute14,
5089             p_information125     => l_pty_rec.pty_attribute15,
5090             p_information126     => l_pty_rec.pty_attribute16,
5091             p_information127     => l_pty_rec.pty_attribute17,
5092             p_information128     => l_pty_rec.pty_attribute18,
5093             p_information129     => l_pty_rec.pty_attribute19,
5094             p_information112     => l_pty_rec.pty_attribute2,
5095             p_information130     => l_pty_rec.pty_attribute20,
5096             p_information131     => l_pty_rec.pty_attribute21,
5097             p_information132     => l_pty_rec.pty_attribute22,
5098             p_information133     => l_pty_rec.pty_attribute23,
5099             p_information134     => l_pty_rec.pty_attribute24,
5100             p_information135     => l_pty_rec.pty_attribute25,
5101             p_information136     => l_pty_rec.pty_attribute26,
5102             p_information137     => l_pty_rec.pty_attribute27,
5103             p_information138     => l_pty_rec.pty_attribute28,
5104             p_information139     => l_pty_rec.pty_attribute29,
5105             p_information113     => l_pty_rec.pty_attribute3,
5106             p_information140     => l_pty_rec.pty_attribute30,
5107             p_information114     => l_pty_rec.pty_attribute4,
5108             p_information115     => l_pty_rec.pty_attribute5,
5109             p_information116     => l_pty_rec.pty_attribute6,
5110             p_information117     => l_pty_rec.pty_attribute7,
5111             p_information118     => l_pty_rec.pty_attribute8,
5112             p_information119     => l_pty_rec.pty_attribute9,
5113             p_information110     => l_pty_rec.pty_attribute_category,
5114             p_information265     => l_pty_rec.object_version_number,
5115             p_object_version_number          => l_object_version_number,
5116             p_effective_date                 => p_effective_date       );
5117             --
5118 
5119             if l_out_pty_result_id is null then
5120               l_out_pty_result_id := l_copy_entity_result_id;
5121             end if;
5122 
5123             if l_result_type_cd = 'DISPLAY' then
5124                l_out_pty_result_id := l_copy_entity_result_id ;
5125             end if;
5126             --
5127          end loop;
5128          --
5129        end loop;
5130      ---------------------------------------------------------------
5131      -- END OF BEN_PL_PCP_TYP ----------------------
5132      ---------------------------------------------------------------
5133      ---------------------------------------------------------------
5134      -- START OF BEN_PL_BNF_CTFN_F ----------------------
5135      ---------------------------------------------------------------
5136       --
5137       --
5138       for l_parent_rec  in c_pcx_from_parent(l_PL_ID) loop
5139       --
5140         l_mirror_src_entity_result_id := l_out_pln_result_id;
5141         l_parent_entity_result_id := l_out_pln_cpp_result_id;
5142 
5143         l_pl_bnf_ctfn_id := l_parent_rec.pl_bnf_ctfn_id ;
5144         --
5145         for l_pcx_rec in c_pcx(l_parent_rec.pl_bnf_ctfn_id,l_mirror_src_entity_result_id,'PCX') loop
5146         --
5147             l_table_route_id := null ;
5148             open ben_plan_design_program_module.g_table_route('PCX');
5149             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
5150             close ben_plan_design_program_module.g_table_route ;
5151             --
5152             l_information5 := hr_general.decode_lookup('BEN_BNF_CTFN_TYP',l_pcx_rec.bnf_ctfn_typ_cd); --'Intersection
5153             --
5154             if p_effective_date between l_pcx_rec.effective_start_date
5155                 and l_pcx_rec.effective_end_date then
5156                 --
5157                 l_result_type_cd := 'DISPLAY';
5158             else
5159                 l_result_type_cd := 'NO DISPLAY';
5160             end if;
5161             --
5162             l_copy_entity_result_id := null;
5163             l_object_version_number := null;
5164             ben_copy_entity_results_api.create_copy_entity_results(
5165                  p_copy_entity_result_id           => l_copy_entity_result_id,
5166                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
5167                  p_result_type_cd                 => l_result_type_cd,
5168 		     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
5169                  p_parent_entity_result_id        => l_parent_entity_result_id,
5170                  p_number_of_copies               => l_number_of_copies,
5171                  p_table_alias					 => 'PCX',
5172                  p_table_route_id                 => l_table_route_id,
5173                  p_information1     => l_pcx_rec.pl_bnf_ctfn_id,
5174                  p_information2     => l_pcx_rec.EFFECTIVE_START_DATE,
5175                  p_information3     => l_pcx_rec.EFFECTIVE_END_DATE,
5176                  p_information4     => l_pcx_rec.business_group_id,
5177                  p_information5     => l_information5 , -- 9999 put name for h-grid
5178                  p_information11     => l_pcx_rec.bnf_ctfn_typ_cd,
5179                  p_information15     => l_pcx_rec.bnf_typ_cd,
5180                  p_information260     => l_pcx_rec.ctfn_rqd_when_rl,
5181                  p_information12     => l_pcx_rec.lack_ctfn_sspnd_enrt_flag,
5182                  p_information111     => l_pcx_rec.pcx_attribute1,
5183                  p_information120     => l_pcx_rec.pcx_attribute10,
5184                  p_information121     => l_pcx_rec.pcx_attribute11,
5185                  p_information122     => l_pcx_rec.pcx_attribute12,
5186                  p_information123     => l_pcx_rec.pcx_attribute13,
5187                  p_information124     => l_pcx_rec.pcx_attribute14,
5188                  p_information125     => l_pcx_rec.pcx_attribute15,
5189                  p_information126     => l_pcx_rec.pcx_attribute16,
5190                  p_information127     => l_pcx_rec.pcx_attribute17,
5191                  p_information128     => l_pcx_rec.pcx_attribute18,
5192                  p_information129     => l_pcx_rec.pcx_attribute19,
5193                  p_information112     => l_pcx_rec.pcx_attribute2,
5194                  p_information130     => l_pcx_rec.pcx_attribute20,
5195                  p_information131     => l_pcx_rec.pcx_attribute21,
5196                  p_information132     => l_pcx_rec.pcx_attribute22,
5197                  p_information133     => l_pcx_rec.pcx_attribute23,
5198                  p_information134     => l_pcx_rec.pcx_attribute24,
5199                  p_information135     => l_pcx_rec.pcx_attribute25,
5200                  p_information136     => l_pcx_rec.pcx_attribute26,
5201                  p_information137     => l_pcx_rec.pcx_attribute27,
5202                  p_information138     => l_pcx_rec.pcx_attribute28,
5203                  p_information139     => l_pcx_rec.pcx_attribute29,
5204                  p_information113     => l_pcx_rec.pcx_attribute3,
5205                  p_information140     => l_pcx_rec.pcx_attribute30,
5206                  p_information114     => l_pcx_rec.pcx_attribute4,
5207                  p_information115     => l_pcx_rec.pcx_attribute5,
5208                  p_information116     => l_pcx_rec.pcx_attribute6,
5209                  p_information117     => l_pcx_rec.pcx_attribute7,
5210                  p_information118     => l_pcx_rec.pcx_attribute8,
5211                  p_information119     => l_pcx_rec.pcx_attribute9,
5212                  p_information110     => l_pcx_rec.pcx_attribute_category,
5213                  p_information13     => l_pcx_rec.pfd_flag,
5214                  p_information261     => l_pcx_rec.pl_id,
5215                  p_information16     => l_pcx_rec.rlshp_typ_cd,
5216                  p_information14     => l_pcx_rec.rqd_flag,
5217                  p_information265     => l_pcx_rec.object_version_number,
5218                  p_object_version_number          => l_object_version_number,
5219                  p_effective_date                 => p_effective_date       );
5220           --
5221 
5222                  if l_out_pcx_result_id is null then
5223                    l_out_pcx_result_id := l_copy_entity_result_id;
5224                  end if;
5225 
5226                  if l_result_type_cd = 'DISPLAY' then
5227                    l_out_pcx_result_id := l_copy_entity_result_id ;
5228                  end if;
5229 				  if (l_pcx_rec.ctfn_rqd_when_rl is not null) then
5230 					   ben_plan_design_program_module.create_formula_result(
5231 							p_validate                       => p_validate
5232 							,p_copy_entity_result_id  => l_copy_entity_result_id
5233 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
5234 							,p_formula_id                  => l_pcx_rec.ctfn_rqd_when_rl
5235 							,p_business_group_id        => l_pcx_rec.business_group_id
5236 							,p_number_of_copies         =>  l_number_of_copies
5237 							,p_object_version_number  => l_object_version_number
5238 							,p_effective_date             => p_effective_date);
5239 					end if;
5240 
5241           --
5242           end loop;
5243         --
5244         end loop;
5245      ---------------------------------------------------------------
5246      -- END OF BEN_PL_BNF_CTFN_F ----------------------
5247      ---------------------------------------------------------------
5248      ---------------------------------------------------------------
5249      -- START OF BEN_PL_DPNT_CVG_CTFN_F ----------------------
5250      ---------------------------------------------------------------
5251       --
5252       --
5253       for l_parent_rec  in c_pnd_from_parent(l_PL_ID) loop
5254       --
5255         l_mirror_src_entity_result_id := l_out_pln_result_id;
5256         l_parent_entity_result_id := l_out_pln_cpp_result_id;
5257 
5258         l_pl_dpnt_cvg_ctfn_id := l_parent_rec.pl_dpnt_cvg_ctfn_id ;
5259         --
5260         for l_pnd_rec in c_pnd(l_parent_rec.pl_dpnt_cvg_ctfn_id,l_mirror_src_entity_result_id,'PND') loop
5261         --
5262             l_table_route_id := null ;
5263             open ben_plan_design_program_module.g_table_route('PND');
5264             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
5265             close ben_plan_design_program_module.g_table_route ;
5266             --
5267             l_information5 := hr_general.decode_lookup('BEN_DPNT_CVG_CTFN_TYP',l_pnd_rec.dpnt_cvg_ctfn_typ_cd); --'Intersection
5268             --
5269             if p_effective_date between l_pnd_rec.effective_start_date
5270                 and l_pnd_rec.effective_end_date then
5271                 --
5272                 l_result_type_cd := 'DISPLAY';
5273             else
5274                 l_result_type_cd := 'NO DISPLAY';
5275             end if;
5276             --
5277             l_copy_entity_result_id := null;
5278             l_object_version_number := null;
5279             ben_copy_entity_results_api.create_copy_entity_results(
5280                  p_copy_entity_result_id           => l_copy_entity_result_id,
5281                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
5282                  p_result_type_cd                 => l_result_type_cd,
5283 	         p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
5284                  p_parent_entity_result_id        => l_parent_entity_result_id,
5285                  p_number_of_copies               => l_number_of_copies,
5286                  p_table_alias					 => 'PND',
5287                  p_table_route_id                 => l_table_route_id,
5288                  p_information1     => l_pnd_rec.pl_dpnt_cvg_ctfn_id,
5289                  p_information2     => l_pnd_rec.EFFECTIVE_START_DATE,
5290                  p_information3     => l_pnd_rec.EFFECTIVE_END_DATE,
5291                  p_information4     => l_pnd_rec.business_group_id,
5292                  p_information5     => l_information5 , -- 9999 put name for h-grid
5293                  p_information257     => l_pnd_rec.ctfn_rqd_when_rl,
5294                  p_information13     => l_pnd_rec.dpnt_cvg_ctfn_typ_cd,
5295                  p_information12     => l_pnd_rec.lack_ctfn_sspnd_enrt_flag,
5296                  p_information11     => l_pnd_rec.pfd_flag,
5297                  p_information261     => l_pnd_rec.pl_id,
5298                  p_information111     => l_pnd_rec.pnd_attribute1,
5299                  p_information120     => l_pnd_rec.pnd_attribute10,
5300                  p_information121     => l_pnd_rec.pnd_attribute11,
5301                  p_information122     => l_pnd_rec.pnd_attribute12,
5302                  p_information123     => l_pnd_rec.pnd_attribute13,
5303                  p_information124     => l_pnd_rec.pnd_attribute14,
5304                  p_information125     => l_pnd_rec.pnd_attribute15,
5305                  p_information126     => l_pnd_rec.pnd_attribute16,
5306                  p_information127     => l_pnd_rec.pnd_attribute17,
5307                  p_information128     => l_pnd_rec.pnd_attribute18,
5308                  p_information129     => l_pnd_rec.pnd_attribute19,
5309                  p_information112     => l_pnd_rec.pnd_attribute2,
5310                  p_information130     => l_pnd_rec.pnd_attribute20,
5311                  p_information131     => l_pnd_rec.pnd_attribute21,
5312                  p_information132     => l_pnd_rec.pnd_attribute22,
5313                  p_information133     => l_pnd_rec.pnd_attribute23,
5314                  p_information134     => l_pnd_rec.pnd_attribute24,
5315                  p_information135     => l_pnd_rec.pnd_attribute25,
5316                  p_information136     => l_pnd_rec.pnd_attribute26,
5317                  p_information137     => l_pnd_rec.pnd_attribute27,
5318                  p_information138     => l_pnd_rec.pnd_attribute28,
5319                  p_information139     => l_pnd_rec.pnd_attribute29,
5320                  p_information113     => l_pnd_rec.pnd_attribute3,
5321                  p_information140     => l_pnd_rec.pnd_attribute30,
5322                  p_information114     => l_pnd_rec.pnd_attribute4,
5323                  p_information115     => l_pnd_rec.pnd_attribute5,
5324                  p_information116     => l_pnd_rec.pnd_attribute6,
5325                  p_information117     => l_pnd_rec.pnd_attribute7,
5326                  p_information118     => l_pnd_rec.pnd_attribute8,
5327                  p_information119     => l_pnd_rec.pnd_attribute9,
5328                  p_information110     => l_pnd_rec.pnd_attribute_category,
5329                  p_information15     => l_pnd_rec.rlshp_typ_cd,
5330                  p_information14     => l_pnd_rec.rqd_flag,
5331                  p_information265     => l_pnd_rec.object_version_number,
5332                  p_object_version_number          => l_object_version_number,
5333                  p_effective_date                 => p_effective_date       );
5334           --
5335 
5336                  if l_out_pnd_result_id is null then
5337                    l_out_pnd_result_id := l_copy_entity_result_id;
5338                  end if;
5339 
5340                  if l_result_type_cd = 'DISPLAY' then
5341                    l_out_pnd_result_id := l_copy_entity_result_id ;
5342                  end if;
5343 
5344 				  if (l_pnd_rec.ctfn_rqd_when_rl is not null) then
5345 					   ben_plan_design_program_module.create_formula_result(
5346 							p_validate                       => p_validate
5347 							,p_copy_entity_result_id  => l_copy_entity_result_id
5348 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
5349 							,p_formula_id                  => l_pnd_rec.ctfn_rqd_when_rl
5350 							,p_business_group_id        => l_pnd_rec.business_group_id
5351 							,p_number_of_copies         =>  l_number_of_copies
5352 							,p_object_version_number  => l_object_version_number
5353 							,p_effective_date             => p_effective_date);
5354 					end if;
5355 
5356           --
5357           end loop;
5358         --
5359         end loop;
5360      ---------------------------------------------------------------
5361      -- END OF BEN_PL_DPNT_CVG_CTFN_F ----------------------
5362      ---------------------------------------------------------------
5363      ---------------------------------------------------------------
5364      ---------------------------------------------------------------
5365      -- START OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
5366      ---------------------------------------------------------------
5367       --
5368       --
5369       for l_parent_rec  in c_peo_from_parent(l_PL_ID) loop
5370       --
5371         l_mirror_src_entity_result_id := l_out_pln_result_id;
5372         l_parent_entity_result_id := l_out_pln_cpp_result_id;
5373 
5374         l_elig_to_prte_rsn_id := l_parent_rec.elig_to_prte_rsn_id ;
5375         --
5376         for l_peo_rec in c_peo(l_parent_rec.elig_to_prte_rsn_id,l_mirror_src_entity_result_id,'PEO') loop
5377         --
5378             l_table_route_id := null ;
5379             open ben_plan_design_program_module.g_table_route('PEO');
5380             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
5381             close ben_plan_design_program_module.g_table_route ;
5382             --
5383             l_information5 := ben_plan_design_program_module.get_ler_name(l_peo_rec.ler_id,p_effective_date); --'Intersection';
5384             --
5385             if p_effective_date between l_peo_rec.effective_start_date
5386                 and l_peo_rec.effective_end_date then
5387                 --
5388                 l_result_type_cd := 'DISPLAY';
5389             else
5390                 l_result_type_cd := 'NO DISPLAY';
5391             end if;
5392             --
5393             l_copy_entity_result_id := null;
5394             l_object_version_number := null;
5395             ben_copy_entity_results_api.create_copy_entity_results(
5396                  p_copy_entity_result_id           => l_copy_entity_result_id,
5397                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
5398                  p_result_type_cd                 => l_result_type_cd,
5399 		     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
5400                  p_parent_entity_result_id        => l_parent_entity_result_id,
5401                  p_number_of_copies               => l_number_of_copies,
5402                  p_table_alias					 => 'PEO',
5403                  p_table_route_id                 => l_table_route_id,
5404                  p_information1     => l_peo_rec.elig_to_prte_rsn_id,
5405                  p_information2     => l_peo_rec.EFFECTIVE_START_DATE,
5406                  p_information3     => l_peo_rec.EFFECTIVE_END_DATE,
5407                  p_information4     => l_peo_rec.business_group_id,
5408                  p_information5     => l_information5 , -- 9999 put name for h-grid
5409                  p_information21     => l_peo_rec.elig_inelig_cd,
5410                  p_information20     => l_peo_rec.ignr_prtn_ovrid_flag,
5411                  p_information257     => l_peo_rec.ler_id,
5412                  p_information17     => l_peo_rec.mx_poe_apls_cd,
5413                  p_information16     => l_peo_rec.mx_poe_det_dt_cd,
5414                  p_information272     => l_peo_rec.mx_poe_det_dt_rl,
5415                  p_information270     => l_peo_rec.mx_poe_rl,
5416                  p_information15     => l_peo_rec.mx_poe_uom,
5417                  p_information269     => l_peo_rec.mx_poe_val,
5418                  p_information258     => l_peo_rec.oipl_id,
5419                  p_information111     => l_peo_rec.peo_attribute1,
5420                  p_information120     => l_peo_rec.peo_attribute10,
5421                  p_information121     => l_peo_rec.peo_attribute11,
5422                  p_information122     => l_peo_rec.peo_attribute12,
5423                  p_information123     => l_peo_rec.peo_attribute13,
5424                  p_information124     => l_peo_rec.peo_attribute14,
5425                  p_information125     => l_peo_rec.peo_attribute15,
5426                  p_information126     => l_peo_rec.peo_attribute16,
5427                  p_information127     => l_peo_rec.peo_attribute17,
5428                  p_information128     => l_peo_rec.peo_attribute18,
5429                  p_information129     => l_peo_rec.peo_attribute19,
5430                  p_information112     => l_peo_rec.peo_attribute2,
5431                  p_information130     => l_peo_rec.peo_attribute20,
5432                  p_information131     => l_peo_rec.peo_attribute21,
5433                  p_information132     => l_peo_rec.peo_attribute22,
5434                  p_information133     => l_peo_rec.peo_attribute23,
5435                  p_information134     => l_peo_rec.peo_attribute24,
5436                  p_information135     => l_peo_rec.peo_attribute25,
5437                  p_information136     => l_peo_rec.peo_attribute26,
5438                  p_information137     => l_peo_rec.peo_attribute27,
5439                  p_information138     => l_peo_rec.peo_attribute28,
5440                  p_information139     => l_peo_rec.peo_attribute29,
5441                  p_information113     => l_peo_rec.peo_attribute3,
5442                  p_information140     => l_peo_rec.peo_attribute30,
5443                  p_information114     => l_peo_rec.peo_attribute4,
5444                  p_information115     => l_peo_rec.peo_attribute5,
5445                  p_information116     => l_peo_rec.peo_attribute6,
5446                  p_information117     => l_peo_rec.peo_attribute7,
5447                  p_information118     => l_peo_rec.peo_attribute8,
5448                  p_information119     => l_peo_rec.peo_attribute9,
5449                  p_information110     => l_peo_rec.peo_attribute_category,
5450                  p_information260     => l_peo_rec.pgm_id,
5451                  p_information261     => l_peo_rec.pl_id,
5452                  p_information256     => l_peo_rec.plip_id,
5453                  p_information12     => l_peo_rec.prtn_eff_end_dt_cd,
5454                  p_information266     => l_peo_rec.prtn_eff_end_dt_rl,
5455                  p_information11     => l_peo_rec.prtn_eff_strt_dt_cd,
5456                  p_information264     => l_peo_rec.prtn_eff_strt_dt_rl,
5457                  p_information19     => l_peo_rec.prtn_ovridbl_flag,
5458                  p_information259     => l_peo_rec.ptip_id,
5459                  p_information18     => l_peo_rec.vrfy_fmly_mmbr_cd,
5460                  p_information273     => l_peo_rec.vrfy_fmly_mmbr_rl,
5461                  p_information14     => l_peo_rec.wait_perd_dt_to_use_cd,
5462                  p_information268     => l_peo_rec.wait_perd_dt_to_use_rl,
5463                  p_information271     => l_peo_rec.wait_perd_rl,
5464                  p_information13     => l_peo_rec.wait_perd_uom,
5465                  p_information267     => l_peo_rec.wait_perd_val,
5466                  p_information265     => l_peo_rec.object_version_number,
5467                  p_object_version_number          => l_object_version_number,
5468                  p_effective_date                 => p_effective_date       );
5469           --
5470 
5471                  if l_out_peo_result_id is null then
5472                    l_out_peo_result_id := l_copy_entity_result_id;
5473                  end if;
5474 
5475                  if l_result_type_cd = 'DISPLAY' then
5476                    l_out_peo_result_id := l_copy_entity_result_id ;
5477                  end if;
5478 
5479 				  if (l_peo_rec.mx_poe_det_dt_rl is not null) then
5480 					   ben_plan_design_program_module.create_formula_result(
5481 							p_validate                       => p_validate
5482 							,p_copy_entity_result_id  => l_copy_entity_result_id
5483 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
5484 							,p_formula_id                  =>  l_peo_rec.mx_poe_det_dt_rl
5485 							,p_business_group_id        =>  l_peo_rec.business_group_id
5486 							,p_number_of_copies         =>  l_number_of_copies
5487 							,p_object_version_number  => l_object_version_number
5488 							,p_effective_date             => p_effective_date);
5489 					end if;
5490 
5491 				  if (l_peo_rec.mx_poe_rl is not null) then
5492 					   ben_plan_design_program_module.create_formula_result(
5493 							p_validate                       => p_validate
5494 							,p_copy_entity_result_id  => l_copy_entity_result_id
5495 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
5496 							,p_formula_id                  =>  l_peo_rec.mx_poe_rl
5497 							,p_business_group_id        =>  l_peo_rec.business_group_id
5498 							,p_number_of_copies         =>  l_number_of_copies
5499 							,p_object_version_number  => l_object_version_number
5500 							,p_effective_date             => p_effective_date);
5501 					end if;
5502 
5503 				  if (l_peo_rec.prtn_eff_end_dt_rl is not null) then
5504 					   ben_plan_design_program_module.create_formula_result(
5505 							p_validate                       => p_validate
5506 							,p_copy_entity_result_id  => l_copy_entity_result_id
5507 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
5508 							,p_formula_id                  => l_peo_rec.prtn_eff_end_dt_rl
5509 							,p_business_group_id        => l_peo_rec.business_group_id
5510 							,p_number_of_copies         =>  l_number_of_copies
5511 							,p_object_version_number  => l_object_version_number
5512 							,p_effective_date             => p_effective_date);
5513 					end if;
5514 
5515 				  if (l_peo_rec.prtn_eff_strt_dt_rl is not null) then
5516 					   ben_plan_design_program_module.create_formula_result(
5517 							p_validate                       => p_validate
5518 							,p_copy_entity_result_id  => l_copy_entity_result_id
5519 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
5520 							,p_formula_id                  => l_peo_rec.prtn_eff_strt_dt_rl
5521 							,p_business_group_id        =>  l_peo_rec.business_group_id
5522 							,p_number_of_copies         =>  l_number_of_copies
5523 							,p_object_version_number  => l_object_version_number
5524 							,p_effective_date             => p_effective_date);
5525 					end if;
5526 
5527 				  if (l_peo_rec.vrfy_fmly_mmbr_rl is not null) then
5528 					   ben_plan_design_program_module.create_formula_result(
5529 							p_validate                       => p_validate
5530 							,p_copy_entity_result_id  => l_copy_entity_result_id
5531 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
5532 							,p_formula_id                  => l_peo_rec.vrfy_fmly_mmbr_rl
5533 							,p_business_group_id        => l_peo_rec.business_group_id
5534 							,p_number_of_copies         =>  l_number_of_copies
5535 							,p_object_version_number  => l_object_version_number
5536 							,p_effective_date             => p_effective_date);
5537 					end if;
5538 
5539 				  if (l_peo_rec.wait_perd_dt_to_use_rl is not null) then
5540 					   ben_plan_design_program_module.create_formula_result(
5541 							p_validate                       => p_validate
5542 							,p_copy_entity_result_id  => l_copy_entity_result_id
5543 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
5544 							,p_formula_id                  =>  l_peo_rec.wait_perd_dt_to_use_rl
5545 							,p_business_group_id        =>  l_peo_rec.business_group_id
5546 							,p_number_of_copies         =>  l_number_of_copies
5547 							,p_object_version_number  => l_object_version_number
5548 							,p_effective_date             => p_effective_date);
5549 					end if;
5550 
5551 				  if (l_peo_rec.wait_perd_rl is not null) then
5552 					   ben_plan_design_program_module.create_formula_result(
5553 							p_validate                       => p_validate
5554 							,p_copy_entity_result_id  => l_copy_entity_result_id
5555 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
5556 							,p_formula_id                  => l_peo_rec.wait_perd_rl
5557 							,p_business_group_id        => l_peo_rec.business_group_id
5558 							,p_number_of_copies         =>  l_number_of_copies
5559 							,p_object_version_number  => l_object_version_number
5560 							,p_effective_date             => p_effective_date);
5561 					end if;
5562             --
5563             ben_plan_design_plan_module.create_ler_result (
5564                p_validate                       => p_validate
5565               ,p_copy_entity_result_id          => l_copy_entity_result_id
5566               ,p_copy_entity_txn_id             => p_copy_entity_txn_id
5567               ,p_ler_id                         => l_peo_rec.ler_id
5568               ,p_business_group_id              => p_business_group_id
5569               ,p_number_of_copies               => l_number_of_copies
5570               ,p_object_version_number          => l_object_version_number
5571               ,p_effective_date                 => p_effective_date
5572               );
5573 
5574           --
5575           end loop;
5576         --
5577         end loop;
5578         ---------------------------------------------------------------
5579         -- END OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
5580         ---------------------------------------------------------------
5581         ---------------------------------------------------------------
5582         -- START OF BEN_DSGN_RQMT_F ----------------------
5583         ---------------------------------------------------------------
5584           --
5585           for l_parent_rec  in c_ddr3_from_parent(l_PL_ID) loop
5586           --
5587             l_mirror_src_entity_result_id := l_out_pln_result_id;
5588             l_parent_entity_result_id := l_out_pln_cpp_result_id;
5589 
5590             --
5591             l_dsgn_rqmt_id := l_parent_rec.dsgn_rqmt_id ;
5592             --
5593             l_ddr3_dsgn_rqmt_esd := null;
5594             --
5595             for l_ddr_rec in c_ddr3(l_parent_rec.dsgn_rqmt_id,l_mirror_src_entity_result_id,'DDR') loop
5596             --
5597               l_table_route_id := null ;
5598               open ben_plan_design_program_module.g_table_route('DDR');
5599               fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
5600               close ben_plan_design_program_module.g_table_route ;
5601               --
5602               l_information5  := hr_general.decode_lookup('BEN_GRP_RLSHP',l_ddr_rec.grp_rlshp_cd); --'Intersection';
5603               --
5604               if p_effective_date between l_ddr_rec.effective_start_date
5605               and l_ddr_rec.effective_end_date then
5606               --
5607                 l_result_type_cd := 'DISPLAY';
5608               else
5609                 l_result_type_cd := 'NO DISPLAY';
5610               end if;
5611               --
5612               l_copy_entity_result_id := null;
5613               l_object_version_number := null;
5614               ben_copy_entity_results_api.create_copy_entity_results(
5615                     p_copy_entity_result_id          => l_copy_entity_result_id,
5616                     p_copy_entity_txn_id             => p_copy_entity_txn_id,
5617                     p_result_type_cd                 => l_result_type_cd,
5618                     p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
5619                     p_parent_entity_result_id        => l_parent_entity_result_id,
5620                     p_number_of_copies               => l_number_of_copies,
5621                     p_table_alias					 => 'DDR',
5622                     p_table_route_id                 => l_table_route_id,
5623                     p_information1     => l_ddr_rec.dsgn_rqmt_id,
5624                     p_information2     => l_ddr_rec.EFFECTIVE_START_DATE,
5625                     p_information3     => l_ddr_rec.EFFECTIVE_END_DATE,
5626                     p_information4     => l_ddr_rec.business_group_id,
5627                     p_information5     => l_information5 , -- 9999 put name for h-grid
5628                     p_information13     => l_ddr_rec.cvr_all_elig_flag,
5629                     p_information111     => l_ddr_rec.ddr_attribute1,
5630                     p_information120     => l_ddr_rec.ddr_attribute10,
5631                     p_information121     => l_ddr_rec.ddr_attribute11,
5632                     p_information122     => l_ddr_rec.ddr_attribute12,
5633                     p_information123     => l_ddr_rec.ddr_attribute13,
5634                     p_information124     => l_ddr_rec.ddr_attribute14,
5635                     p_information125     => l_ddr_rec.ddr_attribute15,
5636                     p_information126     => l_ddr_rec.ddr_attribute16,
5637                     p_information127     => l_ddr_rec.ddr_attribute17,
5638                     p_information128     => l_ddr_rec.ddr_attribute18,
5639                     p_information129     => l_ddr_rec.ddr_attribute19,
5640                     p_information112     => l_ddr_rec.ddr_attribute2,
5641                     p_information130     => l_ddr_rec.ddr_attribute20,
5642                     p_information131     => l_ddr_rec.ddr_attribute21,
5643                     p_information132     => l_ddr_rec.ddr_attribute22,
5644                     p_information133     => l_ddr_rec.ddr_attribute23,
5645                     p_information134     => l_ddr_rec.ddr_attribute24,
5646                     p_information135     => l_ddr_rec.ddr_attribute25,
5647                     p_information136     => l_ddr_rec.ddr_attribute26,
5648                     p_information137     => l_ddr_rec.ddr_attribute27,
5649                     p_information138     => l_ddr_rec.ddr_attribute28,
5650                     p_information139     => l_ddr_rec.ddr_attribute29,
5651                     p_information113     => l_ddr_rec.ddr_attribute3,
5652                     p_information140     => l_ddr_rec.ddr_attribute30,
5653                     p_information114     => l_ddr_rec.ddr_attribute4,
5654                     p_information115     => l_ddr_rec.ddr_attribute5,
5655                     p_information116     => l_ddr_rec.ddr_attribute6,
5656                     p_information117     => l_ddr_rec.ddr_attribute7,
5657                     p_information118     => l_ddr_rec.ddr_attribute8,
5658                     p_information119     => l_ddr_rec.ddr_attribute9,
5659                     p_information110     => l_ddr_rec.ddr_attribute_category,
5660                     p_information15     => l_ddr_rec.dsgn_typ_cd,
5661                     p_information14     => l_ddr_rec.grp_rlshp_cd,
5662                     p_information262     => l_ddr_rec.mn_dpnts_rqd_num,
5663                     p_information263     => l_ddr_rec.mx_dpnts_alwd_num,
5664                     p_information11     => l_ddr_rec.no_mn_num_dfnd_flag,
5665                     p_information12     => l_ddr_rec.no_mx_num_dfnd_flag,
5666                     p_information258     => l_ddr_rec.oipl_id,
5667                     p_information247     => l_ddr_rec.opt_id,
5668                     p_information261     => l_ddr_rec.pl_id,
5669                     p_information265     => l_ddr_rec.object_version_number,
5670                     p_object_version_number          => l_object_version_number,
5671                     p_effective_date                 => p_effective_date       );
5672                     --
5673 
5674                     if l_out_ddr_result_id is null then
5675                       l_out_ddr_result_id := l_copy_entity_result_id;
5676                     end if;
5677 
5678                     if l_result_type_cd = 'DISPLAY' then
5679                        l_out_ddr_result_id := l_copy_entity_result_id ;
5680                     end if;
5681                     --
5682 
5683                     -- To pass as effective date while creating the
5684                     -- non date-tracked child records
5685                     if l_ddr3_dsgn_rqmt_esd is null then
5686                       l_ddr3_dsgn_rqmt_esd := l_ddr_rec.EFFECTIVE_START_DATE;
5687                     end if;
5688 
5689              end loop;
5690              --
5691              ---------------------------------------------------------------
5692              -- START OF BEN_DSGN_RQMT_RLSHP_TYP ----------------------
5693              ---------------------------------------------------------------
5694              --
5695              for l_parent_rec  in c_drr3_from_parent(l_DSGN_RQMT_ID) loop
5696                 --
5697                 l_mirror_src_entity_result_id := l_out_ddr_result_id ;
5698 
5699                 --
5700                 l_dsgn_rqmt_rlshp_typ_id := l_parent_rec.dsgn_rqmt_rlshp_typ_id ;
5701                 --
5702                 for l_drr_rec in c_drr3(l_parent_rec.dsgn_rqmt_rlshp_typ_id,l_mirror_src_entity_result_id,'DRR') loop
5703                   --
5704                   l_table_route_id := null ;
5705                   open ben_plan_design_program_module.g_table_route('DRR');
5706                     fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
5707                   close ben_plan_design_program_module.g_table_route ;
5708                   --
5709                   l_information5  := hr_general.decode_lookup('CONTACT',l_drr_rec.rlshp_typ_cd); --'Intersection';
5710                   --
5711                   l_result_type_cd := 'DISPLAY';
5712                     --
5713                   l_copy_entity_result_id := null;
5714                   l_object_version_number := null;
5715                   ben_copy_entity_results_api.create_copy_entity_results(
5716                     p_copy_entity_result_id           => l_copy_entity_result_id,
5717                     p_copy_entity_txn_id             => p_copy_entity_txn_id,
5718                     p_result_type_cd                 => l_result_type_cd,
5719                     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
5720                     p_parent_entity_result_id        => l_mirror_src_entity_result_id,
5721                     p_number_of_copies               => l_number_of_copies,
5722                     p_table_alias					 => 'DRR',
5723                     p_table_route_id                 => l_table_route_id,
5724                     p_information1     => l_drr_rec.dsgn_rqmt_rlshp_typ_id,
5725                     p_information2     => null,
5726                     p_information3     => null,
5727                     p_information4     => l_drr_rec.business_group_id,
5728                     p_information5     => l_information5 , -- 9999 put name for h-grid
5729                     p_information10     => l_ddr3_dsgn_rqmt_esd,
5730                     p_information111     => l_drr_rec.drr_attribute1,
5731                     p_information120     => l_drr_rec.drr_attribute10,
5732                     p_information121     => l_drr_rec.drr_attribute11,
5733                     p_information122     => l_drr_rec.drr_attribute12,
5734                     p_information123     => l_drr_rec.drr_attribute13,
5735                     p_information124     => l_drr_rec.drr_attribute14,
5736                     p_information125     => l_drr_rec.drr_attribute15,
5737                     p_information126     => l_drr_rec.drr_attribute16,
5738                     p_information127     => l_drr_rec.drr_attribute17,
5739                     p_information128     => l_drr_rec.drr_attribute18,
5740                     p_information129     => l_drr_rec.drr_attribute19,
5741                     p_information112     => l_drr_rec.drr_attribute2,
5742                     p_information130     => l_drr_rec.drr_attribute20,
5743                     p_information131     => l_drr_rec.drr_attribute21,
5744                     p_information132     => l_drr_rec.drr_attribute22,
5745                     p_information133     => l_drr_rec.drr_attribute23,
5746                     p_information134     => l_drr_rec.drr_attribute24,
5747                     p_information135     => l_drr_rec.drr_attribute25,
5748                     p_information136     => l_drr_rec.drr_attribute26,
5749                     p_information137     => l_drr_rec.drr_attribute27,
5750                     p_information138     => l_drr_rec.drr_attribute28,
5751                     p_information139     => l_drr_rec.drr_attribute29,
5752                     p_information113     => l_drr_rec.drr_attribute3,
5753                     p_information140     => l_drr_rec.drr_attribute30,
5754                     p_information114     => l_drr_rec.drr_attribute4,
5755                     p_information115     => l_drr_rec.drr_attribute5,
5756                     p_information116     => l_drr_rec.drr_attribute6,
5757                     p_information117     => l_drr_rec.drr_attribute7,
5758                     p_information118     => l_drr_rec.drr_attribute8,
5759                     p_information119     => l_drr_rec.drr_attribute9,
5760                     p_information110     => l_drr_rec.drr_attribute_category,
5761                     p_information260     => l_drr_rec.dsgn_rqmt_id,
5762                     p_information11     => l_drr_rec.rlshp_typ_cd,
5763                     p_information265     => l_drr_rec.object_version_number,
5764                     p_object_version_number          => l_object_version_number,
5765                     p_effective_date                 => p_effective_date       );
5766                     --
5767 
5768                     if l_out_drr_result_id is null then
5769                       l_out_drr_result_id := l_copy_entity_result_id;
5770                     end if;
5771 
5772                     if l_result_type_cd = 'DISPLAY' then
5773                        l_out_drr_result_id := l_copy_entity_result_id ;
5774                     end if;
5775                     --
5776                  end loop;
5777                  --
5778              end loop;
5779           ---------------------------------------------------------------
5780           -- END OF BEN_DSGN_RQMT_RLSHP_TYP ----------------------
5781           ---------------------------------------------------------------
5782           end loop;
5783         ---------------------------------------------------------------
5784         -- END OF BEN_DSGN_RQMT_F ----------------------
5785         ---------------------------------------------------------------
5786         for l_parent_rec  in c_cop1_from_parent(l_PL_ID) loop
5787           --
5788           create_oipl_result
5789             (  p_validate                =>p_validate
5790               ,p_copy_entity_result_id   =>l_out_pln_result_id
5791               ,p_copy_entity_txn_id      =>p_copy_entity_txn_id
5792               ,p_oipl_id                 =>l_parent_rec.oipl_id
5793               ,p_business_group_id       =>p_business_group_id
5794               ,p_number_of_copies        =>l_number_of_copies
5795               ,p_object_version_number   =>p_object_version_number
5796               ,p_effective_date          =>p_effective_date
5797               ,p_parent_entity_result_id =>l_out_pln_cpp_result_id
5798               ,p_no_dup_rslt             =>p_no_dup_rslt
5799             );
5800           --
5801         end loop;
5802         --
5803      end if;
5804    --
5805    end loop;
5806   --
5807   -- Return the copy_entity_result_id of Plan row
5808   p_copy_entity_result_id := l_out_pln_result_id;
5809 
5810   hr_utility.set_location('Entering:'|| l_proc, 10);
5811   --
5812   -- Issue a savepoint if operating in validation only mode
5813   --
5814   --
5815   hr_utility.set_location(l_proc, 20);
5816   --
5817   -- Business Group id, effective_date's can't be null
5818   -- pl_id or pgm_id must be supplied.
5819   --
5820   --
5821   hr_utility.set_location('Leaving:'|| l_proc, 10);
5822   --
5823 end create_plan_result;
5824 --
5825 -- Overloaded create_plan_result for Plan Design Wizard
5826 -- This has been overloaded to allow copying Plans to staging area
5827 -- without setting information8 to PLNIP
5828 --
5829 procedure create_plan_result
5830   (
5831    p_validate                       in number        default 0 -- false
5832   ,p_copy_entity_result_id          out nocopy number
5833   ,p_copy_entity_txn_id             in  number    default null
5834   ,p_pl_id                          in  number    default null
5835   ,p_plip_id                        in  number    default null
5836   ,p_business_group_id              in  number    default null
5837   ,p_number_of_copies               in  number    default 0
5838   ,p_object_version_number          out nocopy number
5839   ,p_effective_date                 in date
5840   ,p_no_dup_rslt                    in varchar2   default null
5841   ,p_plan_in_program                in varchar2
5842   )
5843 is
5844   l_copy_entity_result_id number;
5845   l_object_version_number number;
5846 begin
5847 
5848      ben_plan_design_plan_module.create_plan_result
5849        (p_validate                       => p_validate
5850        ,p_copy_entity_result_id          => l_copy_entity_result_id
5851        ,p_copy_entity_txn_id             => p_copy_entity_txn_id
5852        ,p_pl_id                          => p_pl_id
5853        ,p_plip_id                        => p_plip_id
5854        ,p_business_group_id              => p_business_group_id
5855        ,p_number_of_copies               => p_number_of_copies
5856        ,p_object_version_number          => l_object_version_number
5857        ,p_effective_date                 => p_effective_date
5858        ,p_no_dup_rslt                    => p_no_dup_rslt
5859         );
5860 
5861     if p_plan_in_program = 'Y' then
5862       update ben_copy_entity_results
5863       set information8 = NULL
5864       where information1 = p_pl_id
5865       and copy_entity_txn_id = p_copy_entity_txn_id
5866       and table_alias = 'PLN';
5867     end if;
5868 
5869     -- Set out variables
5870     p_copy_entity_result_id := l_copy_entity_result_id;
5871     p_object_version_number := l_object_version_number;
5872 
5873 end create_plan_result;
5874 
5875 procedure create_popl_result
5876   (
5877    p_validate                       in  number     default 0 -- false
5878   ,p_copy_entity_result_id          in  number
5879   ,p_copy_entity_txn_id             in  number    default null
5880   ,p_pgm_id                         in  number    default null
5881   ,p_pl_id                          in  number    default null
5882   ,p_business_group_id              in  number    default null
5883   ,p_number_of_copies               in  number    default 0
5884   ,p_object_version_number          out nocopy number
5885   ,p_effective_date                 in  date
5886   ,p_parent_entity_result_id        in  number
5887   ) is
5888 
5889   l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
5890   l_proc varchar2(72) := g_package||'create_popl_result';
5891   l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
5892    --
5893    l_cv_result_type_cd   varchar2(30) :=  'DISPLAY' ;
5894    --
5895    -- Cursor to get mirror_src_entity_result_id
5896    cursor c_parent_result(c_parent_pk_id number,
5897                         -- c_parent_table_name varchar2,
5898                         c_parent_table_alias varchar2,
5899                         c_copy_entity_txn_id number) is
5900    select copy_entity_result_id mirror_src_entity_result_id
5901    from ben_copy_entity_results cpe
5902 --        pqh_table_route trt
5903    where cpe.information1= c_parent_pk_id
5904    and   cpe.result_type_cd = l_cv_result_type_cd
5905    and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
5906 --   and   cpe.table_route_id = trt.table_route_id
5907    -- and   trt.from_clause = 'OAB'
5908    -- and   trt.where_clause = upper(c_parent_table_name) ;
5909    and cpe.table_alias = c_parent_table_alias;
5910    ---
5911 
5912    --
5913    -- Bug : 3752407 : Global cursor g_table_route will now be used
5914    --
5915    -- Cursor to get table_route_id
5916    -- cursor c_table_route(c_parent_table_alias varchar2) is
5917    -- select table_route_id
5918    -- from pqh_table_route trt
5919    -- where trt.table_alias = c_parent_table_alias;
5920    -- trt.from_clause = 'OAB'
5921    -- and   trt.where_clause = upper(c_parent_table_name) ;
5922    ---
5923    ---
5924 ---------------------------------------------------------------
5925 -- START OF BEN_POPL_ACTN_TYP_F ----------------------
5926 ---------------------------------------------------------------
5927    cursor c_pat_from_parent(c_PL_ID number, c_PGM_ID number ) is
5928    select  popl_actn_typ_id
5929    from BEN_POPL_ACTN_TYP_F
5930    -- where  PL_ID = c_PL_ID ;
5931    where ( c_PL_ID is not null and c_PL_ID = PL_ID ) or
5932          ( c_PGM_ID is not null and c_PGM_ID = PGM_ID);
5933    --
5934    cursor c_pat(c_popl_actn_typ_id number,c_mirror_src_entity_result_id number,
5935                 c_table_alias varchar2) is
5936    select  pat.*
5937    from BEN_POPL_ACTN_TYP_F pat
5938    where  pat.popl_actn_typ_id = c_popl_actn_typ_id
5939      -- and pat.business_group_id = p_business_group_id
5940      and not exists (
5941          select /*+  */ null
5942          from ben_copy_entity_results cpe
5943 --              pqh_table_route trt
5944          where copy_entity_txn_id = p_copy_entity_txn_id
5945 --           and trt.table_route_id = cpe.table_route_id
5946            and ( -- c_mirror_src_entity_result_id is null or
5947                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
5948            -- and trt.where_clause = 'BEN_POPL_ACTN_TYP_F'
5949            and cpe.table_alias = c_table_alias
5950            and information1 = c_popl_actn_typ_id
5951            -- and information4 = pat.business_group_id
5952            and information2 = pat.effective_start_date
5953            and information3 = pat.effective_end_date
5954      );
5955    l_out_pat_result_id  number(15);
5956 ---------------------------------------------------------------
5957 -- END OF BEN_POPL_ACTN_TYP_F ----------------------
5958 ---------------------------------------------------------------
5959 ---------------------------------------------------------------
5960 -- START OF BEN_POPL_ENRT_TYP_CYCL_F ----------------------
5961 ---------------------------------------------------------------
5962    cursor c_pet_from_parent(c_PL_ID number, c_PGM_ID number ) is
5963    select  distinct popl_enrt_typ_cycl_id
5964    from BEN_POPL_ENRT_TYP_CYCL_F
5965    where ( c_PL_ID is not null and c_PL_ID = PL_ID ) or
5966          ( c_PGM_ID is not null and c_PGM_ID = PGM_ID);
5967    --
5968    cursor c_pet(c_popl_enrt_typ_cycl_id number ,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
5969    select  pet.*
5970    from BEN_POPL_ENRT_TYP_CYCL_F pet
5971    where  pet.popl_enrt_typ_cycl_id = c_popl_enrt_typ_cycl_id
5972      -- and pet.business_group_id = p_business_group_id
5973      and not exists (
5974          select /*+  */ null
5975          from ben_copy_entity_results cpe
5976 --              pqh_table_route trt
5977          where copy_entity_txn_id = p_copy_entity_txn_id
5978 --           and trt.table_route_id = cpe.table_route_id
5979            and ( -- c_mirror_src_entity_result_id is null or
5980                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
5981            -- and trt.where_clause = 'BEN_POPL_ENRT_TYP_CYCL_F'
5982            and cpe.table_alias = c_table_alias
5983            and information1 = c_popl_enrt_typ_cycl_id
5984            -- and information4 = pet.business_group_id
5985            and information2 = pet.effective_start_date
5986            and information3 = pet.effective_end_date
5987      );
5988    l_pet_popl_enrt_typ_cycl_esd ben_popl_enrt_typ_cycl_f.effective_start_date%type;
5989    l_out_pet_result_id  number(15);
5990 ---------------------------------------------------------------
5991 -- END OF BEN_POPL_ENRT_TYP_CYCL_F ----------------------
5992 ---------------------------------------------------------------
5993 ---------------------------------------------------------------
5994 -- START OF BEN_POPL_ORG_F ----------------------
5995 ---------------------------------------------------------------
5996    cursor c_cpo_from_parent(c_PL_ID number, c_PGM_ID number ) is
5997    select  popl_org_id
5998    from BEN_POPL_ORG_F
5999    --where  PL_ID = c_PL_ID ;
6000    where ( c_PL_ID is not null and c_PL_ID = PL_ID ) or
6001          ( c_PGM_ID is not null and c_PGM_ID = PGM_ID);
6002    --
6003    cursor c_cpo(c_popl_org_id number,c_mirror_src_entity_result_id number,
6004                 c_table_alias varchar2) is
6005    select  cpo.*
6006    from BEN_POPL_ORG_F cpo
6007    where  cpo.popl_org_id = c_popl_org_id
6008      -- and cpo.business_group_id = p_business_group_id
6009      and not exists (
6010          select /*+  */ null
6011          from ben_copy_entity_results cpe
6012 --              pqh_table_route trt
6013          where copy_entity_txn_id = p_copy_entity_txn_id
6014 --           and trt.table_route_id = cpe.table_route_id
6015            and ( -- c_mirror_src_entity_result_id is null or
6016                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6017            -- and trt.where_clause =  'BEN_POPL_ORG_F'
6018            and cpe.table_alias = c_table_alias
6019            and information1 = c_popl_org_id
6020            -- and information4 = cpo.business_group_id
6021            and information2 = cpo.effective_start_date
6022            and information3 = cpo.effective_end_date
6023      );
6024     --
6025     -- pabodla : mapping data
6026     --
6027     cursor c_get_mapping_name2(p_id in number,p_date in date) is
6028     select org.name
6029     from hr_organization_units org
6030     where business_group_id = p_business_group_id
6031       and organization_id = p_id
6032       and  p_date  between  Date_from
6033           and nvl(Date_to, p_date) ;
6034 
6035    l_out_cpo_result_id  number(15);
6036 
6037    cursor c_organization_start_date(c_organization_id number) is
6038    select date_from
6039    from hr_all_organization_units
6040    where organization_id = c_organization_id;
6041 
6042    l_organization_start_date  hr_all_organization_units.date_from%type;
6043 ---------------------------------------------------------------
6044 -- END OF BEN_POPL_ORG_F ----------------------
6045 ---------------------------------------------------------------
6046 ---------------------------------------------------------------
6047 -- START OF BEN_POPL_YR_PERD ----------------------
6048 ---------------------------------------------------------------
6049    cursor c_cpy_from_parent(c_PL_ID number, c_PGM_ID number ) is
6050    select  popl_yr_perd_id
6051    from BEN_POPL_YR_PERD
6052    --where  PL_ID = c_PL_ID ;
6053    where ( c_PL_ID is not null and c_PL_ID = PL_ID ) or
6054          ( c_PGM_ID is not null and c_PGM_ID = PGM_ID);
6055    --
6056    cursor c_cpy(c_popl_yr_perd_id number,c_mirror_src_entity_result_id number,
6057                 c_table_alias varchar2) is
6058    select  cpy.*
6059    from BEN_POPL_YR_PERD cpy
6060    where  cpy.popl_yr_perd_id = c_popl_yr_perd_id
6061      -- and cpy.business_group_id = p_business_group_id
6062      and not exists (
6063          select /*+  */ null
6064          from ben_copy_entity_results cpe
6065 --              pqh_table_route trt
6066          where copy_entity_txn_id = p_copy_entity_txn_id
6067 --           and trt.table_route_id = cpe.table_route_id
6068            and ( -- c_mirror_src_entity_result_id is null or
6069                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6070            -- and trt.where_clause = 'BEN_POPL_YR_PERD'
6071            and cpe.table_alias = c_table_alias
6072            and information1 = c_popl_yr_perd_id
6073            -- and information4 = cpy.business_group_id
6074        );
6075     l_out_cpy_result_id  number(15);
6076 ---------------------------------------------------------------
6077 -- END OF BEN_POPL_YR_PERD ----------------------
6078 ---------------------------------------------------------------
6079 ---------------------------------------------------------------
6080 -- START OF BEN_POPL_RPTG_GRP_F ----------------------
6081 ---------------------------------------------------------------
6082    cursor c_rgr_from_parent(c_PL_ID number, c_PGM_ID number ) is
6083    select  popl_rptg_grp_id
6084    from BEN_POPL_RPTG_GRP_F
6085    -- where  PL_ID = c_PL_ID ;
6086    where ( c_PL_ID is not null and c_PL_ID = PL_ID ) or
6087          ( c_PGM_ID is not null and c_PGM_ID = PGM_ID);
6088    --
6089    cursor c_rgr(c_popl_rptg_grp_id number,c_mirror_src_entity_result_id number,
6090                 c_table_alias varchar2) is
6091    select  rgr.*
6092    from BEN_POPL_RPTG_GRP_F rgr
6093    where  rgr.popl_rptg_grp_id = c_popl_rptg_grp_id
6094      -- and rgr.business_group_id = p_business_group_id
6095      and not exists (
6096          select /*+  */ null
6097          from ben_copy_entity_results cpe
6098               --pqh_table_route trt
6099          where copy_entity_txn_id = p_copy_entity_txn_id
6100 --           and trt.table_route_id = cpe.table_route_id
6101            and ( -- c_mirror_src_entity_result_id is null or
6102                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6103            -- and trt.where_clause = 'BEN_POPL_RPTG_GRP_F'
6104            and cpe.table_alias = c_table_alias
6105            and information1 = c_popl_rptg_grp_id
6106            -- and information4 = rgr.business_group_id
6107            and information2 = rgr.effective_start_date
6108            and information3 = rgr.effective_end_date
6109      );
6110     l_out_rgr_result_id  number(15);
6111 ---------------------------------------------------------------
6112 -- END OF BEN_POPL_RPTG_GRP_F ----------------------
6113 ---------------------------------------------------------------
6114    ---
6115 ---------------------------------------------------------------
6116 -- START OF BEN_YR_PERD ----------------------
6117 ---------------------------------------------------------------
6118    cursor c_yrp_from_parent(c_POPL_YR_PERD_ID number) is
6119    select  distinct yr_perd_id
6120    from BEN_POPL_YR_PERD
6121    where  POPL_YR_PERD_ID = c_POPL_YR_PERD_ID ;
6122    --
6123 ---------------------------------------------------------------
6124 -- END OF BEN_YR_PERD ----------------------
6125 ---------------------------------------------------------------
6126 ---------------------------------------------------------------
6127 -- START OF BEN_POPL_ORG_ROLE_F ----------------------
6128 ---------------------------------------------------------------
6129    cursor c_cpr_from_parent(c_POPL_ORG_ID number) is
6130    select  popl_org_role_id
6131    from BEN_POPL_ORG_ROLE_F
6132    where  POPL_ORG_ID = c_POPL_ORG_ID ;
6133    --
6134    cursor c_cpr(c_popl_org_role_id number ,c_mirror_src_entity_result_id number,
6135                 c_table_alias varchar2) is
6136    select  cpr.*
6137    from BEN_POPL_ORG_ROLE_F cpr
6138    where  cpr.popl_org_role_id = c_popl_org_role_id
6139      -- and cpr.business_group_id = p_business_group_id
6140      and not exists (
6141          select /*+  */ null
6142          from ben_copy_entity_results cpe
6143 --              pqh_table_route trt
6144          where copy_entity_txn_id = p_copy_entity_txn_id
6145 --           and trt.table_route_id = cpe.table_route_id
6146            and ( -- c_mirror_src_entity_result_id is null or
6147                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6148            -- and trt.where_clause = 'BEN_POPL_ORG_ROLE_F'
6149            and cpe.table_alias = c_table_alias
6150            and information1 = c_popl_org_role_id
6151            -- and information4 = cpr.business_group_id
6152            and information2 = cpr.effective_start_date
6153            and information3 = cpr.effective_end_date
6154      );
6155      l_out_cpr_result_id  number(15);
6156 ---------------------------------------------------------------
6157 -- END OF BEN_POPL_ORG_ROLE_F ----------------------
6158 ---------------------------------------------------------------
6159 ---------------------------------------------------------------
6160 -- START OF BEN_RPTG_GRP ----------------------
6161 ---------------------------------------------------------------
6162    cursor c_bnr_from_parent(c_POPL_RPTG_GRP_ID number) is
6163    select  rptg_grp_id
6164    from BEN_POPL_RPTG_GRP_F
6165    where  POPL_RPTG_GRP_ID = c_POPL_RPTG_GRP_ID ;
6166    --
6167    cursor c_bnr(c_rptg_grp_id number,c_mirror_src_entity_result_id number,
6168                 c_table_alias varchar2) is
6169    select  bnr.*
6170    from BEN_RPTG_GRP bnr
6171    where  bnr.rptg_grp_id = c_rptg_grp_id
6172      -- and bnr.business_group_id = p_business_group_id
6173      and not exists (
6174          select /*+  */ null
6175          from ben_copy_entity_results cpe
6176 --              pqh_table_route trt
6177          where copy_entity_txn_id = p_copy_entity_txn_id
6178 --           and trt.table_route_id = cpe.table_route_id
6179            and ( -- c_mirror_src_entity_result_id is null or
6180                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6181            -- and trt.where_clause = 'BEN_RPTG_GRP'
6182            and cpe.table_alias = c_table_alias
6183            and information1 = c_rptg_grp_id
6184            -- and information4 = bnr.business_group_id
6185      );
6186      l_out_bnr_result_id  number(15);
6187 ---------------------------------------------------------------
6188 -- END OF BEN_RPTG_GRP ----------------------
6189 ---------------------------------------------------------------
6190 ---------------------------------------------------------------
6191 -- START OF BEN_LEE_RSN_F ----------------------
6192 ---------------------------------------------------------------
6193    cursor c_len_from_parent(c_POPL_ENRT_TYP_CYCL_ID number) is
6194    select distinct lee_rsn_id
6195    from BEN_LEE_RSN_F
6196    where  POPL_ENRT_TYP_CYCL_ID = c_POPL_ENRT_TYP_CYCL_ID ;
6197    --
6198    cursor c_len(c_lee_rsn_id number,c_mirror_src_entity_result_id number,
6199                 c_table_alias varchar2) is
6200    select  len.*
6201    from BEN_LEE_RSN_F len
6202    where  len.lee_rsn_id = c_lee_rsn_id
6203      -- and len.business_group_id = p_business_group_id
6204      and not exists (
6205          select /*+  */ null
6206          from ben_copy_entity_results cpe
6207 --              pqh_table_route trt
6208          where copy_entity_txn_id = p_copy_entity_txn_id
6209 --           and trt.table_route_id = cpe.table_route_id
6210            and ( -- c_mirror_src_entity_result_id is null or
6211                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6212            -- and trt.where_clause = 'BEN_LEE_RSN_F'
6213            and cpe.table_alias = c_table_alias
6214            and information1 = c_lee_rsn_id
6215            -- and information4 = len.business_group_id
6216            and information2 = len.effective_start_date
6217            and information3 = len.effective_end_date
6218      );
6219    cursor c_len_drp(c_lee_rsn_id number,c_mirror_src_entity_result_id number,
6220                     c_table_alias varchar2) is
6221    select distinct cpe.information257 ler_id
6222          from ben_copy_entity_results cpe,
6223               pqh_table_route trt
6224          where copy_entity_txn_id = p_copy_entity_txn_id
6225          and trt.table_route_id = cpe.table_route_id
6226          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
6227          -- and trt.where_clause = 'BEN_LEE_RSN_F'
6228          and trt.table_alias = c_table_alias
6229          and information1 = c_lee_rsn_id
6230          -- and information4 = p_business_group_id
6231         ;
6232     l_out_len_result_id  number(15);
6233 ---------------------------------------------------------------
6234 -- END OF BEN_LEE_RSN_F ----------------------
6235 ---------------------------------------------------------------
6236 ---------------------------------------------------------------
6237 -- START OF BEN_ENRT_PERD ----------------------
6238 ---------------------------------------------------------------
6239    cursor c_enp_from_parent(c_POPL_ENRT_TYP_CYCL_ID number) is
6240    select  enrt_perd_id
6241    from BEN_ENRT_PERD
6242    where  POPL_ENRT_TYP_CYCL_ID = c_POPL_ENRT_TYP_CYCL_ID ;
6243    --
6244    cursor c_enp(c_enrt_perd_id number,c_mirror_src_entity_result_id number,
6245                 c_table_alias varchar2) is
6246    select  enp.*
6247    from BEN_ENRT_PERD enp
6248    where  enp.enrt_perd_id = c_enrt_perd_id
6249      -- and enp.business_group_id = p_business_group_id
6250      and not exists (
6251          select /*+  */ null
6252          from ben_copy_entity_results cpe
6253 --              pqh_table_route trt
6254          where copy_entity_txn_id = p_copy_entity_txn_id
6255 --           and trt.table_route_id = cpe.table_route_id
6256            and ( -- c_mirror_src_entity_result_id is null or
6257                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6258            -- and trt.where_clause = 'BEN_ENRT_PERD'
6259            and cpe.table_alias = c_table_alias
6260            and information1 = c_enrt_perd_id
6261            -- and information4 = enp.business_group_id
6262     );
6263     --
6264     -- pabodla : mapping data
6265     --
6266     cursor c_get_mapping_name(p_id in number,p_date in date) is
6267       select pos.NAME name
6268       from PER_POSITION_STRUCTURES pos,
6269            PER_POS_STRUCTURE_VERSIONS pov
6270       where pos.business_group_id = p_business_group_id
6271         and POS_STRUCTURE_VERSION_ID = p_id
6272         and pos.POSITION_STRUCTURE_ID = pov.POSITION_STRUCTURE_ID
6273         and p_date between nvl(POV.DATE_FROM, p_date)
6274                                  and nvl(POV.DATE_TO, p_date);
6275     --
6276 
6277     cursor c_pos_structure_start_date(c_pos_structure_version_id number) is
6278     select date_from
6279     from per_pos_structure_versions
6280     where pos_structure_version_id = c_pos_structure_version_id;
6281 
6282     l_pos_structure_start_date per_pos_structure_versions.date_from%type;
6283     l_mapping_id         number;
6284     l_mapping_name       varchar2(600);
6285     l_mapping_column_name1 pqh_attributes.attribute_name%type;
6286     l_mapping_column_name2 pqh_attributes.attribute_name%type;
6287     l_information172     varchar2(600);
6288     l_out_enp_result_id  number(15);
6289     --
6290 ---------------------------------------------------------------
6291 -- END OF BEN_ENRT_PERD ----------------------
6292 ---------------------------------------------------------------
6293 ---------------------------------------------------------------
6294 -- START OF BEN_YR_PERD ----------------------
6295 ---------------------------------------------------------------
6296    cursor c_yrp1_from_parent(c_ENRT_PERD_ID number) is
6297    select  distinct yr_perd_id
6298    from BEN_ENRT_PERD
6299    where  ENRT_PERD_ID = c_ENRT_PERD_ID ;
6300    --
6301 ---------------------------------------------------------------
6302 -- END OF BEN_YR_PERD ----------------------
6303 ---------------------------------------------------------------
6304 ---------------------------------------------------------------
6305 -- START OF BEN_ENRT_PERD_FOR_PL_F ----------------------
6306 ---------------------------------------------------------------
6307    cursor c_erp_from_parent(c_ENRT_PERD_ID number, c_pgm_id number) is
6308    select  ERP.enrt_perd_for_pl_id
6309    from BEN_ENRT_PERD_FOR_PL_F ERP
6310    where  ENRT_PERD_ID = c_ENRT_PERD_ID
6311      and  exists (select null
6312                   from ben_plip_f plip
6313                   where plip.pl_id =  ERP.pl_id
6314                     and plip.pgm_id = c_pgm_id
6315                     and ERP.effective_start_date between
6316                         plip.effective_start_date and plip.effective_end_date);
6317    --
6318    cursor c_erp(c_enrt_perd_for_pl_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
6319    select  erp.*
6320    from BEN_ENRT_PERD_FOR_PL_F erp
6321    where  erp.enrt_perd_for_pl_id = c_enrt_perd_for_pl_id
6322      -- and erp.business_group_id = p_business_group_id
6323      and not exists (
6324          select /*+  */ null
6325          from ben_copy_entity_results cpe
6326 --              pqh_table_route trt
6327          where copy_entity_txn_id = p_copy_entity_txn_id
6328 --           and trt.table_route_id = cpe.table_route_id
6329            and ( -- c_mirror_src_entity_result_id is null or
6330                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6331            -- and trt.where_clause = 'BEN_ENRT_PERD_FOR_PL_F'
6332            and cpe.table_alias = c_table_alias
6333            and information1 = c_enrt_perd_for_pl_id
6334            -- and information4 = erp.business_group_id
6335            and information2 = erp.effective_start_date
6336            and information3 = erp.effective_end_date
6337      );
6338      l_out_erp_result_id  number(15);
6339 ---------------------------------------------------------------
6340 -- END OF BEN_ENRT_PERD_FOR_PL_F ----------------------
6341 ---------------------------------------------------------------
6342 ---------------------------------------------------------------
6343 -- START OF BEN_SCHEDD_ENRT_RL_F ----------------------
6344 ---------------------------------------------------------------
6345    cursor c_ser_from_parent(c_ENRT_PERD_ID number) is
6346    select  schedd_enrt_rl_id
6347    from BEN_SCHEDD_ENRT_RL_F
6348    where  ENRT_PERD_ID = c_ENRT_PERD_ID ;
6349    --
6350    cursor c_ser(c_schedd_enrt_rl_id number,c_mirror_src_entity_result_id number,
6351                 c_table_alias varchar2) is
6352    select  ser.*
6353    from BEN_SCHEDD_ENRT_RL_F ser
6354    where  ser.schedd_enrt_rl_id = c_schedd_enrt_rl_id
6355      -- and ser.business_group_id = p_business_group_id
6356      and not exists (
6357          select /*+  */ null
6358          from ben_copy_entity_results cpe
6359 --              pqh_table_route trt
6360          where copy_entity_txn_id = p_copy_entity_txn_id
6361 --           and trt.table_route_id = cpe.table_route_id
6362            and ( -- c_mirror_src_entity_result_id is null or
6363                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6364            -- and trt.where_clause = 'BEN_SCHEDD_ENRT_RL_F'
6365            and cpe.table_alias = c_table_alias
6366            and information1 = c_schedd_enrt_rl_id
6367            -- and information4 = ser.business_group_id
6368            and information2 = ser.effective_start_date
6369            and information3 = ser.effective_end_date
6370      );
6371      l_out_ser_result_id  number(15);
6372 ---------------------------------------------------------------
6373 -- END OF BEN_SCHEDD_ENRT_RL_F ----------------------
6374 ---------------------------------------------------------------
6375 ---------------------------------------------------------------
6376 -- START OF BEN_LEE_RSN_RL_F ----------------------
6377 ---------------------------------------------------------------
6378    cursor c_lrr_from_parent(c_LEE_RSN_ID number) is
6379    select  lee_rsn_rl_id
6380    from BEN_LEE_RSN_RL_F
6381    where  LEE_RSN_ID = c_LEE_RSN_ID ;
6382    --
6383    cursor c_lrr(c_lee_rsn_rl_id number,c_mirror_src_entity_result_id number,
6384                c_table_alias varchar2) is
6385    select  lrr.*
6386    from BEN_LEE_RSN_RL_F lrr
6387    where  lrr.lee_rsn_rl_id = c_lee_rsn_rl_id
6388      -- and lrr.business_group_id = p_business_group_id
6389      and not exists (
6390          select /*+  */ null
6391          from ben_copy_entity_results cpe
6392 --              pqh_table_route trt
6393          where copy_entity_txn_id = p_copy_entity_txn_id
6394 --           and trt.table_route_id = cpe.table_route_id
6395            and ( -- c_mirror_src_entity_result_id is null or
6396                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6397            -- and trt.where_clause = 'BEN_LEE_RSN_RL_F'
6398            and cpe.table_alias = c_table_alias
6399            and information1 = c_lee_rsn_rl_id
6400            -- and information4 = lrr.business_group_id
6401            and information2 = lrr.effective_start_date
6402            and information3 = lrr.effective_end_date
6403      );
6404      l_out_lrr_result_id  number(15);
6405 ---------------------------------------------------------------
6406 -- END OF BEN_LEE_RSN_RL_F ----------------------
6407 ---------------------------------------------------------------
6408 ---------------------------------------------------------------
6409 -- START OF BEN_ENRT_PERD_FOR_PL_F ----------------------
6410 ---------------------------------------------------------------
6411    cursor c_erp1_from_parent(c_LEE_RSN_ID number, c_pgm_id number) is
6412    select  enrt_perd_for_pl_id
6413    from BEN_ENRT_PERD_FOR_PL_F ERP
6414    where  LEE_RSN_ID = c_LEE_RSN_ID
6415      and  exists (select null
6416                   from ben_plip_f plip
6417                   where plip.pl_id =  ERP.pl_id
6418                     and plip.pgm_id = c_pgm_id
6419                     and ERP.effective_start_date between
6420                         plip.effective_start_date and plip.effective_end_date);
6421    --
6422    cursor c_erp1(c_enrt_perd_for_pl_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
6423    select  erp.*
6424    from BEN_ENRT_PERD_FOR_PL_F erp
6425    where  erp.enrt_perd_for_pl_id = c_enrt_perd_for_pl_id
6426      -- and erp.business_group_id = p_business_group_id
6427      and not exists (
6428          select /*+  */ null
6429          from ben_copy_entity_results cpe
6430 --              pqh_table_route trt
6431          where copy_entity_txn_id = p_copy_entity_txn_id
6432 --           and trt.table_route_id = cpe.table_route_id
6433            and ( -- c_mirror_src_entity_result_id is null or
6434                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6435            -- and trt.where_clause = 'BEN_ENRT_PERD_FOR_PL_F'
6436            and cpe.table_alias = c_table_alias
6437            and information1 = c_enrt_perd_for_pl_id
6438            -- and information4 = erp.business_group_id
6439            and information2 = erp.effective_start_date
6440            and information3 = erp.effective_end_date
6441      );
6442 
6443      l_out_erp1_result_id  number(15);
6444 ---------------------------------------------------------------
6445 -- END OF BEN_ENRT_PERD_FOR_PL_F ----------------------
6446 ---------------------------------------------------------------
6447   ---------------------------------------------------------------
6448   -- START OF BEN_ACTN_TYP ----------------------
6449   ---------------------------------------------------------------
6450    cursor c_eat_from_parent(c_POPL_ACTN_TYP_ID number) is
6451    select  actn_typ_id
6452    from BEN_POPL_ACTN_TYP_F
6453    where  POPL_ACTN_TYP_ID = c_POPL_ACTN_TYP_ID ;
6454    --
6455    cursor c_eat(c_actn_typ_id number,c_mirror_src_entity_result_id number,
6456                 c_table_alias varchar2) is
6457    select  eat.*
6458    from BEN_ACTN_TYP eat
6459    where  eat.actn_typ_id = c_actn_typ_id
6460      -- and eat.business_group_id = p_business_group_id
6461      and not exists (
6462          select /*+  */ null
6463          from ben_copy_entity_results cpe
6464 --              pqh_table_route trt
6465          where copy_entity_txn_id = p_copy_entity_txn_id
6466 --           and trt.table_route_id = cpe.table_route_id
6467            and ( -- c_mirror_src_entity_result_id is null or
6468                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6469            -- and trt.where_clause = 'BEN_ACTN_TYP'
6470            and cpe.table_alias = c_table_alias
6471            and information1 = c_actn_typ_id
6472            -- and information4 = eat.business_group_id
6473      );
6474      l_out_eat_result_id  number(15);
6475   ---------------------------------------------------------------
6476   -- END OF BEN_ACTN_TYP ----------------------
6477   ---------------------------------------------------------------
6478    ---------------------------------------------------------------
6479    -- START OF BEN_PL_REGN_F ----------------------
6480    ---------------------------------------------------------------
6481    cursor c_prg_from_parent(c_RPTG_GRP_ID number) is
6482    select  pl_regn_id
6483    from BEN_PL_REGN_F
6484    where  RPTG_GRP_ID = c_RPTG_GRP_ID ;
6485    --
6486    cursor c_prg(c_pl_regn_id number,c_mirror_src_entity_result_id number,
6487                 c_table_alias varchar2) is
6488    select  prg.*
6489    from BEN_PL_REGN_F prg
6490    where  prg.pl_regn_id = c_pl_regn_id
6491      -- and prg.business_group_id = p_business_group_id
6492      and not exists (
6493          select /*+  */ null
6494          from ben_copy_entity_results cpe
6495 --              pqh_table_route trt
6496          where copy_entity_txn_id = p_copy_entity_txn_id
6497 --         and trt.table_route_id = cpe.table_route_id
6498          and ( -- c_mirror_src_entity_result_id is null or
6499                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6500          -- and trt.where_clause = 'BEN_PL_REGN_F'
6501          and cpe.table_alias = c_table_alias
6502          and information1 = c_pl_regn_id
6503          -- and information4 = prg.business_group_id
6504            and information2 = prg.effective_start_date
6505            and information3 = prg.effective_end_date
6506         );
6507     l_pl_regn_id                 number(15);
6508     l_out_prg_result_id   number(15);
6509    ---------------------------------------------------------------
6510    -- END OF BEN_PL_REGN_F ----------------------
6511    ---------------------------------------------------------------
6512    ---------------------------------------------------------------
6513    -- START OF BEN_PL_REGY_BOD_F ----------------------
6514    ---------------------------------------------------------------
6515    cursor c_prb_from_parent(c_RPTG_GRP_ID number) is
6516    select  pl_regy_bod_id
6517    from BEN_PL_REGY_BOD_F
6518    where  RPTG_GRP_ID = c_RPTG_GRP_ID ;
6519    --
6520    cursor c_prb(c_pl_regy_bod_id number,c_mirror_src_entity_result_id number,
6521                 c_table_alias varchar2) is
6522    select  prb.*
6523    from BEN_PL_REGY_BOD_F prb
6524    where  prb.pl_regy_bod_id = c_pl_regy_bod_id
6525      -- and prb.business_group_id = p_business_group_id
6526      and not exists (
6527          select /*+  */ null
6528          from ben_copy_entity_results cpe
6529 --              pqh_table_route trt
6530          where copy_entity_txn_id = p_copy_entity_txn_id
6531 --         and trt.table_route_id = cpe.table_route_id
6532          and ( -- c_mirror_src_entity_result_id is null or
6533                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6534          -- and trt.where_clause = 'BEN_PL_REGY_BOD_F'
6535          and cpe.table_alias = c_table_alias
6536          and information1 = c_pl_regy_bod_id
6537          -- and information4 = prb.business_group_id
6538            and information2 = prb.effective_start_date
6539            and information3 = prb.effective_end_date
6540         );
6541     l_pl_regy_bod_id                 number(15);
6542     l_out_prb_result_id   number(15);
6543    ---------------------------------------------------------------
6544    -- END OF BEN_PL_REGY_BOD_F ----------------------
6545    ---------------------------------------------------------------
6546    ---------------------------------------------------------------
6547    -- START OF BEN_PL_REGY_PRP_F ----------------------
6548    ---------------------------------------------------------------
6549    cursor c_prp_from_parent(c_PL_REGY_BOD_ID number) is
6550    select  pl_regy_prps_id
6551    from BEN_PL_REGY_PRP_F
6552    where  PL_REGY_BOD_ID = c_PL_REGY_BOD_ID ;
6553    --
6554    cursor c_prp(c_pl_regy_prps_id number,c_mirror_src_entity_result_id number,
6555                 c_table_alias varchar2) is
6556    select  prp.*
6557    from BEN_PL_REGY_PRP_F prp
6558    where  prp.pl_regy_prps_id = c_pl_regy_prps_id
6559      -- and prp.business_group_id = p_business_group_id
6560      and not exists (
6561          select /*+  */ null
6562          from ben_copy_entity_results cpe
6563 --              pqh_table_route trt
6564          where copy_entity_txn_id = p_copy_entity_txn_id
6565 --         and trt.table_route_id = cpe.table_route_id
6566          and ( -- c_mirror_src_entity_result_id is null or
6567                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6568          -- and trt.where_clause = 'BEN_PL_REGY_PRP_F'
6569          and cpe.table_alias = c_table_alias
6570          and information1 = c_pl_regy_prps_id
6571          -- and information4 = prp.business_group_id
6572            and information2 = prp.effective_start_date
6573            and information3 = prp.effective_end_date
6574         );
6575     l_pl_regy_prps_id                 number(15);
6576     l_out_prp_result_id   number(15);
6577    ---------------------------------------------------------------
6578    -- END OF BEN_PL_REGY_PRP_F ----------------------
6579    ---------------------------------------------------------------
6580    ---------------------------------------------------------------
6581    -- START OF BEN_POPL_RPTG_GRP_F ----------------------
6582    ---------------------------------------------------------------
6583    cursor c_rgr1_from_parent(c_RPTG_GRP_ID number) is
6584    select  popl_rptg_grp_id
6585    from BEN_POPL_RPTG_GRP_F
6586    where  RPTG_GRP_ID = c_RPTG_GRP_ID ;
6587    --
6588    cursor c_rgr1(c_popl_rptg_grp_id number,c_mirror_src_entity_result_id number,
6589                  c_table_alias varchar2) is
6590    select  rgr.*
6591    from BEN_POPL_RPTG_GRP_F rgr
6592    where  rgr.popl_rptg_grp_id = c_popl_rptg_grp_id
6593      -- and rgr.business_group_id = p_business_group_id
6594      and not exists (
6595          select /*+  */ null
6596          from ben_copy_entity_results cpe
6597 --              pqh_table_route trt
6598          where copy_entity_txn_id = p_copy_entity_txn_id
6599 --         and trt.table_route_id = cpe.table_route_id
6600          and ( -- c_mirror_src_entity_result_id is null or
6601                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6602          -- and trt.where_clause = 'BEN_POPL_RPTG_GRP_F'
6603          and cpe.table_alias = c_table_alias
6604          and information1 = c_popl_rptg_grp_id
6605          -- and information4 = rgr.business_group_id
6606            and information2 = rgr.effective_start_date
6607            and information3 = rgr.effective_end_date
6608         );
6609    ---------------------------------------------------------------
6610    -- END OF BEN_POPL_RPTG_GRP_F ----------------------
6611    ---------------------------------------------------------------
6612    ---------------------------------------------------------------
6613    -- START OF BEN_REGN_F ----------------------
6614    ---------------------------------------------------------------
6615    cursor c_reg_from_parent(c_PL_REGN_ID number) is
6616    select  regn_id
6617    from BEN_PL_REGN_F
6618    where PL_REGN_ID = c_PL_REGN_ID ;
6619    --
6620    cursor c_reg(c_regn_id number,c_mirror_src_entity_result_id number,
6621                 c_table_alias varchar2) is
6622    select  reg.*
6623    from BEN_REGN_F reg
6624    where  reg.regn_id = c_regn_id
6625      -- and reg.business_group_id = p_business_group_id
6626      and not exists (
6627          select /*+  */ null
6628          from ben_copy_entity_results cpe
6629 --              pqh_table_route trt
6630          where copy_entity_txn_id = p_copy_entity_txn_id
6631 --         and trt.table_route_id = cpe.table_route_id
6632          and ( -- c_mirror_src_entity_result_id is null or
6633                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
6634          -- and trt.where_clause = 'BEN_REGN_F'
6635          and cpe.table_alias = c_table_alias
6636          and information1 = c_regn_id
6637          -- and information4 = reg.business_group_id
6638            and information2 = reg.effective_start_date
6639            and information3 = reg.effective_end_date
6640         );
6641     l_regn_id                 number(15);
6642     l_out_reg_result_id   number(15);
6643    ---------------------------------------------------------------
6644    -- END OF BEN_REGN_F ----------------------
6645    ---------------------------------------------------------------
6646 
6647    cursor c_object_exists(c_pk_id                number,
6648                           c_table_alias          varchar2) is
6649     select null
6650     from ben_copy_entity_results cpe
6651 --         pqh_table_route trt
6652     where copy_entity_txn_id = p_copy_entity_txn_id
6653 --    and trt.table_route_id = cpe.table_route_id
6654     and cpe.table_alias = c_table_alias
6655     and information1 = c_pk_id;
6656 
6657    l_dummy                     varchar2(1);
6658 
6659    l_table_route_id            number(15);
6660    l_mirror_src_entity_result_id number(15):= p_copy_entity_result_id;
6661    l_result_type_cd            varchar2(30);
6662    l_information5              ben_copy_entity_results.information5%type;
6663    l_regn_name                 ben_regn_f.name%type;
6664    --
6665    l_pl_id                     number(15);
6666    l_popl_yr_perd_id           number(15);
6667    l_yr_perd_id                number(15);
6668    l_wthn_yr_perd_id           number(15);
6669    l_yr_perd_id1               number(15);
6670    l_wthn_yr_perd_id1          number(15);
6671    l_popl_org_id               number(15);
6672    l_popl_org_role_id          number(15);
6673    l_pl_gd_or_svc_id           number(15);
6674    l_gd_or_svc_typ_id          number(15);
6675    l_pl_gd_r_svc_ctfn_id       number(15);
6676    l_rptg_grp_id               number(15);
6677    l_popl_rptg_grp_id          number(15);
6678    l_number_of_copies          number(15);
6679    l_popl_enrt_typ_cycl_id     number(15);
6680    l_enrt_perd_id              number(15);
6681    l_lee_rsn_id                number(15);
6682    l_schedd_enrt_rl_id         number(15);
6683    l_enrt_perd_for_pl_id       number(15);
6684    l_enrt_perd_for_pl_id1      number(15);
6685    l_lee_rsn_rl_id             number(15);
6686    l_actn_typ_id               number(15);
6687    l_popl_actn_typ_id          number(15);
6688 
6689    l_parent_entity_result_id   number(15);
6690 begin
6691    --
6692    --
6693    l_number_of_copies := p_number_of_copies ;
6694 
6695    --
6696    ---------------------------------------------------------------
6697    -- START OF BEN_POPL_ACTN_TYP_F ----------------------
6698    ---------------------------------------------------------------
6699    --
6700    --
6701    for l_parent_rec  in c_pat_from_parent(p_pl_id,p_pgm_id) loop
6702    --
6703    --
6704       l_mirror_src_entity_result_id := p_copy_entity_result_id ;
6705       l_parent_entity_result_id := p_parent_entity_result_id ;
6706       l_popl_actn_typ_id := l_parent_rec.popl_actn_typ_id;
6707 
6708       for l_pat_rec in c_pat(l_parent_rec.popl_actn_typ_id,l_mirror_src_entity_result_id,'PAT') loop
6709       --
6710             l_table_route_id := null ;
6711             open ben_plan_design_program_module.g_table_route('PAT');
6712             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
6713             close ben_plan_design_program_module.g_table_route ;
6714             --
6715             l_information5 := ben_plan_design_program_module.get_actn_typ_name(l_pat_rec.actn_typ_id); --'Intersection;
6716             --
6717             --
6718             if p_effective_date between l_pat_rec.effective_start_date
6719                 and l_pat_rec.effective_end_date then
6720                 --
6721                 l_result_type_cd := 'DISPLAY';
6722             else
6723                 l_result_type_cd := 'NO DISPLAY';
6724             end if;
6725             --
6726             l_copy_entity_result_id := null;
6727             l_object_version_number := null;
6728             ben_copy_entity_results_api.create_copy_entity_results(
6729                  p_copy_entity_result_id           => l_copy_entity_result_id,
6730                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
6731                  p_result_type_cd                 => l_result_type_cd,
6732 		 p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
6733                  p_parent_entity_result_id        => l_parent_entity_result_id,
6734                  p_table_alias					  => 'PAT',
6735                  p_number_of_copies               => l_number_of_copies,
6736                  p_table_route_id                 => l_table_route_id,
6737                  p_information1     => l_pat_rec.popl_actn_typ_id,
6738                  p_information2     => l_pat_rec.EFFECTIVE_START_DATE,
6739                  p_information3     => l_pat_rec.EFFECTIVE_END_DATE,
6740                  p_information4     => l_pat_rec.business_group_id,
6741                  p_information5     => l_information5 , -- 9999 put name for h-grid
6742 		 p_information11     => l_pat_rec.actn_typ_due_dt_cd,
6743 		 p_information262     => l_pat_rec.actn_typ_due_dt_rl,
6744 		 p_information221     => l_pat_rec.actn_typ_id,
6745 		 p_information111     => l_pat_rec.pat_attribute1,
6746 		 p_information120     => l_pat_rec.pat_attribute10,
6747 		 p_information121     => l_pat_rec.pat_attribute11,
6748 		 p_information122     => l_pat_rec.pat_attribute12,
6749 		 p_information123     => l_pat_rec.pat_attribute13,
6750 		 p_information124     => l_pat_rec.pat_attribute14,
6751 		 p_information125     => l_pat_rec.pat_attribute15,
6752 		 p_information126     => l_pat_rec.pat_attribute16,
6753 		 p_information127     => l_pat_rec.pat_attribute17,
6754 		 p_information128     => l_pat_rec.pat_attribute18,
6755 		 p_information129     => l_pat_rec.pat_attribute19,
6756 		 p_information112     => l_pat_rec.pat_attribute2,
6757 		 p_information130     => l_pat_rec.pat_attribute20,
6758 		 p_information131     => l_pat_rec.pat_attribute21,
6759 		 p_information132     => l_pat_rec.pat_attribute22,
6760 		 p_information133     => l_pat_rec.pat_attribute23,
6761 		 p_information134     => l_pat_rec.pat_attribute24,
6762 		 p_information135     => l_pat_rec.pat_attribute25,
6763 		 p_information136     => l_pat_rec.pat_attribute26,
6764 		 p_information137     => l_pat_rec.pat_attribute27,
6765 		 p_information138     => l_pat_rec.pat_attribute28,
6766 		 p_information139     => l_pat_rec.pat_attribute29,
6767 		 p_information113     => l_pat_rec.pat_attribute3,
6768 		 p_information140     => l_pat_rec.pat_attribute30,
6769 		 p_information114     => l_pat_rec.pat_attribute4,
6770 		 p_information115     => l_pat_rec.pat_attribute5,
6771 		 p_information116     => l_pat_rec.pat_attribute6,
6772 		 p_information117     => l_pat_rec.pat_attribute7,
6773 		 p_information118     => l_pat_rec.pat_attribute8,
6774 		 p_information119     => l_pat_rec.pat_attribute9,
6775 		 p_information110     => l_pat_rec.pat_attribute_category,
6776 		 p_information260     => l_pat_rec.pgm_id,
6777 		 p_information261     => l_pat_rec.pl_id,
6778                  p_information265     => l_pat_rec.object_version_number,
6779                  p_object_version_number          => l_object_version_number,
6780                  p_effective_date                 => p_effective_date       );
6781           --
6782 
6783           if l_out_pat_result_id is null then
6784             l_out_pat_result_id := l_copy_entity_result_id;
6785           end if;
6786 
6787           if l_result_type_cd = 'DISPLAY' then
6788             l_out_pat_result_id := l_copy_entity_result_id ;
6789           end if;
6790 
6791 				  if (l_pat_rec.actn_typ_due_dt_rl is not null) then
6792 					   ben_plan_design_program_module.create_formula_result(
6793 							p_validate                       => p_validate
6794 							,p_copy_entity_result_id  => l_copy_entity_result_id
6795 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
6796 							,p_formula_id                  => l_pat_rec.actn_typ_due_dt_rl
6797 							,p_business_group_id        => l_pat_rec.business_group_id
6798 							,p_number_of_copies         =>  l_number_of_copies
6799 							,p_object_version_number  => l_object_version_number
6800 							,p_effective_date             => p_effective_date);
6801 					end if;
6802 
6803           --
6804           end loop;
6805         --
6806           ---------------------------------------------------------------
6807           -- START OF BEN_ACTN_TYP ----------------------
6808           ---------------------------------------------------------------
6809            --
6810            for l_parent_rec  in c_eat_from_parent(l_POPL_ACTN_TYP_ID) loop
6811            --
6812              l_mirror_src_entity_result_id := l_out_pat_result_id ;
6813 
6814              l_actn_typ_id := l_parent_rec.actn_typ_id ;
6815 
6816              if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
6817                open c_object_exists(l_actn_typ_id,'EAT');
6818                fetch c_object_exists into l_dummy;
6819                if c_object_exists%found then
6820                  close c_object_exists;
6821                  exit;
6822                end if;
6823                close c_object_exists;
6824              end if;
6825              --
6826              for l_eat_rec in c_eat(l_parent_rec.actn_typ_id,l_mirror_src_entity_result_id,'EAT') loop
6827              --
6828              --
6829                 l_table_route_id := null ;
6830                 open ben_plan_design_program_module.g_table_route('EAT');
6831                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
6832                 close ben_plan_design_program_module.g_table_route ;
6833                  --
6834                  l_information5  := l_eat_rec.name; --'Intersection';
6835                  --
6836                  l_result_type_cd := 'DISPLAY';
6837                  --
6838                  l_copy_entity_result_id := null;
6839                  l_object_version_number := null;
6840                  ben_copy_entity_results_api.create_copy_entity_results(
6841                       p_copy_entity_result_id          => l_copy_entity_result_id,
6842                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
6843                       p_result_type_cd                 => l_result_type_cd,
6844                       p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
6845                       p_parent_entity_result_id        => l_mirror_src_entity_result_id,
6846                       p_number_of_copies               => l_number_of_copies,
6847                       p_table_alias					  => 'EAT',
6848                       p_table_route_id                 => l_table_route_id,
6849                       p_information1     => l_eat_rec.actn_typ_id,
6850                       p_information2     => null,
6851                       p_information3     => null,
6852                       p_information4     => l_eat_rec.business_group_id,
6853                       p_information5     => l_information5 , -- 9999 put name for h-grid
6854 		      p_information185     => l_eat_rec.description,
6855 		      p_information111     => l_eat_rec.eat_attribute1,
6856 		      p_information120     => l_eat_rec.eat_attribute10,
6857 		      p_information121     => l_eat_rec.eat_attribute11,
6858 		      p_information122     => l_eat_rec.eat_attribute12,
6859 		      p_information123     => l_eat_rec.eat_attribute13,
6860 		      p_information124     => l_eat_rec.eat_attribute14,
6861 		      p_information125     => l_eat_rec.eat_attribute15,
6862 		      p_information126     => l_eat_rec.eat_attribute16,
6863 		      p_information127     => l_eat_rec.eat_attribute17,
6864 		      p_information128     => l_eat_rec.eat_attribute18,
6865 		      p_information129     => l_eat_rec.eat_attribute19,
6866 		      p_information112     => l_eat_rec.eat_attribute2,
6867 		      p_information130     => l_eat_rec.eat_attribute20,
6868 		      p_information131     => l_eat_rec.eat_attribute21,
6869 		      p_information132     => l_eat_rec.eat_attribute22,
6870 		      p_information133     => l_eat_rec.eat_attribute23,
6871 		      p_information134     => l_eat_rec.eat_attribute24,
6872 		      p_information135     => l_eat_rec.eat_attribute25,
6873 		      p_information136     => l_eat_rec.eat_attribute26,
6874 		      p_information137     => l_eat_rec.eat_attribute27,
6875 		      p_information138     => l_eat_rec.eat_attribute28,
6876 		      p_information139     => l_eat_rec.eat_attribute29,
6877 		      p_information113     => l_eat_rec.eat_attribute3,
6878 		      p_information140     => l_eat_rec.eat_attribute30,
6879 		      p_information114     => l_eat_rec.eat_attribute4,
6880 		      p_information115     => l_eat_rec.eat_attribute5,
6881 		      p_information116     => l_eat_rec.eat_attribute6,
6882 		      p_information117     => l_eat_rec.eat_attribute7,
6883 		      p_information118     => l_eat_rec.eat_attribute8,
6884 		      p_information119     => l_eat_rec.eat_attribute9,
6885 		      p_information110     => l_eat_rec.eat_attribute_category,
6886 		      p_information170     => l_eat_rec.name,
6887 		      p_information11     => l_eat_rec.type_cd,
6888                       p_information265     => l_eat_rec.object_version_number,
6889 		      p_object_version_number          => l_object_version_number,
6890 	              p_effective_date                 => p_effective_date       );
6891                --
6892 
6893                --
6894 
6895                   if l_out_eat_result_id is null then
6896                    l_out_eat_result_id := l_copy_entity_result_id;
6897                  end if;
6898 
6899                  if l_result_type_cd = 'DISPLAY' then
6900                    l_out_eat_result_id := l_copy_entity_result_id ;
6901                  end if;
6902 
6903                end loop;
6904              --
6905              end loop;
6906           ---------------------------------------------------------------
6907           -- END OF BEN_ACTN_TYP ----------------------
6908           ---------------------------------------------------------------
6909         end loop;
6910      ---------------------------------------------------------------
6911      -- END OF BEN_POPL_ACTN_TYP_F ----------------------
6912      ---------------------------------------------------------------
6913      ---------------------------------------------------------------
6914      -- START OF BEN_POPL_ENRT_TYP_CYCL_F ----------------------
6915      ---------------------------------------------------------------
6916       --
6917       for l_parent_rec  in c_pet_from_parent(p_pl_id,p_pgm_id) loop
6918       --
6919       --
6920         l_pet_popl_enrt_typ_cycl_esd := null;
6921         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
6922         l_parent_entity_result_id := p_parent_entity_result_id ;
6923         --
6924         l_popl_enrt_typ_cycl_id := l_parent_rec.popl_enrt_typ_cycl_id ;
6925         --
6926         for l_pet_rec in c_pet(l_parent_rec.popl_enrt_typ_cycl_id,l_mirror_src_entity_result_id,'PET') loop
6927         --
6928             --
6929             l_table_route_id := null ;
6930             open ben_plan_design_program_module.g_table_route('PET');
6931             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
6932             close ben_plan_design_program_module.g_table_route ;
6933             --
6934             l_information5  := hr_general.decode_lookup('BEN_ENRT_TYP_CYCL',l_pet_rec.enrt_typ_cycl_cd); --'Intersection';
6935             if p_effective_date between l_pet_rec.effective_start_date
6936                 and l_pet_rec.effective_end_date then
6937                 --
6938                 l_result_type_cd := 'DISPLAY';
6939             else
6940                 l_result_type_cd := 'NO DISPLAY';
6941             end if;
6942             --
6943             l_copy_entity_result_id := null;
6944             l_object_version_number := null;
6945             ben_copy_entity_results_api.create_copy_entity_results(
6946                  p_copy_entity_result_id          => l_copy_entity_result_id,
6947                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
6948                  p_result_type_cd                 => l_result_type_cd,
6949 		     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
6950                  p_parent_entity_result_id        => l_parent_entity_result_id,
6951                  p_table_alias					  => 'PET',
6952                  p_number_of_copies               => l_number_of_copies,
6953                  p_table_route_id                 => l_table_route_id,
6954                  p_information1     => l_pet_rec.popl_enrt_typ_cycl_id,
6955                  p_information2     => l_pet_rec.EFFECTIVE_START_DATE,
6956                  p_information3     => l_pet_rec.EFFECTIVE_END_DATE,
6957                  p_information4     => l_pet_rec.business_group_id,
6958                  p_information5     => l_information5 , -- 9999 put name for h-grid
6959                  p_information11     => l_pet_rec.enrt_typ_cycl_cd,
6960                  p_information111     => l_pet_rec.pet_attribute1,
6961                  p_information120     => l_pet_rec.pet_attribute10,
6962                  p_information121     => l_pet_rec.pet_attribute11,
6963                  p_information122     => l_pet_rec.pet_attribute12,
6964                  p_information123     => l_pet_rec.pet_attribute13,
6965                  p_information124     => l_pet_rec.pet_attribute14,
6966                  p_information125     => l_pet_rec.pet_attribute15,
6967                  p_information126     => l_pet_rec.pet_attribute16,
6968                  p_information127     => l_pet_rec.pet_attribute17,
6969                  p_information128     => l_pet_rec.pet_attribute18,
6970                  p_information129     => l_pet_rec.pet_attribute19,
6971                  p_information112     => l_pet_rec.pet_attribute2,
6972                  p_information130     => l_pet_rec.pet_attribute20,
6973                  p_information131     => l_pet_rec.pet_attribute21,
6974                  p_information132     => l_pet_rec.pet_attribute22,
6975                  p_information133     => l_pet_rec.pet_attribute23,
6976                  p_information134     => l_pet_rec.pet_attribute24,
6977                  p_information135     => l_pet_rec.pet_attribute25,
6978                  p_information136     => l_pet_rec.pet_attribute26,
6979                  p_information137     => l_pet_rec.pet_attribute27,
6980                  p_information138     => l_pet_rec.pet_attribute28,
6981                  p_information139     => l_pet_rec.pet_attribute29,
6982                  p_information113     => l_pet_rec.pet_attribute3,
6983                  p_information140     => l_pet_rec.pet_attribute30,
6984                  p_information114     => l_pet_rec.pet_attribute4,
6985                  p_information115     => l_pet_rec.pet_attribute5,
6986                  p_information116     => l_pet_rec.pet_attribute6,
6987                  p_information117     => l_pet_rec.pet_attribute7,
6988                  p_information118     => l_pet_rec.pet_attribute8,
6989                  p_information119     => l_pet_rec.pet_attribute9,
6990                  p_information110     => l_pet_rec.pet_attribute_category,
6991                  p_information260     => l_pet_rec.pgm_id,
6992                  p_information261     => l_pet_rec.pl_id,
6993                  p_information265     => l_pet_rec.object_version_number,
6994                  p_object_version_number          => l_object_version_number,
6995                  p_effective_date                 => p_effective_date       );
6996                  --
6997 
6998                  if l_out_pet_result_id is null then
6999                    l_out_pet_result_id := l_copy_entity_result_id;
7000                  end if;
7001 
7002                  if l_result_type_cd = 'DISPLAY' then
7003                    l_out_pet_result_id := l_copy_entity_result_id ;
7004                  end if;
7005 
7006 
7007                  -- To pass as effective date while creating the
7008                  -- non date-tracked child records
7009                  if l_pet_popl_enrt_typ_cycl_esd is null then
7010                    l_pet_popl_enrt_typ_cycl_esd := l_pet_rec.EFFECTIVE_START_DATE;
7011                  end if;
7012           end loop;
7013 
7014         ---------------------------------------------------------------
7015         -- START OF BEN_ENRT_PERD ----------------------
7016         ---------------------------------------------------------------
7017          --
7018          for l_parent_rec  in c_enp_from_parent(l_POPL_ENRT_TYP_CYCL_ID) loop
7019          --
7020            l_mirror_src_entity_result_id := l_out_pet_result_id ;
7021 
7022            l_enrt_perd_id := l_parent_rec.enrt_perd_id ;
7023            --
7024            for l_enp_rec in c_enp(l_parent_rec.enrt_perd_id,l_mirror_src_entity_result_id,'ENP') loop
7025            --
7026            --
7027                l_table_route_id := null ;
7028                open ben_plan_design_program_module.g_table_route('ENP');
7029                fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
7030                close ben_plan_design_program_module.g_table_route ;
7031                --
7032                l_information5  := TO_CHAR(l_enp_rec.strt_dt,'DD-Mon-YYYY')||' -  '||
7033                                   TO_CHAR(l_enp_rec.end_dt,'DD-Mon-YYYY'); --'Intersection';
7034                --
7035                l_result_type_cd := 'DISPLAY';
7036                --
7037                l_copy_entity_result_id := null;
7038                l_object_version_number := null;
7039 
7040                -- To store effective_start_date of position_structure_version
7041                -- for Mapping - Bug 2958658
7042                --
7043                l_pos_structure_start_date := null;
7044                if l_enp_rec.pos_structure_version_id is not null then
7045                  open c_pos_structure_start_date(l_enp_rec.pos_structure_version_id);
7046                  fetch c_pos_structure_start_date into l_pos_structure_start_date;
7047                  close c_pos_structure_start_date;
7048                end if;
7049 
7050                    --
7051                    -- pabodla : MAPPING DATA : Store the mapping column information.
7052                    --
7053 
7054                    l_mapping_name := null;
7055                    l_mapping_id   := null;
7056                    --
7057                    -- Get the defined balance name to display on mapping page.
7058                    --
7059                    open c_get_mapping_name(l_enp_rec.pos_structure_version_id,
7060                                            NVL(l_pos_structure_start_date,p_effective_date));
7061                    fetch c_get_mapping_name into l_mapping_name;
7062                    close c_get_mapping_name;
7063                    --
7064                    l_mapping_id   := l_enp_rec.pos_structure_version_id;
7065                    --
7066                    --To set user friendly labels on the mapping page
7067                    --
7068                    l_mapping_column_name1 := null;
7069                    l_mapping_column_name2 :=null;
7070                    BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
7071                                               l_mapping_column_name1,
7072                                               l_mapping_column_name2,
7073                                               p_copy_entity_txn_id);
7074                    --
7075 
7076                ben_copy_entity_results_api.create_copy_entity_results(
7077                     p_copy_entity_result_id           => l_copy_entity_result_id,
7078                     p_copy_entity_txn_id             => p_copy_entity_txn_id,
7079                     p_result_type_cd                 => l_result_type_cd,
7080                     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
7081                     p_parent_entity_result_id        => l_mirror_src_entity_result_id,
7082                     p_number_of_copies               => l_number_of_copies,
7083 					p_table_alias					  => 'ENP',
7084                     p_table_route_id                 => l_table_route_id,
7085                     p_information1     => l_enp_rec.enrt_perd_id,
7086                     p_information2     => null,
7087                     p_information3     => null,
7088                     p_information4     => l_enp_rec.business_group_id,
7089                     p_information5     => l_information5 , -- 9999 put name for h-grid
7090                     p_information10      => l_pet_popl_enrt_typ_cycl_esd,
7091                     p_information306     => l_enp_rec.asg_updt_eff_date,
7092                     p_information316     => l_enp_rec.asnd_lf_evt_dt,
7093                     p_information11      => l_enp_rec.auto_distr_flag,
7094                     p_information308     => l_enp_rec.bdgt_upd_end_dt,
7095                     p_information309     => l_enp_rec.bdgt_upd_strt_dt,
7096                     p_information16      => l_enp_rec.cls_enrt_dt_to_use_cd,
7097                     -- tilak cwb pl copy fix
7098                     p_information24      => l_enp_rec.approval_mode_cd,
7099                     p_information310     => l_enp_rec.data_freeze_date,
7100                     p_information268     => l_enp_rec.hrchy_ame_app_id,
7101                     p_information25      => l_enp_rec.hrchy_ame_trn_cd,
7102                     p_information267     => l_enp_rec.hrchy_rl,
7103                     p_information23      => l_enp_rec.sal_chg_reason_cd,
7104                     --
7105                     p_information312     => l_enp_rec.dflt_enrt_dt,
7106                     p_information12      => l_enp_rec.dflt_ws_acc_cd,
7107                     p_information13      => l_enp_rec.emp_interview_type_cd,
7108                     p_information317     => l_enp_rec.end_dt,
7109                     p_information111     => l_enp_rec.enp_attribute1,
7110                     p_information120     => l_enp_rec.enp_attribute10,
7111                     p_information121     => l_enp_rec.enp_attribute11,
7112                     p_information122     => l_enp_rec.enp_attribute12,
7113                     p_information123     => l_enp_rec.enp_attribute13,
7114                     p_information124     => l_enp_rec.enp_attribute14,
7115                     p_information125     => l_enp_rec.enp_attribute15,
7116                     p_information126     => l_enp_rec.enp_attribute16,
7117                     p_information127     => l_enp_rec.enp_attribute17,
7118                     p_information128     => l_enp_rec.enp_attribute18,
7119                     p_information129     => l_enp_rec.enp_attribute19,
7120                     p_information112     => l_enp_rec.enp_attribute2,
7121                     p_information130     => l_enp_rec.enp_attribute20,
7122                     p_information131     => l_enp_rec.enp_attribute21,
7123                     p_information132     => l_enp_rec.enp_attribute22,
7124                     p_information133     => l_enp_rec.enp_attribute23,
7125                     p_information134     => l_enp_rec.enp_attribute24,
7126                     p_information135     => l_enp_rec.enp_attribute25,
7127                     p_information136     => l_enp_rec.enp_attribute26,
7128                     p_information137     => l_enp_rec.enp_attribute27,
7129                     p_information138     => l_enp_rec.enp_attribute28,
7130                     p_information139     => l_enp_rec.enp_attribute29,
7131                     p_information113     => l_enp_rec.enp_attribute3,
7132                     p_information140     => l_enp_rec.enp_attribute30,
7133                     p_information114     => l_enp_rec.enp_attribute4,
7134                     p_information115     => l_enp_rec.enp_attribute5,
7135                     p_information116     => l_enp_rec.enp_attribute6,
7136                     p_information117     => l_enp_rec.enp_attribute7,
7137                     p_information118     => l_enp_rec.enp_attribute8,
7138                     p_information119     => l_enp_rec.enp_attribute9,
7139                     p_information110     => l_enp_rec.enp_attribute_category,
7140                     p_information314     => l_enp_rec.enrt_cvg_end_dt,
7141                     p_information18      => l_enp_rec.enrt_cvg_end_dt_cd,
7142                     p_information263     => l_enp_rec.enrt_cvg_end_dt_rl,
7143                     p_information313     => l_enp_rec.enrt_cvg_strt_dt,
7144                     p_information17      => l_enp_rec.enrt_cvg_strt_dt_cd,
7145                     p_information262     => l_enp_rec.enrt_cvg_strt_dt_rl,
7146                     p_information14      => l_enp_rec.hrchy_to_use_cd,
7147                     p_information257     => l_enp_rec.ler_id,
7148                     p_information307     => l_enp_rec.perf_revw_strt_dt,
7149                     p_information232     => l_enp_rec.popl_enrt_typ_cycl_id,
7150                     -- Data for MAPPING columns.
7151                     p_information173     => l_mapping_name,
7152                     p_information174     => l_mapping_id,
7153                     p_information181     => l_mapping_column_name1,
7154                     p_information182     => l_mapping_column_name2,
7155                     -- END other product Mapping columns.
7156                     p_information315     => l_enp_rec.procg_end_dt,
7157                     p_information15      => l_enp_rec.prsvr_bdgt_cd,
7158                     p_information20      => l_enp_rec.rt_end_dt_cd,
7159                     p_information264     => l_enp_rec.rt_end_dt_rl,
7160                     p_information19      => l_enp_rec.rt_strt_dt_cd,
7161                     p_information261     => l_enp_rec.rt_strt_dt_rl,
7162                     p_information318     => l_enp_rec.strt_dt,
7163                     p_information21      => l_enp_rec.uses_bdgt_flag,
7164                     p_information319     => l_enp_rec.ws_upd_end_dt,
7165                     p_information320     => l_enp_rec.ws_upd_strt_dt,
7166                     p_information266     => l_enp_rec.wthn_yr_perd_id,
7167                     p_information240     => l_enp_rec.yr_perd_id,
7168                     p_information22      => l_enp_rec.enrt_perd_det_ovrlp_bckdt_cd,
7169                     p_information166     => l_pos_structure_start_date,
7170                     p_information265     => l_enp_rec.object_version_number,
7171 		    --Added two cols reinstate_cd,reinstate_ovrdn_cd
7172 		    p_information26		=> l_enp_rec.reinstate_cd,
7173 		    p_information27		=> l_enp_rec.reinstate_ovrdn_cd,
7174 		    --
7175                     p_object_version_number          => l_object_version_number,
7176                     p_effective_date                 => p_effective_date       );
7177                     --
7178 
7179                     if l_out_enp_result_id is null then
7180                       l_out_enp_result_id := l_copy_entity_result_id;
7181                     end if;
7182 
7183                     if l_result_type_cd = 'DISPLAY' then
7184                       l_out_enp_result_id := l_copy_entity_result_id ;
7185                     end if;
7186 
7187               if (l_enp_rec.ler_id is not null) then
7188                    ben_plan_design_plan_module.create_ler_result (
7189                        p_validate                       => p_validate
7190                       ,p_copy_entity_result_id          => l_copy_entity_result_id
7191                       ,p_copy_entity_txn_id             => p_copy_entity_txn_id
7192                       ,p_ler_id                         => l_enp_rec.ler_id
7193                       ,p_business_group_id              => l_enp_rec.business_group_id
7194                       ,p_number_of_copies               => l_number_of_copies
7195                       ,p_object_version_number          => l_object_version_number
7196                       ,p_effective_date                 => p_effective_date
7197                       );
7198               end if;
7199               --
7200 	      if (l_enp_rec.enrt_cvg_strt_dt_rl is not null) then
7201 		   ben_plan_design_program_module.create_formula_result(
7202 			p_validate                       => p_validate
7203 			,p_copy_entity_result_id  => l_copy_entity_result_id
7204 			,p_copy_entity_txn_id      => p_copy_entity_txn_id
7205 			,p_formula_id                  => l_enp_rec.enrt_cvg_strt_dt_rl
7206 			,p_business_group_id        => l_enp_rec.business_group_id
7207 			,p_number_of_copies         =>  l_number_of_copies
7208 			,p_object_version_number  => l_object_version_number
7209 			,p_effective_date             => p_effective_date);
7210 	      end if;
7211               --
7212 	      if (l_enp_rec.hrchy_rl is not null) then
7213 		   ben_plan_design_program_module.create_formula_result(
7214 			p_validate                       => p_validate
7215 			,p_copy_entity_result_id  => l_copy_entity_result_id
7216 			,p_copy_entity_txn_id      => p_copy_entity_txn_id
7217 			,p_formula_id                  => l_enp_rec.hrchy_rl
7218 			,p_business_group_id        => l_enp_rec.business_group_id
7219 			,p_number_of_copies         =>  l_number_of_copies
7220 			,p_object_version_number  => l_object_version_number
7221 			,p_effective_date             => p_effective_date);
7222 	      end if;
7223 
7224               if (l_enp_rec.enrt_cvg_end_dt_rl is not null) then
7225 		   ben_plan_design_program_module.create_formula_result(
7226 			p_validate                       => p_validate
7227 			,p_copy_entity_result_id  => l_copy_entity_result_id
7228 			,p_copy_entity_txn_id      => p_copy_entity_txn_id
7229 			,p_formula_id                  =>  l_enp_rec.enrt_cvg_end_dt_rl
7230 			,p_business_group_id        =>  l_enp_rec.business_group_id
7231 			,p_number_of_copies         =>  l_number_of_copies
7232 			,p_object_version_number  => l_object_version_number
7233 			,p_effective_date             => p_effective_date);
7234               end if;
7235 
7236               if (l_enp_rec.rt_end_dt_rl is not null) then
7237 		   ben_plan_design_program_module.create_formula_result(
7238 			p_validate                       => p_validate
7239 			,p_copy_entity_result_id  => l_copy_entity_result_id
7240 			,p_copy_entity_txn_id      => p_copy_entity_txn_id
7241 			,p_formula_id                  => l_enp_rec.rt_end_dt_rl
7242 			,p_business_group_id        => l_enp_rec.business_group_id
7243 			,p_number_of_copies         =>  l_number_of_copies
7244 			,p_object_version_number  => l_object_version_number
7245 			,p_effective_date             => p_effective_date);
7246               end if;
7247 
7248               if (l_enp_rec.rt_strt_dt_rl is not null) then
7249 		   ben_plan_design_program_module.create_formula_result(
7250 			p_validate                       => p_validate
7251 			,p_copy_entity_result_id  => l_copy_entity_result_id
7252 			,p_copy_entity_txn_id      => p_copy_entity_txn_id
7253 			,p_formula_id                  =>  l_enp_rec.rt_strt_dt_rl
7254 			,p_business_group_id        =>  l_enp_rec.business_group_id
7255 			,p_number_of_copies         =>  l_number_of_copies
7256 			,p_object_version_number  => l_object_version_number
7257 			,p_effective_date             => p_effective_date);
7258 	      end if;
7259 
7260              --
7261              end loop;
7262            --
7263              ---------------------------------------------------------------
7264              -- START OF BEN_YR_PERD ----------------------
7265              ---------------------------------------------------------------
7266               --
7267               for l_parent_rec  in c_yrp1_from_parent(l_ENRT_PERD_ID) loop
7268               --
7269                 create_yr_perd_result
7270                 (p_validate                       => p_validate
7271                 ,p_copy_entity_result_id          => l_out_enp_result_id
7272                 ,p_copy_entity_txn_id             => p_copy_entity_txn_id
7273                 ,p_yr_perd_id                     => l_parent_rec.yr_perd_id
7274                 ,p_business_group_id              => p_business_group_id
7275                 ,p_number_of_copies               => p_number_of_copies
7276                 ,p_object_version_number          => l_object_version_number
7277                 ,p_effective_date                 => p_effective_date
7278                 ,p_parent_entity_result_id        => l_out_enp_result_id
7279                 );
7280               end loop;
7281               --
7282              ---------------------------------------------------------------
7283              -- END OF BEN_YR_PERD ----------------------
7284              ---------------------------------------------------------------
7285             ---------------------------------------------------------------
7286             -- START OF BEN_ENRT_PERD_FOR_PL_F ----------------------
7287             ---------------------------------------------------------------
7288              --
7289              for l_parent_rec  in c_erp_from_parent(l_ENRT_PERD_ID, p_pgm_id) loop
7290              --
7291                l_mirror_src_entity_result_id := l_out_enp_result_id ;
7292 
7293                l_enrt_perd_for_pl_id := l_parent_rec.enrt_perd_for_pl_id ;
7294                --
7295                for l_erp_rec in c_erp(l_parent_rec.enrt_perd_for_pl_id,l_mirror_src_entity_result_id,'ERP') loop
7296                --
7297                --
7298                    l_table_route_id := null ;
7299                    open ben_plan_design_program_module.g_table_route('ERP');
7300                    fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
7301                    close ben_plan_design_program_module.g_table_route ;
7302                    --
7303                    l_information5  := ben_plan_design_program_module.get_pl_name(l_erp_rec.pl_id,p_effective_date);--'Intersection'
7304                    --
7305                    if p_effective_date between l_erp_rec.effective_start_date
7306                        and l_erp_rec.effective_end_date then
7307                        --
7308                        l_result_type_cd := 'DISPLAY';
7309                    else
7310                        l_result_type_cd := 'NO DISPLAY';
7311                    end if;
7312                    --
7313                    l_copy_entity_result_id := null;
7314                    l_object_version_number := null;
7315                    ben_copy_entity_results_api.create_copy_entity_results(
7316                         p_copy_entity_result_id           => l_copy_entity_result_id,
7317                         p_copy_entity_txn_id             => p_copy_entity_txn_id,
7318                         p_result_type_cd                 => l_result_type_cd,
7319                         p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
7320                         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
7321                         p_number_of_copies               => l_number_of_copies,
7322                         p_table_alias					  => 'ERP',
7323                         p_table_route_id                 => l_table_route_id,
7324                         p_information1     => l_erp_rec.enrt_perd_for_pl_id,
7325                         p_information2     => l_erp_rec.EFFECTIVE_START_DATE,
7326                         p_information3     => l_erp_rec.EFFECTIVE_END_DATE,
7327                         p_information4     => l_erp_rec.business_group_id,
7328                         p_information5     => l_information5 , -- 9999 put name for h-grid
7329                         p_information12     => l_erp_rec.enrt_cvg_end_dt_cd,
7330                         p_information262     => l_erp_rec.enrt_cvg_end_dt_rl,
7331                         p_information11     => l_erp_rec.enrt_cvg_strt_dt_cd,
7332                         p_information260     => l_erp_rec.enrt_cvg_strt_dt_rl,
7333                         p_information244     => l_erp_rec.enrt_perd_id,
7334                         p_information111     => l_erp_rec.erp_attribute1,
7335                         p_information120     => l_erp_rec.erp_attribute10,
7336                         p_information121     => l_erp_rec.erp_attribute11,
7337                         p_information122     => l_erp_rec.erp_attribute12,
7338                         p_information123     => l_erp_rec.erp_attribute13,
7339                         p_information124     => l_erp_rec.erp_attribute14,
7340                         p_information125     => l_erp_rec.erp_attribute15,
7341                         p_information126     => l_erp_rec.erp_attribute16,
7342                         p_information127     => l_erp_rec.erp_attribute17,
7343                         p_information128     => l_erp_rec.erp_attribute18,
7344                         p_information129     => l_erp_rec.erp_attribute19,
7345                         p_information112     => l_erp_rec.erp_attribute2,
7346                         p_information130     => l_erp_rec.erp_attribute20,
7347                         p_information131     => l_erp_rec.erp_attribute21,
7348                         p_information132     => l_erp_rec.erp_attribute22,
7349                         p_information133     => l_erp_rec.erp_attribute23,
7350                         p_information134     => l_erp_rec.erp_attribute24,
7351                         p_information135     => l_erp_rec.erp_attribute25,
7352                         p_information136     => l_erp_rec.erp_attribute26,
7353                         p_information137     => l_erp_rec.erp_attribute27,
7354                         p_information138     => l_erp_rec.erp_attribute28,
7355                         p_information139     => l_erp_rec.erp_attribute29,
7356                         p_information113     => l_erp_rec.erp_attribute3,
7357                         p_information140     => l_erp_rec.erp_attribute30,
7358                         p_information114     => l_erp_rec.erp_attribute4,
7359                         p_information115     => l_erp_rec.erp_attribute5,
7360                         p_information116     => l_erp_rec.erp_attribute6,
7361                         p_information117     => l_erp_rec.erp_attribute7,
7362                         p_information118     => l_erp_rec.erp_attribute8,
7363                         p_information119     => l_erp_rec.erp_attribute9,
7364                         p_information110     => l_erp_rec.erp_attribute_category,
7365                         p_information234     => l_erp_rec.lee_rsn_id,
7366                         p_information261     => l_erp_rec.pl_id,
7367                         p_information14     => l_erp_rec.rt_end_dt_cd,
7368                         p_information264     => l_erp_rec.rt_end_dt_rl,
7369                         p_information13     => l_erp_rec.rt_strt_dt_cd,
7370                         p_information263     => l_erp_rec.rt_strt_dt_rl,
7371                         p_information265     => l_erp_rec.object_version_number,
7372                         p_object_version_number          => l_object_version_number,
7373                         p_effective_date                 => p_effective_date       );
7374                  --
7375 
7376                         if l_out_erp_result_id is null then
7377                           l_out_erp_result_id := l_copy_entity_result_id;
7378                         end if;
7379 
7380                         if l_result_type_cd = 'DISPLAY' then
7381                           l_out_erp_result_id := l_copy_entity_result_id ;
7382                         end if;
7383 
7384                       if (l_erp_rec.enrt_cvg_strt_dt_rl is not null) then
7385 						   ben_plan_design_program_module.create_formula_result(
7386 								p_validate                       => p_validate
7387 								,p_copy_entity_result_id  => l_copy_entity_result_id
7388 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
7389 								,p_formula_id                  =>  l_erp_rec.enrt_cvg_strt_dt_rl
7390 								,p_business_group_id        => l_erp_rec.business_group_id
7391 								,p_number_of_copies         =>  l_number_of_copies
7392 								,p_object_version_number  => l_object_version_number
7393 								,p_effective_date             => p_effective_date);
7394 						end if;
7395 
7396                       if (l_erp_rec.enrt_cvg_end_dt_rl is not null) then
7397 						   ben_plan_design_program_module.create_formula_result(
7398 								p_validate                       => p_validate
7399 								,p_copy_entity_result_id  => l_copy_entity_result_id
7400 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
7401 								,p_formula_id                  => l_erp_rec.enrt_cvg_end_dt_rl
7402 								,p_business_group_id        => l_erp_rec.business_group_id
7403 								,p_number_of_copies         =>  l_number_of_copies
7404 								,p_object_version_number  => l_object_version_number
7405 								,p_effective_date             => p_effective_date);
7406 						end if;
7407 
7408                       if (l_erp_rec.rt_end_dt_rl is not null) then
7409 						   ben_plan_design_program_module.create_formula_result(
7410 								p_validate                       => p_validate
7411 								,p_copy_entity_result_id  => l_copy_entity_result_id
7412 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
7413 								,p_formula_id                  => l_erp_rec.rt_end_dt_rl
7414 								,p_business_group_id        => l_erp_rec.business_group_id
7415 								,p_number_of_copies         =>  l_number_of_copies
7416 								,p_object_version_number  => l_object_version_number
7417 								,p_effective_date             => p_effective_date);
7418 						end if;
7419 
7420                       if (l_erp_rec.rt_strt_dt_rl is not null) then
7421 						   ben_plan_design_program_module.create_formula_result(
7422 								p_validate                       => p_validate
7423 								,p_copy_entity_result_id  => l_copy_entity_result_id
7424 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
7425 								,p_formula_id                  => l_erp_rec.rt_strt_dt_rl
7426 								,p_business_group_id        => l_erp_rec.business_group_id
7427 								,p_number_of_copies         =>  l_number_of_copies
7428 								,p_object_version_number  => l_object_version_number
7429 								,p_effective_date             => p_effective_date);
7430 						end if;
7431 
7432                  --
7433                  end loop;
7434                --
7435                end loop;
7436             ---------------------------------------------------------------
7437             -- END OF BEN_ENRT_PERD_FOR_PL_F ----------------------
7438             ---------------------------------------------------------------
7439              ---------------------------------------------------------------
7440              -- START OF BEN_SCHEDD_ENRT_RL_F ----------------------
7441              ---------------------------------------------------------------
7442               --
7443               for l_parent_rec  in c_ser_from_parent(l_ENRT_PERD_ID) loop
7444               --
7445                 l_mirror_src_entity_result_id := l_out_enp_result_id ;
7446 
7447                 l_schedd_enrt_rl_id := l_parent_rec.schedd_enrt_rl_id ;
7448                 --
7449                 for l_ser_rec in c_ser(l_parent_rec.schedd_enrt_rl_id,l_mirror_src_entity_result_id,'SER') loop
7450                 --
7451                 --
7452                     l_table_route_id := null ;
7453                     open ben_plan_design_program_module.g_table_route('SER');
7454                     fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
7455                     close ben_plan_design_program_module.g_table_route ;
7456                     --
7457                     l_information5  := ben_plan_design_program_module.get_formula_name(l_ser_rec.formula_id,p_effective_date); --'Intersection';
7458                     --
7459                     if p_effective_date between l_ser_rec.effective_start_date
7460                         and l_ser_rec.effective_end_date then
7461                         --
7462                         l_result_type_cd := 'DISPLAY';
7463                     else
7464                         l_result_type_cd := 'NO DISPLAY';
7465                     end if;
7466                     --
7467                     l_copy_entity_result_id := null;
7468                     l_object_version_number := null;
7469                     ben_copy_entity_results_api.create_copy_entity_results(
7470                          p_copy_entity_result_id           => l_copy_entity_result_id,
7471                          p_copy_entity_txn_id             => p_copy_entity_txn_id,
7472                          p_result_type_cd                 => l_result_type_cd,
7473                          p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
7474                          p_parent_entity_result_id        => l_mirror_src_entity_result_id,
7475                          p_number_of_copies               => l_number_of_copies,
7476                          p_table_alias					  => 'SER',
7477                          p_table_route_id                 => l_table_route_id,
7478                          p_information1     => l_ser_rec.schedd_enrt_rl_id,
7479                          p_information2     => l_ser_rec.EFFECTIVE_START_DATE,
7480                          p_information3     => l_ser_rec.EFFECTIVE_END_DATE,
7481                          p_information4     => l_ser_rec.business_group_id,
7482                          p_information5     => l_information5 , -- 9999 put name for h-grid
7483                          p_information244     => l_ser_rec.enrt_perd_id,
7484                          p_information251     => l_ser_rec.formula_id,
7485                          p_information260     => l_ser_rec.ordr_to_aply_num,
7486                          p_information111     => l_ser_rec.ser_attribute1,
7487                          p_information120     => l_ser_rec.ser_attribute10,
7488                          p_information121     => l_ser_rec.ser_attribute11,
7489                          p_information122     => l_ser_rec.ser_attribute12,
7490                          p_information123     => l_ser_rec.ser_attribute13,
7491                          p_information124     => l_ser_rec.ser_attribute14,
7492                          p_information125     => l_ser_rec.ser_attribute15,
7493                          p_information126     => l_ser_rec.ser_attribute16,
7494                          p_information127     => l_ser_rec.ser_attribute17,
7495                          p_information128     => l_ser_rec.ser_attribute18,
7496                          p_information129     => l_ser_rec.ser_attribute19,
7497                          p_information112     => l_ser_rec.ser_attribute2,
7498                          p_information130     => l_ser_rec.ser_attribute20,
7499                          p_information131     => l_ser_rec.ser_attribute21,
7500                          p_information132     => l_ser_rec.ser_attribute22,
7501                          p_information133     => l_ser_rec.ser_attribute23,
7502                          p_information134     => l_ser_rec.ser_attribute24,
7503                          p_information135     => l_ser_rec.ser_attribute25,
7504                          p_information136     => l_ser_rec.ser_attribute26,
7505                          p_information137     => l_ser_rec.ser_attribute27,
7506                          p_information138     => l_ser_rec.ser_attribute28,
7507                          p_information139     => l_ser_rec.ser_attribute29,
7508                          p_information113     => l_ser_rec.ser_attribute3,
7509                          p_information140     => l_ser_rec.ser_attribute30,
7510                          p_information114     => l_ser_rec.ser_attribute4,
7511                          p_information115     => l_ser_rec.ser_attribute5,
7512                          p_information116     => l_ser_rec.ser_attribute6,
7513                          p_information117     => l_ser_rec.ser_attribute7,
7514                          p_information118     => l_ser_rec.ser_attribute8,
7515                          p_information119     => l_ser_rec.ser_attribute9,
7516                          p_information110     => l_ser_rec.ser_attribute_category,
7517                          p_information265     => l_ser_rec.object_version_number,
7518                          p_object_version_number          => l_object_version_number,
7519                          p_effective_date                 => p_effective_date       );
7520                   --
7521 
7522                          if l_out_ser_result_id is null then
7523                           l_out_ser_result_id := l_copy_entity_result_id;
7524                         end if;
7525 
7526                         if l_result_type_cd = 'DISPLAY' then
7527                           l_out_ser_result_id := l_copy_entity_result_id ;
7528                         end if;
7529 
7530                       if (l_ser_rec.formula_id is not null) then
7531 						   ben_plan_design_program_module.create_formula_result(
7532 								p_validate                       => p_validate
7533 								,p_copy_entity_result_id  => l_copy_entity_result_id
7534 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
7535 								,p_formula_id                  => l_ser_rec.formula_id
7536 								,p_business_group_id        => l_ser_rec.business_group_id
7537 								,p_number_of_copies         =>  l_number_of_copies
7538 								,p_object_version_number  => l_object_version_number
7539 								,p_effective_date             => p_effective_date);
7540 						end if;
7541 
7542                   --
7543                   end loop;
7544                 --
7545                 end loop;
7546              ---------------------------------------------------------------
7547              -- END OF BEN_SCHEDD_ENRT_RL_F ----------------------
7548              ---------------------------------------------------------------
7549            end loop;
7550         ---------------------------------------------------------------
7551         -- END OF BEN_ENRT_PERD ----------------------
7552         ---------------------------------------------------------------
7553          ---------------------------------------------------------------
7554          -- START OF BEN_LEE_RSN_F ----------------------
7555          ---------------------------------------------------------------
7556           --
7557           for l_parent_rec  in c_len_from_parent(l_POPL_ENRT_TYP_CYCL_ID) loop
7558           --
7559             l_mirror_src_entity_result_id := l_out_pet_result_id ;
7560 
7561             l_lee_rsn_id := l_parent_rec.lee_rsn_id ;
7562             --
7563             for l_len_rec in c_len(l_parent_rec.lee_rsn_id,l_mirror_src_entity_result_id,'LEN') loop
7564             --
7565             --
7566                 l_table_route_id := null ;
7567                 open ben_plan_design_program_module.g_table_route('LEN');
7568                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
7569                 close ben_plan_design_program_module.g_table_route ;
7570                 --
7571                 l_information5  := ben_plan_design_program_module.get_ler_name(l_len_rec.ler_id,p_effective_date); --'Intersection';
7572                 --
7573                 if p_effective_date between l_len_rec.effective_start_date
7574                     and l_len_rec.effective_end_date then
7575                     --
7576                     l_result_type_cd := 'DISPLAY';
7577                 else
7578                     l_result_type_cd := 'NO DISPLAY';
7579                 end if;
7580                 --
7581                 l_copy_entity_result_id := null;
7582                 l_object_version_number := null;
7583                 ben_copy_entity_results_api.create_copy_entity_results(
7584                      p_copy_entity_result_id           => l_copy_entity_result_id,
7585                      p_copy_entity_txn_id             => p_copy_entity_txn_id,
7586                      p_result_type_cd                 => l_result_type_cd,
7587                      p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
7588                      p_parent_entity_result_id        => l_mirror_src_entity_result_id,
7589                      p_number_of_copies               => l_number_of_copies,
7590                      p_table_alias					  => 'LEN',
7591                      p_table_route_id                 => l_table_route_id,
7592                      p_information1     => l_len_rec.lee_rsn_id,
7593                      p_information2     => l_len_rec.EFFECTIVE_START_DATE,
7594                      p_information3     => l_len_rec.EFFECTIVE_END_DATE,
7595                      p_information4     => l_len_rec.business_group_id,
7596                      p_information5     => l_information5 , -- 9999 put name for h-grid
7597                      p_information260     => l_len_rec.addl_procg_dys_num,
7598                      p_information11     => l_len_rec.cls_enrt_dt_to_use_cd,
7599                      p_information258     => l_len_rec.dys_aftr_end_to_dflt_num,
7600                      p_information262     => l_len_rec.dys_no_enrl_cant_enrl_num,
7601                      p_information261     => l_len_rec.dys_no_enrl_not_elig_num,
7602                      p_information12     => l_len_rec.enrt_cvg_end_dt_cd,
7603                      p_information266     => l_len_rec.enrt_cvg_end_dt_rl,
7604                      p_information13     => l_len_rec.enrt_cvg_strt_dt_cd,
7605                      p_information267     => l_len_rec.enrt_cvg_strt_dt_rl,
7606                      p_information15     => l_len_rec.enrt_perd_end_dt_cd,
7607                      p_information268     => l_len_rec.enrt_perd_end_dt_rl,
7608                      p_information14     => l_len_rec.enrt_perd_strt_dt_cd,
7609                      p_information259     => l_len_rec.enrt_perd_strt_dt_rl,
7610                      p_information111     => l_len_rec.len_attribute1,
7611                      p_information120     => l_len_rec.len_attribute10,
7612                      p_information121     => l_len_rec.len_attribute11,
7613                      p_information122     => l_len_rec.len_attribute12,
7614                      p_information123     => l_len_rec.len_attribute13,
7615                      p_information124     => l_len_rec.len_attribute14,
7616                      p_information125     => l_len_rec.len_attribute15,
7617                      p_information126     => l_len_rec.len_attribute16,
7618                      p_information127     => l_len_rec.len_attribute17,
7619                      p_information128     => l_len_rec.len_attribute18,
7620                      p_information129     => l_len_rec.len_attribute19,
7621                      p_information112     => l_len_rec.len_attribute2,
7622                      p_information130     => l_len_rec.len_attribute20,
7623                      p_information131     => l_len_rec.len_attribute21,
7624                      p_information132     => l_len_rec.len_attribute22,
7625                      p_information133     => l_len_rec.len_attribute23,
7626                      p_information134     => l_len_rec.len_attribute24,
7627                      p_information135     => l_len_rec.len_attribute25,
7628                      p_information136     => l_len_rec.len_attribute26,
7629                      p_information137     => l_len_rec.len_attribute27,
7630                      p_information138     => l_len_rec.len_attribute28,
7631                      p_information139     => l_len_rec.len_attribute29,
7632                      p_information113     => l_len_rec.len_attribute3,
7633                      p_information140     => l_len_rec.len_attribute30,
7634                      p_information114     => l_len_rec.len_attribute4,
7635                      p_information115     => l_len_rec.len_attribute5,
7636                      p_information116     => l_len_rec.len_attribute6,
7637                      p_information117     => l_len_rec.len_attribute7,
7638                      p_information118     => l_len_rec.len_attribute8,
7639                      p_information119     => l_len_rec.len_attribute9,
7640                      p_information110     => l_len_rec.len_attribute_category,
7641                      p_information257     => l_len_rec.ler_id,
7642                      p_information232     => l_len_rec.popl_enrt_typ_cycl_id,
7643                      p_information16     => l_len_rec.rt_end_dt_cd,
7644                      p_information263     => l_len_rec.rt_end_dt_rl,
7645                      p_information17     => l_len_rec.rt_strt_dt_cd,
7646                      p_information264     => l_len_rec.rt_strt_dt_rl,
7647                      p_information18      => l_len_rec.enrt_perd_det_ovrlp_bckdt_cd,
7648                      p_information265     => l_len_rec.object_version_number,
7649 		     --Two new cols added reinstate_cd, reinstate_ovrdn_cd
7650 		     p_information19		=> l_len_rec.reinstate_cd,
7651      		     p_information20		=> l_len_rec.reinstate_ovrdn_cd,
7652 		     p_information271		=> l_len_rec.ENRT_PERD_STRT_DAYS,
7653      		     p_information272		=> l_len_rec.ENRT_PERD_END_DAYS,
7654                      --
7655                      p_object_version_number          => l_object_version_number,
7656                      p_effective_date                 => p_effective_date       );
7657                 --
7658 
7659                 if l_out_len_result_id is null then
7660                   l_out_len_result_id := l_copy_entity_result_id;
7661                 end if;
7662 
7663                 if l_result_type_cd = 'DISPLAY' then
7664                   l_out_len_result_id := l_copy_entity_result_id ;
7665                 end if;
7666 				--
7667 
7668 				 if (l_len_rec.enrt_cvg_end_dt_rl is not null) then
7669 				   ben_plan_design_program_module.create_formula_result(
7670 						p_validate                       => p_validate
7671 						,p_copy_entity_result_id  => l_copy_entity_result_id
7672 						,p_copy_entity_txn_id      => p_copy_entity_txn_id
7673 						,p_formula_id                  => l_len_rec.enrt_cvg_end_dt_rl
7674 						,p_business_group_id        => l_len_rec.business_group_id
7675 						,p_number_of_copies         =>  l_number_of_copies
7676 						,p_object_version_number  => l_object_version_number
7677 						,p_effective_date             => p_effective_date);
7678 				end if;
7679 
7680 				 if (l_len_rec.enrt_cvg_strt_dt_rl is not null) then
7681 				   ben_plan_design_program_module.create_formula_result(
7682 						p_validate                       => p_validate
7683 						,p_copy_entity_result_id  => l_copy_entity_result_id
7684 						,p_copy_entity_txn_id      => p_copy_entity_txn_id
7685 						,p_formula_id                  => l_len_rec.enrt_cvg_strt_dt_rl
7686 						,p_business_group_id        => l_len_rec.business_group_id
7687 						,p_number_of_copies         =>  l_number_of_copies
7688 						,p_object_version_number  => l_object_version_number
7689 						,p_effective_date             => p_effective_date);
7690 				end if;
7691 
7692 				 if (l_len_rec.enrt_perd_end_dt_rl is not null) then
7693 				   ben_plan_design_program_module.create_formula_result(
7694 						p_validate                       => p_validate
7695 						,p_copy_entity_result_id  => l_copy_entity_result_id
7696 						,p_copy_entity_txn_id      => p_copy_entity_txn_id
7697 						,p_formula_id                  => l_len_rec.enrt_perd_end_dt_rl
7698 						,p_business_group_id        => l_len_rec.business_group_id
7699 						,p_number_of_copies         =>  l_number_of_copies
7700 						,p_object_version_number  => l_object_version_number
7701 						,p_effective_date             => p_effective_date);
7702 				end if;
7703 
7704 				 if (l_len_rec.enrt_perd_strt_dt_rl is not null) then
7705 				   ben_plan_design_program_module.create_formula_result(
7706 						p_validate                       => p_validate
7707 						,p_copy_entity_result_id  => l_copy_entity_result_id
7708 						,p_copy_entity_txn_id      => p_copy_entity_txn_id
7709 						,p_formula_id                  => l_len_rec.enrt_perd_strt_dt_rl
7710 						,p_business_group_id        => l_len_rec.business_group_id
7711 						,p_number_of_copies         =>  l_number_of_copies
7712 						,p_object_version_number  => l_object_version_number
7713 						,p_effective_date             => p_effective_date);
7714 				end if;
7715 
7716 				 if (l_len_rec.rt_end_dt_rl is not null) then
7717 				   ben_plan_design_program_module.create_formula_result(
7718 						p_validate                       => p_validate
7719 						,p_copy_entity_result_id  => l_copy_entity_result_id
7720 						,p_copy_entity_txn_id      => p_copy_entity_txn_id
7721 						,p_formula_id                  => l_len_rec.rt_end_dt_rl
7722 						,p_business_group_id        => l_len_rec.business_group_id
7723 						,p_number_of_copies         =>  l_number_of_copies
7724 						,p_object_version_number  => l_object_version_number
7725 						,p_effective_date             => p_effective_date);
7726 				end if;
7727 				 if (l_len_rec.rt_strt_dt_rl is not null) then
7728 				   ben_plan_design_program_module.create_formula_result(
7729 						p_validate                       => p_validate
7730 						,p_copy_entity_result_id  => l_copy_entity_result_id
7731 						,p_copy_entity_txn_id      => p_copy_entity_txn_id
7732 						,p_formula_id                  => l_len_rec.rt_strt_dt_rl
7733 						,p_business_group_id        => l_len_rec.business_group_id
7734 						,p_number_of_copies         =>  l_number_of_copies
7735 						,p_object_version_number  => l_object_version_number
7736 						,p_effective_date             => p_effective_date);
7737 				end if;
7738 
7739 
7740 
7741                 --
7742               end loop;
7743             --
7744               for l_len_rec in c_len_drp(l_parent_rec.lee_rsn_id,l_mirror_src_entity_result_id,'LEN') loop
7745                    create_ler_result (
7746                       p_validate                       => p_validate
7747                      ,p_copy_entity_result_id          => l_out_len_result_id
7748                      ,p_copy_entity_txn_id             => p_copy_entity_txn_id
7749                      ,p_ler_id                         => l_len_rec.ler_id
7750                      ,p_business_group_id              => p_business_group_id
7751                      ,p_number_of_copies               => p_number_of_copies
7752                      ,p_object_version_number          => l_object_version_number
7753                      ,p_effective_date                 => p_effective_date
7754                      );
7755               end loop;
7756              ---------------------------------------------------------------
7757              -- START OF BEN_ENRT_PERD_FOR_PL_F ----------------------
7758              ---------------------------------------------------------------
7759               --
7760               for l_parent_rec  in c_erp1_from_parent(l_LEE_RSN_ID, p_pgm_id) loop
7761               --
7762                 l_mirror_src_entity_result_id := l_out_len_result_id ;
7763 
7764                 l_enrt_perd_for_pl_id1 := l_parent_rec.enrt_perd_for_pl_id ;
7765                 --
7766                 for l_erp_rec in c_erp1(l_parent_rec.enrt_perd_for_pl_id,l_mirror_src_entity_result_id,'ERP') loop
7767                 --
7768                 --
7769                     l_table_route_id := null ;
7770                     open ben_plan_design_program_module.g_table_route('ERP');
7771                     fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
7772                     close ben_plan_design_program_module.g_table_route ;
7773                     --
7774                     l_information5  := ben_plan_design_program_module.get_pl_name(l_erp_rec.pl_id,p_effective_date);--'Intersection';
7775                     --
7776                     if p_effective_date between l_erp_rec.effective_start_date
7777                         and l_erp_rec.effective_end_date then
7778                         --
7779                         l_result_type_cd := 'DISPLAY';
7780                     else
7781                         l_result_type_cd := 'NO DISPLAY';
7782                     end if;
7783                     --
7784                     l_copy_entity_result_id := null;
7785                     l_object_version_number := null;
7786                     ben_copy_entity_results_api.create_copy_entity_results(
7787                          p_copy_entity_result_id           => l_copy_entity_result_id,
7788                          p_copy_entity_txn_id             => p_copy_entity_txn_id,
7789                          p_result_type_cd                 => l_result_type_cd,
7790                          p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
7791                          p_parent_entity_result_id        => l_mirror_src_entity_result_id,
7792                          p_number_of_copies               => l_number_of_copies,
7793                          p_table_alias					  => 'ERP',
7794                          p_table_route_id                 => l_table_route_id,
7795                          p_information1     => l_erp_rec.enrt_perd_for_pl_id,
7796                          p_information2     => l_erp_rec.EFFECTIVE_START_DATE,
7797                          p_information3     => l_erp_rec.EFFECTIVE_END_DATE,
7798                          p_information4     => l_erp_rec.business_group_id,
7799                          p_information5     => l_information5 , -- 9999 put name for h-grid
7800                          p_information12     => l_erp_rec.enrt_cvg_end_dt_cd,
7801                          p_information262     => l_erp_rec.enrt_cvg_end_dt_rl,
7802                          p_information11     => l_erp_rec.enrt_cvg_strt_dt_cd,
7803                          p_information260     => l_erp_rec.enrt_cvg_strt_dt_rl,
7804                          p_information244     => l_erp_rec.enrt_perd_id,
7805                          p_information111     => l_erp_rec.erp_attribute1,
7806                          p_information120     => l_erp_rec.erp_attribute10,
7807                          p_information121     => l_erp_rec.erp_attribute11,
7808                          p_information122     => l_erp_rec.erp_attribute12,
7809                          p_information123     => l_erp_rec.erp_attribute13,
7810                          p_information124     => l_erp_rec.erp_attribute14,
7811                          p_information125     => l_erp_rec.erp_attribute15,
7812                          p_information126     => l_erp_rec.erp_attribute16,
7813                          p_information127     => l_erp_rec.erp_attribute17,
7814                          p_information128     => l_erp_rec.erp_attribute18,
7815                          p_information129     => l_erp_rec.erp_attribute19,
7816                          p_information112     => l_erp_rec.erp_attribute2,
7817                          p_information130     => l_erp_rec.erp_attribute20,
7818                          p_information131     => l_erp_rec.erp_attribute21,
7819                          p_information132     => l_erp_rec.erp_attribute22,
7820                          p_information133     => l_erp_rec.erp_attribute23,
7821                          p_information134     => l_erp_rec.erp_attribute24,
7822                          p_information135     => l_erp_rec.erp_attribute25,
7823                          p_information136     => l_erp_rec.erp_attribute26,
7824                          p_information137     => l_erp_rec.erp_attribute27,
7825                          p_information138     => l_erp_rec.erp_attribute28,
7826                          p_information139     => l_erp_rec.erp_attribute29,
7827                          p_information113     => l_erp_rec.erp_attribute3,
7828                          p_information140     => l_erp_rec.erp_attribute30,
7829                          p_information114     => l_erp_rec.erp_attribute4,
7830                          p_information115     => l_erp_rec.erp_attribute5,
7831                          p_information116     => l_erp_rec.erp_attribute6,
7832                          p_information117     => l_erp_rec.erp_attribute7,
7833                          p_information118     => l_erp_rec.erp_attribute8,
7834                          p_information119     => l_erp_rec.erp_attribute9,
7835                          p_information110     => l_erp_rec.erp_attribute_category,
7836                          p_information234     => l_erp_rec.lee_rsn_id,
7837                          p_information261     => l_erp_rec.pl_id,
7838                          p_information14     => l_erp_rec.rt_end_dt_cd,
7839                          p_information264     => l_erp_rec.rt_end_dt_rl,
7840                          p_information13     => l_erp_rec.rt_strt_dt_cd,
7841                          p_information263     => l_erp_rec.rt_strt_dt_rl,
7842                          p_information265     => l_erp_rec.object_version_number,
7843                          p_object_version_number          => l_object_version_number,
7844                          p_effective_date                 => p_effective_date       );
7845                   --
7846 
7847                          if l_out_erp1_result_id is null then
7848                            l_out_erp1_result_id := l_copy_entity_result_id;
7849                          end if;
7850 
7851                          if l_result_type_cd = 'DISPLAY' then
7852                            l_out_erp1_result_id := l_copy_entity_result_id ;
7853                          end if;
7854 
7855                   end loop;
7856                 --
7857                 end loop;
7858              ---------------------------------------------------------------
7859              -- END OF BEN_ENRT_PERD_FOR_PL_F ----------------------
7860              ---------------------------------------------------------------
7861              ---------------------------------------------------------------
7862              -- START OF BEN_LEE_RSN_RL_F ----------------------
7863              ---------------------------------------------------------------
7864               --
7865               for l_parent_rec  in c_lrr_from_parent(l_LEE_RSN_ID) loop
7866               --
7867                 l_mirror_src_entity_result_id := l_out_len_result_id ;
7868 
7869                 l_lee_rsn_rl_id := l_parent_rec.lee_rsn_rl_id ;
7870                 --
7871                 for l_lrr_rec in c_lrr(l_parent_rec.lee_rsn_rl_id,l_mirror_src_entity_result_id,'LRR') loop
7872                 --
7873                 --
7874                     l_table_route_id := null ;
7875                     open ben_plan_design_program_module.g_table_route('LRR');
7876                     fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
7877                     close ben_plan_design_program_module.g_table_route ;
7878                     --
7879                     l_information5  := ben_plan_design_program_module.get_formula_name(l_lrr_rec.formula_id,p_effective_date);
7880                                       --'Intersection';
7881                     --
7882                     if p_effective_date between l_lrr_rec.effective_start_date
7883                         and l_lrr_rec.effective_end_date then
7884                         --
7885                         l_result_type_cd := 'DISPLAY';
7886                     else
7887                         l_result_type_cd := 'NO DISPLAY';
7888                     end if;
7889                     --
7890                     l_copy_entity_result_id := null;
7891                     l_object_version_number := null;
7892                     ben_copy_entity_results_api.create_copy_entity_results(
7893                          p_copy_entity_result_id           => l_copy_entity_result_id,
7894                          p_copy_entity_txn_id             => p_copy_entity_txn_id,
7895                          p_result_type_cd                 => l_result_type_cd,
7896                          p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
7897                          p_parent_entity_result_id        => l_mirror_src_entity_result_id,
7898                          p_number_of_copies               => l_number_of_copies,
7899                          p_table_alias					  => 'LRR',
7900                          p_table_route_id                 => l_table_route_id,
7901                          p_information1     => l_lrr_rec.lee_rsn_rl_id,
7902                          p_information2     => l_lrr_rec.EFFECTIVE_START_DATE,
7903                          p_information3     => l_lrr_rec.EFFECTIVE_END_DATE,
7904                          p_information4     => l_lrr_rec.business_group_id,
7905                          p_information5     => l_information5 , -- 9999 put name for h-grid
7906                          p_information251     => l_lrr_rec.formula_id,
7907                          p_information234     => l_lrr_rec.lee_rsn_id,
7908                          p_information111     => l_lrr_rec.lrr_attribute1,
7909                          p_information120     => l_lrr_rec.lrr_attribute10,
7910                          p_information121     => l_lrr_rec.lrr_attribute11,
7911                          p_information122     => l_lrr_rec.lrr_attribute12,
7912                          p_information123     => l_lrr_rec.lrr_attribute13,
7913                          p_information124     => l_lrr_rec.lrr_attribute14,
7914                          p_information125     => l_lrr_rec.lrr_attribute15,
7915                          p_information126     => l_lrr_rec.lrr_attribute16,
7916                          p_information127     => l_lrr_rec.lrr_attribute17,
7917                          p_information128     => l_lrr_rec.lrr_attribute18,
7918                          p_information129     => l_lrr_rec.lrr_attribute19,
7919                          p_information112     => l_lrr_rec.lrr_attribute2,
7920                          p_information130     => l_lrr_rec.lrr_attribute20,
7921                          p_information131     => l_lrr_rec.lrr_attribute21,
7922                          p_information132     => l_lrr_rec.lrr_attribute22,
7923                          p_information133     => l_lrr_rec.lrr_attribute23,
7924                          p_information134     => l_lrr_rec.lrr_attribute24,
7925                          p_information135     => l_lrr_rec.lrr_attribute25,
7926                          p_information136     => l_lrr_rec.lrr_attribute26,
7927                          p_information137     => l_lrr_rec.lrr_attribute27,
7928                          p_information138     => l_lrr_rec.lrr_attribute28,
7929                          p_information139     => l_lrr_rec.lrr_attribute29,
7930                          p_information113     => l_lrr_rec.lrr_attribute3,
7931                          p_information140     => l_lrr_rec.lrr_attribute30,
7932                          p_information114     => l_lrr_rec.lrr_attribute4,
7933                          p_information115     => l_lrr_rec.lrr_attribute5,
7934                          p_information116     => l_lrr_rec.lrr_attribute6,
7935                          p_information117     => l_lrr_rec.lrr_attribute7,
7936                          p_information118     => l_lrr_rec.lrr_attribute8,
7937                          p_information119     => l_lrr_rec.lrr_attribute9,
7938                          p_information110     => l_lrr_rec.lrr_attribute_category,
7939                          p_information260     => l_lrr_rec.ordr_to_aply_num,
7940                          p_information265     => l_lrr_rec.object_version_number,
7941                          p_object_version_number          => l_object_version_number,
7942                          p_effective_date                 => p_effective_date       );
7943                   --
7944 
7945                       if l_out_lrr_result_id is null then
7946                         l_out_lrr_result_id := l_copy_entity_result_id;
7947                       end if;
7948 
7949                       if l_result_type_cd = 'DISPLAY' then
7950                         l_out_lrr_result_id := l_copy_entity_result_id ;
7951                       end if;
7952 
7953                       if (l_lrr_rec.formula_id is not null) then
7954 						   ben_plan_design_program_module.create_formula_result(
7955 								p_validate                       => p_validate
7956 								,p_copy_entity_result_id  => l_copy_entity_result_id
7957 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
7958 								,p_formula_id                  => l_lrr_rec.formula_id
7959 								,p_business_group_id        => l_lrr_rec.business_group_id
7960 								,p_number_of_copies         =>  l_number_of_copies
7961 								,p_object_version_number  => l_object_version_number
7962 								,p_effective_date             => p_effective_date);
7963 						end if;
7964 
7965                   --
7966                   end loop;
7967                 --
7968                 end loop;
7969              ---------------------------------------------------------------
7970              -- END OF BEN_LEE_RSN_RL_F ----------------------
7971              ---------------------------------------------------------------
7972             end loop;
7973          ---------------------------------------------------------------
7974          -- END OF BEN_LEE_RSN_F ----------------------
7975          ---------------------------------------------------------------
7976         --
7977         end loop;
7978      ---------------------------------------------------------------
7979      -- END OF BEN_POPL_ENRT_TYP_CYCL_F ----------------------
7980      ---------------------------------------------------------------
7981      ---------------------------------------------------------------
7982      -- START OF BEN_POPL_ORG_F ----------------------
7983      ---------------------------------------------------------------
7984       --
7985       --
7986       for l_parent_rec  in c_cpo_from_parent(p_pl_id,p_pgm_id) loop
7987       --
7988         --
7989         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
7990         l_parent_entity_result_id := p_parent_entity_result_id ;
7991         l_popl_org_id := l_parent_rec.popl_org_id ;
7992 
7993         for l_cpo_rec in c_cpo(l_parent_rec.popl_org_id,l_mirror_src_entity_result_id,'CPO') loop
7994         --
7995             --
7996             l_table_route_id := null ;
7997             open ben_plan_design_program_module.g_table_route('CPO');
7998             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
7999             close ben_plan_design_program_module.g_table_route ;
8000             --
8001             l_information5 := ben_plan_design_program_module.get_organization_name(l_cpo_rec.organization_id);--'Intersection'
8002             --
8003             --
8004             if p_effective_date between l_cpo_rec.effective_start_date
8005                 and l_cpo_rec.effective_end_date then
8006                 --
8007                 l_result_type_cd := 'DISPLAY';
8008             else
8009                 l_result_type_cd := 'NO DISPLAY';
8010             end if;
8011 
8012             -- To store effective_start_date of organization
8013             -- for Mapping - Bug 2958658
8014             --
8015             l_organization_start_date := null;
8016             if l_cpo_rec.organization_id is not null then
8017               open c_organization_start_date(l_cpo_rec.organization_id);
8018               fetch c_organization_start_date into l_organization_start_date;
8019               close c_organization_start_date;
8020             end if;
8021 
8022             --
8023             -- pabodla : MAPPING DATA : Store the mapping column information.
8024             --
8025 
8026             l_mapping_name := null;
8027             l_mapping_id   := null;
8028             --
8029             -- Get the organization name to display on mapping page.
8030             --
8031             open c_get_mapping_name2(l_cpo_rec.organization_id,
8032                                      NVL(l_organization_start_date,p_effective_date));
8033             fetch c_get_mapping_name2 into l_mapping_name;
8034             close c_get_mapping_name2;
8035             --
8036             l_mapping_id   := l_cpo_rec.organization_id;
8037             --
8038             hr_utility.set_location('l_mapping_id/organization_id '||l_mapping_id,100);
8039             hr_utility.set_location('l_mapping_name '||l_mapping_name,100);
8040             --
8041             --To set user friendly labels on the mapping page
8042             --
8043             l_mapping_column_name1 := null;
8044             l_mapping_column_name2 :=null;
8045             BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
8046                                        l_mapping_column_name1,
8047                                        l_mapping_column_name2,
8048                                        p_copy_entity_txn_id);
8049             --
8050 
8051             l_copy_entity_result_id := null;
8052             l_object_version_number := null;
8053             ben_copy_entity_results_api.create_copy_entity_results(
8054                  p_copy_entity_result_id           => l_copy_entity_result_id,
8055                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
8056                  p_result_type_cd                 => l_result_type_cd,
8057 		     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
8058                  p_parent_entity_result_id        => l_parent_entity_result_id,
8059                  p_number_of_copies               => l_number_of_copies,
8060                  p_table_alias					  => 'CPO',
8061                  p_table_route_id                 => l_table_route_id,
8062                  p_information1     => l_cpo_rec.popl_org_id,
8063                  p_information2     => l_cpo_rec.EFFECTIVE_START_DATE,
8064                  p_information3     => l_cpo_rec.EFFECTIVE_END_DATE,
8065                  p_information4     => l_cpo_rec.business_group_id,
8066                  p_information5     => l_information5 , -- 9999 put name for h-grid
8067                  p_information111     => l_cpo_rec.cpo_attribute1,
8068                  p_information120     => l_cpo_rec.cpo_attribute10,
8069                  p_information121     => l_cpo_rec.cpo_attribute11,
8070                  p_information122     => l_cpo_rec.cpo_attribute12,
8071                  p_information123     => l_cpo_rec.cpo_attribute13,
8072                  p_information124     => l_cpo_rec.cpo_attribute14,
8073                  p_information125     => l_cpo_rec.cpo_attribute15,
8074                  p_information126     => l_cpo_rec.cpo_attribute16,
8075                  p_information127     => l_cpo_rec.cpo_attribute17,
8076                  p_information128     => l_cpo_rec.cpo_attribute18,
8077                  p_information129     => l_cpo_rec.cpo_attribute19,
8078                  p_information112     => l_cpo_rec.cpo_attribute2,
8079                  p_information130     => l_cpo_rec.cpo_attribute20,
8080                  p_information131     => l_cpo_rec.cpo_attribute21,
8081                  p_information132     => l_cpo_rec.cpo_attribute22,
8082                  p_information133     => l_cpo_rec.cpo_attribute23,
8083                  p_information134     => l_cpo_rec.cpo_attribute24,
8084                  p_information135     => l_cpo_rec.cpo_attribute25,
8085                  p_information136     => l_cpo_rec.cpo_attribute26,
8086                  p_information137     => l_cpo_rec.cpo_attribute27,
8087                  p_information138     => l_cpo_rec.cpo_attribute28,
8088                  p_information139     => l_cpo_rec.cpo_attribute29,
8089                  p_information113     => l_cpo_rec.cpo_attribute3,
8090                  p_information140     => l_cpo_rec.cpo_attribute30,
8091                  p_information114     => l_cpo_rec.cpo_attribute4,
8092                  p_information115     => l_cpo_rec.cpo_attribute5,
8093                  p_information116     => l_cpo_rec.cpo_attribute6,
8094                  p_information117     => l_cpo_rec.cpo_attribute7,
8095                  p_information118     => l_cpo_rec.cpo_attribute8,
8096                  p_information119     => l_cpo_rec.cpo_attribute9,
8097                  p_information110     => l_cpo_rec.cpo_attribute_category,
8098                  p_information257     => l_cpo_rec.cstmr_num,
8099                  p_information252     => l_cpo_rec.organization_id,
8100                  -- Data for MAPPING columns.
8101                  p_information173    => l_mapping_name,
8102                  p_information174    => l_mapping_id,
8103                  p_information181    => l_mapping_column_name1,
8104                  p_information182    => l_mapping_column_name2,
8105                  -- END other product Mapping columns.
8106                  p_information258     => l_cpo_rec.person_id,
8107                  p_information260     => l_cpo_rec.pgm_id,
8108                  p_information261     => l_cpo_rec.pl_id,
8109                  p_information141     => l_cpo_rec.plcy_r_grp,
8110                  p_information166     => l_organization_start_date,
8111                  p_information265     => l_cpo_rec.object_version_number,
8112                  p_object_version_number          => l_object_version_number,
8113                  p_effective_date                 => p_effective_date       );
8114           --
8115 
8116                  if l_out_cpo_result_id is null then
8117                   l_out_cpo_result_id := l_copy_entity_result_id;
8118                 end if;
8119 
8120                 if l_result_type_cd = 'DISPLAY' then
8121                   l_out_cpo_result_id := l_copy_entity_result_id ;
8122                 end if;
8123 
8124           end loop;
8125         --
8126           ---------------------------------------------------------------
8127           -- START OF BEN_POPL_ORG_ROLE_F ----------------------
8128           ---------------------------------------------------------------
8129            --
8130            for l_parent_rec  in c_cpr_from_parent(l_POPL_ORG_ID) loop
8131            --
8132              l_mirror_src_entity_result_id := l_out_cpo_result_id ;
8133 
8134              l_popl_org_role_id := l_parent_rec.popl_org_role_id ;
8135              --
8136              for l_cpr_rec in c_cpr(l_parent_rec.popl_org_role_id,l_mirror_src_entity_result_id,'CPR') loop
8137              --
8138              --
8139                  l_table_route_id := null ;
8140                  open ben_plan_design_program_module.g_table_route('CPR');
8141                  fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8142                  close ben_plan_design_program_module.g_table_route ;
8143                  --
8144                  l_information5  := l_cpr_rec.name; --'Intersection';
8145                  --
8146                  if p_effective_date between l_cpr_rec.effective_start_date
8147                      and l_cpr_rec.effective_end_date then
8148                      --
8149                      l_result_type_cd := 'DISPLAY';
8150                  else
8151                      l_result_type_cd := 'NO DISPLAY';
8152                  end if;
8153                  --
8154                  l_copy_entity_result_id := null;
8155                  l_object_version_number := null;
8156                  ben_copy_entity_results_api.create_copy_entity_results(
8157                       p_copy_entity_result_id           => l_copy_entity_result_id,
8158                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
8159                       p_result_type_cd                 => l_result_type_cd,
8160                       p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
8161                       p_parent_entity_result_id        => l_mirror_src_entity_result_id,
8162                       p_number_of_copies               => l_number_of_copies,
8163                       p_table_alias					  => 'CPR',
8164                       p_table_route_id                 => l_table_route_id,
8165                       p_information1     => l_cpr_rec.popl_org_role_id,
8166                       p_information2     => l_cpr_rec.EFFECTIVE_START_DATE,
8167                       p_information3     => l_cpr_rec.EFFECTIVE_END_DATE,
8168                       p_information4     => l_cpr_rec.business_group_id,
8169                       p_information5     => l_information5 , -- 9999 put name for h-grid
8170                       p_information111     => l_cpr_rec.cpr_attribute1,
8171                       p_information120     => l_cpr_rec.cpr_attribute10,
8172                       p_information121     => l_cpr_rec.cpr_attribute11,
8173                       p_information122     => l_cpr_rec.cpr_attribute12,
8174                       p_information123     => l_cpr_rec.cpr_attribute13,
8175                       p_information124     => l_cpr_rec.cpr_attribute14,
8176                       p_information125     => l_cpr_rec.cpr_attribute15,
8177                       p_information126     => l_cpr_rec.cpr_attribute16,
8178                       p_information127     => l_cpr_rec.cpr_attribute17,
8179                       p_information128     => l_cpr_rec.cpr_attribute18,
8180                       p_information129     => l_cpr_rec.cpr_attribute19,
8181                       p_information112     => l_cpr_rec.cpr_attribute2,
8182                       p_information130     => l_cpr_rec.cpr_attribute20,
8183                       p_information131     => l_cpr_rec.cpr_attribute21,
8184                       p_information132     => l_cpr_rec.cpr_attribute22,
8185                       p_information133     => l_cpr_rec.cpr_attribute23,
8186                       p_information134     => l_cpr_rec.cpr_attribute24,
8187                       p_information135     => l_cpr_rec.cpr_attribute25,
8188                       p_information136     => l_cpr_rec.cpr_attribute26,
8189                       p_information137     => l_cpr_rec.cpr_attribute27,
8190                       p_information138     => l_cpr_rec.cpr_attribute28,
8191                       p_information139     => l_cpr_rec.cpr_attribute29,
8192                       p_information113     => l_cpr_rec.cpr_attribute3,
8193                       p_information140     => l_cpr_rec.cpr_attribute30,
8194                       p_information114     => l_cpr_rec.cpr_attribute4,
8195                       p_information115     => l_cpr_rec.cpr_attribute5,
8196                       p_information116     => l_cpr_rec.cpr_attribute6,
8197                       p_information117     => l_cpr_rec.cpr_attribute7,
8198                       p_information118     => l_cpr_rec.cpr_attribute8,
8199                       p_information119     => l_cpr_rec.cpr_attribute9,
8200                       p_information110     => l_cpr_rec.cpr_attribute_category,
8201                       p_information170     => l_cpr_rec.name,
8202                       p_information11     => l_cpr_rec.org_role_typ_cd,
8203                       p_information260     => l_cpr_rec.popl_org_id,
8204                       p_information265     => l_cpr_rec.object_version_number,
8205                       p_object_version_number          => l_object_version_number,
8206                       p_effective_date                 => p_effective_date       );
8207                --
8208 
8209                       if l_out_cpr_result_id is null then
8210                         l_out_cpr_result_id := l_copy_entity_result_id;
8211                       end if;
8212 
8213                       if l_result_type_cd = 'DISPLAY' then
8214                         l_out_cpr_result_id := l_copy_entity_result_id ;
8215                       end if;
8216                end loop;
8217              --
8218              end loop;
8219           ---------------------------------------------------------------
8220           -- END OF BEN_POPL_ORG_ROLE_F ----------------------
8221           ---------------------------------------------------------------
8222         end loop;
8223      ---------------------------------------------------------------
8224      -- END OF BEN_POPL_ORG_F ----------------------
8225      ---------------------------------------------------------------
8226      ---------------------------------------------------------------
8227      -- START OF BEN_POPL_YR_PERD ----------------------
8228      ---------------------------------------------------------------
8229       --
8230       for l_parent_rec  in c_cpy_from_parent(p_pl_id,p_pgm_id) loop
8231       --
8232       --
8233         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
8234         l_parent_entity_result_id := p_parent_entity_result_id ;
8235         l_popl_yr_perd_id  := l_parent_rec.popl_yr_perd_id ;
8236 
8237         for l_cpy_rec in c_cpy(l_parent_rec.popl_yr_perd_id,l_mirror_src_entity_result_id,'CPY') loop
8238         --
8239             --
8240             l_table_route_id := null ;
8241             open ben_plan_design_program_module.g_table_route('CPY');
8242             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8243             close ben_plan_design_program_module.g_table_route ;
8244             --
8245             l_information5 := ben_plan_design_program_module.get_yr_perd_name(l_cpy_rec.yr_perd_id); --'Intersection'
8246             --
8247             l_result_type_cd := 'DISPLAY';
8248             --
8249             l_copy_entity_result_id := null;
8250             l_object_version_number := null;
8251             ben_copy_entity_results_api.create_copy_entity_results(
8252                  p_copy_entity_result_id           => l_copy_entity_result_id,
8253                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
8254                  p_result_type_cd                 => l_result_type_cd,
8255 		     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
8256                  p_parent_entity_result_id        => l_parent_entity_result_id,
8257                  p_number_of_copies               => l_number_of_copies,
8258                  p_table_alias					  => 'CPY',
8259                  p_table_route_id                 => l_table_route_id,
8260                  p_information1     => l_cpy_rec.popl_yr_perd_id,
8261                  p_information2     => null,
8262                  p_information3     => null,
8263                  p_information4     => l_cpy_rec.business_group_id,
8264                  p_information5     => l_information5 , -- 9999 put name for h-grid
8265                  p_information308     => l_cpy_rec.acpt_clm_rqsts_thru_dt,
8266                  p_information111     => l_cpy_rec.cpy_attribute1,
8267                  p_information120     => l_cpy_rec.cpy_attribute10,
8268                  p_information121     => l_cpy_rec.cpy_attribute11,
8269                  p_information122     => l_cpy_rec.cpy_attribute12,
8270                  p_information123     => l_cpy_rec.cpy_attribute13,
8271                  p_information124     => l_cpy_rec.cpy_attribute14,
8272                  p_information125     => l_cpy_rec.cpy_attribute15,
8273                  p_information126     => l_cpy_rec.cpy_attribute16,
8274                  p_information127     => l_cpy_rec.cpy_attribute17,
8275                  p_information128     => l_cpy_rec.cpy_attribute18,
8276                  p_information129     => l_cpy_rec.cpy_attribute19,
8277                  p_information112     => l_cpy_rec.cpy_attribute2,
8278                  p_information130     => l_cpy_rec.cpy_attribute20,
8279                  p_information131     => l_cpy_rec.cpy_attribute21,
8280                  p_information132     => l_cpy_rec.cpy_attribute22,
8281                  p_information133     => l_cpy_rec.cpy_attribute23,
8282                  p_information134     => l_cpy_rec.cpy_attribute24,
8283                  p_information135     => l_cpy_rec.cpy_attribute25,
8284                  p_information136     => l_cpy_rec.cpy_attribute26,
8285                  p_information137     => l_cpy_rec.cpy_attribute27,
8286                  p_information138     => l_cpy_rec.cpy_attribute28,
8287                  p_information139     => l_cpy_rec.cpy_attribute29,
8288                  p_information113     => l_cpy_rec.cpy_attribute3,
8289                  p_information140     => l_cpy_rec.cpy_attribute30,
8290                  p_information114     => l_cpy_rec.cpy_attribute4,
8291                  p_information115     => l_cpy_rec.cpy_attribute5,
8292                  p_information116     => l_cpy_rec.cpy_attribute6,
8293                  p_information117     => l_cpy_rec.cpy_attribute7,
8294                  p_information118     => l_cpy_rec.cpy_attribute8,
8295                  p_information119     => l_cpy_rec.cpy_attribute9,
8296                  p_information110     => l_cpy_rec.cpy_attribute_category,
8297                  p_information262     => l_cpy_rec.ordr_num,
8298                  p_information260     => l_cpy_rec.pgm_id,
8299                  p_information261     => l_cpy_rec.pl_id,
8300                  p_information309     => l_cpy_rec.py_clms_thru_dt,
8301                  p_information240     => l_cpy_rec.yr_perd_id,
8302                  p_information265     => l_cpy_rec.object_version_number,
8303                  p_object_version_number          => l_object_version_number,
8304                  p_effective_date                 => p_effective_date       );
8305             --
8306 
8307                  if l_out_cpy_result_id is null then
8308                   l_out_cpy_result_id := l_copy_entity_result_id;
8309                 end if;
8310 
8311                 if l_result_type_cd = 'DISPLAY' then
8312                   l_out_cpy_result_id := l_copy_entity_result_id ;
8313                 end if;
8314 
8315             end loop ;
8316 
8317          ---------------------------------------------------------------
8318          -- START OF BEN_YR_PERD ----------------------
8319          ---------------------------------------------------------------
8320           --
8321           --
8322           for l_parent_rec  in c_yrp_from_parent(l_POPL_YR_PERD_ID) loop
8323           --
8324             create_yr_perd_result
8325                 (p_validate                       => p_validate
8326                 ,p_copy_entity_result_id          => l_out_cpy_result_id
8327                 ,p_copy_entity_txn_id             => p_copy_entity_txn_id
8328                 ,p_yr_perd_id                     => l_parent_rec.yr_perd_id
8329                 ,p_business_group_id              => p_business_group_id
8330                 ,p_number_of_copies               => p_number_of_copies
8331                 ,p_object_version_number          => l_object_version_number
8332                 ,p_effective_date                 => p_effective_date
8333                 ,p_parent_entity_result_id        => l_out_cpy_result_id
8334                 );
8335           end loop;
8336          ---------------------------------------------------------------
8337          -- END OF BEN_YR_PERD ----------------------
8338          ---------------------------------------------------------------
8339         --
8340         end loop;
8341      ---------------------------------------------------------------
8342      -- END OF BEN_POPL_YR_PERD ----------------------
8343      ---------------------------------------------------------------
8344      ---------------------------------------------------------------
8345      ---------------------------------------------------------------
8346      -- START OF BEN_POPL_RPTG_GRP_F ----------------------
8347      ---------------------------------------------------------------
8348       --
8349       --
8350       for l_parent_rec  in c_rgr_from_parent(p_pl_id,p_pgm_id) loop
8351       --
8352       --
8353         l_mirror_src_entity_result_id := p_copy_entity_result_id ;
8354         l_parent_entity_result_id := p_parent_entity_result_id ;
8355         l_popl_rptg_grp_id          := l_parent_rec.popl_rptg_grp_id ;
8356 
8357         for l_rgr_rec in c_rgr(l_parent_rec.popl_rptg_grp_id,l_mirror_src_entity_result_id,'RGR') loop
8358         --
8359             --
8360             l_table_route_id := null ;
8361             open ben_plan_design_program_module.g_table_route('RGR');
8362             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8363             close ben_plan_design_program_module.g_table_route ;
8364             --
8365             l_information5 := ben_plan_design_program_module.get_rptg_grp_name(l_rgr_rec.rptg_grp_id); --'Intersection';
8366             --
8367             if p_effective_date between l_rgr_rec.effective_start_date
8368                 and l_rgr_rec.effective_end_date then
8369                 --
8370                 l_result_type_cd := 'DISPLAY';
8371             else
8372                 l_result_type_cd := 'NO DISPLAY';
8373             end if;
8374             --
8375             l_copy_entity_result_id := null;
8376             l_object_version_number := null;
8377             ben_copy_entity_results_api.create_copy_entity_results(
8378                  p_copy_entity_result_id          => l_copy_entity_result_id,
8379                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
8380                  p_result_type_cd                 => l_result_type_cd,
8381 		     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
8382                  p_parent_entity_result_id        => l_parent_entity_result_id,
8383                  p_number_of_copies               => l_number_of_copies,
8384                  p_table_alias					  => 'RGR',
8385                  p_table_route_id                 => l_table_route_id,
8386                  p_information1     => l_rgr_rec.popl_rptg_grp_id,
8387                  p_information2     => l_rgr_rec.EFFECTIVE_START_DATE,
8388                  p_information3     => l_rgr_rec.EFFECTIVE_END_DATE,
8389                  p_information4     => l_rgr_rec.business_group_id,
8390                  p_information5     => l_information5 , -- 9999 put name for h-grid
8391                  p_information260     => l_rgr_rec.pgm_id,
8392                  p_information261     => l_rgr_rec.pl_id,
8393                  p_information111     => l_rgr_rec.rgr_attribute1,
8394                  p_information120     => l_rgr_rec.rgr_attribute10,
8395                  p_information121     => l_rgr_rec.rgr_attribute11,
8396                  p_information122     => l_rgr_rec.rgr_attribute12,
8397                  p_information123     => l_rgr_rec.rgr_attribute13,
8398                  p_information124     => l_rgr_rec.rgr_attribute14,
8399                  p_information125     => l_rgr_rec.rgr_attribute15,
8400                  p_information126     => l_rgr_rec.rgr_attribute16,
8401                  p_information127     => l_rgr_rec.rgr_attribute17,
8402                  p_information128     => l_rgr_rec.rgr_attribute18,
8403                  p_information129     => l_rgr_rec.rgr_attribute19,
8404                  p_information112     => l_rgr_rec.rgr_attribute2,
8405                  p_information130     => l_rgr_rec.rgr_attribute20,
8406                  p_information131     => l_rgr_rec.rgr_attribute21,
8407                  p_information132     => l_rgr_rec.rgr_attribute22,
8408                  p_information133     => l_rgr_rec.rgr_attribute23,
8409                  p_information134     => l_rgr_rec.rgr_attribute24,
8410                  p_information135     => l_rgr_rec.rgr_attribute25,
8411                  p_information136     => l_rgr_rec.rgr_attribute26,
8412                  p_information137     => l_rgr_rec.rgr_attribute27,
8413                  p_information138     => l_rgr_rec.rgr_attribute28,
8414                  p_information139     => l_rgr_rec.rgr_attribute29,
8415                  p_information113     => l_rgr_rec.rgr_attribute3,
8416                  p_information140     => l_rgr_rec.rgr_attribute30,
8417                  p_information114     => l_rgr_rec.rgr_attribute4,
8418                  p_information115     => l_rgr_rec.rgr_attribute5,
8419                  p_information116     => l_rgr_rec.rgr_attribute6,
8420                  p_information117     => l_rgr_rec.rgr_attribute7,
8421                  p_information118     => l_rgr_rec.rgr_attribute8,
8422                  p_information119     => l_rgr_rec.rgr_attribute9,
8423                  p_information110     => l_rgr_rec.rgr_attribute_category,
8424                  p_information242     => l_rgr_rec.rptg_grp_id,
8425                  p_information265     => l_rgr_rec.object_version_number,
8426                  p_object_version_number          => l_object_version_number,
8427                  p_effective_date                 => p_effective_date       );
8428           --
8429 
8430                   if l_out_rgr_result_id is null then
8431                     l_out_rgr_result_id := l_copy_entity_result_id;
8432                   end if;
8433 
8434                   if l_result_type_cd = 'DISPLAY' then
8435                     l_out_rgr_result_id := l_copy_entity_result_id ;
8436                   end if;
8437         end loop;
8438         --
8439         ---------------------------------------------------------------
8440         -- START OF BEN_RPTG_GRP ----------------------
8441         ---------------------------------------------------------------
8442          --
8443          for l_parent_rec  in c_bnr_from_parent(l_POPL_RPTG_GRP_ID) loop
8444          --
8445            l_mirror_src_entity_result_id := l_out_rgr_result_id ;
8446 
8447            l_rptg_grp_id := l_parent_rec.rptg_grp_id ;
8448 
8449            if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
8450              open c_object_exists(l_rptg_grp_id,'BNR');
8451              fetch c_object_exists into l_dummy;
8452              if c_object_exists%found then
8453                close c_object_exists;
8454                exit;
8455              end if;
8456              close c_object_exists;
8457            end if;
8458 
8459            --
8460            for l_bnr_rec in c_bnr(l_parent_rec.rptg_grp_id,l_mirror_src_entity_result_id,'BNR') loop
8461            --
8462            --
8463                l_table_route_id := null ;
8464                open ben_plan_design_program_module.g_table_route('BNR');
8465                fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8466                close ben_plan_design_program_module.g_table_route ;
8467                --
8468                l_information5  := l_bnr_rec.name; --'Intersection';
8469                --
8470                l_result_type_cd := 'DISPLAY';
8471                --
8472                l_copy_entity_result_id := null;
8473                l_object_version_number := null;
8474                ben_copy_entity_results_api.create_copy_entity_results(
8475                     p_copy_entity_result_id           => l_copy_entity_result_id,
8476                     p_copy_entity_txn_id             => p_copy_entity_txn_id,
8477                     p_result_type_cd                 => l_result_type_cd,
8478                     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
8479                     p_parent_entity_result_id        => l_mirror_src_entity_result_id,
8480                     p_number_of_copies               => l_number_of_copies,
8481                     p_table_alias					  => 'BNR',
8482                     p_table_route_id                 => l_table_route_id,
8483                     p_information1     => l_bnr_rec.rptg_grp_id,
8484                     p_information2     => null,
8485                     p_information3     => null,
8486                     p_information4     => l_bnr_rec.business_group_id,
8487                     p_information5     => l_information5 , -- 9999 put name for h-grid
8488                     p_information111     => l_bnr_rec.bnr_attribute1,
8489                     p_information120     => l_bnr_rec.bnr_attribute10,
8490                     p_information121     => l_bnr_rec.bnr_attribute11,
8491                     p_information122     => l_bnr_rec.bnr_attribute12,
8492                     p_information123     => l_bnr_rec.bnr_attribute13,
8493                     p_information124     => l_bnr_rec.bnr_attribute14,
8494                     p_information125     => l_bnr_rec.bnr_attribute15,
8495                     p_information126     => l_bnr_rec.bnr_attribute16,
8496                     p_information127     => l_bnr_rec.bnr_attribute17,
8497                     p_information128     => l_bnr_rec.bnr_attribute18,
8498                     p_information129     => l_bnr_rec.bnr_attribute19,
8499                     p_information112     => l_bnr_rec.bnr_attribute2,
8500                     p_information130     => l_bnr_rec.bnr_attribute20,
8501                     p_information131     => l_bnr_rec.bnr_attribute21,
8502                     p_information132     => l_bnr_rec.bnr_attribute22,
8503                     p_information133     => l_bnr_rec.bnr_attribute23,
8504                     p_information134     => l_bnr_rec.bnr_attribute24,
8505                     p_information135     => l_bnr_rec.bnr_attribute25,
8506                     p_information136     => l_bnr_rec.bnr_attribute26,
8507                     p_information137     => l_bnr_rec.bnr_attribute27,
8508                     p_information138     => l_bnr_rec.bnr_attribute28,
8509                     p_information139     => l_bnr_rec.bnr_attribute29,
8510                     p_information113     => l_bnr_rec.bnr_attribute3,
8511                     p_information140     => l_bnr_rec.bnr_attribute30,
8512                     p_information114     => l_bnr_rec.bnr_attribute4,
8513                     p_information115     => l_bnr_rec.bnr_attribute5,
8514                     p_information116     => l_bnr_rec.bnr_attribute6,
8515                     p_information117     => l_bnr_rec.bnr_attribute7,
8516                     p_information118     => l_bnr_rec.bnr_attribute8,
8517                     p_information119     => l_bnr_rec.bnr_attribute9,
8518                     p_information110     => l_bnr_rec.bnr_attribute_category,
8519                     p_information11     => l_bnr_rec.function_code,
8520                     p_information12     => l_bnr_rec.legislation_code,
8521                     p_information170     => l_bnr_rec.name,
8522                     p_information185     => l_bnr_rec.rpg_desc,
8523                     p_information13     => l_bnr_rec.rptg_prps_cd,
8524                     p_information265     => l_bnr_rec.object_version_number,
8525                     p_object_version_number          => l_object_version_number,
8526                     p_effective_date                 => p_effective_date       );
8527              --
8528                   if l_out_bnr_result_id is null then
8529                     l_out_bnr_result_id := l_copy_entity_result_id;
8530                   end if;
8531 
8532                   if l_result_type_cd = 'DISPLAY' then
8533                     l_out_bnr_result_id := l_copy_entity_result_id ;
8534                   end if;
8535 
8536              end loop;
8537            --
8538                ---------------------------------------------------------------
8539                -- START OF BEN_PL_REGN_F ----------------------
8540                ---------------------------------------------------------------
8541                --
8542                for l_parent_rec  in c_prg_from_parent(l_RPTG_GRP_ID) loop
8543                   --
8544                   l_mirror_src_entity_result_id := l_out_bnr_result_id ;
8545                   --
8546                   l_pl_regn_id := l_parent_rec.pl_regn_id ;
8547 
8548                   if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
8549                     open c_object_exists(l_pl_regn_id,'PRG');
8550                     fetch c_object_exists into l_dummy;
8551                     if c_object_exists%found then
8552                       close c_object_exists;
8553                       exit;
8554                     end if;
8555                     close c_object_exists;
8556                   end if;
8557 
8558                   --
8559                   for l_prg_rec in c_prg(l_parent_rec.pl_regn_id,l_mirror_src_entity_result_id,'PRG') loop
8560                     --
8561                     l_table_route_id := null ;
8562                     open ben_plan_design_program_module.g_table_route('PRG');
8563                       fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8564                     close ben_plan_design_program_module.g_table_route ;
8565                     --
8566                     l_information5  := ben_plan_design_program_module.get_regn_name(l_prg_rec.regn_id,
8567                                                               p_effective_date );
8568                     --
8569                     if p_effective_date between l_prg_rec.effective_start_date
8570                        and l_prg_rec.effective_end_date then
8571                      --
8572                        l_result_type_cd := 'DISPLAY';
8573                     else
8574                        l_result_type_cd := 'NO DISPLAY';
8575                     end if;
8576 
8577                     /* NOT REQUIRED AS create_REG_rows will handle this
8578                     --
8579                     --
8580                     -- Store the Regulation name in information185
8581                     -- Records for Regulations (BEN_REGN_F) will not created in the Target Business Group
8582                     -- The copy process will try and map the Regulation name to the ones existing in the
8583                     -- Target Business Group and if a match is found, then that Regulation Id will be used
8584                     -- for creating Plan Regulation (BEN_PL_REGN) records.
8585 
8586                     l_regn_name :=  ben_plan_design_program_module.get_regn_name(l_prg_rec.regn_id,l_prg_rec.effective_start_date);
8587                     --
8588                     */
8589 
8590                     l_copy_entity_result_id := null;
8591                     l_object_version_number := null;
8592                     ben_copy_entity_results_api.create_copy_entity_results(
8593                       p_copy_entity_result_id           => l_copy_entity_result_id,
8594                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
8595                       p_result_type_cd                 => l_result_type_cd,
8596                       p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
8597                       p_parent_entity_result_id      => l_mirror_src_entity_result_id,
8598                       p_number_of_copies               => l_number_of_copies,
8599                       p_table_alias					  => 'PRG',
8600                       p_table_route_id                 => l_table_route_id,
8601                       p_information1     => l_prg_rec.pl_regn_id,
8602                       p_information2     => l_prg_rec.EFFECTIVE_START_DATE,
8603                       p_information3     => l_prg_rec.EFFECTIVE_END_DATE,
8604                       p_information4     => l_prg_rec.business_group_id,
8605                       p_information5     => l_information5 , -- 9999 put name for h-grid
8606                       p_information259     => l_prg_rec.cntr_nndscrn_rl,
8607                       p_information260     => l_prg_rec.cvg_nndscrn_rl,
8608                       p_information262     => l_prg_rec.five_pct_ownr_rl,
8609                       p_information257     => l_prg_rec.hghly_compd_det_rl,
8610                       p_information258     => l_prg_rec.key_ee_det_rl,
8611                       p_information261     => l_prg_rec.pl_id,
8612                       p_information111     => l_prg_rec.prg_attribute1,
8613                       p_information120     => l_prg_rec.prg_attribute10,
8614                       p_information121     => l_prg_rec.prg_attribute11,
8615                       p_information122     => l_prg_rec.prg_attribute12,
8616                       p_information123     => l_prg_rec.prg_attribute13,
8617                       p_information124     => l_prg_rec.prg_attribute14,
8618                       p_information125     => l_prg_rec.prg_attribute15,
8619                       p_information126     => l_prg_rec.prg_attribute16,
8620                       p_information127     => l_prg_rec.prg_attribute17,
8621                       p_information128     => l_prg_rec.prg_attribute18,
8622                       p_information129     => l_prg_rec.prg_attribute19,
8623                       p_information112     => l_prg_rec.prg_attribute2,
8624                       p_information130     => l_prg_rec.prg_attribute20,
8625                       p_information131     => l_prg_rec.prg_attribute21,
8626                       p_information132     => l_prg_rec.prg_attribute22,
8627                       p_information133     => l_prg_rec.prg_attribute23,
8628                       p_information134     => l_prg_rec.prg_attribute24,
8629                       p_information135     => l_prg_rec.prg_attribute25,
8630                       p_information136     => l_prg_rec.prg_attribute26,
8631                       p_information137     => l_prg_rec.prg_attribute27,
8632                       p_information138     => l_prg_rec.prg_attribute28,
8633                       p_information139     => l_prg_rec.prg_attribute29,
8634                       p_information113     => l_prg_rec.prg_attribute3,
8635                       p_information140     => l_prg_rec.prg_attribute30,
8636                       p_information114     => l_prg_rec.prg_attribute4,
8637                       p_information115     => l_prg_rec.prg_attribute5,
8638                       p_information116     => l_prg_rec.prg_attribute6,
8639                       p_information117     => l_prg_rec.prg_attribute7,
8640                       p_information118     => l_prg_rec.prg_attribute8,
8641                       p_information119     => l_prg_rec.prg_attribute9,
8642                       p_information110     => l_prg_rec.prg_attribute_category,
8643                       p_information231     => l_prg_rec.regn_id,
8644                       p_information11     => l_prg_rec.regy_pl_typ_cd,
8645                       p_information242     => l_prg_rec.rptg_grp_id,
8646                       -- p_information185     => l_regn_name, -- NOT REQUIRED AS create_REG_rows will handle this
8647 
8648                       p_information265     => l_prg_rec.object_version_number,
8649                       p_object_version_number          => l_object_version_number,
8650                       p_effective_date                 => p_effective_date       );
8651                       --
8652 
8653                       if l_out_prg_result_id is null then
8654                         l_out_prg_result_id := l_copy_entity_result_id;
8655                       end if;
8656 
8657                       if l_result_type_cd = 'DISPLAY' then
8658                          l_out_prg_result_id := l_copy_entity_result_id ;
8659                       end if;
8660                       --
8661                    end loop;
8662                    --
8663                    ---------------------------------------------------------------
8664                    -- START OF BEN_REGN_F ----------------------
8665                    ---------------------------------------------------------------
8666                    --
8667                    for l_parent_rec  in c_reg_from_parent(l_PL_REGN_ID) loop
8668                       --
8669                       l_mirror_src_entity_result_id := l_out_prg_result_id ;
8670                       --
8671                       l_regn_id := l_parent_rec.regn_id ;
8672 
8673                       if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
8674                         open c_object_exists(l_regn_id,'REG');
8675                         fetch c_object_exists into l_dummy;
8676                         if c_object_exists%found then
8677                           close c_object_exists;
8678                           exit;
8679                         end if;
8680                         close c_object_exists;
8681                       end if;
8682                       --
8683                       for l_reg_rec in c_reg(l_parent_rec.regn_id,l_mirror_src_entity_result_id,'REG') loop
8684                         --
8685                         l_table_route_id := null ;
8686                         open ben_plan_design_program_module.g_table_route('REG');
8687                           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8688                         close ben_plan_design_program_module.g_table_route ;
8689                         --
8690                         l_information5  := l_reg_rec.name ;
8691                         --
8692                         if p_effective_date between l_reg_rec.effective_start_date
8693                            and l_reg_rec.effective_end_date then
8694                          --
8695                            l_result_type_cd := 'DISPLAY';
8696                         else
8697                            l_result_type_cd := 'NO DISPLAY';
8698                         end if;
8699                           --
8700                         l_copy_entity_result_id := null;
8701                         l_object_version_number := null;
8702                         ben_copy_entity_results_api.create_copy_entity_results(
8703                           p_copy_entity_result_id           => l_copy_entity_result_id,
8704                           p_copy_entity_txn_id             => p_copy_entity_txn_id,
8705                           p_result_type_cd                 => l_result_type_cd,
8706                           p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
8707                           p_parent_entity_result_id      => l_mirror_src_entity_result_id,
8708                           p_number_of_copies               => l_number_of_copies,
8709                           p_table_alias					  => 'REG',
8710                           p_table_route_id                 => l_table_route_id,
8711                           p_information1     => l_reg_rec.regn_id,
8712                           p_information2     => l_reg_rec.EFFECTIVE_START_DATE,
8713                           p_information3     => l_reg_rec.EFFECTIVE_END_DATE,
8714                           p_information4     => l_reg_rec.business_group_id,
8715                           p_information5     => l_information5 , -- 9999 put name for h-grid
8716                           p_information170     => l_reg_rec.name,
8717                           p_information252     => l_reg_rec.organization_id,
8718                           p_information111     => l_reg_rec.reg_attribute1,
8719                           p_information120     => l_reg_rec.reg_attribute10,
8720                           p_information121     => l_reg_rec.reg_attribute11,
8721                           p_information122     => l_reg_rec.reg_attribute12,
8722                           p_information123     => l_reg_rec.reg_attribute13,
8723                           p_information124     => l_reg_rec.reg_attribute14,
8724                           p_information125     => l_reg_rec.reg_attribute15,
8725                           p_information126     => l_reg_rec.reg_attribute16,
8726                           p_information127     => l_reg_rec.reg_attribute17,
8727                           p_information128     => l_reg_rec.reg_attribute18,
8728                           p_information129     => l_reg_rec.reg_attribute19,
8729                           p_information112     => l_reg_rec.reg_attribute2,
8730                           p_information130     => l_reg_rec.reg_attribute20,
8731                           p_information131     => l_reg_rec.reg_attribute21,
8732                           p_information132     => l_reg_rec.reg_attribute22,
8733                           p_information133     => l_reg_rec.reg_attribute23,
8734                           p_information134     => l_reg_rec.reg_attribute24,
8735                           p_information135     => l_reg_rec.reg_attribute25,
8736                           p_information136     => l_reg_rec.reg_attribute26,
8737                           p_information137     => l_reg_rec.reg_attribute27,
8738                           p_information138     => l_reg_rec.reg_attribute28,
8739                           p_information139     => l_reg_rec.reg_attribute29,
8740                           p_information113     => l_reg_rec.reg_attribute3,
8741                           p_information140     => l_reg_rec.reg_attribute30,
8742                           p_information114     => l_reg_rec.reg_attribute4,
8743                           p_information115     => l_reg_rec.reg_attribute5,
8744                           p_information116     => l_reg_rec.reg_attribute6,
8745                           p_information117     => l_reg_rec.reg_attribute7,
8746                           p_information118     => l_reg_rec.reg_attribute8,
8747                           p_information119     => l_reg_rec.reg_attribute9,
8748                           p_information110     => l_reg_rec.reg_attribute_category,
8749                           p_information185     => l_reg_rec.sttry_citn_name,
8750                           p_information265     => l_reg_rec.object_version_number,
8751                           p_object_version_number          => l_object_version_number,
8752                           p_effective_date                 => p_effective_date       );
8753                           --
8754 
8755                           if l_out_reg_result_id is null then
8756                             l_out_reg_result_id := l_copy_entity_result_id;
8757                           end if;
8758 
8759                           if l_result_type_cd = 'DISPLAY' then
8760                              l_out_reg_result_id := l_copy_entity_result_id ;
8761                           end if;
8762                           --
8763                        end loop;
8764                        --
8765                      end loop;
8766                   ---------------------------------------------------------------
8767                   -- END OF BEN_REGN_F ----------------------
8768                   ---------------------------------------------------------------
8769                  end loop;
8770               ---------------------------------------------------------------
8771               -- END OF BEN_PL_REGN_F ----------------------
8772               ---------------------------------------------------------------
8773                ---------------------------------------------------------------
8774                -- START OF BEN_PL_REGY_BOD_F ----------------------
8775                ---------------------------------------------------------------
8776                --
8777                for l_parent_rec  in c_prb_from_parent(l_RPTG_GRP_ID) loop
8778                   --
8779                   l_mirror_src_entity_result_id := l_out_bnr_result_id ;
8780                   --
8781                   l_pl_regy_bod_id := l_parent_rec.pl_regy_bod_id ;
8782                   --
8783                   for l_prb_rec in c_prb(l_parent_rec.pl_regy_bod_id,l_mirror_src_entity_result_id,'PRB') loop
8784                     --
8785                     l_table_route_id := null ;
8786                     open ben_plan_design_program_module.g_table_route('PRB');
8787                       fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8788                     close ben_plan_design_program_module.g_table_route ;
8789                     --
8790                     l_information5  := l_prb_rec.regy_pl_name ;
8791                     --
8792                     if p_effective_date between l_prb_rec.effective_start_date
8793                        and l_prb_rec.effective_end_date then
8794                      --
8795                        l_result_type_cd := 'DISPLAY';
8796                     else
8797                        l_result_type_cd := 'NO DISPLAY';
8798                     end if;
8799                       --
8800                     l_copy_entity_result_id := null;
8801                     l_object_version_number := null;
8802                     ben_copy_entity_results_api.create_copy_entity_results(
8803                       p_copy_entity_result_id           => l_copy_entity_result_id,
8804                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
8805                       p_result_type_cd                 => l_result_type_cd,
8806                       p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
8807                       p_parent_entity_result_id      => l_mirror_src_entity_result_id,
8808                       p_number_of_copies               => l_number_of_copies,
8809                       p_table_alias					  => 'PRB',
8810                       p_table_route_id                 => l_table_route_id,
8811                       p_information1     => l_prb_rec.pl_regy_bod_id,
8812                       p_information2     => l_prb_rec.EFFECTIVE_START_DATE,
8813                       p_information3     => l_prb_rec.EFFECTIVE_END_DATE,
8814                       p_information4     => l_prb_rec.business_group_id,
8815                       p_information5     => l_information5 , -- 9999 put name for h-grid
8816                       p_information306     => l_prb_rec.aprvd_trmn_dt,
8817                       p_information252     => l_prb_rec.organization_id,
8818                       p_information261     => l_prb_rec.pl_id,
8819                       p_information111     => l_prb_rec.prb_attribute1,
8820                       p_information120     => l_prb_rec.prb_attribute10,
8821                       p_information121     => l_prb_rec.prb_attribute11,
8822                       p_information122     => l_prb_rec.prb_attribute12,
8823                       p_information123     => l_prb_rec.prb_attribute13,
8824                       p_information124     => l_prb_rec.prb_attribute14,
8825                       p_information125     => l_prb_rec.prb_attribute15,
8826                       p_information126     => l_prb_rec.prb_attribute16,
8827                       p_information127     => l_prb_rec.prb_attribute17,
8828                       p_information128     => l_prb_rec.prb_attribute18,
8829                       p_information129     => l_prb_rec.prb_attribute19,
8830                       p_information112     => l_prb_rec.prb_attribute2,
8831                       p_information130     => l_prb_rec.prb_attribute20,
8832                       p_information131     => l_prb_rec.prb_attribute21,
8833                       p_information132     => l_prb_rec.prb_attribute22,
8834                       p_information133     => l_prb_rec.prb_attribute23,
8835                       p_information134     => l_prb_rec.prb_attribute24,
8836                       p_information135     => l_prb_rec.prb_attribute25,
8837                       p_information136     => l_prb_rec.prb_attribute26,
8838                       p_information137     => l_prb_rec.prb_attribute27,
8839                       p_information138     => l_prb_rec.prb_attribute28,
8840                       p_information139     => l_prb_rec.prb_attribute29,
8841                       p_information113     => l_prb_rec.prb_attribute3,
8842                       p_information140     => l_prb_rec.prb_attribute30,
8843                       p_information114     => l_prb_rec.prb_attribute4,
8844                       p_information115     => l_prb_rec.prb_attribute5,
8845                       p_information116     => l_prb_rec.prb_attribute6,
8846                       p_information117     => l_prb_rec.prb_attribute7,
8847                       p_information118     => l_prb_rec.prb_attribute8,
8848                       p_information119     => l_prb_rec.prb_attribute9,
8849                       p_information110     => l_prb_rec.prb_attribute_category,
8850                       p_information309     => l_prb_rec.quald_dt,
8851                       p_information11     => l_prb_rec.quald_flag,
8852                       p_information185     => l_prb_rec.regy_pl_name,
8853                       p_information242     => l_prb_rec.rptg_grp_id,
8854                       p_information265     => l_prb_rec.object_version_number,
8855                       p_object_version_number          => l_object_version_number,
8856                       p_effective_date                 => p_effective_date       );
8857                       --
8858 
8859                       if l_out_prb_result_id is null then
8860                         l_out_prb_result_id := l_copy_entity_result_id;
8861                       end if;
8862 
8863                       if l_result_type_cd = 'DISPLAY' then
8864                          l_out_prb_result_id := l_copy_entity_result_id ;
8865                       end if;
8866                       --
8867                    end loop;
8868                    --
8869                    ---------------------------------------------------------------
8870                    -- START OF BEN_PL_REGY_PRP_F ----------------------
8871                    ---------------------------------------------------------------
8872                    --
8873                    for l_parent_rec  in c_prp_from_parent(l_PL_REGY_BOD_ID) loop
8874                       --
8875                       l_mirror_src_entity_result_id := l_out_prb_result_id ;
8876                       --
8877                       l_pl_regy_prps_id := l_parent_rec.pl_regy_prps_id ;
8878                       --
8879                       for l_prp_rec in c_prp(l_parent_rec.pl_regy_prps_id,l_mirror_src_entity_result_id,'PRP') loop
8880                         --
8881                         l_table_route_id := null ;
8882                         open ben_plan_design_program_module.g_table_route('PRP');
8883                           fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
8884                         close ben_plan_design_program_module.g_table_route ;
8885                         --
8886                         l_information5  := hr_general.decode_lookup('BEN_REGY_PRPS',l_prp_rec.pl_regy_prps_cd);
8887                         --
8888                         if p_effective_date between l_prp_rec.effective_start_date
8889                            and l_prp_rec.effective_end_date then
8890                          --
8891                            l_result_type_cd := 'DISPLAY';
8892                         else
8893                            l_result_type_cd := 'NO DISPLAY';
8894                         end if;
8895                           --
8896                         l_copy_entity_result_id := null;
8897                         l_object_version_number := null;
8898                         ben_copy_entity_results_api.create_copy_entity_results(
8899                           p_copy_entity_result_id           => l_copy_entity_result_id,
8900                           p_copy_entity_txn_id             => p_copy_entity_txn_id,
8901                           p_result_type_cd                 => l_result_type_cd,
8902                           p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
8903                           p_parent_entity_result_id      => l_mirror_src_entity_result_id,
8904                           p_number_of_copies               => l_number_of_copies,
8905                           p_table_alias					  => 'PRP',
8906                           p_table_route_id                 => l_table_route_id,
8907                           p_information1     => l_prp_rec.pl_regy_prps_id,
8908                           p_information2     => l_prp_rec.EFFECTIVE_START_DATE,
8909                           p_information3     => l_prp_rec.EFFECTIVE_END_DATE,
8910                           p_information4     => l_prp_rec.business_group_id,
8911                           p_information5     => l_information5 , -- 9999 put name for h-grid
8912                           p_information258     => l_prp_rec.pl_regy_bod_id,
8913                           p_information11     => l_prp_rec.pl_regy_prps_cd,
8914                           p_information257     => l_prp_rec.pl_regy_prps_id,
8915                           p_information111     => l_prp_rec.prp_attribute1,
8916                           p_information120     => l_prp_rec.prp_attribute10,
8917                           p_information121     => l_prp_rec.prp_attribute11,
8918                           p_information122     => l_prp_rec.prp_attribute12,
8919                           p_information123     => l_prp_rec.prp_attribute13,
8920                           p_information124     => l_prp_rec.prp_attribute14,
8921                           p_information125     => l_prp_rec.prp_attribute15,
8922                           p_information126     => l_prp_rec.prp_attribute16,
8923                           p_information127     => l_prp_rec.prp_attribute17,
8924                           p_information128     => l_prp_rec.prp_attribute18,
8925                           p_information129     => l_prp_rec.prp_attribute19,
8926                           p_information112     => l_prp_rec.prp_attribute2,
8927                           p_information130     => l_prp_rec.prp_attribute20,
8928                           p_information131     => l_prp_rec.prp_attribute21,
8929                           p_information132     => l_prp_rec.prp_attribute22,
8930                           p_information133     => l_prp_rec.prp_attribute23,
8931                           p_information134     => l_prp_rec.prp_attribute24,
8932                           p_information135     => l_prp_rec.prp_attribute25,
8933                           p_information136     => l_prp_rec.prp_attribute26,
8934                           p_information137     => l_prp_rec.prp_attribute27,
8935                           p_information138     => l_prp_rec.prp_attribute28,
8936                           p_information139     => l_prp_rec.prp_attribute29,
8937                           p_information113     => l_prp_rec.prp_attribute3,
8938                           p_information140     => l_prp_rec.prp_attribute30,
8939                           p_information114     => l_prp_rec.prp_attribute4,
8940                           p_information115     => l_prp_rec.prp_attribute5,
8941                           p_information116     => l_prp_rec.prp_attribute6,
8942                           p_information117     => l_prp_rec.prp_attribute7,
8943                           p_information118     => l_prp_rec.prp_attribute8,
8944                           p_information119     => l_prp_rec.prp_attribute9,
8945                           p_information110     => l_prp_rec.prp_attribute_category,
8946                           p_information265     => l_prp_rec.object_version_number,
8947                           p_object_version_number          => l_object_version_number,
8948                           p_effective_date                 => p_effective_date       );
8949                           --
8950 
8951                           if l_out_prp_result_id is null then
8952                             l_out_prp_result_id := l_copy_entity_result_id;
8953                           end if;
8954 
8955                           if l_result_type_cd = 'DISPLAY' then
8956                              l_out_prp_result_id := l_copy_entity_result_id ;
8957                           end if;
8958                           --
8959                        end loop;
8960                        --
8961                      end loop;
8962                   ---------------------------------------------------------------
8963                   -- END OF BEN_PL_REGY_PRP_F ----------------------
8964                   ---------------------------------------------------------------
8965                  end loop;
8966               ---------------------------------------------------------------
8967               -- END OF BEN_PL_REGY_BOD_F ----------------------
8968               ---------------------------------------------------------------
8969                ---------------------------------------------------------------
8970                -- START OF BEN_POPL_RPTG_GRP_F ----------------------
8971                ---------------------------------------------------------------
8972                --
8973                /* NOT REQUIRED HERE
8974               */
8975               ---------------------------------------------------------------
8976               -- END OF BEN_POPL_RPTG_GRP_F ----------------------
8977               ---------------------------------------------------------------
8978            end loop;
8979         ---------------------------------------------------------------
8980         -- END OF BEN_RPTG_GRP ----------------------
8981         ---------------------------------------------------------------
8982         end loop;
8983      ---------------------------------------------------------------
8984      -- END OF BEN_POPL_RPTG_GRP_F ----------------------
8985      ---------------------------------------------------------------
8986    --
8987   hr_utility.set_location('Entering:'|| l_proc, 10);
8988   --
8989   -- Issue a savepoint if operating in validation only mode
8990   --
8991   --
8992   hr_utility.set_location(l_proc, 20);
8993   --
8994   -- Business Group id, effective_date's can't be null
8995   -- pl_id or pgm_id must be supplied.
8996   --
8997   --
8998   hr_utility.set_location('Leaving:'|| l_proc, 10);
8999   --
9000 end create_popl_result ;
9001 --
9002 procedure create_ler_result
9003   (
9004    p_validate                       in  number     default 0 -- false
9005   ,p_copy_entity_result_id          in  number
9006   ,p_copy_entity_txn_id             in  number    default null
9007   ,p_ler_id                         in  number    default null
9008   ,p_business_group_id              in  number    default null
9009   ,p_number_of_copies               in  number    default 0
9010   ,p_object_version_number          out nocopy number
9011   ,p_effective_date                 in  date
9012   ,p_no_dup_rslt                    in  varchar2  default null
9013   ) is
9014   --
9015   l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
9016   l_proc varchar2(72) := g_package||'create_ler_result';
9017   l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
9018   --
9019    --
9020    -- Bug : 3752407 : Global cursor g_table_route will now be used
9021    --
9022    -- Cursor to get table_route_id
9023    -- cursor c_table_route(c_parent_table_alias varchar2) is
9024    -- select table_route_id
9025    -- from pqh_table_route trt
9026    -- where trt.table_alias = c_parent_table_alias;
9027    -- trt.from_clause = 'OAB'
9028    -- and   trt.where_clause = upper(c_parent_table_name) ;
9029    --
9030    l_cv_result_type_cd   varchar2(30) :=  'DISPLAY' ;
9031    --
9032    -- Cursor to get mirror_src_entity_result_id
9033    cursor c_parent_result(c_parent_pk_id number,
9034                         -- c_parent_table_name varchar2,
9035                         c_parent_table_alias varchar2,
9036                         c_copy_entity_txn_id number) is
9037    select copy_entity_result_id mirror_src_entity_result_id
9038    from ben_copy_entity_results cpe
9039 --        pqh_table_route trt
9040    where cpe.information1= c_parent_pk_id
9041    and   cpe.result_type_cd = l_cv_result_type_cd
9042    and   cpe.copy_entity_txn_id = c_copy_entity_txn_id
9043 --   and   cpe.table_route_id = trt.table_route_id
9044    -- and   trt.from_clause = 'OAB'
9045    -- and   trt.where_clause = upper(c_parent_table_name) ;
9046    and   cpe.table_alias = c_parent_table_alias;
9047    ---
9048   ---------------------------------------------------------------
9049   -- START OF BEN_LER_F ----------------------
9050   ---------------------------------------------------------------
9051    cursor c_ler(c_ler_id number,c_mirror_src_entity_result_id number,
9052                 c_table_alias varchar2) is
9053    select  ler.*
9054    from BEN_LER_F ler
9055    where  ler.ler_id = c_ler_id
9056      -- and ler.business_group_id = p_business_group_id
9057      and not exists (
9058          select /*+  */ null
9059          from ben_copy_entity_results cpe
9060 --              pqh_table_route trt
9061          where copy_entity_txn_id = p_copy_entity_txn_id
9062 --           and trt.table_route_id = cpe.table_route_id
9063            and ( -- c_mirror_src_entity_result_id is null or
9064                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
9065            -- and trt.where_clause = 'BEN_LER_F'
9066            and cpe.table_alias = c_table_alias
9067            and information1 = c_ler_id
9068            -- and information4 = ler.business_group_id
9069            and information2 = ler.effective_start_date
9070            and information3 = ler.effective_end_date
9071      );
9072   ---------------------------------------------------------------
9073   -- END OF BEN_LER_F ----------------------
9074   ---------------------------------------------------------------
9075   ---------------------------------------------------------------
9076   -- START OF BEN_CSS_RLTD_PER_PER_IN_LER_F ----------------------
9077   ---------------------------------------------------------------
9078    cursor c_csr_from_parent(c_LER_ID number) is
9079    select  css_rltd_per_per_in_ler_id
9080    from BEN_CSS_RLTD_PER_PER_IN_LER_F
9081    where  LER_ID = c_LER_ID ;
9082    --
9083    cursor c_csr(c_css_rltd_per_per_in_ler_id number ,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
9084    select  csr.*
9085    from BEN_CSS_RLTD_PER_PER_IN_LER_F csr
9086    where  csr.css_rltd_per_per_in_ler_id = c_css_rltd_per_per_in_ler_id
9087      -- and csr.business_group_id = p_business_group_id
9088      and not exists (
9089          select /*+  */ null
9090          from ben_copy_entity_results cpe
9091 --              pqh_table_route trt
9092          where copy_entity_txn_id = p_copy_entity_txn_id
9093 --           and trt.table_route_id = cpe.table_route_id
9094            and ( -- c_mirror_src_entity_result_id is null or
9095                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
9096            -- and trt.where_clause = 'BEN_CSS_RLTD_PER_PER_IN_LER_F'
9097            and cpe.table_alias = c_table_alias
9098            and information1 = c_css_rltd_per_per_in_ler_id
9099            -- and information4 = csr.business_group_id
9100            and information2 = csr.effective_start_date
9101            and information3 = csr.effective_end_date
9102      );
9103      l_out_csr_result_id number(15);
9104   ---------------------------------------------------------------
9105   -- END OF BEN_CSS_RLTD_PER_PER_IN_LER_F ----------------------
9106   ---------------------------------------------------------------
9107   ---------------------------------------------------------------
9108   -- START OF BEN_LER_PER_INFO_CS_LER_F ----------------------
9109   ---------------------------------------------------------------
9110    cursor c_lpl_from_parent(c_LER_ID number) is
9111    select  ler_per_info_cs_ler_id
9112    from BEN_LER_PER_INFO_CS_LER_F
9113    where  LER_ID = c_LER_ID
9114      and  ( exists ( select 'x'
9115                    from ben_ler_f
9116                    where LER_ID = c_LER_ID
9117                      and typ_cd = 'ABS')  OR
9118             nvl(p_no_dup_rslt, 'X') = 'Y');  -- For plan design wizard copy lpl also
9119    --
9120    cursor c_lpl(c_ler_per_info_cs_ler_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
9121    select  lpl.*
9122    from BEN_LER_PER_INFO_CS_LER_F lpl
9123    where  lpl.ler_per_info_cs_ler_id = c_ler_per_info_cs_ler_id
9124      -- and lpl.business_group_id = p_business_group_id
9125      and not exists (
9126          select /*+  */ null
9127          from ben_copy_entity_results cpe
9128 --              pqh_table_route trt
9129          where copy_entity_txn_id = p_copy_entity_txn_id
9130 --           and trt.table_route_id = cpe.table_route_id
9131            and ( -- c_mirror_src_entity_result_id is null or
9132                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
9133            -- and trt.where_clause = 'BEN_LER_PER_INFO_CS_LER_F'
9134            and cpe.table_alias = c_table_alias
9135            and information1 = c_ler_per_info_cs_ler_id
9136            -- and information4 = lpl.business_group_id
9137            and information2 = lpl.effective_start_date
9138            and information3 = lpl.effective_end_date
9139      );
9140      l_out_lpl_result_id number(15);
9141   ---------------------------------------------------------------
9142   -- END OF BEN_LER_PER_INFO_CS_LER_F ----------------------
9143   ---------------------------------------------------------------
9144   ---------------------------------------------------------------
9145   -- START OF BEN_LER_RLTD_PER_CS_LER_F ----------------------
9146   ---------------------------------------------------------------
9147    cursor c_lrc_from_parent(c_LER_ID number) is
9148    select  ler_rltd_per_cs_ler_id
9149    from BEN_LER_RLTD_PER_CS_LER_F
9150    where  LER_ID = c_LER_ID ;
9151    --
9152    cursor c_lrc(c_ler_rltd_per_cs_ler_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
9153    select  lrc.*
9154    from BEN_LER_RLTD_PER_CS_LER_F lrc
9155    where  lrc.ler_rltd_per_cs_ler_id = c_ler_rltd_per_cs_ler_id
9156      -- and lrc.business_group_id = p_business_group_id
9157      and not exists (
9158          select /*+  */ null
9159          from ben_copy_entity_results cpe
9160 --              pqh_table_route trt
9161          where copy_entity_txn_id = p_copy_entity_txn_id
9162 --           and trt.table_route_id = cpe.table_route_id
9163            and ( -- c_mirror_src_entity_result_id is null or
9164                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
9165            -- and trt.where_clause = 'BEN_LER_RLTD_PER_CS_LER_F'
9166            and cpe.table_alias = c_table_alias
9167            and information1 = c_ler_rltd_per_cs_ler_id
9168            -- and information4 = lrc.business_group_id
9169            and information2 = lrc.effective_start_date
9170            and information3 = lrc.effective_end_date
9171      );
9172      l_out_lrc_result_id number(15);
9173   ---------------------------------------------------------------
9174   -- END OF BEN_LER_RLTD_PER_CS_LER_F ----------------------
9175   ---------------------------------------------------------------
9176   ---------------------------------------------------------------
9177   -- START OF BEN_PER_INFO_CHG_CS_LER_F ----------------------
9178   ---------------------------------------------------------------
9179    cursor c_psl_from_parent(c_LER_PER_INFO_CS_LER_ID number) is
9180    select  psl.per_info_chg_cs_ler_id
9181    from BEN_LER_PER_INFO_CS_LER_F lpl,
9182         BEN_PER_INFO_CHG_CS_LER_F psl
9183    where  LER_PER_INFO_CS_LER_ID = c_LER_PER_INFO_CS_LER_ID
9184      and psl.PER_INFO_CHG_CS_LER_id = lpl.PER_INFO_CHG_CS_LER_id
9185      and  source_table = 'PER_ABSENCE_ATTENDANCES';
9186    --
9187    cursor c_psl(c_per_info_chg_cs_ler_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
9188    select  psl.*
9189    from BEN_PER_INFO_CHG_CS_LER_F psl
9190    where  psl.per_info_chg_cs_ler_id = c_per_info_chg_cs_ler_id
9191      -- and psl.business_group_id = p_business_group_id
9192      and not exists (
9193          select /*+  */ null
9194          from ben_copy_entity_results cpe
9195 --              pqh_table_route trt
9196          where copy_entity_txn_id = p_copy_entity_txn_id
9197 --           and trt.table_route_id = cpe.table_route_id
9198            and ( -- c_mirror_src_entity_result_id is null or
9199                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
9200            -- and trt.where_clause = 'BEN_PER_INFO_CHG_CS_LER_F'
9201            and cpe.table_alias = c_table_alias
9202            and information1 = c_per_info_chg_cs_ler_id
9203            -- and information4 = psl.business_group_id
9204            and information2 = psl.effective_start_date
9205            and information3 = psl.effective_end_date
9206      );
9207     --
9208     cursor c_abs_reason(cv_lookup_code in varchar2, cv_effective_date in date) is
9209     SELECT distinct hl.meaning
9210     FROM hr_lookups hl,
9211          per_abs_attendance_reasons abs
9212     WHERE hl.lookup_type = 'ABSENCE_REASON'
9213       AND hl.lookup_code = abs.name
9214       AND hl.lookup_code = cv_lookup_code
9215       AND hl.enabled_flag = 'Y'
9216       AND abs.business_group_id = p_business_group_id
9217       AND cv_effective_date between nvl(start_date_active,cv_effective_date)
9218       and nvl(end_date_active,cv_effective_date);
9219     --
9220     cursor c_abs_type(cv_val in varchar2) is
9221     SELECT distinct name
9222     from PER_ABSENCE_ATTENDANCE_TYPES
9223     WHERE business_group_id = p_business_group_id
9224       and to_char(absence_attendance_type_id) = cv_val;
9225     --
9226     l_abs_old_name varchar2(600);
9227     l_abs_new_name varchar2(600);
9228     l_out_psl_result_id number(15);
9229   ---------------------------------------------------------------
9230   -- END OF BEN_PER_INFO_CHG_CS_LER_F ----------------------
9231   ---------------------------------------------------------------
9232   ---------------------------------------------------------------
9233   -- START OF BEN_RLTD_PER_CHG_CS_LER_F ----------------------
9234   ---------------------------------------------------------------
9235    cursor c_rcl_from_parent(c_LER_RLTD_PER_CS_LER_ID number) is
9236    select  rltd_per_chg_cs_ler_id
9237    from BEN_LER_RLTD_PER_CS_LER_F
9238    where  LER_RLTD_PER_CS_LER_ID = c_LER_RLTD_PER_CS_LER_ID ;
9239    --
9240    cursor c_rcl(c_rltd_per_chg_cs_ler_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
9241    select  rcl.*
9242    from BEN_RLTD_PER_CHG_CS_LER_F rcl
9243    where  rcl.rltd_per_chg_cs_ler_id = c_rltd_per_chg_cs_ler_id
9244      -- and rcl.business_group_id = p_business_group_id
9245      and not exists (
9246          select /*+  */ null
9247          from ben_copy_entity_results cpe
9248 --              pqh_table_route trt
9249          where copy_entity_txn_id = p_copy_entity_txn_id
9250 --           and trt.table_route_id = cpe.table_route_id
9251            and ( -- c_mirror_src_entity_result_id is null or
9252                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
9253            -- and trt.where_clause = 'BEN_RLTD_PER_CHG_CS_LER_F'
9254            and cpe.table_alias = c_table_alias
9255            and information1 = c_rltd_per_chg_cs_ler_id
9256            -- and information4 = rcl.business_group_id
9257            and information2 = rcl.effective_start_date
9258            and information3 = rcl.effective_end_date
9259      );
9260      l_out_rcl_result_id number(15);
9261   ---------------------------------------------------------------
9262   -- END OF BEN_RLTD_PER_CHG_CS_LER_F ----------------------
9263   ---------------------------------------------------------------
9264 
9265   cursor c_object_exists(c_pk_id                number,
9266                           c_table_alias          varchar2) is
9267     select null
9268     from ben_copy_entity_results cpe
9269 --         pqh_table_route trt
9270     where copy_entity_txn_id = p_copy_entity_txn_id
9271 --    and trt.table_route_id = cpe.table_route_id
9272     and cpe.table_alias = c_table_alias
9273     and information1 = c_pk_id;
9274 
9275   l_dummy                     varchar2(1);
9276 
9277   l_table_route_id                number(15);
9278   l_mirror_src_entity_result_id     number(15);
9279   l_result_type_cd                varchar2(30);
9280   l_information5                  ben_copy_entity_results.information5%type;
9281   l_ler_id                        number(15);
9282   l_number_of_copies              number(15);
9283   l_css_rltd_per_per_in_ler_id    number(15);
9284   l_ler_per_info_cs_ler_id        number(15);
9285   l_ler_rltd_per_cs_ler_id        number(15);
9286   l_per_info_chg_cs_ler_id        number(15);
9287   l_rltd_per_chg_cs_ler_id        number(15);
9288   l_out_src_result_id             number(15);
9289 begin
9290 
9291   if p_no_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
9292     ben_plan_design_program_module.g_pdw_allow_dup_rslt := ben_plan_design_program_module.g_pdw_no_dup_rslt;
9293   end if;
9294 
9295   if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
9296     open c_object_exists(p_ler_id,'LER');
9297     fetch c_object_exists into l_dummy;
9298     if c_object_exists%found then
9299       close c_object_exists;
9300       return;
9301     end if;
9302     close c_object_exists;
9303   end if;
9304 
9305   --
9306   l_number_of_copies := p_number_of_copies ;
9307 
9308   --
9309   ---------------------------------------------------------------
9310   -- START OF BEN_LER_F ----------------------
9311   ---------------------------------------------------------------
9312   --
9313   l_mirror_src_entity_result_id := p_copy_entity_result_id;
9314   --
9315   for l_ler_rec in c_ler(p_ler_id,l_mirror_src_entity_result_id,'LER') loop
9316    --
9317    --
9318        l_table_route_id := null ;
9319        open ben_plan_design_program_module.g_table_route('LER');
9320        fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9321        close ben_plan_design_program_module.g_table_route ;
9322        --
9323        l_information5  := l_ler_rec.name; --'Intersection';
9324        --
9325        l_ler_id := l_ler_rec.ler_id ;
9326        if p_effective_date between l_ler_rec.effective_start_date
9327            and l_ler_rec.effective_end_date then
9328            --
9329            l_result_type_cd := 'DISPLAY';
9330        else
9331            l_result_type_cd := 'NO DISPLAY';
9332        end if;
9333        --
9334        l_copy_entity_result_id := null;
9335        l_object_version_number := null;
9336        ben_copy_entity_results_api.create_copy_entity_results(
9337             p_copy_entity_result_id           => l_copy_entity_result_id,
9338             p_copy_entity_txn_id             => p_copy_entity_txn_id,
9339             p_result_type_cd                 => l_result_type_cd,
9340             p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
9341             p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9342             p_number_of_copies               => l_number_of_copies,
9343             p_table_alias					 => 'LER',
9344             p_table_route_id                 => l_table_route_id,
9345             p_information1     => l_ler_rec.ler_id,
9346             p_information2     => l_ler_rec.EFFECTIVE_START_DATE,
9347             p_information3     => l_ler_rec.EFFECTIVE_END_DATE,
9348             p_information4     => l_ler_rec.business_group_id,
9349             p_information5     => l_information5 , -- 9999 put name for h-grid
9350             p_information22     => l_ler_rec.ck_rltd_per_elig_flag,
9351             p_information23     => l_ler_rec.cm_aply_flag,
9352             p_information219     => l_ler_rec.desc_txt,
9353             p_information111     => l_ler_rec.ler_attribute1,
9354             p_information120     => l_ler_rec.ler_attribute10,
9355             p_information121     => l_ler_rec.ler_attribute11,
9356             p_information122     => l_ler_rec.ler_attribute12,
9357             p_information123     => l_ler_rec.ler_attribute13,
9358             p_information124     => l_ler_rec.ler_attribute14,
9359             p_information125     => l_ler_rec.ler_attribute15,
9360             p_information126     => l_ler_rec.ler_attribute16,
9361             p_information127     => l_ler_rec.ler_attribute17,
9362             p_information128     => l_ler_rec.ler_attribute18,
9363             p_information129     => l_ler_rec.ler_attribute19,
9364             p_information112     => l_ler_rec.ler_attribute2,
9365             p_information130     => l_ler_rec.ler_attribute20,
9366             p_information131     => l_ler_rec.ler_attribute21,
9367             p_information132     => l_ler_rec.ler_attribute22,
9368             p_information133     => l_ler_rec.ler_attribute23,
9369             p_information134     => l_ler_rec.ler_attribute24,
9370             p_information135     => l_ler_rec.ler_attribute25,
9371             p_information136     => l_ler_rec.ler_attribute26,
9372             p_information137     => l_ler_rec.ler_attribute27,
9373             p_information138     => l_ler_rec.ler_attribute28,
9374             p_information139     => l_ler_rec.ler_attribute29,
9375             p_information113     => l_ler_rec.ler_attribute3,
9376             p_information140     => l_ler_rec.ler_attribute30,
9377             p_information114     => l_ler_rec.ler_attribute4,
9378             p_information115     => l_ler_rec.ler_attribute5,
9379             p_information116     => l_ler_rec.ler_attribute6,
9380             p_information117     => l_ler_rec.ler_attribute7,
9381             p_information118     => l_ler_rec.ler_attribute8,
9382             p_information119     => l_ler_rec.ler_attribute9,
9383             p_information110     => l_ler_rec.ler_attribute_category,
9384             p_information261     => l_ler_rec.ler_eval_rl,
9385             p_information15      => l_ler_rec.ler_stat_cd,
9386             p_information13      => l_ler_rec.lf_evt_oper_cd,
9387             p_information170     => l_ler_rec.name,
9388             p_information21      => l_ler_rec.ocrd_dt_det_cd,
9389             p_information24      => l_ler_rec.ovridg_le_flag,
9390             p_information17      => l_ler_rec.ptnl_ler_trtmt_cd,
9391             p_information25      => l_ler_rec.qualg_evt_flag,
9392             p_information26      => l_ler_rec.ss_pcp_disp_cd, --4301332
9393             p_information11      => l_ler_rec.short_code,
9394             p_information12      => l_ler_rec.short_name,
9395             p_information14      => l_ler_rec.slctbl_slf_svc_cd,
9396             p_information263     => l_ler_rec.tmlns_dys_num,
9397             p_information20      => l_ler_rec.tmlns_eval_cd,
9398             p_information19      => l_ler_rec.tmlns_perd_cd,
9399             p_information262     => l_ler_rec.tmlns_perd_rl,
9400             p_information16      => l_ler_rec.typ_cd,
9401             p_information18      => l_ler_rec.whn_to_prcs_cd,
9402             p_information265     => l_ler_rec.object_version_number,
9403             p_object_version_number          => l_object_version_number,
9404             p_effective_date                 => p_effective_date       );
9405    --
9406 
9407             if l_out_src_result_id is null then
9408               l_out_src_result_id := l_copy_entity_result_id;
9409             end if;
9410 
9411             if l_result_type_cd = 'DISPLAY' then
9412 		  -- ------------------------------------------------------------------------
9413 		  l_out_src_result_id := l_copy_entity_result_id ;
9414 		  -- ------------------------------------------------------------------------
9415 		end if;
9416 	--
9417 			if (l_ler_rec.ler_eval_rl is not null) then
9418 			   ben_plan_design_program_module.create_formula_result(
9419 					p_validate                       => p_validate
9420 					,p_copy_entity_result_id  => l_copy_entity_result_id
9421 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
9422 					,p_formula_id                  => l_ler_rec.ler_eval_rl
9423 					,p_business_group_id        => l_ler_rec.business_group_id
9424 					,p_number_of_copies         =>  l_number_of_copies
9425 					,p_object_version_number  => l_object_version_number
9426 					,p_effective_date             => p_effective_date);
9427 			end if;
9428 
9429 			if (l_ler_rec.tmlns_perd_rl is not null) then
9430 			   ben_plan_design_program_module.create_formula_result(
9431 					p_validate                       => p_validate
9432 					,p_copy_entity_result_id  => l_copy_entity_result_id
9433 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
9434 					,p_formula_id                  => l_ler_rec.tmlns_perd_rl
9435 					,p_business_group_id        => l_ler_rec.business_group_id
9436 					,p_number_of_copies         =>  l_number_of_copies
9437 					,p_object_version_number  => l_object_version_number
9438 					,p_effective_date             => p_effective_date);
9439 			end if;
9440 
9441 	--
9442    end loop;
9443    ---------------------------------------------------------------
9444    -- END OF BEN_LER_F ----------------------
9445    ---------------------------------------------------------------
9446          /* -- START NOTIMPLEMENTED
9447          ---------------------------------------------------------------
9448          -- START OF BEN_CSS_RLTD_PER_PER_IN_LER_F ----------------------
9449          ---------------------------------------------------------------
9450        --
9451        for l_parent_rec  in c_csr_from_parent(l_LER_ID) loop
9452        --
9453             l_mirror_src_entity_result_id := l_out_src_result_id ;
9454 
9455             l_css_rltd_per_per_in_ler_id := l_parent_rec.css_rltd_per_per_in_ler_id ;
9456             --
9457             for l_csr_rec in c_csr(l_parent_rec.css_rltd_per_per_in_ler_id,l_mirror_src_entity_result_id,'CSR') loop
9458             --
9459             --
9460                 l_table_route_id := null ;
9461                 open ben_plan_design_program_module.g_table_route('CSR');
9462                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9463                 close ben_plan_design_program_module.g_table_route ;
9464                 --
9465                 l_information5  := ben_plan_design_program_module.get_ler_name(l_csr_rec.rsltg_ler_id,p_effective_date); --'Intersection';
9466                 --
9467                 l_css_rltd_per_per_in_ler_id := l_csr_rec.css_rltd_per_per_in_ler_id ;
9468                 if p_effective_date between l_csr_rec.effective_start_date
9469                     and l_csr_rec.effective_end_date then
9470                     --
9471                     l_result_type_cd := 'DISPLAY';
9472                 else
9473                     l_result_type_cd := 'NO DISPLAY';
9474                 end if;
9475                 --
9476                 l_copy_entity_result_id := null;
9477                 l_object_version_number := null;
9478                 ben_copy_entity_results_api.create_copy_entity_results(
9479                      p_copy_entity_result_id           => l_copy_entity_result_id,
9480                      p_copy_entity_txn_id             => p_copy_entity_txn_id,
9481                      p_result_type_cd                 => l_result_type_cd,
9482                      p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
9483                      p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9484                      p_number_of_copies               => l_number_of_copies,
9485                      p_table_route_id                 => l_table_route_id,
9486                      p_information1     => l_csr_rec.css_rltd_per_per_in_ler_id,
9487                      p_information2     => l_csr_rec.EFFECTIVE_START_DATE,
9488                      p_information3     => l_csr_rec.EFFECTIVE_END_DATE,
9489                      p_information4     => l_csr_rec.business_group_id,
9490                      p_information5     => l_information5 , -- 9999 put name for h-grid
9491                      p_information111     => l_csr_rec.csr_attribute1,
9492                      p_information120     => l_csr_rec.csr_attribute10,
9493                      p_information121     => l_csr_rec.csr_attribute11,
9494                      p_information122     => l_csr_rec.csr_attribute12,
9495                      p_information123     => l_csr_rec.csr_attribute13,
9496                      p_information124     => l_csr_rec.csr_attribute14,
9497                      p_information125     => l_csr_rec.csr_attribute15,
9498                      p_information126     => l_csr_rec.csr_attribute16,
9499                      p_information127     => l_csr_rec.csr_attribute17,
9500                      p_information128     => l_csr_rec.csr_attribute18,
9501                      p_information129     => l_csr_rec.csr_attribute19,
9502                      p_information112     => l_csr_rec.csr_attribute2,
9503                      p_information130     => l_csr_rec.csr_attribute20,
9504                      p_information131     => l_csr_rec.csr_attribute21,
9505                      p_information132     => l_csr_rec.csr_attribute22,
9506                      p_information133     => l_csr_rec.csr_attribute23,
9507                      p_information134     => l_csr_rec.csr_attribute24,
9508                      p_information135     => l_csr_rec.csr_attribute25,
9509                      p_information136     => l_csr_rec.csr_attribute26,
9510                      p_information137     => l_csr_rec.csr_attribute27,
9511                      p_information138     => l_csr_rec.csr_attribute28,
9512                      p_information139     => l_csr_rec.csr_attribute29,
9513                      p_information113     => l_csr_rec.csr_attribute3,
9514                      p_information140     => l_csr_rec.csr_attribute30,
9515                      p_information114     => l_csr_rec.csr_attribute4,
9516                      p_information115     => l_csr_rec.csr_attribute5,
9517                      p_information116     => l_csr_rec.csr_attribute6,
9518                      p_information117     => l_csr_rec.csr_attribute7,
9519                      p_information118     => l_csr_rec.csr_attribute8,
9520                      p_information119     => l_csr_rec.csr_attribute9,
9521                      p_information110     => l_csr_rec.csr_attribute_category,
9522                      p_information257     => l_csr_rec.ler_id,
9523                      p_information261     => l_csr_rec.ordr_to_prcs_num,
9524                      p_information262     => l_csr_rec.rsltg_ler_id,
9525                      p_information265     => l_csr_rec.object_version_number,
9526                      p_object_version_number          => l_object_version_number,
9527                      p_effective_date                 => p_effective_date       );
9528               --
9529 
9530                      if l_out_csr_result_id is null then
9531                        l_out_csr_result_id := l_copy_entity_result_id;
9532                      end if;
9533 
9534                      if l_result_type_cd = 'DISPLAY' then
9535                        l_out_csr_result_id := l_copy_entity_result_id ;
9536                      end if;
9537               end loop;
9538             --
9539             end loop;
9540          ---------------------------------------------------------------
9541          -- END OF BEN_CSS_RLTD_PER_PER_IN_LER_F ----------------------
9542          ---------------------------------------------------------------
9543 */
9544          -- NOTIMPLEMENTED
9545          ---------------------------------------------------------------
9546          -- START OF BEN_LER_PER_INFO_CS_LER_F ----------------------
9547          ---------------------------------------------------------------
9548             --
9549          for l_parent_rec  in c_lpl_from_parent(l_LER_ID) loop
9550          --
9551            l_mirror_src_entity_result_id := l_out_src_result_id ;
9552 
9553            l_ler_per_info_cs_ler_id := l_parent_rec.ler_per_info_cs_ler_id ;
9554            --
9555            for l_lpl_rec in c_lpl(l_parent_rec.ler_per_info_cs_ler_id,l_mirror_src_entity_result_id,'LPL') loop
9556            --
9557            --
9558                l_table_route_id := null ;
9559                open ben_plan_design_program_module.g_table_route('LPL');
9560                fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9561                close ben_plan_design_program_module.g_table_route ;
9562                 --
9563                 l_information5  := ben_plan_design_program_module.get_per_info_chg_cs_ler_name(l_lpl_rec.per_info_chg_cs_ler_id,
9564                                                    p_effective_date); --'Intersection';
9565                 --
9566                 if p_effective_date between l_lpl_rec.effective_start_date
9567                     and l_lpl_rec.effective_end_date then
9568                     --
9569                     l_result_type_cd := 'DISPLAY';
9570                 else
9571                     l_result_type_cd := 'NO DISPLAY';
9572                 end if;
9573                 --
9574                 l_copy_entity_result_id := null;
9575                 l_object_version_number := null;
9576                 ben_copy_entity_results_api.create_copy_entity_results(
9577                      p_copy_entity_result_id           => l_copy_entity_result_id,
9578                      p_copy_entity_txn_id             => p_copy_entity_txn_id,
9579                      p_result_type_cd                 => l_result_type_cd,
9580                      p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
9581                      p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9582                      p_number_of_copies               => l_number_of_copies,
9583                      p_table_alias					 => 'LPL',
9584                      p_table_route_id                 => l_table_route_id,
9585                      p_information1     => l_lpl_rec.ler_per_info_cs_ler_id,
9586                      p_information2     => l_lpl_rec.EFFECTIVE_START_DATE,
9587                      p_information3     => l_lpl_rec.EFFECTIVE_END_DATE,
9588                      p_information4     => l_lpl_rec.business_group_id,
9589                      p_information5     => l_information5 , -- 9999 put name for h-grid
9590                      p_information257     => l_lpl_rec.ler_id,
9591                      p_information262     => l_lpl_rec.ler_per_info_cs_ler_rl,
9592                      p_information111     => l_lpl_rec.lpl_attribute1,
9593                      p_information120     => l_lpl_rec.lpl_attribute10,
9594                      p_information121     => l_lpl_rec.lpl_attribute11,
9595                      p_information122     => l_lpl_rec.lpl_attribute12,
9596                      p_information123     => l_lpl_rec.lpl_attribute13,
9597                      p_information124     => l_lpl_rec.lpl_attribute14,
9598                      p_information125     => l_lpl_rec.lpl_attribute15,
9599                      p_information126     => l_lpl_rec.lpl_attribute16,
9600                      p_information127     => l_lpl_rec.lpl_attribute17,
9601                      p_information128     => l_lpl_rec.lpl_attribute18,
9602                      p_information129     => l_lpl_rec.lpl_attribute19,
9603                      p_information112     => l_lpl_rec.lpl_attribute2,
9604                      p_information130     => l_lpl_rec.lpl_attribute20,
9605                      p_information131     => l_lpl_rec.lpl_attribute21,
9606                      p_information132     => l_lpl_rec.lpl_attribute22,
9607                      p_information133     => l_lpl_rec.lpl_attribute23,
9608                      p_information134     => l_lpl_rec.lpl_attribute24,
9609                      p_information135     => l_lpl_rec.lpl_attribute25,
9610                      p_information136     => l_lpl_rec.lpl_attribute26,
9611                      p_information137     => l_lpl_rec.lpl_attribute27,
9612                      p_information138     => l_lpl_rec.lpl_attribute28,
9613                      p_information139     => l_lpl_rec.lpl_attribute29,
9614                      p_information113     => l_lpl_rec.lpl_attribute3,
9615                      p_information140     => l_lpl_rec.lpl_attribute30,
9616                      p_information114     => l_lpl_rec.lpl_attribute4,
9617                      p_information115     => l_lpl_rec.lpl_attribute5,
9618                      p_information116     => l_lpl_rec.lpl_attribute6,
9619                      p_information117     => l_lpl_rec.lpl_attribute7,
9620                      p_information118     => l_lpl_rec.lpl_attribute8,
9621                      p_information119     => l_lpl_rec.lpl_attribute9,
9622                      p_information110     => l_lpl_rec.lpl_attribute_category,
9623                      p_information258     => l_lpl_rec.per_info_chg_cs_ler_id,
9624                      p_information265     => l_lpl_rec.object_version_number,
9625                      p_object_version_number          => l_object_version_number,
9626                      p_effective_date                 => p_effective_date       );
9627               --
9628 
9629                       if l_out_lpl_result_id is null then
9630                         l_out_lpl_result_id := l_copy_entity_result_id;
9631                       end if;
9632 
9633                       if l_result_type_cd = 'DISPLAY' then
9634                         l_out_lpl_result_id := l_copy_entity_result_id ;
9635                       end if;
9636 
9637                       if (l_lpl_rec.ler_per_info_cs_ler_rl is not null) then
9638 						   ben_plan_design_program_module.create_formula_result(
9639 								p_validate                       => p_validate
9640 								,p_copy_entity_result_id  => l_copy_entity_result_id
9641 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
9642 								,p_formula_id                  => l_lpl_rec.ler_per_info_cs_ler_rl
9643 								,p_business_group_id        => l_lpl_rec.business_group_id
9644 								,p_number_of_copies         =>  l_number_of_copies
9645 								,p_object_version_number  => l_object_version_number
9646 								,p_effective_date             => p_effective_date);
9647 						end if;
9648 
9649               --
9650             end loop;
9651             --
9652                ---------------------------------------------------------------
9653                -- START OF BEN_PER_INFO_CHG_CS_LER_F ----------------------
9654                ---------------------------------------------------------------
9655                --
9656                for l_parent_rec  in c_psl_from_parent(l_LER_PER_INFO_CS_LER_ID) loop
9657                --
9658                  l_mirror_src_entity_result_id := l_out_lpl_result_id ;
9659 
9660                  l_per_info_chg_cs_ler_id := l_parent_rec.per_info_chg_cs_ler_id ;
9661                  --
9662                  for l_psl_rec in c_psl(l_parent_rec.per_info_chg_cs_ler_id,l_mirror_src_entity_result_id,'PSL') loop
9663                  --
9664                  --
9665                      l_table_route_id := null ;
9666                      open ben_plan_design_program_module.g_table_route('PSL');
9667                      fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9668                      close ben_plan_design_program_module.g_table_route ;
9669                       --
9670                       l_information5  := SUBSTR(l_psl_rec.name,1,255); --'Intersection';
9671                       --
9672 
9673                       if p_effective_date between l_psl_rec.effective_start_date
9674                           and l_psl_rec.effective_end_date then
9675                           --
9676                           l_result_type_cd := 'DISPLAY';
9677                       else
9678                           l_result_type_cd := 'NO DISPLAY';
9679                       end if;
9680                       --
9681                       -- For absences seeded plan design
9682                       --
9683                       l_abs_old_name := null;
9684                       l_abs_new_name := null;
9685                       --
9686                       if l_psl_rec.source_table = 'PER_ABSENCE_ATTENDANCES' then
9687                          --
9688                          if l_psl_rec.source_column = 'ABSENCE_ATTENDANCE_TYPE_ID' then
9689                             --
9690                             if l_psl_rec.old_val not in ('OABANY', 'NULL') then
9691                                open c_abs_type(l_psl_rec.old_val);
9692                                fetch c_abs_type into l_abs_old_name;
9693                                close c_abs_type;
9694                             end if;
9695                             --
9696                             if l_psl_rec.new_val not in ('OABANY', 'NULL') then
9697                                open c_abs_type(l_psl_rec.new_val);
9698                                fetch c_abs_type into l_abs_new_name;
9699                                close c_abs_type;
9700                             end if;
9701                             --
9702                          elsif l_psl_rec.source_column = 'ABS_ATTENDANCE_REASON_ID' then
9703                             --
9704                             if l_psl_rec.old_val not in ('OABANY', 'NULL') then
9705                                open c_abs_reason(l_psl_rec.old_val, p_effective_date);
9706                                fetch c_abs_reason into l_abs_old_name;
9707                                close c_abs_reason;
9708                             end if;
9709                             --
9710                             if l_psl_rec.new_val not in ('OABANY', 'NULL') then
9711                                open c_abs_reason(l_psl_rec.new_val,p_effective_date );
9712                                fetch c_abs_reason into l_abs_new_name;
9713                                close c_abs_reason;
9714                             end if;
9715                             --
9716                          end if;
9717                          --
9718                       end if;
9719                       --
9720                       l_copy_entity_result_id := null;
9721                       l_object_version_number := null;
9722                       ben_copy_entity_results_api.create_copy_entity_results(
9723                            p_copy_entity_result_id           => l_copy_entity_result_id,
9724                            p_copy_entity_txn_id             => p_copy_entity_txn_id,
9725                            p_result_type_cd                 => l_result_type_cd,
9726                            p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
9727                            p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9728                            p_number_of_copies               => l_number_of_copies,
9729                            p_table_alias					 => 'PSL',
9730                            p_table_route_id                 => l_table_route_id,
9731                            p_information1     => l_psl_rec.per_info_chg_cs_ler_id,
9732                            p_information2     => l_psl_rec.EFFECTIVE_START_DATE,
9733                            p_information3     => l_psl_rec.EFFECTIVE_END_DATE,
9734                            p_information4     => l_psl_rec.business_group_id,
9735                            p_information5     => l_information5 , -- 9999 put name for h-grid
9736                            --
9737                            -- Bug No: 3907710
9738                            --
9739                            p_information11    => l_psl_rec.rule_overrides_flag,
9740                            --
9741                            p_information218     => l_psl_rec.name,
9742                            p_information186     => l_psl_rec.new_val,
9743                            p_information185     => l_psl_rec.old_val,
9744                            p_information260     => l_psl_rec.per_info_chg_cs_ler_rl,
9745                            p_information111     => l_psl_rec.psl_attribute1,
9746                            p_information120     => l_psl_rec.psl_attribute10,
9747                            p_information121     => l_psl_rec.psl_attribute11,
9748                            p_information122     => l_psl_rec.psl_attribute12,
9749                            p_information123     => l_psl_rec.psl_attribute13,
9750                            p_information124     => l_psl_rec.psl_attribute14,
9751                            p_information125     => l_psl_rec.psl_attribute15,
9752                            p_information126     => l_psl_rec.psl_attribute16,
9753                            p_information127     => l_psl_rec.psl_attribute17,
9754                            p_information128     => l_psl_rec.psl_attribute18,
9755                            p_information129     => l_psl_rec.psl_attribute19,
9756                            p_information112     => l_psl_rec.psl_attribute2,
9757                            p_information130     => l_psl_rec.psl_attribute20,
9758                            p_information131     => l_psl_rec.psl_attribute21,
9759                            p_information132     => l_psl_rec.psl_attribute22,
9760                            p_information133     => l_psl_rec.psl_attribute23,
9761                            p_information134     => l_psl_rec.psl_attribute24,
9762                            p_information135     => l_psl_rec.psl_attribute25,
9763                            p_information136     => l_psl_rec.psl_attribute26,
9764                            p_information137     => l_psl_rec.psl_attribute27,
9765                            p_information138     => l_psl_rec.psl_attribute28,
9766                            p_information139     => l_psl_rec.psl_attribute29,
9767                            p_information113     => l_psl_rec.psl_attribute3,
9768                            p_information140     => l_psl_rec.psl_attribute30,
9769                            p_information114     => l_psl_rec.psl_attribute4,
9770                            p_information115     => l_psl_rec.psl_attribute5,
9771                            p_information116     => l_psl_rec.psl_attribute6,
9772                            p_information117     => l_psl_rec.psl_attribute7,
9773                            p_information118     => l_psl_rec.psl_attribute8,
9774                            p_information119     => l_psl_rec.psl_attribute9,
9775                            p_information110     => l_psl_rec.psl_attribute_category,
9776                            p_information141     => l_psl_rec.source_column,
9777                            p_information142     => l_psl_rec.source_table,
9778                            p_information219     => l_psl_rec.whatif_lbl_txt,
9779                            p_information187     => l_abs_new_name,
9780                            p_information188     => l_abs_old_name,
9781                            p_information265     => l_psl_rec.object_version_number,
9782                            p_object_version_number          => l_object_version_number,
9783                            p_effective_date                 => p_effective_date       );
9784                     --
9785 
9786                         if l_out_psl_result_id is null then
9787                           l_out_psl_result_id := l_copy_entity_result_id;
9788                         end if;
9789 
9790                         if l_result_type_cd = 'DISPLAY' then
9791                           l_out_psl_result_id := l_copy_entity_result_id ;
9792                         end if;
9793 
9794 				if (l_psl_rec.per_info_chg_cs_ler_rl is not null) then
9795 				   ben_plan_design_program_module.create_formula_result(
9796 					p_validate                       => p_validate
9797 					,p_copy_entity_result_id  => l_copy_entity_result_id
9798 					,p_copy_entity_txn_id      => p_copy_entity_txn_id
9799 					,p_formula_id                  => l_psl_rec.per_info_chg_cs_ler_rl
9800 					,p_business_group_id        => l_psl_rec.business_group_id
9801 					,p_number_of_copies         =>  l_number_of_copies
9802 					,p_object_version_number  => l_object_version_number
9803 					,p_effective_date             => p_effective_date);
9804 				end if;
9805 				--
9806                     end loop;
9807                   --
9808                   end loop;
9809                ---------------------------------------------------------------
9810                -- END OF BEN_PER_INFO_CHG_CS_LER_F ----------------------
9811                ---------------------------------------------------------------
9812             end loop;
9813          ---------------------------------------------------------------
9814          -- END OF BEN_LER_PER_INFO_CS_LER_F ----------------------
9815          ---------------------------------------------------------------
9816          /* -- NOTIMPLEMENTED
9817          ---------------------------------------------------------------
9818          -- START OF BEN_LER_RLTD_PER_CS_LER_F ----------------------
9819          ---------------------------------------------------------------
9820          --
9821          for l_parent_rec  in c_lrc_from_parent(l_LER_ID) loop
9822          --
9823             l_mirror_src_entity_result_id := l_out_src_result_id ;
9824 
9825             l_ler_rltd_per_cs_ler_id := l_parent_rec.ler_rltd_per_cs_ler_id ;
9826             --
9827             for l_lrc_rec in c_lrc(l_parent_rec.ler_rltd_per_cs_ler_id,l_mirror_src_entity_result_id,'LRC') loop
9828             --
9829             --
9830                 l_table_route_id := null ;
9831                 open ben_plan_design_program_module.g_table_route('LRC');
9832                 fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9833                 close ben_plan_design_program_module.g_table_route ;
9834                 --
9835                 l_information5  := SUBSTR(
9836                                      ben_plan_design_program_module.get_rltd_per_chg_cs_ler_name(
9837                                      l_lrc_rec.rltd_per_chg_cs_ler_id,
9838                                      p_effective_date),1,255); --'Intersection';
9839                 --
9840                 l_ler_rltd_per_cs_ler_id := l_lrc_rec.ler_rltd_per_cs_ler_id ;
9841                 if p_effective_date between l_lrc_rec.effective_start_date
9842                     and l_lrc_rec.effective_end_date then
9843                     --
9844                     l_result_type_cd := 'DISPLAY';
9845                 else
9846                     l_result_type_cd := 'NO DISPLAY';
9847                 end if;
9848                 --
9849                 l_copy_entity_result_id := null;
9850                 l_object_version_number := null;
9851                 ben_copy_entity_results_api.create_copy_entity_results(
9852                      p_copy_entity_result_id           => l_copy_entity_result_id,
9853                      p_copy_entity_txn_id             => p_copy_entity_txn_id,
9854                      p_result_type_cd                 => l_result_type_cd,
9855                      p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
9856                      p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9857                      p_number_of_copies               => l_number_of_copies,
9858                      p_table_route_id                 => l_table_route_id,
9859                      p_information1     => l_lrc_rec.ler_rltd_per_cs_ler_id,
9860                      p_information2     => l_lrc_rec.EFFECTIVE_START_DATE,
9861                      p_information3     => l_lrc_rec.EFFECTIVE_END_DATE,
9862                      p_information4     => l_lrc_rec.business_group_id,
9863                      p_information5     => l_information5 , -- 9999 put name for h-grid
9864 		     p_information257     => l_lrc_rec.ler_id,
9865 		     p_information262     => l_lrc_rec.ler_rltd_per_cs_chg_rl,
9866 		     p_information111     => l_lrc_rec.lrc_attribute1,
9867                      p_information120     => l_lrc_rec.lrc_attribute10,
9868                      p_information121     => l_lrc_rec.lrc_attribute11,
9869                      p_information122     => l_lrc_rec.lrc_attribute12,
9870                      p_information123     => l_lrc_rec.lrc_attribute13,
9871                      p_information124     => l_lrc_rec.lrc_attribute14,
9872                      p_information125     => l_lrc_rec.lrc_attribute15,
9873                      p_information126     => l_lrc_rec.lrc_attribute16,
9874                      p_information127     => l_lrc_rec.lrc_attribute17,
9875                      p_information128     => l_lrc_rec.lrc_attribute18,
9876                      p_information129     => l_lrc_rec.lrc_attribute19,
9877                      p_information112     => l_lrc_rec.lrc_attribute2,
9878                      p_information130     => l_lrc_rec.lrc_attribute20,
9879                      p_information131     => l_lrc_rec.lrc_attribute21,
9880                      p_information132     => l_lrc_rec.lrc_attribute22,
9881                      p_information133     => l_lrc_rec.lrc_attribute23,
9882                      p_information134     => l_lrc_rec.lrc_attribute24,
9883                      p_information135     => l_lrc_rec.lrc_attribute25,
9884                      p_information136     => l_lrc_rec.lrc_attribute26,
9885                      p_information137     => l_lrc_rec.lrc_attribute27,
9886                      p_information138     => l_lrc_rec.lrc_attribute28,
9887                      p_information139     => l_lrc_rec.lrc_attribute29,
9888                      p_information113     => l_lrc_rec.lrc_attribute3,
9889                      p_information140     => l_lrc_rec.lrc_attribute30,
9890                      p_information114     => l_lrc_rec.lrc_attribute4,
9891                      p_information115     => l_lrc_rec.lrc_attribute5,
9892                      p_information116     => l_lrc_rec.lrc_attribute6,
9893                      p_information117     => l_lrc_rec.lrc_attribute7,
9894                      p_information118     => l_lrc_rec.lrc_attribute8,
9895                      p_information119     => l_lrc_rec.lrc_attribute9,
9896                      p_information110     => l_lrc_rec.lrc_attribute_category,
9897                      p_information258     => l_lrc_rec.rltd_per_chg_cs_ler_id,
9898                      p_information265     => l_lrc_rec.object_version_number,
9899                      p_object_version_number          => l_object_version_number,
9900                      p_effective_date                 => p_effective_date       );
9901               --
9902 
9903                      if l_out_lrc_result_id is null then
9904                        l_out_lrc_result_id := l_copy_entity_result_id;
9905                      end if;
9906 
9907                      if l_result_type_cd = 'DISPLAY' then
9908                        l_out_lrc_result_id := l_copy_entity_result_id ;
9909                      end if;
9910 
9911                       if (l_lrc_rec.ler_rltd_per_cs_chg_rl is not null) then
9912 						   ben_plan_design_program_module.create_formula_result(
9913 								p_validate                       => p_validate
9914 								,p_copy_entity_result_id  => l_copy_entity_result_id
9915 								,p_copy_entity_txn_id      => p_copy_entity_txn_id
9916 								,p_formula_id                  => l_lrc_rec.ler_rltd_per_cs_chg_rl
9917 								,p_business_group_id        => l_lrc_rec.business_group_id
9918 								,p_number_of_copies         =>  l_number_of_copies
9919 								,p_object_version_number  => l_object_version_number
9920 								,p_effective_date             => p_effective_date);
9921 						end if;
9922 
9923 
9924               --
9925               end loop;
9926             --
9927              ---------------------------------------------------------------
9928              -- START OF BEN_RLTD_PER_CHG_CS_LER_F ----------------------
9929              ---------------------------------------------------------------
9930               --
9931               for l_parent_rec  in c_rcl_from_parent(l_LER_RLTD_PER_CS_LER_ID) loop
9932               --
9933                 l_mirror_src_entity_result_id := l_out_lrc_result_id ;
9934 
9935                 l_rltd_per_chg_cs_ler_id := l_parent_rec.rltd_per_chg_cs_ler_id ;
9936                 --
9937                 for l_rcl_rec in c_rcl(l_parent_rec.rltd_per_chg_cs_ler_id,l_mirror_src_entity_result_id,'RCL') loop
9938                 --
9939                 --
9940                    l_table_route_id := null ;
9941                    open ben_plan_design_program_module.g_table_route('RCL');
9942                    fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
9943                    close ben_plan_design_program_module.g_table_route ;
9944                    --
9945                    l_information5  := SUBSTR(l_rcl_rec.name,1,255); --'Intersection';
9946                    --
9947 
9948                     if p_effective_date between l_rcl_rec.effective_start_date
9949                         and l_rcl_rec.effective_end_date then
9950                         --
9951                         l_result_type_cd := 'DISPLAY';
9952                     else
9953                         l_result_type_cd := 'NO DISPLAY';
9954                     end if;
9955                     --
9956                     l_copy_entity_result_id := null;
9957                     l_object_version_number := null;
9958                     ben_copy_entity_results_api.create_copy_entity_results(
9959                          p_copy_entity_result_id           => l_copy_entity_result_id,
9960                          p_copy_entity_txn_id             => p_copy_entity_txn_id,
9961                          p_result_type_cd                 => l_result_type_cd,
9962                          p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
9963                          p_parent_entity_result_id        => l_mirror_src_entity_result_id,
9964                          p_number_of_copies               => l_number_of_copies,
9965                          p_table_route_id                 => l_table_route_id,
9966                          p_information1     => l_rcl_rec.rltd_per_chg_cs_ler_id,
9967                          p_information2     => l_rcl_rec.EFFECTIVE_START_DATE,
9968                          p_information3     => l_rcl_rec.EFFECTIVE_END_DATE,
9969                          p_information4     => l_rcl_rec.business_group_id,
9970                          p_information5     => l_information5 , -- 9999 put name for h-grid
9971                          --
9972                          -- Bug No: 3907710
9973                          --
9974                          p_information11    => l_rcl_rec.rule_overrides_flag,
9975                          --
9976                          p_information218     => l_rcl_rec.name,
9977                          p_information186     => l_rcl_rec.new_val,
9978                          p_information185     => l_rcl_rec.old_val,
9979                          p_information111     => l_rcl_rec.rcl_attribute1,
9980                          p_information120     => l_rcl_rec.rcl_attribute10,
9981                          p_information121     => l_rcl_rec.rcl_attribute11,
9982                          p_information122     => l_rcl_rec.rcl_attribute12,
9983                          p_information123     => l_rcl_rec.rcl_attribute13,
9984                          p_information124     => l_rcl_rec.rcl_attribute14,
9985                          p_information125     => l_rcl_rec.rcl_attribute15,
9986                          p_information126     => l_rcl_rec.rcl_attribute16,
9987                          p_information127     => l_rcl_rec.rcl_attribute17,
9988                          p_information128     => l_rcl_rec.rcl_attribute18,
9989                          p_information129     => l_rcl_rec.rcl_attribute19,
9990                          p_information112     => l_rcl_rec.rcl_attribute2,
9991                          p_information130     => l_rcl_rec.rcl_attribute20,
9992                          p_information131     => l_rcl_rec.rcl_attribute21,
9993                          p_information132     => l_rcl_rec.rcl_attribute22,
9994                          p_information133     => l_rcl_rec.rcl_attribute23,
9995                          p_information134     => l_rcl_rec.rcl_attribute24,
9996                          p_information135     => l_rcl_rec.rcl_attribute25,
9997                          p_information136     => l_rcl_rec.rcl_attribute26,
9998                          p_information137     => l_rcl_rec.rcl_attribute27,
9999                          p_information138     => l_rcl_rec.rcl_attribute28,
10000                          p_information139     => l_rcl_rec.rcl_attribute29,
10001                          p_information113     => l_rcl_rec.rcl_attribute3,
10002                          p_information140     => l_rcl_rec.rcl_attribute30,
10003                          p_information114     => l_rcl_rec.rcl_attribute4,
10004                          p_information115     => l_rcl_rec.rcl_attribute5,
10005                          p_information116     => l_rcl_rec.rcl_attribute6,
10006                          p_information117     => l_rcl_rec.rcl_attribute7,
10007                          p_information118     => l_rcl_rec.rcl_attribute8,
10008                          p_information119     => l_rcl_rec.rcl_attribute9,
10009                          p_information110     => l_rcl_rec.rcl_attribute_category,
10010                          p_information260     => l_rcl_rec.rltd_per_chg_cs_ler_rl,
10011                          p_information141     => l_rcl_rec.source_column,
10012                          p_information142     => l_rcl_rec.source_table,
10013                          p_information219     => l_rcl_rec.whatif_lbl_txt,
10014                          p_information265     => l_rcl_rec.object_version_number,
10015                          p_object_version_number          => l_object_version_number,
10016                          p_effective_date                 => p_effective_date       );
10017                   --
10018 
10019                       if l_out_rcl_result_id is null then
10020                         l_out_rcl_result_id := l_copy_entity_result_id;
10021                       end if;
10022 
10023                       if l_result_type_cd = 'DISPLAY' then
10024                         l_out_rcl_result_id := l_copy_entity_result_id ;
10025                       end if;
10026 
10027                       if (l_rcl_rec.rltd_per_chg_cs_ler_rl is not null) then
10028 			   ben_plan_design_program_module.create_formula_result(
10029 				p_validate                => p_validate
10030 				,p_copy_entity_result_id  => l_copy_entity_result_id
10031 				,p_copy_entity_txn_id     => p_copy_entity_txn_id
10032 				,p_formula_id             => l_rcl_rec.rltd_per_chg_cs_ler_rl
10033 				,p_business_group_id      => l_rcl_rec.business_group_id
10034 				,p_number_of_copies       => l_number_of_copies
10035 				,p_object_version_number  => l_object_version_number
10036 				,p_effective_date         => p_effective_date);
10037 			end if;
10038                   --
10039                   end loop;
10040                 --
10041                 end loop;
10042              ---------------------------------------------------------------
10043              -- END OF BEN_RLTD_PER_CHG_CS_LER_F ----------------------
10044              ---------------------------------------------------------------
10045             end loop;
10046          ---------------------------------------------------------------
10047          -- END OF BEN_LER_RLTD_PER_CS_LER_F ----------------------
10048          ---------------------------------------------------------------
10049          -- End NOTIMPLEMENTED
10050          */
10051 end;
10052 --
10053 procedure create_oipl_result
10054   (  p_validate                       in  number     default 0 -- false
10055     ,p_copy_entity_result_id          in  number
10056     ,p_copy_entity_txn_id             in  number
10057     ,p_oipl_id                        in  number
10058     ,p_business_group_id              in  number    default null
10059     ,p_number_of_copies               in  number    default 0
10060     ,p_object_version_number          out nocopy number
10061     ,p_effective_date                 in  date
10062     ,p_parent_entity_result_id        in  number
10063     ,p_no_dup_rslt                    in varchar2   default null
10064     ) is
10065     --
10066     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
10067     l_proc varchar2(72) := g_package||'create_popl_result';
10068     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
10069     --
10070     l_result_type_cd   varchar2(30) :=  'DISPLAY' ;
10071     -- Cursor to get mirror_src_entity_result_id
10072     cursor c_parent_result(c_parent_pk_id number,
10073                         c_parent_table_alias varchar2,
10074                         c_copy_entity_txn_id number) is
10075     select copy_entity_result_id mirror_src_entity_result_id
10076     from ben_copy_entity_results cpe
10077 --         pqh_table_route trt
10078     where cpe.information1        = c_parent_pk_id
10079     and   cpe.result_type_cd      = l_result_type_cd
10080     and   cpe.copy_entity_txn_id  = c_copy_entity_txn_id
10081 --    and   cpe.table_route_id      = trt.table_route_id
10082     and   cpe.table_alias         = c_parent_table_alias;
10083     --
10084     -- Cursor to get table_route_id
10085     --
10086     -- Bug : 3752407 : Global cursor g_table_route will now be used
10087     --
10088     -- cursor c_table_route(c_parent_table_alias varchar2) is
10089     -- select table_route_id
10090     -- from pqh_table_route trt
10091     -- where trt.table_alias         = c_parent_table_alias;
10092     --
10093    ---------------------------------------------------------------
10094    -- START OF BEN_OIPL_F ----------------------
10095    ---------------------------------------------------------------
10096    cursor c_cop1(c_oipl_id number,c_mirror_src_entity_result_id number,
10097                  c_table_alias varchar2) is
10098    select  cop.*
10099    from BEN_OIPL_F cop
10100    where  cop.oipl_id = c_oipl_id
10101      -- and cop.business_group_id = p_business_group_id
10102      and not exists (
10103          select /*+  */ null
10104          from ben_copy_entity_results cpe
10105 --              pqh_table_route trt
10106          where copy_entity_txn_id = p_copy_entity_txn_id
10107 --         and trt.table_route_id = cpe.table_route_id
10108          and ( -- c_mirror_src_entity_result_id is null or
10109                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
10110          -- and trt.where_clause = 'BEN_OIPL_F'
10111          and cpe.table_alias = c_table_alias
10112          and information1 = c_oipl_id
10113          -- and information4 = cop.business_group_id
10114            and information2 = cop.effective_start_date
10115            and information3 = cop.effective_end_date
10116         );
10117     l_oipl_id                 number(15);
10118     l_out_cop_result_id   number(15);
10119    ---------------------------------------------------------------
10120    -- END OF BEN_OIPL_F ----------------------
10121    ---------------------------------------------------------------
10122    ---------------------------------------------------------------
10123    -- START OF BEN_DSGN_RQMT_F ----------------------
10124    ---------------------------------------------------------------
10125    cursor c_ddr1_from_parent(c_OIPL_ID number) is
10126    select  dsgn_rqmt_id
10127    from BEN_DSGN_RQMT_F
10128    where  OIPL_ID = c_OIPL_ID ;
10129    --
10130    cursor c_ddr1(c_dsgn_rqmt_id number,c_mirror_src_entity_result_id number,
10131                  c_table_alias varchar2) is
10132    select  ddr.*
10133    from BEN_DSGN_RQMT_F ddr
10134    where  ddr.dsgn_rqmt_id = c_dsgn_rqmt_id
10135      -- and ddr.business_group_id = p_business_group_id
10136      and not exists (
10137          select /*+  */ null
10138          from ben_copy_entity_results cpe
10139 --              pqh_table_route trt
10140          where copy_entity_txn_id = p_copy_entity_txn_id
10141 --         and trt.table_route_id = cpe.table_route_id
10142          and ( -- c_mirror_src_entity_result_id is null or
10143                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
10144          -- and trt.where_clause = 'BEN_DSGN_RQMT_F'
10145          and cpe.table_alias = c_table_alias
10146          and information1 = c_dsgn_rqmt_id
10147          -- and information4 = ddr.business_group_id
10148            and information2 = ddr.effective_start_date
10149            and information3 = ddr.effective_end_date
10150         );
10151     l_dsgn_rqmt_id                 number(15);
10152     l_out_ddr_result_id   number(15);
10153     l_ddr1_dsgn_rqmt_esd ben_dsgn_rqmt_f.effective_start_date%type;
10154    ---------------------------------------------------------------
10155    -- END OF BEN_DSGN_RQMT_F ----------------------
10156    ---------------------------------------------------------------
10157    ---------------------------------------------------------------
10158    -- START OF BEN_DSGN_RQMT_RLSHP_TYP ----------------------
10159    ---------------------------------------------------------------
10160    cursor c_drr1_from_parent(c_DSGN_RQMT_ID number) is
10161    select  dsgn_rqmt_rlshp_typ_id
10162    from BEN_DSGN_RQMT_RLSHP_TYP
10163    where  DSGN_RQMT_ID = c_DSGN_RQMT_ID ;
10164    --
10165    cursor c_drr1(c_dsgn_rqmt_rlshp_typ_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
10166    select  drr.*
10167    from BEN_DSGN_RQMT_RLSHP_TYP drr
10168    where  drr.dsgn_rqmt_rlshp_typ_id = c_dsgn_rqmt_rlshp_typ_id
10169      -- and drr.business_group_id = p_business_group_id
10170      and not exists (
10171          select /*+  */ null
10172          from ben_copy_entity_results cpe
10173 --              pqh_table_route trt
10174          where copy_entity_txn_id = p_copy_entity_txn_id
10175 --         and trt.table_route_id = cpe.table_route_id
10176          and ( -- c_mirror_src_entity_result_id is null or
10177                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
10178          -- and trt.where_clause = 'BEN_DSGN_RQMT_RLSHP_TYP'
10179          and cpe.table_alias = c_table_alias
10180          and information1 = c_dsgn_rqmt_rlshp_typ_id
10181          -- and information4 = drr.business_group_id
10182         );
10183     l_dsgn_rqmt_rlshp_typ_id                 number(15);
10184     l_out_drr_result_id   number(15);
10185    ---------------------------------------------------------------
10186    -- END OF BEN_DSGN_RQMT_RLSHP_TYP ----------------------
10187    ---------------------------------------------------------------
10188    ---------------------------------------------------------------
10189    -- START OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
10190    ---------------------------------------------------------------
10191    cursor c_peo1_from_parent(c_OIPL_ID number) is
10192    select  elig_to_prte_rsn_id
10193    from BEN_ELIG_TO_PRTE_RSN_F
10194    where  OIPL_ID = c_OIPL_ID ;
10195    --
10196    cursor c_peo1(c_elig_to_prte_rsn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
10197    select  peo.*
10198    from BEN_ELIG_TO_PRTE_RSN_F peo
10199    where  peo.elig_to_prte_rsn_id = c_elig_to_prte_rsn_id
10200      -- and peo.business_group_id = p_business_group_id
10201      and not exists (
10202          select /*+  */ null
10203          from ben_copy_entity_results cpe
10204 --              pqh_table_route trt
10205          where copy_entity_txn_id = p_copy_entity_txn_id
10206 --         and trt.table_route_id = cpe.table_route_id
10207          and ( -- c_mirror_src_entity_result_id is null or
10208                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
10209          -- and trt.where_clause = 'BEN_ELIG_TO_PRTE_RSN_F'
10210          and cpe.table_alias = c_table_alias
10211          and information1 = c_elig_to_prte_rsn_id
10212          -- and information4 = peo.business_group_id
10213            and information2 = peo.effective_start_date
10214            and information3 = peo.effective_end_date
10215         );
10216     l_out_peo_result_id   number(15);
10217    ---------------------------------------------------------------
10218    -- END OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
10219    ---------------------------------------------------------------
10220    ---------------------------------------------------------------
10221    -- START OF BEN_LER_CHG_OIPL_ENRT_F ----------------------
10222    ---------------------------------------------------------------
10223    cursor c_lop_from_parent(c_OIPL_ID number) is
10224    select distinct ler_chg_oipl_enrt_id
10225    from BEN_LER_CHG_OIPL_ENRT_F
10226    where  OIPL_ID = c_OIPL_ID ;
10227    --
10228    cursor c_lop(c_ler_chg_oipl_enrt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
10229    select  lop.*
10230    from BEN_LER_CHG_OIPL_ENRT_F lop
10231    where  lop.ler_chg_oipl_enrt_id = c_ler_chg_oipl_enrt_id
10232      -- and lop.business_group_id = p_business_group_id
10233      and not exists (
10234          select /*+  */ null
10235          from ben_copy_entity_results cpe
10236 --              pqh_table_route trt
10237          where copy_entity_txn_id = p_copy_entity_txn_id
10238 --         and trt.table_route_id = cpe.table_route_id
10239          and ( -- c_mirror_src_entity_result_id is null or
10240                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
10241          -- and trt.where_clause = 'BEN_LER_CHG_OIPL_ENRT_F'
10242          and cpe.table_alias = c_table_alias
10243          and information1 = c_ler_chg_oipl_enrt_id
10244          -- and information4 = lop.business_group_id
10245            and information2 = lop.effective_start_date
10246            and information3 = lop.effective_end_date
10247         );
10248     l_ler_chg_oipl_enrt_id                 number(15);
10249     l_out_lop_result_id   number(15);
10250    cursor c_lop_drp(c_ler_chg_oipl_enrt_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
10251    select distinct cpe.information257 ler_id
10252          from ben_copy_entity_results cpe
10253 --              pqh_table_route trt
10254          where copy_entity_txn_id = p_copy_entity_txn_id
10255 --         and trt.table_route_id   = cpe.table_route_id
10256          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
10257          -- and trt.where_clause = 'BEN_LER_CHG_OIPL_ENRT_F'
10258          and cpe.table_alias = c_table_alias
10259          and information1 = c_ler_chg_oipl_enrt_id
10260          -- and information4 = p_business_group_id
10261         ;
10262    ---------------------------------------------------------------
10263    -- END OF BEN_LER_CHG_OIPL_ENRT_F ----------------------
10264    ---------------------------------------------------------------
10265    ---------------------------------------------------------------
10266    -- START OF BEN_ENRT_CTFN_F ----------------------
10267    ---------------------------------------------------------------
10268    cursor c_ecf1_from_parent(c_OIPL_ID number) is
10269    select  enrt_ctfn_id
10270    from BEN_ENRT_CTFN_F
10271    where  OIPL_ID = c_OIPL_ID ;
10272    --
10273    cursor c_ecf1(c_enrt_ctfn_id number,c_mirror_src_entity_result_id number,
10274                  c_table_alias varchar2) is
10275    select  ecf.*
10276    from BEN_ENRT_CTFN_F ecf
10277    where  ecf.enrt_ctfn_id = c_enrt_ctfn_id
10278      -- and ecf.business_group_id = p_business_group_id
10279      and not exists (
10280          select /*+  */ null
10281          from ben_copy_entity_results cpe
10282 --              pqh_table_route trt
10283          where copy_entity_txn_id = p_copy_entity_txn_id
10284 --         and trt.table_route_id = cpe.table_route_id
10285          and ( -- c_mirror_src_entity_result_id is null or
10286                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
10287          -- and trt.where_clause = 'BEN_ENRT_CTFN_F'
10288          and cpe.table_alias = c_table_alias
10289          and information1 = c_enrt_ctfn_id
10290          -- and information4 = ecf.business_group_id
10291            and information2 = ecf.effective_start_date
10292            and information3 = ecf.effective_end_date
10293         );
10294     l_out_ecf_result_id   number(15);
10295    ---------------------------------------------------------------
10296    -- END OF BEN_ENRT_CTFN_F ----------------------
10297    ---------------------------------------------------------------
10298    ---------------------------------------------------------------
10299    -- START OF BEN_LER_RQRS_ENRT_CTFN_F ----------------------
10300    ---------------------------------------------------------------
10301    cursor c_lre1_from_parent(c_OIPL_ID number) is
10302    select distinct ler_rqrs_enrt_ctfn_id
10303    from BEN_LER_RQRS_ENRT_CTFN_F
10304    where  OIPL_ID = c_OIPL_ID ;
10305    --
10306    cursor c_lre1(c_ler_rqrs_enrt_ctfn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
10307    select  lre.*
10308    from BEN_LER_RQRS_ENRT_CTFN_F lre
10309    where  lre.ler_rqrs_enrt_ctfn_id = c_ler_rqrs_enrt_ctfn_id
10310      -- and lre.business_group_id = p_business_group_id
10311      and not exists (
10312          select /*+  */ null
10313          from ben_copy_entity_results cpe
10314 --              pqh_table_route trt
10315          where copy_entity_txn_id = p_copy_entity_txn_id
10316 --         and trt.table_route_id = cpe.table_route_id
10317          and ( -- c_mirror_src_entity_result_id is null or
10318                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
10319          -- and trt.where_clause = 'BEN_LER_RQRS_ENRT_CTFN_F'
10320          and cpe.table_alias = c_table_alias
10321          and information1 = c_ler_rqrs_enrt_ctfn_id
10322          -- and information4 = lre.business_group_id
10323            and information2 = lre.effective_start_date
10324            and information3 = lre.effective_end_date
10325         );
10326     l_out_lre_result_id   number(15);
10327    cursor c_lre1_drp(c_ler_rqrs_enrt_ctfn_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
10328    select distinct cpe.information257 ler_id
10329          from ben_copy_entity_results cpe
10330 --              pqh_table_route trt
10331          where copy_entity_txn_id = p_copy_entity_txn_id
10332 --         and trt.table_route_id = cpe.table_route_id
10333          and mirror_src_entity_result_id = c_mirror_src_entity_result_id
10334          -- and trt.where_clause = 'BEN_LER_RQRS_ENRT_CTFN_F'
10335          and cpe.table_alias = c_table_alias
10336          and information1 = c_ler_rqrs_enrt_ctfn_id
10337          -- and information4 = p_business_group_id
10338         ;
10339    ---------------------------------------------------------------
10340    -- END OF BEN_LER_RQRS_ENRT_CTFN_F ----------------------
10341    ---------------------------------------------------------------
10342    ---------------------------------------------------------------
10343    -- START OF BEN_LER_ENRT_CTFN_F ----------------------
10344    ---------------------------------------------------------------
10345    cursor c_lnc1_from_parent(c_LER_RQRS_ENRT_CTFN_ID number) is
10346    select  ler_enrt_ctfn_id
10347    from BEN_LER_ENRT_CTFN_F
10348    where  LER_RQRS_ENRT_CTFN_ID = c_LER_RQRS_ENRT_CTFN_ID ;
10349    --
10350    cursor c_lnc1(c_ler_enrt_ctfn_id number,c_mirror_src_entity_result_id number,                 c_table_alias varchar2) is
10351    select  lnc.*
10352    from BEN_LER_ENRT_CTFN_F lnc
10353    where  lnc.ler_enrt_ctfn_id = c_ler_enrt_ctfn_id
10354      -- and lnc.business_group_id = p_business_group_id
10355      and not exists (
10356          select /*+  */ null
10357          from ben_copy_entity_results cpe
10358 --              pqh_table_route trt
10359          where copy_entity_txn_id = p_copy_entity_txn_id
10360 --         and trt.table_route_id = cpe.table_route_id
10361          and ( -- c_mirror_src_entity_result_id is null or
10362                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
10363          -- and trt.where_clause = 'BEN_LER_ENRT_CTFN_F'
10364          and cpe.table_alias = c_table_alias
10365          and information1 = c_ler_enrt_ctfn_id
10366          -- and information4 = lnc.business_group_id
10367            and information2 = lnc.effective_start_date
10368            and information3 = lnc.effective_end_date
10369         );
10370     l_out_lnc_result_id   number(15);
10371    ---------------------------------------------------------------
10372    -- END OF BEN_LER_ENRT_CTFN_F ----------------------
10373    ---------------------------------------------------------------
10374 
10375    cursor c_opt1_from_parent(c_OIPL_ID number) is
10376    select  distinct opt_id
10377    from BEN_OIPL_F
10378    where  OIPL_ID = c_OIPL_ID ;
10379 
10380    l_mirror_src_entity_result_id    number;
10381    l_parent_entity_result_id        number;
10382    l_table_route_id                 number;
10383    l_information5                   ben_copy_entity_results.information5%TYPE;
10384    l_number_of_copies               number := p_number_of_copies ;
10385    --
10386    L_ELIG_TO_PRTE_RSN_ID            number;
10387 
10388    L_LER_RQRS_ENRT_CTFN_ID          number;
10389    L_ENRT_CTFN_ID                   number;
10390    L_LER_ENRT_CTFN_ID               number;
10391    L_PL_TYP_ID                      number;
10392    L_OUT_PTP_RESULT_ID              number;
10393    --
10394 begin
10395   --
10396         ---------------------------------------------------------------
10397         -- START OF BEN_OIPL_F ----------------------
10398         ---------------------------------------------------------------
10399 
10400              l_mirror_src_entity_result_id := p_copy_entity_result_id;
10401              l_parent_entity_result_id := p_parent_entity_result_id;
10402 
10403              l_oipl_id := p_oipl_id ;
10404              --
10405              for l_cop_rec in c_cop1(l_oipl_id,l_mirror_src_entity_result_id,'COP') loop
10406                --
10407                l_table_route_id := null ;
10408                open ben_plan_design_program_module.g_table_route('COP');
10409                  fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
10410                close ben_plan_design_program_module.g_table_route ;
10411                --
10412                l_information5  := ben_plan_design_program_module.get_opt_name(l_cop_rec.opt_id,p_effective_date); --'Intersection';
10413                --
10414                if p_effective_date between l_cop_rec.effective_start_date
10415                   and l_cop_rec.effective_end_date then
10416                 --
10417                   l_result_type_cd := 'DISPLAY';
10418                else
10419                   l_result_type_cd := 'NO DISPLAY';
10420                end if;
10421                  --
10422                l_copy_entity_result_id := null;
10423                l_object_version_number := null;
10424                ben_copy_entity_results_api.create_copy_entity_results(
10425                  p_copy_entity_result_id           => l_copy_entity_result_id,
10426                  p_copy_entity_txn_id             => p_copy_entity_txn_id,
10427                  p_result_type_cd                 => l_result_type_cd,
10428                  p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
10429                  p_parent_entity_result_id        => l_parent_entity_result_id,
10430                  p_number_of_copies               => l_number_of_copies,
10431                  p_table_alias					  => 'COP',
10432                  p_table_route_id                 => l_table_route_id,
10433                  p_information1     => l_cop_rec.oipl_id,
10434                  p_information2     => l_cop_rec.EFFECTIVE_START_DATE,
10435                  p_information3     => l_cop_rec.EFFECTIVE_END_DATE,
10436                  p_information4     => l_cop_rec.business_group_id,
10437                  p_information5     => l_information5 , -- 9999 put name for h-grid
10438                  p_information250     => l_cop_rec.actl_prem_id,
10439                  p_information25     => l_cop_rec.auto_enrt_flag,
10440                  p_information264     => l_cop_rec.auto_enrt_mthd_rl,
10441                  p_information111     => l_cop_rec.cop_attribute1,
10442                  p_information120     => l_cop_rec.cop_attribute10,
10443                  p_information121     => l_cop_rec.cop_attribute11,
10444                  p_information122     => l_cop_rec.cop_attribute12,
10445                  p_information123     => l_cop_rec.cop_attribute13,
10446                  p_information124     => l_cop_rec.cop_attribute14,
10447                  p_information125     => l_cop_rec.cop_attribute15,
10448                  p_information126     => l_cop_rec.cop_attribute16,
10449                  p_information127     => l_cop_rec.cop_attribute17,
10450                  p_information128     => l_cop_rec.cop_attribute18,
10451                  p_information129     => l_cop_rec.cop_attribute19,
10452                  p_information112     => l_cop_rec.cop_attribute2,
10453                  p_information130     => l_cop_rec.cop_attribute20,
10454                  p_information131     => l_cop_rec.cop_attribute21,
10455                  p_information132     => l_cop_rec.cop_attribute22,
10456                  p_information133     => l_cop_rec.cop_attribute23,
10457                  p_information134     => l_cop_rec.cop_attribute24,
10458                  p_information135     => l_cop_rec.cop_attribute25,
10459                  p_information136     => l_cop_rec.cop_attribute26,
10460                  p_information137     => l_cop_rec.cop_attribute27,
10461                  p_information138     => l_cop_rec.cop_attribute28,
10462                  p_information139     => l_cop_rec.cop_attribute29,
10463                  p_information113     => l_cop_rec.cop_attribute3,
10464                  p_information140     => l_cop_rec.cop_attribute30,
10465                  p_information114     => l_cop_rec.cop_attribute4,
10466                  p_information115     => l_cop_rec.cop_attribute5,
10467                  p_information116     => l_cop_rec.cop_attribute6,
10468                  p_information117     => l_cop_rec.cop_attribute7,
10469                  p_information118     => l_cop_rec.cop_attribute8,
10470                  p_information119     => l_cop_rec.cop_attribute9,
10471                  p_information110     => l_cop_rec.cop_attribute_category,
10472                  p_information26     => l_cop_rec.dflt_enrt_cd,
10473                  p_information266     => l_cop_rec.dflt_enrt_det_rl,
10474                  p_information18     => l_cop_rec.dflt_flag,
10475                  p_information24     => l_cop_rec.drvbl_fctr_apls_rts_flag,
10476                  p_information22     => l_cop_rec.drvbl_fctr_prtn_elig_flag,
10477                  p_information20     => l_cop_rec.elig_apls_flag,
10478                  p_information14     => l_cop_rec.enrt_cd,
10479                  p_information257     => l_cop_rec.enrt_rl,
10480                  p_information13     => l_cop_rec.hidden_flag,
10481                  p_information141     => l_cop_rec.ivr_ident,
10482                  p_information17     => l_cop_rec.mndtry_flag,
10483                  p_information268     => l_cop_rec.mndtry_rl,
10484                  p_information19     => l_cop_rec.oipl_stat_cd,
10485                  p_information247     => l_cop_rec.opt_id,
10486                  p_information263     => l_cop_rec.ordr_num,
10487                  p_information16     => l_cop_rec.pcp_dpnt_dsgn_cd,
10488                  p_information15     => l_cop_rec.pcp_dsgn_cd,
10489                  p_information27     => l_cop_rec.per_cvrd_cd,
10490                  p_information261     => l_cop_rec.pl_id,
10491                  p_information269     => l_cop_rec.postelcn_edit_rl,
10492                  p_information23     => l_cop_rec.prtn_elig_ovrid_alwd_flag,
10493                  p_information267     => l_cop_rec.rqd_perd_enrt_nenrt_rl,
10494                  p_information29     => l_cop_rec.rqd_perd_enrt_nenrt_uom,
10495                  p_information293     => l_cop_rec.rqd_perd_enrt_nenrt_val,
10496                  p_information11     => l_cop_rec.short_code,
10497                  p_information12     => l_cop_rec.short_name,
10498                  p_information21     => l_cop_rec.trk_inelig_per_flag,
10499                  p_information185     => l_cop_rec.url_ref_name,
10500                  p_information28     => l_cop_rec.vrfy_fmly_mmbr_cd,
10501                  p_information270     => l_cop_rec.vrfy_fmly_mmbr_rl,
10502                  p_INFORMATION198     => l_cop_rec.SUSP_IF_CTFN_NOT_PRVD_FLAG,
10503                  p_INFORMATION197     => l_cop_rec.CTFN_DETERMINE_CD,
10504                  p_information265     => l_cop_rec.object_version_number,
10505                  p_object_version_number          => l_object_version_number,
10506                  p_effective_date                 => p_effective_date       );
10507                  --
10508 
10509                  if l_out_cop_result_id is null then
10510                    l_out_cop_result_id := l_copy_entity_result_id;
10511                  end if;
10512 
10513                  if l_result_type_cd = 'DISPLAY' then
10514                     l_out_cop_result_id := l_copy_entity_result_id ;
10515                  end if;
10516                  --
10517 				  if (l_cop_rec.auto_enrt_mthd_rl is not null) then
10518 					   ben_plan_design_program_module.create_formula_result(
10519 							p_validate                       => p_validate
10520 							,p_copy_entity_result_id  => l_copy_entity_result_id
10521 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
10522 							,p_formula_id                  => l_cop_rec.auto_enrt_mthd_rl
10523 							,p_business_group_id        => l_cop_rec.business_group_id
10524 							,p_number_of_copies         =>  l_number_of_copies
10525 							,p_object_version_number  => l_object_version_number
10526 							,p_effective_date             => p_effective_date);
10527 					end if;
10528 
10529 				  if (l_cop_rec.dflt_enrt_det_rl is not null) then
10530 					   ben_plan_design_program_module.create_formula_result(
10531 							p_validate                       => p_validate
10532 							,p_copy_entity_result_id  => l_copy_entity_result_id
10533 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
10534 							,p_formula_id                  => l_cop_rec.dflt_enrt_det_rl
10535 							,p_business_group_id        => l_cop_rec.business_group_id
10536 							,p_number_of_copies         =>  l_number_of_copies
10537 							,p_object_version_number  => l_object_version_number
10538 							,p_effective_date             => p_effective_date);
10539 					end if;
10540 
10541 				  if (l_cop_rec.enrt_rl is not null) then
10542 					   ben_plan_design_program_module.create_formula_result(
10543 							p_validate                       => p_validate
10544 							,p_copy_entity_result_id  => l_copy_entity_result_id
10545 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
10546 							,p_formula_id                  => l_cop_rec.enrt_rl
10547 							,p_business_group_id        => l_cop_rec.business_group_id
10548 							,p_number_of_copies         =>  l_number_of_copies
10549 							,p_object_version_number  => l_object_version_number
10550 							,p_effective_date             => p_effective_date);
10551 					end if;
10552 
10553 				  if (l_cop_rec.mndtry_rl is not null) then
10554 					   ben_plan_design_program_module.create_formula_result(
10555 							p_validate                       => p_validate
10556 							,p_copy_entity_result_id  => l_copy_entity_result_id
10557 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
10558 							,p_formula_id                  => l_cop_rec.mndtry_rl
10559 							,p_business_group_id        => l_cop_rec.business_group_id
10560 							,p_number_of_copies         =>  l_number_of_copies
10561 							,p_object_version_number  => l_object_version_number
10562 							,p_effective_date             => p_effective_date);
10563 					end if;
10564 
10565 				  if (l_cop_rec.postelcn_edit_rl is not null) then
10566 					   ben_plan_design_program_module.create_formula_result(
10567 							p_validate                       => p_validate
10568 							,p_copy_entity_result_id  => l_copy_entity_result_id
10569 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
10570 							,p_formula_id                  => l_cop_rec.postelcn_edit_rl
10571 							,p_business_group_id        => l_cop_rec.business_group_id
10572 							,p_number_of_copies         =>  l_number_of_copies
10573 							,p_object_version_number  => l_object_version_number
10574 							,p_effective_date             => p_effective_date);
10575 					end if;
10576 
10577 				  if (l_cop_rec.rqd_perd_enrt_nenrt_rl is not null) then
10578 					   ben_plan_design_program_module.create_formula_result(
10579 							p_validate                       => p_validate
10580 							,p_copy_entity_result_id  => l_copy_entity_result_id
10581 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
10582 							,p_formula_id                  => l_cop_rec.rqd_perd_enrt_nenrt_rl
10583 							,p_business_group_id        => l_cop_rec.business_group_id
10584 							,p_number_of_copies         =>  l_number_of_copies
10585 							,p_object_version_number  => l_object_version_number
10586 							,p_effective_date             => p_effective_date);
10587 					end if;
10588 
10589 				  if (l_cop_rec.vrfy_fmly_mmbr_rl is not null) then
10590 					   ben_plan_design_program_module.create_formula_result(
10591 							p_validate                       => p_validate
10592 							,p_copy_entity_result_id  => l_copy_entity_result_id
10593 							,p_copy_entity_txn_id      => p_copy_entity_txn_id
10594 							,p_formula_id                  => l_cop_rec.vrfy_fmly_mmbr_rl
10595 							,p_business_group_id        => l_cop_rec.business_group_id
10596 							,p_number_of_copies         =>  l_number_of_copies
10597 							,p_object_version_number  => l_object_version_number
10598 							,p_effective_date             => p_effective_date);
10599 					end if;
10600 
10601                  --
10602               end loop;
10603 
10604               -- Create children of OIPL only
10605               -- if OIPL is created
10606               --
10607               if l_out_cop_result_id is not null then
10608 
10609               -- ------------------------------------------------------------------------
10610               -- Eligibility Profiles
10611               -- ------------------------------------------------------------------------
10612               ben_plan_design_elpro_module.create_elpro_results
10613                  (
10614                    p_validate                     => p_validate
10615                   ,p_copy_entity_result_id        => l_out_cop_result_id
10616                   ,p_copy_entity_txn_id           => p_copy_entity_txn_id
10617                   ,p_pgm_id                       => null
10618                   ,p_ptip_id                      => null
10619                   ,p_plip_id                      => null
10620                   ,p_pl_id                        => null
10621                   ,p_oipl_id                      => l_oipl_id
10622                   ,p_business_group_id            => p_business_group_id
10623                   ,p_number_of_copies             => p_number_of_copies
10624                   ,p_object_version_number        => l_object_version_number
10625                   ,p_effective_date               => p_effective_date
10626                   ,p_parent_entity_result_id      => l_out_cop_result_id
10627                  );
10628               --
10629               -- ------------------------------------------------------------------------
10630               -- Standard Rates ,Flex Credits at Oipl level
10631               -- ------------------------------------------------------------------------
10632               ben_pd_rate_and_cvg_module.create_rate_results
10633                 (
10634                   p_validate                   => p_validate
10635                  ,p_copy_entity_result_id      => l_out_cop_result_id
10636                  ,p_copy_entity_txn_id         => p_copy_entity_txn_id
10637                  ,p_pgm_id                     => null
10638                  ,p_ptip_id                    => null
10639                  ,p_plip_id                    => null
10640                  ,p_pl_id                      => null
10641                  ,p_oipl_id                    => l_oipl_id
10642                  ,p_oiplip_id                  => null
10643                  ,p_cmbn_plip_id               => null
10644                  ,p_cmbn_ptip_id               => null
10645                  ,p_cmbn_ptip_opt_id           => null
10646                  ,p_business_group_id          => p_business_group_id
10647                  ,p_number_of_copies             => p_number_of_copies
10648                  ,p_object_version_number      => l_object_version_number
10649                  ,p_effective_date             => p_effective_date
10650                  ,p_parent_entity_result_id      => l_out_cop_result_id
10651                  ) ;
10652 
10653               -- ------------------------------------------------------------------------
10654               -- Coverage Calculations OIPL Level
10655               -- ------------------------------------------------------------------------
10656 
10657               ben_pd_rate_and_cvg_module.create_coverage_results
10658                 (
10659                   p_validate                   => p_validate
10660                  ,p_copy_entity_result_id      => l_out_cop_result_id
10661                  ,p_copy_entity_txn_id         => p_copy_entity_txn_id
10662                  ,p_plip_id                    => null
10663                  ,p_pl_id                      => null
10664                  ,p_oipl_id                    => l_oipl_id
10665                  ,p_business_group_id          => p_business_group_id
10666                  ,p_number_of_copies           => p_number_of_copies
10667                  ,p_object_version_number      => l_object_version_number
10668                  ,p_effective_date             => p_effective_date
10669                  ,p_parent_entity_result_id    => l_out_cop_result_id
10670                ) ;
10671 
10672               -- ------------------------------------------------------------------------
10673               -- Actual Premiums - OIPL Level
10674               -- ------------------------------------------------------------------------
10675 
10676               ben_pd_rate_and_cvg_module.create_premium_results
10677               (
10678                  p_validate                => p_validate
10679                 ,p_copy_entity_result_id   => l_out_cop_result_id
10680                 ,p_copy_entity_txn_id      => p_copy_entity_txn_id
10681                 ,p_pl_id                   => null
10682                 ,p_oipl_id                 => l_oipl_id
10683                 ,p_business_group_id       => p_business_group_id
10684                 ,p_number_of_copies        => p_number_of_copies
10685                 ,p_object_version_number   => l_object_version_number
10686                 ,p_effective_date          => p_effective_date
10687                 ,p_parent_entity_result_id => l_out_cop_result_id
10688              ) ;
10689 
10690              ---------------------------------------------------------------
10691              -- START OF BEN_DSGN_RQMT_F ----------------------
10692              ---------------------------------------------------------------
10693              --
10694              for l_parent_rec  in c_ddr1_from_parent(l_OIPL_ID) loop
10695                 --
10696                 l_mirror_src_entity_result_id := l_out_cop_result_id ;
10697 
10698                 --
10699                 l_dsgn_rqmt_id := l_parent_rec.dsgn_rqmt_id ;
10700                 --
10701                 --
10702                 l_ddr1_dsgn_rqmt_esd := null;
10703                 --
10704                 for l_ddr_rec in c_ddr1(l_parent_rec.dsgn_rqmt_id,l_mirror_src_entity_result_id,'DDR') loop
10705                   --
10706                   l_table_route_id := null ;
10707                   open ben_plan_design_program_module.g_table_route('DDR');
10708                     fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
10709                   close ben_plan_design_program_module.g_table_route ;
10710                   --
10711                   l_information5  := hr_general.decode_lookup('BEN_GRP_RLSHP',l_ddr_rec.grp_rlshp_cd); --'Intersection';
10712                   --
10713                   if p_effective_date between l_ddr_rec.effective_start_date
10714                      and l_ddr_rec.effective_end_date then
10715                    --
10716                      l_result_type_cd := 'DISPLAY';
10717                   else
10718                      l_result_type_cd := 'NO DISPLAY';
10719                   end if;
10720                     --
10721                   l_copy_entity_result_id := null;
10722                   l_object_version_number := null;
10723                   ben_copy_entity_results_api.create_copy_entity_results(
10724                     p_copy_entity_result_id           => l_copy_entity_result_id,
10725                     p_copy_entity_txn_id             => p_copy_entity_txn_id,
10726                     p_result_type_cd                 => l_result_type_cd,
10727                     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
10728                     p_parent_entity_result_id        => l_mirror_src_entity_result_id,
10729                     p_number_of_copies               => l_number_of_copies,
10730                     p_table_alias					  => 'DDR',
10731                     p_table_route_id                 => l_table_route_id,
10732                     p_information1     => l_ddr_rec.dsgn_rqmt_id,
10733                     p_information2     => l_ddr_rec.EFFECTIVE_START_DATE,
10734                     p_information3     => l_ddr_rec.EFFECTIVE_END_DATE,
10735                     p_information4     => l_ddr_rec.business_group_id,
10736                     p_information5     => l_information5 , -- 9999 put name for h-grid
10737                     p_information13     => l_ddr_rec.cvr_all_elig_flag,
10738                     p_information111     => l_ddr_rec.ddr_attribute1,
10739                     p_information120     => l_ddr_rec.ddr_attribute10,
10740                     p_information121     => l_ddr_rec.ddr_attribute11,
10741                     p_information122     => l_ddr_rec.ddr_attribute12,
10742                     p_information123     => l_ddr_rec.ddr_attribute13,
10743                     p_information124     => l_ddr_rec.ddr_attribute14,
10744                     p_information125     => l_ddr_rec.ddr_attribute15,
10745                     p_information126     => l_ddr_rec.ddr_attribute16,
10746                     p_information127     => l_ddr_rec.ddr_attribute17,
10747                     p_information128     => l_ddr_rec.ddr_attribute18,
10748                     p_information129     => l_ddr_rec.ddr_attribute19,
10749                     p_information112     => l_ddr_rec.ddr_attribute2,
10750                     p_information130     => l_ddr_rec.ddr_attribute20,
10751                     p_information131     => l_ddr_rec.ddr_attribute21,
10752                     p_information132     => l_ddr_rec.ddr_attribute22,
10753                     p_information133     => l_ddr_rec.ddr_attribute23,
10754                     p_information134     => l_ddr_rec.ddr_attribute24,
10755                     p_information135     => l_ddr_rec.ddr_attribute25,
10756                     p_information136     => l_ddr_rec.ddr_attribute26,
10757                     p_information137     => l_ddr_rec.ddr_attribute27,
10758                     p_information138     => l_ddr_rec.ddr_attribute28,
10759                     p_information139     => l_ddr_rec.ddr_attribute29,
10760                     p_information113     => l_ddr_rec.ddr_attribute3,
10761                     p_information140     => l_ddr_rec.ddr_attribute30,
10762                     p_information114     => l_ddr_rec.ddr_attribute4,
10763                     p_information115     => l_ddr_rec.ddr_attribute5,
10764                     p_information116     => l_ddr_rec.ddr_attribute6,
10765                     p_information117     => l_ddr_rec.ddr_attribute7,
10766                     p_information118     => l_ddr_rec.ddr_attribute8,
10767                     p_information119     => l_ddr_rec.ddr_attribute9,
10768                     p_information110     => l_ddr_rec.ddr_attribute_category,
10769                     p_information15     => l_ddr_rec.dsgn_typ_cd,
10770                     p_information14     => l_ddr_rec.grp_rlshp_cd,
10771                     p_information262     => l_ddr_rec.mn_dpnts_rqd_num,
10772                     p_information263     => l_ddr_rec.mx_dpnts_alwd_num,
10773                     p_information11     => l_ddr_rec.no_mn_num_dfnd_flag,
10774                     p_information12     => l_ddr_rec.no_mx_num_dfnd_flag,
10775                     p_information258     => l_ddr_rec.oipl_id,
10776                     p_information247     => l_ddr_rec.opt_id,
10777                     p_information261     => l_ddr_rec.pl_id,
10778                     p_information265     => l_ddr_rec.object_version_number,
10779                     p_object_version_number          => l_object_version_number,
10780                     p_effective_date                 => p_effective_date       );
10781                     --
10782 
10783                     if l_out_ddr_result_id is null then
10784                       l_out_ddr_result_id := l_copy_entity_result_id;
10785                     end if;
10786 
10787                     if l_result_type_cd = 'DISPLAY' then
10788                        l_out_ddr_result_id := l_copy_entity_result_id ;
10789                     end if;
10790                     --
10791 
10792                     -- To pass as effective date while creating the
10793                     -- non date-tracked child records
10794                     if l_ddr1_dsgn_rqmt_esd is null then
10795                       l_ddr1_dsgn_rqmt_esd := l_ddr_rec.EFFECTIVE_START_DATE;
10796                     end if;
10797 
10798                  end loop;
10799                  --
10800              ---------------------------------------------------------------
10801              -- START OF BEN_DSGN_RQMT_RLSHP_TYP ----------------------
10802              ---------------------------------------------------------------
10803              --
10804              for l_parent_rec  in c_drr1_from_parent(l_DSGN_RQMT_ID) loop
10805                 --
10806                 l_mirror_src_entity_result_id := l_out_ddr_result_id ;
10807 
10808                 --
10809                 l_dsgn_rqmt_rlshp_typ_id := l_parent_rec.dsgn_rqmt_rlshp_typ_id ;
10810                 --
10811                 for l_drr_rec in c_drr1(l_parent_rec.dsgn_rqmt_rlshp_typ_id,l_mirror_src_entity_result_id,'DRR') loop
10812                   --
10813                   l_table_route_id := null ;
10814                   open ben_plan_design_program_module.g_table_route('DRR');
10815                     fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
10816                   close ben_plan_design_program_module.g_table_route ;
10817                   --
10818                   l_information5  := hr_general.decode_lookup('CONTACT',l_drr_rec.rlshp_typ_cd); --'Intersection';
10819                   --
10820                   l_result_type_cd := 'DISPLAY';
10821                     --
10822                   l_copy_entity_result_id := null;
10823                   l_object_version_number := null;
10824                   ben_copy_entity_results_api.create_copy_entity_results(
10825                     p_copy_entity_result_id           => l_copy_entity_result_id,
10826                     p_copy_entity_txn_id             => p_copy_entity_txn_id,
10827                     p_result_type_cd                 => l_result_type_cd,
10828                     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
10829                     p_parent_entity_result_id        => l_mirror_src_entity_result_id,
10830                     p_number_of_copies               => l_number_of_copies,
10831                     p_table_alias					  => 'DRR',
10832                     p_table_route_id                 => l_table_route_id,
10833                     p_information1     => l_drr_rec.dsgn_rqmt_rlshp_typ_id,
10834                     p_information2     => null,
10835                     p_information3     => null,
10836                     p_information4     => l_drr_rec.business_group_id,
10837                     p_information5     => l_information5 , -- 9999 put name for h-grid
10838                     p_information10     => l_ddr1_dsgn_rqmt_esd,
10839                     p_information111     => l_drr_rec.drr_attribute1,
10840                     p_information120     => l_drr_rec.drr_attribute10,
10841                     p_information121     => l_drr_rec.drr_attribute11,
10842                     p_information122     => l_drr_rec.drr_attribute12,
10843                     p_information123     => l_drr_rec.drr_attribute13,
10844                     p_information124     => l_drr_rec.drr_attribute14,
10845                     p_information125     => l_drr_rec.drr_attribute15,
10846                     p_information126     => l_drr_rec.drr_attribute16,
10847                     p_information127     => l_drr_rec.drr_attribute17,
10848                     p_information128     => l_drr_rec.drr_attribute18,
10849                     p_information129     => l_drr_rec.drr_attribute19,
10850                     p_information112     => l_drr_rec.drr_attribute2,
10851                     p_information130     => l_drr_rec.drr_attribute20,
10852                     p_information131     => l_drr_rec.drr_attribute21,
10853                     p_information132     => l_drr_rec.drr_attribute22,
10854                     p_information133     => l_drr_rec.drr_attribute23,
10855                     p_information134     => l_drr_rec.drr_attribute24,
10856                     p_information135     => l_drr_rec.drr_attribute25,
10857                     p_information136     => l_drr_rec.drr_attribute26,
10858                     p_information137     => l_drr_rec.drr_attribute27,
10859                     p_information138     => l_drr_rec.drr_attribute28,
10860                     p_information139     => l_drr_rec.drr_attribute29,
10861                     p_information113     => l_drr_rec.drr_attribute3,
10862                     p_information140     => l_drr_rec.drr_attribute30,
10863                     p_information114     => l_drr_rec.drr_attribute4,
10864                     p_information115     => l_drr_rec.drr_attribute5,
10865                     p_information116     => l_drr_rec.drr_attribute6,
10866                     p_information117     => l_drr_rec.drr_attribute7,
10867                     p_information118     => l_drr_rec.drr_attribute8,
10868                     p_information119     => l_drr_rec.drr_attribute9,
10869                     p_information110     => l_drr_rec.drr_attribute_category,
10870                     p_information260     => l_drr_rec.dsgn_rqmt_id,
10871                     p_information11     => l_drr_rec.rlshp_typ_cd,
10872                     p_information265     => l_drr_rec.object_version_number,
10873                     p_object_version_number          => l_object_version_number,
10874                     p_effective_date                 => p_effective_date       );
10875                     --
10876 
10877                     if l_out_drr_result_id is null then
10878                       l_out_drr_result_id := l_copy_entity_result_id;
10879                     end if;
10880 
10881                     if l_result_type_cd = 'DISPLAY' then
10882                        l_out_drr_result_id := l_copy_entity_result_id ;
10883                     end if;
10884                     --
10885                  end loop;
10886                  --
10887                end loop;
10888                ---------------------------------------------------------------
10889                -- END OF BEN_DSGN_RQMT_RLSHP_TYP ----------------------
10890                ---------------------------------------------------------------
10891              end loop;
10892              ---------------------------------------------------------------
10893              -- END OF BEN_DSGN_RQMT_F ----------------------
10894              ---------------------------------------------------------------
10895              ---------------------------------------------------------------
10896              -- START OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
10897              ---------------------------------------------------------------
10898              --
10899              for l_parent_rec  in c_peo1_from_parent(l_OIPL_ID) loop
10900                 --
10901                 l_mirror_src_entity_result_id := l_out_cop_result_id ;
10902 
10903                 --
10904                 l_elig_to_prte_rsn_id := l_parent_rec.elig_to_prte_rsn_id ;
10905                 --
10906                 for l_peo_rec in c_peo1(l_parent_rec.elig_to_prte_rsn_id,l_mirror_src_entity_result_id,'PEO') loop
10907                   --
10908                   l_table_route_id := null ;
10909                   open ben_plan_design_program_module.g_table_route('PEO');
10910                     fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
10911                   close ben_plan_design_program_module.g_table_route ;
10912                   --
10913                   l_information5  := ben_plan_design_program_module.get_ler_name(l_peo_rec.ler_id,p_effective_date); --'Intersection';
10914                   --
10915                   if p_effective_date between l_peo_rec.effective_start_date
10916                      and l_peo_rec.effective_end_date then
10917                    --
10918                      l_result_type_cd := 'DISPLAY';
10919                   else
10920                      l_result_type_cd := 'NO DISPLAY';
10921                   end if;
10922                     --
10923                   l_copy_entity_result_id := null;
10924                   l_object_version_number := null;
10925                   ben_copy_entity_results_api.create_copy_entity_results(
10926                     p_copy_entity_result_id           => l_copy_entity_result_id,
10927                     p_copy_entity_txn_id             => p_copy_entity_txn_id,
10928                     p_result_type_cd                 => l_result_type_cd,
10929                     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
10930                     p_parent_entity_result_id        => l_mirror_src_entity_result_id,
10931                     p_number_of_copies               => l_number_of_copies,
10932                     p_table_alias					  => 'PEO',
10933                     p_table_route_id                 => l_table_route_id,
10934                     p_information1     => l_peo_rec.elig_to_prte_rsn_id,
10935                     p_information2     => l_peo_rec.EFFECTIVE_START_DATE,
10936                     p_information3     => l_peo_rec.EFFECTIVE_END_DATE,
10937                     p_information4     => l_peo_rec.business_group_id,
10938                     p_information5     => l_information5 , -- 9999 put name for h-grid
10939                     p_information21     => l_peo_rec.elig_inelig_cd,
10940                     p_information20     => l_peo_rec.ignr_prtn_ovrid_flag,
10941                     p_information257     => l_peo_rec.ler_id,
10942                     p_information17     => l_peo_rec.mx_poe_apls_cd,
10943                     p_information16     => l_peo_rec.mx_poe_det_dt_cd,
10944                     p_information272     => l_peo_rec.mx_poe_det_dt_rl,
10945                     p_information270     => l_peo_rec.mx_poe_rl,
10946                     p_information15     => l_peo_rec.mx_poe_uom,
10947                     p_information269     => l_peo_rec.mx_poe_val,
10948                     p_information258     => l_peo_rec.oipl_id,
10949                     p_information111     => l_peo_rec.peo_attribute1,
10950                     p_information120     => l_peo_rec.peo_attribute10,
10951                     p_information121     => l_peo_rec.peo_attribute11,
10952                     p_information122     => l_peo_rec.peo_attribute12,
10953                     p_information123     => l_peo_rec.peo_attribute13,
10954                     p_information124     => l_peo_rec.peo_attribute14,
10955                     p_information125     => l_peo_rec.peo_attribute15,
10956                     p_information126     => l_peo_rec.peo_attribute16,
10957                     p_information127     => l_peo_rec.peo_attribute17,
10958                     p_information128     => l_peo_rec.peo_attribute18,
10959                     p_information129     => l_peo_rec.peo_attribute19,
10960                     p_information112     => l_peo_rec.peo_attribute2,
10961                     p_information130     => l_peo_rec.peo_attribute20,
10962                     p_information131     => l_peo_rec.peo_attribute21,
10963                     p_information132     => l_peo_rec.peo_attribute22,
10964                     p_information133     => l_peo_rec.peo_attribute23,
10965                     p_information134     => l_peo_rec.peo_attribute24,
10966                     p_information135     => l_peo_rec.peo_attribute25,
10967                     p_information136     => l_peo_rec.peo_attribute26,
10968                     p_information137     => l_peo_rec.peo_attribute27,
10969                     p_information138     => l_peo_rec.peo_attribute28,
10970                     p_information139     => l_peo_rec.peo_attribute29,
10971                     p_information113     => l_peo_rec.peo_attribute3,
10972                     p_information140     => l_peo_rec.peo_attribute30,
10973                     p_information114     => l_peo_rec.peo_attribute4,
10974                     p_information115     => l_peo_rec.peo_attribute5,
10975                     p_information116     => l_peo_rec.peo_attribute6,
10976                     p_information117     => l_peo_rec.peo_attribute7,
10977                     p_information118     => l_peo_rec.peo_attribute8,
10978                     p_information119     => l_peo_rec.peo_attribute9,
10979                     p_information110     => l_peo_rec.peo_attribute_category,
10980                     p_information260     => l_peo_rec.pgm_id,
10981                     p_information261     => l_peo_rec.pl_id,
10982                     p_information256     => l_peo_rec.plip_id,
10983                     p_information12      => l_peo_rec.prtn_eff_end_dt_cd,
10984                     p_information266     => l_peo_rec.prtn_eff_end_dt_rl,
10985                     p_information11      => l_peo_rec.prtn_eff_strt_dt_cd,
10986                     p_information264     => l_peo_rec.prtn_eff_strt_dt_rl,
10987                     p_information19      => l_peo_rec.prtn_ovridbl_flag,
10988                     p_information259     => l_peo_rec.ptip_id,
10989                     p_information18      => l_peo_rec.vrfy_fmly_mmbr_cd,
10990                     p_information273     => l_peo_rec.vrfy_fmly_mmbr_rl,
10991                     p_information14      => l_peo_rec.wait_perd_dt_to_use_cd,
10992                     p_information268     => l_peo_rec.wait_perd_dt_to_use_rl,
10993                     p_information271     => l_peo_rec.wait_perd_rl,
10994                     p_information13      => l_peo_rec.wait_perd_uom,
10995 	              p_information267     => l_peo_rec.wait_perd_val,
10996                     p_information265     => l_peo_rec.object_version_number,
10997 	              p_object_version_number          => l_object_version_number,
10998                     p_effective_date                 => p_effective_date       );
10999                     --
11000 
11001                     if l_out_peo_result_id is null then
11002                      l_out_peo_result_id := l_copy_entity_result_id;
11003                     end if;
11004 
11005                     if l_result_type_cd = 'DISPLAY' then
11006                        l_out_peo_result_id := l_copy_entity_result_id ;
11007                     end if;
11008                     --
11009                     ben_plan_design_plan_module.create_ler_result (
11010                        p_validate                       => p_validate
11011                       ,p_copy_entity_result_id          => l_copy_entity_result_id
11012                       ,p_copy_entity_txn_id             => p_copy_entity_txn_id
11013                       ,p_ler_id                         => l_peo_rec.ler_id
11014                       ,p_business_group_id              => p_business_group_id
11015                       ,p_number_of_copies               => l_number_of_copies
11016                       ,p_object_version_number          => l_object_version_number
11017                       ,p_effective_date                 => p_effective_date
11018                       );
11019                     --
11020                  end loop;
11021                  --
11022              end loop;
11023              ---------------------------------------------------------------
11024              -- END OF BEN_ELIG_TO_PRTE_RSN_F ----------------------
11025              ---------------------------------------------------------------
11026              ---------------------------------------------------------------
11027              -- START OF BEN_LER_CHG_OIPL_ENRT_F ----------------------
11028              ---------------------------------------------------------------
11029              --
11030              for l_parent_rec  in c_lop_from_parent(l_OIPL_ID) loop
11031              --
11032                l_mirror_src_entity_result_id := l_out_cop_result_id ;
11033                --
11034                l_ler_chg_oipl_enrt_id := l_parent_rec.ler_chg_oipl_enrt_id ;
11035                --
11036                for l_lop_rec in c_lop(l_parent_rec.ler_chg_oipl_enrt_id,l_mirror_src_entity_result_id,'LOP') loop
11037                --
11038                  l_table_route_id := null ;
11039                  open ben_plan_design_program_module.g_table_route('LOP');
11040                  fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11041                  close ben_plan_design_program_module.g_table_route ;
11042                  --
11043                  l_information5  := ben_plan_design_program_module.get_ler_name(l_lop_rec.ler_id,p_effective_date); --'Intersection';
11044                  --
11045                  if p_effective_date between l_lop_rec.effective_start_date
11046                  and l_lop_rec.effective_end_date then
11047                  --
11048                    l_result_type_cd := 'DISPLAY';
11049                  else
11050                    l_result_type_cd := 'NO DISPLAY';
11051                  end if;
11052                  --
11053                  l_copy_entity_result_id := null;
11054                  l_object_version_number := null;
11055                  ben_copy_entity_results_api.create_copy_entity_results(
11056                    p_copy_entity_result_id           => l_copy_entity_result_id,
11057                    p_copy_entity_txn_id             => p_copy_entity_txn_id,
11058                    p_result_type_cd                 => l_result_type_cd,
11059                    p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
11060                    p_parent_entity_result_id      => l_mirror_src_entity_result_id,
11061                    p_number_of_copies               => l_number_of_copies,
11062                    p_table_alias					  => 'LOP',
11063                    p_table_route_id                 => l_table_route_id,
11064                    p_information1     => l_lop_rec.ler_chg_oipl_enrt_id,
11065                    p_information2     => l_lop_rec.EFFECTIVE_START_DATE,
11066                    p_information3     => l_lop_rec.EFFECTIVE_END_DATE,
11067                    p_information4     => l_lop_rec.business_group_id,
11068                    p_information5     => l_information5 , -- 9999 put name for h-grid
11069                    p_information14     => l_lop_rec.auto_enrt_flag,
11070                    p_information262     => l_lop_rec.auto_enrt_mthd_rl,
11071                    p_information11     => l_lop_rec.crnt_enrt_prclds_chg_flag,
11072                    p_information16     => l_lop_rec.dflt_enrt_cd,
11073                    p_information264     => l_lop_rec.dflt_enrt_rl,
11074                    p_information12     => l_lop_rec.dflt_flag,
11075                    p_information15     => l_lop_rec.enrt_cd,
11076                    p_information263     => l_lop_rec.enrt_rl,
11077                    p_information257     => l_lop_rec.ler_id,
11078                    p_information111     => l_lop_rec.lop_attribute1,
11079                    p_information120     => l_lop_rec.lop_attribute10,
11080                    p_information121     => l_lop_rec.lop_attribute11,
11081                    p_information122     => l_lop_rec.lop_attribute12,
11082                    p_information123     => l_lop_rec.lop_attribute13,
11083                    p_information124     => l_lop_rec.lop_attribute14,
11084                    p_information125     => l_lop_rec.lop_attribute15,
11085                    p_information126     => l_lop_rec.lop_attribute16,
11086                    p_information127     => l_lop_rec.lop_attribute17,
11087                    p_information128     => l_lop_rec.lop_attribute18,
11088                    p_information129     => l_lop_rec.lop_attribute19,
11089                    p_information112     => l_lop_rec.lop_attribute2,
11090                    p_information130     => l_lop_rec.lop_attribute20,
11091                    p_information131     => l_lop_rec.lop_attribute21,
11092                    p_information132     => l_lop_rec.lop_attribute22,
11093                    p_information133     => l_lop_rec.lop_attribute23,
11094                    p_information134     => l_lop_rec.lop_attribute24,
11095                    p_information135     => l_lop_rec.lop_attribute25,
11096                    p_information136     => l_lop_rec.lop_attribute26,
11097                    p_information137     => l_lop_rec.lop_attribute27,
11098                    p_information138     => l_lop_rec.lop_attribute28,
11099                    p_information139     => l_lop_rec.lop_attribute29,
11100                    p_information113     => l_lop_rec.lop_attribute3,
11101                    p_information140     => l_lop_rec.lop_attribute30,
11102                    p_information114     => l_lop_rec.lop_attribute4,
11103                    p_information115     => l_lop_rec.lop_attribute5,
11104                    p_information116     => l_lop_rec.lop_attribute6,
11105                    p_information117     => l_lop_rec.lop_attribute7,
11106                    p_information118     => l_lop_rec.lop_attribute8,
11107                    p_information119     => l_lop_rec.lop_attribute9,
11108                    p_information110     => l_lop_rec.lop_attribute_category,
11109                    p_information258     => l_lop_rec.oipl_id,
11110                    p_information13     => l_lop_rec.stl_elig_cant_chg_flag,
11111                    p_information265     => l_lop_rec.object_version_number,
11112                    p_object_version_number          => l_object_version_number,
11113                    p_effective_date                 => p_effective_date       );
11114                  --
11115 
11116                  if l_out_lop_result_id is null then
11117                    l_out_lop_result_id := l_copy_entity_result_id;
11118                  end if;
11119 
11120                  if l_result_type_cd = 'DISPLAY' then
11121                    l_out_lop_result_id := l_copy_entity_result_id ;
11122                  end if;
11123                  --
11124                  -- Copy Fast Formulas if any are attached to any column --
11125                  ---------------------------------------------------------------
11126                  --  AUTO_ENRT_MTHD_RL -----------------
11127                  ---------------------------------------------------------------
11128 
11129                  if to_char(l_lop_rec.auto_enrt_mthd_rl) is not null then
11130                  --
11131                    ben_plan_design_program_module.create_formula_result
11132                    (
11133                      p_validate                       =>  0
11134                     ,p_copy_entity_result_id          =>  l_copy_entity_result_id
11135                     ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
11136                     ,p_formula_id                     =>  l_lop_rec.auto_enrt_mthd_rl
11137                     ,p_business_group_id              =>  l_lop_rec.business_group_id
11138                     ,p_number_of_copies               =>  l_number_of_copies
11139                     ,p_object_version_number          =>  l_object_version_number
11140                     ,p_effective_date                 =>  p_effective_date
11141                  );
11142                  --
11143                  end if;
11144 
11145                  ---------------------------------------------------------------
11146                  --  DFLT_ENRT__RL -----------------
11147                  ---------------------------------------------------------------
11148 
11149                  if to_char(l_lop_rec.dflt_enrt_rl) is not null then
11150                  --
11151                   ben_plan_design_program_module.create_formula_result
11152                   (
11153                     p_validate                       =>  0
11154                    ,p_copy_entity_result_id          =>  l_copy_entity_result_id
11155                    ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
11156                    ,p_formula_id                     =>  l_lop_rec.dflt_enrt_rl
11157                    ,p_business_group_id              =>  l_lop_rec.business_group_id
11158                    ,p_number_of_copies               =>  l_number_of_copies
11159                    ,p_object_version_number          =>  l_object_version_number
11160                    ,p_effective_date                 =>  p_effective_date
11161                  );
11162                  --
11163                  end if;
11164 
11165                 ---------------------------------------------------------------
11166                 --  ENRT__RL -----------------
11167                 ---------------------------------------------------------------
11168 
11169                 if to_char(l_lop_rec.enrt_rl) is not null then
11170                 --
11171                  ben_plan_design_program_module.create_formula_result
11172                  (
11173                    p_validate                       =>  0
11174                   ,p_copy_entity_result_id          =>  l_copy_entity_result_id
11175                   ,p_copy_entity_txn_id             =>  p_copy_entity_txn_id
11176                   ,p_formula_id                     =>  l_lop_rec.enrt_rl
11177                   ,p_business_group_id              =>  l_lop_rec.business_group_id
11178                   ,p_number_of_copies               =>  l_number_of_copies
11179                   ,p_object_version_number          =>  l_object_version_number
11180                   ,p_effective_date                 =>  p_effective_date
11181                  );
11182                 --
11183                 end if;
11184 
11185                end loop;
11186                --
11187                for l_lop_rec in c_lop_drp(l_parent_rec.ler_chg_oipl_enrt_id,l_mirror_src_entity_result_id,'LOP') loop
11188                    create_ler_result (
11189                       p_validate                       => p_validate
11190                      ,p_copy_entity_result_id          => l_out_lop_result_id
11191                      ,p_copy_entity_txn_id             => p_copy_entity_txn_id
11192                      ,p_ler_id                         => l_lop_rec.ler_id
11193                      ,p_business_group_id              => p_business_group_id
11194                      ,p_number_of_copies               => p_number_of_copies
11195                      ,p_object_version_number          => l_object_version_number
11196                      ,p_effective_date                 => p_effective_date
11197                      );
11198                end loop;
11199              end loop;
11200              ---------------------------------------------------------------
11201              -- END OF BEN_LER_CHG_OIPL_ENRT_F ----------------------
11202              ---------------------------------------------------------------
11203              ---------------------------------------------------------------
11204              -- START OF BEN_ENRT_CTFN_F ----------------------
11205              ---------------------------------------------------------------
11206              --
11207              for l_parent_rec  in c_ecf1_from_parent(l_OIPL_ID) loop
11208                 --
11209                 l_mirror_src_entity_result_id := l_out_cop_result_id ;
11210 
11211                 --
11212                 l_enrt_ctfn_id := l_parent_rec.enrt_ctfn_id ;
11213                 --
11214                 for l_ecf_rec in c_ecf1(l_parent_rec.enrt_ctfn_id,l_mirror_src_entity_result_id,'ECF') loop
11215                   --
11216                   l_table_route_id := null ;
11217                   open ben_plan_design_program_module.g_table_route('ECF');
11218                     fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11219                   close ben_plan_design_program_module.g_table_route ;
11220                   --
11221                   l_information5  := hr_general.decode_lookup('BEN_ENRT_CTFN_TYP',l_ecf_rec.enrt_ctfn_typ_cd); --'Intersection'
11222                   --
11223                   if p_effective_date between l_ecf_rec.effective_start_date
11224                      and l_ecf_rec.effective_end_date then
11225                    --
11226                      l_result_type_cd := 'DISPLAY';
11227                   else
11228                      l_result_type_cd := 'NO DISPLAY';
11229                   end if;
11230                     --
11231                   l_copy_entity_result_id := null;
11232                   l_object_version_number := null;
11233                   ben_copy_entity_results_api.create_copy_entity_results(
11234                     p_copy_entity_result_id           => l_copy_entity_result_id,
11235                     p_copy_entity_txn_id             => p_copy_entity_txn_id,
11236                     p_result_type_cd                 => l_result_type_cd,
11237                     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
11238                     p_parent_entity_result_id        => l_mirror_src_entity_result_id,
11239                     p_table_alias					  => 'ECF',
11240                     p_number_of_copies               => l_number_of_copies,
11241                     p_table_route_id                 => l_table_route_id,
11242                     p_information1     => l_ecf_rec.enrt_ctfn_id,
11243                     p_information2     => l_ecf_rec.EFFECTIVE_START_DATE,
11244                     p_information3     => l_ecf_rec.EFFECTIVE_END_DATE,
11245                     p_information4     => l_ecf_rec.business_group_id,
11246                     p_information5     => l_information5 , -- 9999 put name for h-grid
11247                     p_information262     => l_ecf_rec.ctfn_rqd_when_rl,
11248                     p_information111     => l_ecf_rec.ecf_attribute1,
11249                     p_information120     => l_ecf_rec.ecf_attribute10,
11250                     p_information121     => l_ecf_rec.ecf_attribute11,
11251                     p_information122     => l_ecf_rec.ecf_attribute12,
11252                     p_information123     => l_ecf_rec.ecf_attribute13,
11253                     p_information124     => l_ecf_rec.ecf_attribute14,
11254                     p_information125     => l_ecf_rec.ecf_attribute15,
11255                     p_information126     => l_ecf_rec.ecf_attribute16,
11256                     p_information127     => l_ecf_rec.ecf_attribute17,
11257                     p_information128     => l_ecf_rec.ecf_attribute18,
11258                     p_information129     => l_ecf_rec.ecf_attribute19,
11259                     p_information112     => l_ecf_rec.ecf_attribute2,
11260                     p_information130     => l_ecf_rec.ecf_attribute20,
11261                     p_information131     => l_ecf_rec.ecf_attribute21,
11262                     p_information132     => l_ecf_rec.ecf_attribute22,
11263                     p_information133     => l_ecf_rec.ecf_attribute23,
11264                     p_information134     => l_ecf_rec.ecf_attribute24,
11265                     p_information135     => l_ecf_rec.ecf_attribute25,
11266                     p_information136     => l_ecf_rec.ecf_attribute26,
11267                     p_information137     => l_ecf_rec.ecf_attribute27,
11268                     p_information138     => l_ecf_rec.ecf_attribute28,
11269                     p_information139     => l_ecf_rec.ecf_attribute29,
11270                     p_information113     => l_ecf_rec.ecf_attribute3,
11271                     p_information140     => l_ecf_rec.ecf_attribute30,
11272                     p_information114     => l_ecf_rec.ecf_attribute4,
11273                     p_information115     => l_ecf_rec.ecf_attribute5,
11274                     p_information116     => l_ecf_rec.ecf_attribute6,
11275                     p_information117     => l_ecf_rec.ecf_attribute7,
11276                     p_information118     => l_ecf_rec.ecf_attribute8,
11277                     p_information119     => l_ecf_rec.ecf_attribute9,
11278                     p_information110     => l_ecf_rec.ecf_attribute_category,
11279                     p_information11     => l_ecf_rec.enrt_ctfn_typ_cd,
11280                     p_information258     => l_ecf_rec.oipl_id,
11281                     p_information261     => l_ecf_rec.pl_id,
11282                     p_information256     => l_ecf_rec.plip_id,
11283                     p_information12     => l_ecf_rec.rqd_flag,
11284                     p_information265     => l_ecf_rec.object_version_number,
11285                     p_object_version_number          => l_object_version_number,
11286                     p_effective_date                 => p_effective_date       );
11287                     --
11288 
11289                     if l_out_ecf_result_id is null then
11290                       l_out_ecf_result_id := l_copy_entity_result_id;
11291                     end if;
11292 
11293                     if l_result_type_cd = 'DISPLAY' then
11294                        l_out_ecf_result_id := l_copy_entity_result_id ;
11295                     end if;
11296                     --
11297                  end loop;
11298              --
11299              end loop;
11300              ---------------------------------------------------------------
11301              -- END OF BEN_ENRT_CTFN_F ----------------------
11302              ---------------------------------------------------------------
11303              ---------------------------------------------------------------
11304              -- START OF BEN_LER_RQRS_ENRT_CTFN_F ----------------------
11305              ---------------------------------------------------------------
11306              --
11307              for l_parent_rec  in c_lre1_from_parent(l_OIPL_ID) loop
11308                 --
11309                 l_mirror_src_entity_result_id := l_out_cop_result_id ;
11310 
11311                 --
11312                 l_ler_rqrs_enrt_ctfn_id := l_parent_rec.ler_rqrs_enrt_ctfn_id ;
11313                 --
11314                 for l_lre_rec in c_lre1(l_parent_rec.ler_rqrs_enrt_ctfn_id,l_mirror_src_entity_result_id,'LRE') loop
11315                   --
11316                   l_table_route_id := null ;
11317                   open ben_plan_design_program_module.g_table_route('LRE');
11318                     fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11319                   close ben_plan_design_program_module.g_table_route ;
11320                   --
11321                   l_information5  := ben_plan_design_program_module.get_ler_name(l_lre_rec.ler_id,p_effective_date); --'Intersection';
11322                   --
11323                   if p_effective_date between l_lre_rec.effective_start_date
11324                      and l_lre_rec.effective_end_date then
11325                   --
11326                      l_result_type_cd := 'DISPLAY';
11327                   else
11328                      l_result_type_cd := 'NO DISPLAY';
11329                   end if;
11330                     --
11331                   l_copy_entity_result_id := null;
11332                   l_object_version_number := null;
11333                   ben_copy_entity_results_api.create_copy_entity_results(
11334                     p_copy_entity_result_id           => l_copy_entity_result_id,
11335                     p_copy_entity_txn_id             => p_copy_entity_txn_id,
11336                     p_result_type_cd                 => l_result_type_cd,
11337                     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
11338                     p_parent_entity_result_id        => l_mirror_src_entity_result_id,
11339                     p_number_of_copies               => l_number_of_copies,
11340                     p_table_alias					  => 'LRE',
11341                     p_table_route_id                 => l_table_route_id,
11342                     p_information1     => l_lre_rec.ler_rqrs_enrt_ctfn_id,
11343                     p_information2     => l_lre_rec.EFFECTIVE_START_DATE,
11344                     p_information3     => l_lre_rec.EFFECTIVE_END_DATE,
11345                     p_information4     => l_lre_rec.business_group_id,
11346                     p_information5     => l_information5 , -- 9999 put name for h-grid
11347                     p_information263     => l_lre_rec.ctfn_rqd_when_rl,
11348                     p_information11     => l_lre_rec.excld_flag,
11349                     p_information257     => l_lre_rec.ler_id,
11350                     p_information111     => l_lre_rec.lre_attribute1,
11351                     p_information120     => l_lre_rec.lre_attribute10,
11352                     p_information121     => l_lre_rec.lre_attribute11,
11353                     p_information122     => l_lre_rec.lre_attribute12,
11354                     p_information123     => l_lre_rec.lre_attribute13,
11355                     p_information124     => l_lre_rec.lre_attribute14,
11356                     p_information125     => l_lre_rec.lre_attribute15,
11357                     p_information126     => l_lre_rec.lre_attribute16,
11358                     p_information127     => l_lre_rec.lre_attribute17,
11359                     p_information128     => l_lre_rec.lre_attribute18,
11360                     p_information129     => l_lre_rec.lre_attribute19,
11361                     p_information112     => l_lre_rec.lre_attribute2,
11362                     p_information130     => l_lre_rec.lre_attribute20,
11363                     p_information131     => l_lre_rec.lre_attribute21,
11364                     p_information132     => l_lre_rec.lre_attribute22,
11365                     p_information133     => l_lre_rec.lre_attribute23,
11366                     p_information134     => l_lre_rec.lre_attribute24,
11367                     p_information135     => l_lre_rec.lre_attribute25,
11368                     p_information136     => l_lre_rec.lre_attribute26,
11369                     p_information137     => l_lre_rec.lre_attribute27,
11370                     p_information138     => l_lre_rec.lre_attribute28,
11371                     p_information139     => l_lre_rec.lre_attribute29,
11372                     p_information113     => l_lre_rec.lre_attribute3,
11373                     p_information140     => l_lre_rec.lre_attribute30,
11374                     p_information114     => l_lre_rec.lre_attribute4,
11375                     p_information115     => l_lre_rec.lre_attribute5,
11376                     p_information116     => l_lre_rec.lre_attribute6,
11377                     p_information117     => l_lre_rec.lre_attribute7,
11378                     p_information118     => l_lre_rec.lre_attribute8,
11379                     p_information119     => l_lre_rec.lre_attribute9,
11380                     p_information110     => l_lre_rec.lre_attribute_category,
11381                     p_information258     => l_lre_rec.oipl_id,
11382                     p_information261     => l_lre_rec.pl_id,
11383                     p_information256     => l_lre_rec.plip_id,
11384                     p_INFORMATION198     => l_lre_rec.SUSP_IF_CTFN_NOT_PRVD_FLAG,  /* Bug 4089500 */
11385                     p_INFORMATION197     => l_lre_rec.CTFN_DETERMINE_CD,           /* Bug 4089500 */
11386                     p_information265     => l_lre_rec.object_version_number,
11387                     p_object_version_number          => l_object_version_number,
11388                     p_effective_date                 => p_effective_date       );
11389                     --
11390 
11391                     if l_out_lre_result_id is null then
11392                       l_out_lre_result_id := l_copy_entity_result_id;
11393                     end if;
11394 
11395                     if l_result_type_cd = 'DISPLAY' then
11396                        l_out_lre_result_id := l_copy_entity_result_id ;
11397                     end if;
11398                     --
11399                  end loop;
11400                  --
11401                  for l_lre_rec in c_lre1_drp(l_parent_rec.ler_rqrs_enrt_ctfn_id,l_mirror_src_entity_result_id,'LRE') loop
11402                    ben_plan_design_plan_module.create_ler_result (
11403                             p_validate                       => p_validate
11404                            ,p_copy_entity_result_id          => l_out_lre_result_id
11405                            ,p_copy_entity_txn_id             => p_copy_entity_txn_id
11406                            ,p_ler_id                         => l_lre_rec.ler_id
11407                            ,p_business_group_id              => p_business_group_id
11408                            ,p_number_of_copies             => p_number_of_copies
11409                            ,p_object_version_number          => l_object_version_number
11410                            ,p_effective_date                 => p_effective_date
11411                            );
11412                  end loop ;
11413 
11414               ---------------------------------------------------------------
11415               -- START OF BEN_LER_ENRT_CTFN_F ----------------------
11416               ---------------------------------------------------------------
11417               --
11418               for l_parent_rec  in c_lnc1_from_parent(l_LER_RQRS_ENRT_CTFN_ID) loop
11419                  --
11420                  l_mirror_src_entity_result_id := l_out_lre_result_id ;
11421 
11422                  --
11423                  l_ler_enrt_ctfn_id := l_parent_rec.ler_enrt_ctfn_id ;
11424                  --
11425                  for l_lnc_rec in c_lnc1(l_parent_rec.ler_enrt_ctfn_id,l_mirror_src_entity_result_id,'LNC') loop
11426                    --
11427                    l_table_route_id := null ;
11428                    open ben_plan_design_program_module.g_table_route('LNC');
11429                      fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11430                    close ben_plan_design_program_module.g_table_route ;
11431                    --
11432                    l_information5  := hr_general.decode_lookup('BEN_ENRT_CTFN_TYP',l_lnc_rec.enrt_ctfn_typ_cd); --'Intersection'
11433                    --
11434                    if p_effective_date between l_lnc_rec.effective_start_date
11435                       and l_lnc_rec.effective_end_date then
11436                     --
11437                       l_result_type_cd := 'DISPLAY';
11438                    else
11439                       l_result_type_cd := 'NO DISPLAY';
11440                    end if;
11441                      --
11442                    l_copy_entity_result_id := null;
11443                    l_object_version_number := null;
11444                    ben_copy_entity_results_api.create_copy_entity_results(
11445                      p_copy_entity_result_id           => l_copy_entity_result_id,
11446                      p_copy_entity_txn_id             => p_copy_entity_txn_id,
11447                      p_result_type_cd                 => l_result_type_cd,
11448                      p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
11449                      p_parent_entity_result_id        => l_mirror_src_entity_result_id,
11450                      p_number_of_copies               => l_number_of_copies,
11451                      p_table_alias					  => 'LNC',
11452                      p_table_route_id                 => l_table_route_id,
11453                      p_information1     => l_lnc_rec.ler_enrt_ctfn_id,
11454                      p_information2     => l_lnc_rec.EFFECTIVE_START_DATE,
11455                      p_information3     => l_lnc_rec.EFFECTIVE_END_DATE,
11456                      p_information4     => l_lnc_rec.business_group_id,
11457                      p_information5     => l_information5 , -- 9999 put name for h-grid
11458                      p_information258     => l_lnc_rec.ctfn_rqd_when_rl,
11459                      p_information12     => l_lnc_rec.enrt_ctfn_typ_cd,
11460                      p_information257     => l_lnc_rec.ler_rqrs_enrt_ctfn_id,
11461                      p_information111     => l_lnc_rec.lnc_attribute1,
11462                      p_information120     => l_lnc_rec.lnc_attribute10,
11463                      p_information121     => l_lnc_rec.lnc_attribute11,
11464                      p_information122     => l_lnc_rec.lnc_attribute12,
11465                      p_information123     => l_lnc_rec.lnc_attribute13,
11466                      p_information124     => l_lnc_rec.lnc_attribute14,
11467                      p_information125     => l_lnc_rec.lnc_attribute15,
11468                      p_information126     => l_lnc_rec.lnc_attribute16,
11469                      p_information127     => l_lnc_rec.lnc_attribute17,
11470                      p_information128     => l_lnc_rec.lnc_attribute18,
11471                      p_information129     => l_lnc_rec.lnc_attribute19,
11472                      p_information112     => l_lnc_rec.lnc_attribute2,
11473                      p_information130     => l_lnc_rec.lnc_attribute20,
11474                      p_information131     => l_lnc_rec.lnc_attribute21,
11475                      p_information132     => l_lnc_rec.lnc_attribute22,
11476                      p_information133     => l_lnc_rec.lnc_attribute23,
11477                      p_information134     => l_lnc_rec.lnc_attribute24,
11478                      p_information135     => l_lnc_rec.lnc_attribute25,
11479                      p_information136     => l_lnc_rec.lnc_attribute26,
11480                      p_information137     => l_lnc_rec.lnc_attribute27,
11481                      p_information138     => l_lnc_rec.lnc_attribute28,
11482                      p_information139     => l_lnc_rec.lnc_attribute29,
11483                      p_information113     => l_lnc_rec.lnc_attribute3,
11484                      p_information140     => l_lnc_rec.lnc_attribute30,
11485                      p_information114     => l_lnc_rec.lnc_attribute4,
11486                      p_information115     => l_lnc_rec.lnc_attribute5,
11487                      p_information116     => l_lnc_rec.lnc_attribute6,
11488                      p_information117     => l_lnc_rec.lnc_attribute7,
11489                      p_information118     => l_lnc_rec.lnc_attribute8,
11490                      p_information119     => l_lnc_rec.lnc_attribute9,
11491                      p_information110     => l_lnc_rec.lnc_attribute_category,
11492                      p_information11     => l_lnc_rec.rqd_flag,
11493                      p_information265     => l_lnc_rec.object_version_number,
11494                      p_object_version_number          => l_object_version_number,
11495                      p_effective_date                 => p_effective_date       );
11496                      --
11497 
11498                      if l_out_lnc_result_id is null then
11499                         l_out_lnc_result_id := l_copy_entity_result_id;
11500                       end if;
11501 
11502                      if l_result_type_cd = 'DISPLAY' then
11503                         l_out_lnc_result_id := l_copy_entity_result_id ;
11504                      end if;
11505                      --
11506                   end loop;
11507                   --
11508                 end loop;
11509              ---------------------------------------------------------------
11510              -- END OF BEN_LER_ENRT_CTFN_F ----------------------
11511              ---------------------------------------------------------------
11512              end loop;
11513              ---------------------------------------------------------------
11514              -- END OF BEN_LER_RQRS_ENRT_CTFN_F ----------------------
11515              ---------------------------------------------------------------
11516 
11517              for l_parent_rec  in c_opt1_from_parent(l_OIPL_ID) loop
11518                create_opt_result
11519                ( p_validate                       => p_validate
11520                 ,p_copy_entity_result_id          => l_out_cop_result_id
11521                 ,p_copy_entity_txn_id             => p_copy_entity_txn_id
11522                 ,p_opt_id                         => l_parent_rec.opt_id
11523                 ,p_business_group_id              => p_business_group_id
11524                 ,p_number_of_copies               => p_number_of_copies
11525                 ,p_object_version_number          => l_object_version_number
11526                 ,p_effective_date                 => p_effective_date
11527                 ,p_parent_entity_result_id        => l_out_cop_result_id
11528                 ,p_no_dup_rslt                    => p_no_dup_rslt
11529                 );
11530              end loop;
11531 
11532          end if;
11533          ---------------------------------------------------------------
11534          -- END OF BEN_OIPL_F ----------------------
11535          ---------------------------------------------------------------
11536   --
11537 end create_oipl_result ;
11538 --
11539 procedure create_opt_result
11540   (  p_validate                       in  number     default 0 -- false
11541     ,p_copy_entity_result_id          in  number
11542     ,p_copy_entity_txn_id             in  number
11543     ,p_opt_id                         in  number
11544     ,p_business_group_id              in  number    default null
11545     ,p_number_of_copies               in  number    default 0
11546     ,p_object_version_number          out nocopy number
11547     ,p_effective_date                 in  date
11548     ,p_parent_entity_result_id        in  number
11549     ,p_no_dup_rslt                    in  varchar2  default null
11550     ) is
11551     --
11552     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
11553     l_proc varchar2(72) := g_package||'create_popl_result';
11554     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
11555     --
11556     l_result_type_cd   varchar2(30) :=  'DISPLAY' ;
11557     -- Cursor to get mirror_src_entity_result_id
11558     cursor c_parent_result(c_parent_pk_id number,
11559                         c_parent_table_alias varchar2,
11560                         c_copy_entity_txn_id number) is
11561     select copy_entity_result_id mirror_src_entity_result_id
11562     from ben_copy_entity_results cpe
11563 --         pqh_table_route trt
11564     where cpe.information1        = c_parent_pk_id
11565     and   cpe.result_type_cd      = l_result_type_cd
11566     and   cpe.copy_entity_txn_id  = c_copy_entity_txn_id
11567 --    and   cpe.table_route_id      = trt.table_route_id
11568     and   cpe.table_alias         = c_parent_table_alias;
11569     --
11570     --
11571     -- Bug : 3752407 : Global cursor g_table_route will now be used
11572     -- Cursor to get table_route_id
11573     --
11574     -- cursor c_table_route(c_parent_table_alias varchar2) is
11575     -- select table_route_id
11576     -- from pqh_table_route trt
11577     -- where trt.table_alias         = c_parent_table_alias;
11578     --
11579    ---------------------------------------------------------------
11580    -- START OF BEN_OPT_F ----------------------
11581    ---------------------------------------------------------------
11582    cursor c_opt1(c_opt_id number,c_mirror_src_entity_result_id number,
11583                  c_table_alias varchar2) is
11584    select  opt.*
11585    from BEN_OPT_F opt
11586    where  opt.opt_id = c_opt_id
11587      -- and opt.business_group_id = p_business_group_id
11588      and not exists (
11589          select /*+  */ null
11590          from ben_copy_entity_results cpe
11591 --              pqh_table_route trt
11592          where copy_entity_txn_id = p_copy_entity_txn_id
11593 --         and trt.table_route_id = cpe.table_route_id
11594          and ( -- c_mirror_src_entity_result_id is null or
11595                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
11596          -- and trt.where_clause = 'BEN_OPT_F'
11597          and cpe.table_alias = c_table_alias
11598          and information1 = c_opt_id
11599          -- and information4 = opt.business_group_id
11600            and information2 = opt.effective_start_date
11601            and information3 = opt.effective_end_date
11602         );
11603 
11604    --
11605    --Mapping for CWB Group_pl_id
11606    --
11607    cursor c_grp_opt_name (p_group_opt_id in number) is
11608    select name group_opt_name
11609    from ben_opt_f
11610    where opt_id = p_group_opt_id
11611      and p_effective_date between effective_start_date and effective_end_date;
11612 
11613    l_mapping_id         number;
11614    l_mapping_name       varchar2(600);
11615    l_mapping_column_name1 pqh_attributes.attribute_name%type;
11616    l_mapping_column_name2 pqh_attributes.attribute_name%type;
11617 
11618    -- Mapping end for CWB
11619 
11620     l_opt_id                 number(15);
11621     l_out_opt_result_id   number(15);
11622    ---------------------------------------------------------------
11623    -- END OF BEN_OPT_F ----------------------
11624    ---------------------------------------------------------------
11625    ---------------------------------------------------------------
11626    -- START OF BEN_DSGN_RQMT_F ----------------------
11627    ---------------------------------------------------------------
11628    cursor c_ddr2_from_parent(c_OPT_ID number) is
11629    select  dsgn_rqmt_id
11630    from BEN_DSGN_RQMT_F
11631    where  OPT_ID = c_OPT_ID ;
11632    --
11633    cursor c_ddr2(c_dsgn_rqmt_id number,c_mirror_src_entity_result_id number,
11634                  c_table_alias varchar2) is
11635    select  ddr.*
11636    from BEN_DSGN_RQMT_F ddr
11637    where  ddr.dsgn_rqmt_id = c_dsgn_rqmt_id
11638      -- and ddr.business_group_id = p_business_group_id
11639      and not exists (
11640          select /*+  */ null
11641          from ben_copy_entity_results cpe
11642 --              pqh_table_route trt
11643          where copy_entity_txn_id = p_copy_entity_txn_id
11644 --         and trt.table_route_id = cpe.table_route_id
11645          and ( -- c_mirror_src_entity_result_id is null or
11646                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
11647          -- and trt.where_clause = 'BEN_DSGN_RQMT_F'
11648          and cpe.table_alias = c_table_alias
11649          and information1 = c_dsgn_rqmt_id
11650          -- and information4 = ddr.business_group_id
11651            and information2 = ddr.effective_start_date
11652            and information3 = ddr.effective_end_date
11653         );
11654 
11655    l_ddr2_dsgn_rqmt_esd ben_dsgn_rqmt_f.effective_start_date%type;
11656    ---------------------------------------------------------------
11657    -- END OF BEN_DSGN_RQMT_F ----------------------
11658    ---------------------------------------------------------------
11659    ---------------------------------------------------------------
11660    -- START OF BEN_PL_TYP_OPT_TYP_F ----------------------
11661    ---------------------------------------------------------------
11662    cursor c_pon1_from_parent(c_OPT_ID number) is
11663    select  pl_typ_opt_typ_id
11664    from BEN_PL_TYP_OPT_TYP_F
11665    where  OPT_ID = c_OPT_ID ;
11666    --
11667    cursor c_pon1(c_pl_typ_opt_typ_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
11668    select  pon.*
11669    from BEN_PL_TYP_OPT_TYP_F pon
11670    where  pon.pl_typ_opt_typ_id = c_pl_typ_opt_typ_id
11671      -- and pon.business_group_id = p_business_group_id
11672      and not exists (
11673          select /*+  */ null
11674          from ben_copy_entity_results cpe
11675 --              pqh_table_route trt
11676          where copy_entity_txn_id = p_copy_entity_txn_id
11677 --         and trt.table_route_id = cpe.table_route_id
11678          and ( -- c_mirror_src_entity_result_id is null or
11679                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
11680          -- and trt.where_clause = 'BEN_PL_TYP_OPT_TYP_F'
11681          and cpe.table_alias = c_table_alias
11682          and information1 = c_pl_typ_opt_typ_id
11683          -- and information4 = pon.business_group_id
11684            and information2 = pon.effective_start_date
11685            and information3 = pon.effective_end_date
11686         );
11687     l_pl_typ_opt_typ_id                 number(15);
11688     l_out_pon_result_id   number(15);
11689    ---------------------------------------------------------------
11690    -- END OF BEN_PL_TYP_OPT_TYP_F ----------------------
11691    ---------------------------------------------------------------
11692    ---------------------------------------------------------------
11693    -- START OF BEN_DSGN_RQMT_RLSHP_TYP ----------------------
11694    ---------------------------------------------------------------
11695    cursor c_drr2_from_parent(c_DSGN_RQMT_ID number) is
11696    select  dsgn_rqmt_rlshp_typ_id
11697    from BEN_DSGN_RQMT_RLSHP_TYP
11698    where  DSGN_RQMT_ID = c_DSGN_RQMT_ID ;
11699    --
11700    cursor c_drr2(c_dsgn_rqmt_rlshp_typ_id number,c_mirror_src_entity_result_id number,c_table_alias varchar2) is
11701    select  drr.*
11702    from BEN_DSGN_RQMT_RLSHP_TYP drr
11703    where  drr.dsgn_rqmt_rlshp_typ_id = c_dsgn_rqmt_rlshp_typ_id
11704      -- and drr.business_group_id = p_business_group_id
11705      and not exists (
11706          select /*+  */ null
11707          from ben_copy_entity_results cpe
11708 --              pqh_table_route trt
11709          where copy_entity_txn_id = p_copy_entity_txn_id
11710 --         and trt.table_route_id = cpe.table_route_id
11711          and ( -- c_mirror_src_entity_result_id is null or
11712                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
11713          -- and trt.where_clause = 'BEN_DSGN_RQMT_RLSHP_TYP'
11714          and cpe.table_alias = c_table_alias
11715          and information1 = c_dsgn_rqmt_rlshp_typ_id
11716          -- and information4 = drr.business_group_id
11717         );
11718    ---------------------------------------------------------------
11719    -- END OF BEN_DSGN_RQMT_RLSHP_TYP ----------------------
11720    ---------------------------------------------------------------
11721    ---------------------------------------------------------------
11722    -- START OF BEN_PL_TYP_F ----------------------
11723    ---------------------------------------------------------------
11724    cursor c_ptp1_from_parent(c_PL_TYP_OPT_TYP_ID number) is
11725    select  distinct pl_typ_id
11726    from BEN_PL_TYP_OPT_TYP_F
11727    where  PL_TYP_OPT_TYP_ID = c_PL_TYP_OPT_TYP_ID ;
11728    --
11729    ---------------------------------------------------------------
11730    -- END OF BEN_PL_TYP_F ----------------------
11731    ---------------------------------------------------------------
11732 
11733    cursor c_opt_exists(c_opt_id               number,
11734                        c_table_alias          varchar2) is
11735     select null
11736     from ben_copy_entity_results cpe
11737 --         pqh_table_route trt
11738     where copy_entity_txn_id = p_copy_entity_txn_id
11739 --    and trt.table_route_id = cpe.table_route_id
11740     and cpe.table_alias = c_table_alias
11741     and information1 = c_opt_id;
11742 
11743    l_dummy                          varchar2(1);
11744 
11745    l_mirror_src_entity_result_id    number(15);
11746    l_parent_entity_result_id        number(15);
11747    l_table_route_id                 number(15);
11748    l_information5                   ben_copy_entity_results.information5%TYPE;
11749    l_number_of_copies               number := p_number_of_copies ;
11750    --
11751    L_ELIG_TO_PRTE_RSN_ID            number(15);
11752 
11753    L_LER_RQRS_ENRT_CTFN_ID          number(15);
11754    L_ENRT_CTFN_ID                   number(15);
11755    L_LER_ENRT_CTFN_ID               number(15);
11756    L_PL_TYP_ID                      number(15);
11757    L_OUT_PTP_RESULT_ID              number(15);
11758    --
11759    L_DSGN_RQMT_ID                   number(15);
11760    L_OUT_DDR_RESULT_ID              number(15);
11761    L_DSGN_RQMT_RLSHP_TYP_ID         number(15);
11762    L_OUT_DRR_RESULT_ID              number(15);
11763    l_group_opt_id                   NUMBER(15);
11764 
11765 begin
11766   --
11767         ---------------------------------------------------------------
11768         -- START OF BEN_OPT_F ----------------------
11769         ---------------------------------------------------------------
11770 
11771              if p_no_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
11772                ben_plan_design_program_module.g_pdw_allow_dup_rslt := ben_plan_design_program_module.g_pdw_no_dup_rslt;
11773              end if;
11774 
11775              if p_no_dup_rslt = 'Y' OR
11776                 ben_plan_design_program_module.g_pdw_allow_dup_rslt =
11777                   ben_plan_design_program_module.g_pdw_no_dup_rslt then
11778                open c_opt_exists(p_opt_id,'OPT');
11779                fetch c_opt_exists into l_dummy;
11780                if c_opt_exists%found then
11781                  close c_opt_exists;
11782                  return;
11783                end if;
11784                close c_opt_exists;
11785              end if;
11786 
11787              l_mirror_src_entity_result_id := p_copy_entity_result_id;
11788              l_parent_entity_result_id := p_parent_entity_result_id;
11789 
11790                 l_opt_id := p_opt_id ;
11791                 --
11792                 for l_opt_rec in c_opt1(l_opt_id,l_mirror_src_entity_result_id,'OPT') loop
11793                   --
11794                   l_table_route_id := null ;
11795                   open ben_plan_design_program_module.g_table_route('OPT');
11796                     fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11797                   close ben_plan_design_program_module.g_table_route ;
11798                   --
11799                   l_information5  := l_opt_rec.name; --'Intersection';
11800                   --
11801                   if p_effective_date between l_opt_rec.effective_start_date
11802                      and l_opt_rec.effective_end_date then
11803                    --
11804                      l_result_type_cd := 'DISPLAY';
11805                   else
11806                      l_result_type_cd := 'NO DISPLAY';
11807                   end if;
11808                   --
11809                   -- mapping for CWB plan
11810                   --
11811                   -- Bug 4665663 - Map only if it is not a Group Option
11812                   l_group_opt_id := NULL;
11813                   --
11814                   if (l_opt_rec.group_opt_id IS NOT NULL and
11815                           l_opt_rec.opt_id <> l_opt_rec.group_opt_id) then
11816                     --
11817                     open c_grp_opt_name(l_opt_rec.group_opt_id);
11818                     fetch c_grp_opt_name into l_mapping_name;
11819                     close c_grp_opt_name;
11820                     --
11821                     l_group_opt_id := l_opt_rec.group_opt_id; -- 4665663
11822                     --
11823                     --To set user friendly labels on the mapping page
11824                     --
11825                     l_mapping_column_name1 := null;
11826                     l_mapping_column_name2 :=null;
11827                     BEN_PLAN_DESIGN_TXNS_API.get_mapping_column_name(l_table_route_id,
11828                                   l_mapping_column_name1,
11829                                   l_mapping_column_name2,
11830                                   p_copy_entity_txn_id);
11831                   --
11832                   end if;
11833                   --
11834                   l_copy_entity_result_id := null;
11835                   l_object_version_number := null;
11836                   --
11837                   ben_copy_entity_results_api.create_copy_entity_results(
11838                     p_copy_entity_result_id           => l_copy_entity_result_id,
11839                     p_copy_entity_txn_id             => p_copy_entity_txn_id,
11840                     p_result_type_cd                 => l_result_type_cd,
11841                     p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
11842                     p_parent_entity_result_id        => null, -- Hide BEN_OPT_F for HGrid
11843                     p_number_of_copies               => l_number_of_copies,
11844                     p_table_alias					 => 'OPT',
11845                     p_table_route_id                 => l_table_route_id,
11846                     p_information1     => l_opt_rec.opt_id,
11847                     p_information2     => l_opt_rec.EFFECTIVE_START_DATE,
11848                     p_information3     => l_opt_rec.EFFECTIVE_END_DATE,
11849                     p_information4     => l_opt_rec.business_group_id,
11850                     p_information5     => l_information5 , -- 9999 put name for h-grid
11851                     p_information249     => l_opt_rec.cmbn_ptip_opt_id,
11852                     p_information13      => l_opt_rec.component_reason,
11853                     -- tilak cwb pl copy fix
11854                     p_information264     => l_opt_rec.group_opt_id,
11855                     -- Data for MAPPING columns.
11856                     p_information173     => l_mapping_name,
11857                     p_information174     => l_group_opt_id,
11858                     p_information181     => l_mapping_column_name1,
11859                     p_information182     => l_mapping_column_name2,
11860                     -- END other product Mapping columns.
11861                     p_information14      => l_opt_rec.invk_wv_opt_flag,
11862                     p_information141     => l_opt_rec.mapping_table_name,
11863                     p_information257     => l_opt_rec.mapping_table_pk_id,
11864                     p_information170     => l_opt_rec.name,
11865                     p_information111     => l_opt_rec.opt_attribute1,
11866                     p_information120     => l_opt_rec.opt_attribute10,
11867                     p_information121     => l_opt_rec.opt_attribute11,
11868                     p_information122     => l_opt_rec.opt_attribute12,
11869                     p_information123     => l_opt_rec.opt_attribute13,
11870                     p_information124     => l_opt_rec.opt_attribute14,
11871                     p_information125     => l_opt_rec.opt_attribute15,
11872                     p_information126     => l_opt_rec.opt_attribute16,
11873                     p_information127     => l_opt_rec.opt_attribute17,
11874                     p_information128     => l_opt_rec.opt_attribute18,
11875                     p_information129     => l_opt_rec.opt_attribute19,
11876                     p_information112     => l_opt_rec.opt_attribute2,
11877                     p_information130     => l_opt_rec.opt_attribute20,
11878                     p_information131     => l_opt_rec.opt_attribute21,
11879                     p_information132     => l_opt_rec.opt_attribute22,
11880                     p_information133     => l_opt_rec.opt_attribute23,
11881                     p_information134     => l_opt_rec.opt_attribute24,
11882                     p_information135     => l_opt_rec.opt_attribute25,
11883                     p_information136     => l_opt_rec.opt_attribute26,
11884                     p_information137     => l_opt_rec.opt_attribute27,
11885                     p_information138     => l_opt_rec.opt_attribute28,
11886                     p_information139     => l_opt_rec.opt_attribute29,
11887                     p_information113     => l_opt_rec.opt_attribute3,
11888                     p_information140     => l_opt_rec.opt_attribute30,
11889                     p_information114     => l_opt_rec.opt_attribute4,
11890                     p_information115     => l_opt_rec.opt_attribute5,
11891                     p_information116     => l_opt_rec.opt_attribute6,
11892                     p_information117     => l_opt_rec.opt_attribute7,
11893                     p_information118     => l_opt_rec.opt_attribute8,
11894                     p_information119     => l_opt_rec.opt_attribute9,
11895                     p_information110     => l_opt_rec.opt_attribute_category,
11896                     p_information258     => l_opt_rec.rqd_perd_enrt_nenrt_rl,
11897                     p_information15      => l_opt_rec.rqd_perd_enrt_nenrt_uom,
11898                     p_information259     => l_opt_rec.rqd_perd_enrt_nenrt_val,
11899                     p_information11      => l_opt_rec.short_code,
11900                     p_information12      => l_opt_rec.short_name,
11901                     p_information16      => l_opt_rec.legislation_code,          /* Bug 3939490 */
11902                     p_information17      => l_opt_rec.legislation_subgroup,      /* Bug 3939490 */
11903                     p_information265     => l_opt_rec.object_version_number,
11904                     p_object_version_number          => l_object_version_number,
11905                     p_effective_date                 => p_effective_date       );
11906                     --
11907 
11908                     if l_out_opt_result_id is null then
11909                       l_out_opt_result_id := l_copy_entity_result_id;
11910                     end if;
11911 
11912                     if l_result_type_cd = 'DISPLAY' then
11913                        l_out_opt_result_id := l_copy_entity_result_id ;
11914                     end if;
11915                     --
11916                     if (l_opt_rec.rqd_perd_enrt_nenrt_rl is not null) then
11917 		      ben_plan_design_program_module.create_formula_result(
11918 			p_validate                       => p_validate
11919 			,p_copy_entity_result_id         => l_copy_entity_result_id
11920 			,p_copy_entity_txn_id            => p_copy_entity_txn_id
11921 			,p_formula_id                    => l_opt_rec.rqd_perd_enrt_nenrt_rl
11922 			,p_business_group_id             => l_opt_rec.business_group_id
11923 			,p_number_of_copies              => l_number_of_copies
11924 			,p_object_version_number         => l_object_version_number
11925 			,p_effective_date                => p_effective_date);
11926 	   	    end if;
11927 
11928               end loop;
11929 
11930               -- Create children of OPT only
11931               -- if OPT is created
11932               --
11933               if l_out_opt_result_id is not null then
11934 
11935                --
11936                -- ------------------------------------------------------------------------
11937                -- Standard Rates ,Flex Credits at Option level
11938                -- ------------------------------------------------------------------------
11939                 ben_pd_rate_and_cvg_module.create_rate_results
11940                 (
11941                   p_validate                   => p_validate
11942                  ,p_copy_entity_result_id      => l_out_opt_result_id
11943                  ,p_copy_entity_txn_id         => p_copy_entity_txn_id
11944                  ,p_pgm_id                     => null
11945                  ,p_ptip_id                    => null
11946                  ,p_plip_id                    => null
11947                  ,p_pl_id                      => null
11948                  ,p_oipl_id                    => null
11949                  ,p_oiplip_id                  => null
11950                  ,p_cmbn_plip_id               => null
11951                  ,p_cmbn_ptip_id               => null
11952                  ,p_cmbn_ptip_opt_id           => null
11953                  ,p_business_group_id          => p_business_group_id
11954                  ,p_number_of_copies           => l_number_of_copies
11955                  ,p_object_version_number      => l_object_version_number
11956                  ,p_effective_date             => p_effective_date
11957                  ,p_parent_entity_result_id    => l_parent_entity_result_id
11958                   --
11959                  ,p_opt_id                     => l_opt_id
11960                   --
11961                   ) ;
11962                --
11963                ---------------------------------------------------------------
11964                -- START OF BEN_DSGN_RQMT_F ----------------------
11965                ---------------------------------------------------------------
11966                --
11967                for l_parent_rec  in c_ddr2_from_parent(l_OPT_ID) loop
11968                   --
11969                   l_mirror_src_entity_result_id := l_out_opt_result_id ;
11970 
11971                   --
11972                   l_dsgn_rqmt_id := l_parent_rec.dsgn_rqmt_id ;
11973                   --
11974                   l_ddr2_dsgn_rqmt_esd := null;
11975                   --
11976                   for l_ddr_rec in c_ddr2(l_parent_rec.dsgn_rqmt_id,l_mirror_src_entity_result_id,'DDR') loop
11977                     --
11978                     l_table_route_id := null ;
11979                     open ben_plan_design_program_module.g_table_route('DDR');
11980                       fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
11981                     close ben_plan_design_program_module.g_table_route ;
11982                     --
11983                     l_information5  := hr_general.decode_lookup('BEN_GRP_RLSHP',l_ddr_rec.grp_rlshp_cd); --'Intersection';
11984                     --
11985                     if p_effective_date between l_ddr_rec.effective_start_date
11986                        and l_ddr_rec.effective_end_date then
11987                      --
11988                        l_result_type_cd := 'DISPLAY';
11989                     else
11990                        l_result_type_cd := 'NO DISPLAY';
11991                     end if;
11992                       --
11993                     l_copy_entity_result_id := null;
11994                     l_object_version_number := null;
11995                     ben_copy_entity_results_api.create_copy_entity_results(
11996                       p_copy_entity_result_id           => l_copy_entity_result_id,
11997                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
11998                       p_result_type_cd                 => l_result_type_cd,
11999                       p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
12000                       p_parent_entity_result_id        => l_parent_entity_result_id,
12001                       p_number_of_copies               => l_number_of_copies,
12002                       p_table_alias					 => 'DDR',
12003                       p_table_route_id                 => l_table_route_id,
12004                       p_information1     => l_ddr_rec.dsgn_rqmt_id,
12005                       p_information2     => l_ddr_rec.EFFECTIVE_START_DATE,
12006                       p_information3     => l_ddr_rec.EFFECTIVE_END_DATE,
12007                       p_information4     => l_ddr_rec.business_group_id,
12008                       p_information5     => l_information5 , -- 9999 put name for h-grid
12009                       p_information13     => l_ddr_rec.cvr_all_elig_flag,
12010                       p_information111     => l_ddr_rec.ddr_attribute1,
12011                       p_information120     => l_ddr_rec.ddr_attribute10,
12012                       p_information121     => l_ddr_rec.ddr_attribute11,
12013                       p_information122     => l_ddr_rec.ddr_attribute12,
12014                       p_information123     => l_ddr_rec.ddr_attribute13,
12015                       p_information124     => l_ddr_rec.ddr_attribute14,
12016                       p_information125     => l_ddr_rec.ddr_attribute15,
12017                       p_information126     => l_ddr_rec.ddr_attribute16,
12018                       p_information127     => l_ddr_rec.ddr_attribute17,
12019                       p_information128     => l_ddr_rec.ddr_attribute18,
12020                       p_information129     => l_ddr_rec.ddr_attribute19,
12021                       p_information112     => l_ddr_rec.ddr_attribute2,
12022                       p_information130     => l_ddr_rec.ddr_attribute20,
12023                       p_information131     => l_ddr_rec.ddr_attribute21,
12024                       p_information132     => l_ddr_rec.ddr_attribute22,
12025                       p_information133     => l_ddr_rec.ddr_attribute23,
12026                       p_information134     => l_ddr_rec.ddr_attribute24,
12027                       p_information135     => l_ddr_rec.ddr_attribute25,
12028                       p_information136     => l_ddr_rec.ddr_attribute26,
12029                       p_information137     => l_ddr_rec.ddr_attribute27,
12030                       p_information138     => l_ddr_rec.ddr_attribute28,
12031                       p_information139     => l_ddr_rec.ddr_attribute29,
12032                       p_information113     => l_ddr_rec.ddr_attribute3,
12033                       p_information140     => l_ddr_rec.ddr_attribute30,
12034                       p_information114     => l_ddr_rec.ddr_attribute4,
12035                       p_information115     => l_ddr_rec.ddr_attribute5,
12036                       p_information116     => l_ddr_rec.ddr_attribute6,
12037                       p_information117     => l_ddr_rec.ddr_attribute7,
12038                       p_information118     => l_ddr_rec.ddr_attribute8,
12039                       p_information119     => l_ddr_rec.ddr_attribute9,
12040                       p_information110     => l_ddr_rec.ddr_attribute_category,
12041                       p_information15     => l_ddr_rec.dsgn_typ_cd,
12042                       p_information14     => l_ddr_rec.grp_rlshp_cd,
12043                       p_information262     => l_ddr_rec.mn_dpnts_rqd_num,
12044                       p_information263     => l_ddr_rec.mx_dpnts_alwd_num,
12045                       p_information11     => l_ddr_rec.no_mn_num_dfnd_flag,
12046                       p_information12     => l_ddr_rec.no_mx_num_dfnd_flag,
12047                       p_information258     => l_ddr_rec.oipl_id,
12048                       p_information247     => l_ddr_rec.opt_id,
12049                       p_information261     => l_ddr_rec.pl_id,
12050                       p_information265     => l_ddr_rec.object_version_number,
12051                       p_object_version_number          => l_object_version_number,
12052                       p_effective_date                 => p_effective_date       );
12053                       --
12054 
12055                       if l_out_ddr_result_id is null then
12056                         l_out_ddr_result_id := l_copy_entity_result_id;
12057                       end if;
12058 
12059                       if l_result_type_cd = 'DISPLAY' then
12060                          l_out_ddr_result_id := l_copy_entity_result_id ;
12061                       end if;
12062                       --
12063 
12064                       -- To pass as effective date while creating the
12065                       -- non date-tracked child records
12066                       if l_ddr2_dsgn_rqmt_esd is null then
12067                         l_ddr2_dsgn_rqmt_esd := l_ddr_rec.EFFECTIVE_START_DATE;
12068                       end if;
12069 
12070                    end loop;
12071                    --
12072                ---------------------------------------------------------------
12073                -- START OF BEN_DSGN_RQMT_RLSHP_TYP ----------------------
12074                ---------------------------------------------------------------
12075                --
12076                for l_parent_rec  in c_drr2_from_parent(l_DSGN_RQMT_ID) loop
12077                   --
12078                   l_mirror_src_entity_result_id := l_out_ddr_result_id ;
12079 
12080                   --
12081                   l_dsgn_rqmt_rlshp_typ_id := l_parent_rec.dsgn_rqmt_rlshp_typ_id ;
12082                   --
12083                   for l_drr_rec in c_drr2(l_parent_rec.dsgn_rqmt_rlshp_typ_id,l_mirror_src_entity_result_id,'DRR') loop
12084                     --
12085                     l_table_route_id := null ;
12086                     open ben_plan_design_program_module.g_table_route('DRR');
12087                       fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
12088                     close ben_plan_design_program_module.g_table_route ;
12089                     --
12090                     l_information5  := hr_general.decode_lookup('CONTACT',l_drr_rec.rlshp_typ_cd); --'Intersection';
12091                     --
12092                     l_result_type_cd := 'DISPLAY';
12093                       --
12094                     l_copy_entity_result_id := null;
12095                     l_object_version_number := null;
12096                     ben_copy_entity_results_api.create_copy_entity_results(
12097                       p_copy_entity_result_id           => l_copy_entity_result_id,
12098                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
12099                       p_result_type_cd                 => l_result_type_cd,
12100                       p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
12101                       p_parent_entity_result_id        => l_mirror_src_entity_result_id,
12102                       p_number_of_copies               => l_number_of_copies,
12103                       p_table_alias					 => 'DRR',
12104                       p_table_route_id                 => l_table_route_id,
12105                       p_information1     => l_drr_rec.dsgn_rqmt_rlshp_typ_id,
12106                       p_information2     => null,
12107                       p_information3     => null,
12108                       p_information4     => l_drr_rec.business_group_id,
12109                       p_information5     => l_information5 , -- 9999 put name for h-grid
12110                       p_information10     => l_ddr2_dsgn_rqmt_esd,
12111                       p_information111     => l_drr_rec.drr_attribute1,
12112                       p_information120     => l_drr_rec.drr_attribute10,
12113                       p_information121     => l_drr_rec.drr_attribute11,
12114                       p_information122     => l_drr_rec.drr_attribute12,
12115                       p_information123     => l_drr_rec.drr_attribute13,
12116                       p_information124     => l_drr_rec.drr_attribute14,
12117                       p_information125     => l_drr_rec.drr_attribute15,
12118                       p_information126     => l_drr_rec.drr_attribute16,
12119                       p_information127     => l_drr_rec.drr_attribute17,
12120                       p_information128     => l_drr_rec.drr_attribute18,
12121                       p_information129     => l_drr_rec.drr_attribute19,
12122                       p_information112     => l_drr_rec.drr_attribute2,
12123                       p_information130     => l_drr_rec.drr_attribute20,
12124                       p_information131     => l_drr_rec.drr_attribute21,
12125                       p_information132     => l_drr_rec.drr_attribute22,
12126                       p_information133     => l_drr_rec.drr_attribute23,
12127                       p_information134     => l_drr_rec.drr_attribute24,
12128                       p_information135     => l_drr_rec.drr_attribute25,
12129                       p_information136     => l_drr_rec.drr_attribute26,
12130                       p_information137     => l_drr_rec.drr_attribute27,
12131                       p_information138     => l_drr_rec.drr_attribute28,
12132                       p_information139     => l_drr_rec.drr_attribute29,
12133                       p_information113     => l_drr_rec.drr_attribute3,
12134                       p_information140     => l_drr_rec.drr_attribute30,
12135                       p_information114     => l_drr_rec.drr_attribute4,
12136                       p_information115     => l_drr_rec.drr_attribute5,
12137                       p_information116     => l_drr_rec.drr_attribute6,
12138                       p_information117     => l_drr_rec.drr_attribute7,
12139                       p_information118     => l_drr_rec.drr_attribute8,
12140                       p_information119     => l_drr_rec.drr_attribute9,
12141                       p_information110     => l_drr_rec.drr_attribute_category,
12142                       p_information260     => l_drr_rec.dsgn_rqmt_id,
12143                       p_information11     => l_drr_rec.rlshp_typ_cd,
12144                       p_information265     => l_drr_rec.object_version_number,
12145                       p_object_version_number          => l_object_version_number,
12146                       p_effective_date                 => p_effective_date       );
12147                       --
12148 
12149                       if l_out_drr_result_id is null then
12150                         l_out_drr_result_id := l_copy_entity_result_id;
12151                       end if;
12152 
12153                       if l_result_type_cd = 'DISPLAY' then
12154                          l_out_drr_result_id := l_copy_entity_result_id ;
12155                       end if;
12156                       --
12157                    end loop;
12158                    --
12159                  end loop;
12160                ---------------------------------------------------------------
12161                -- END OF BEN_DSGN_RQMT_RLSHP_TYP ----------------------
12162                ---------------------------------------------------------------
12163                end loop;
12164                ---------------------------------------------------------------
12165                -- END OF BEN_DSGN_RQMT_F ----------------------
12166                ---------------------------------------------------------------
12167                ---------------------------------------------------------------
12168                -- START OF BEN_PL_TYP_OPT_TYP_F ----------------------
12169                ---------------------------------------------------------------
12170                --
12171                for l_parent_rec  in c_pon1_from_parent(l_OPT_ID) loop
12172                   --
12173                   l_mirror_src_entity_result_id := l_out_opt_result_id ;
12174 
12175 
12176                   --
12177                   l_pl_typ_opt_typ_id := l_parent_rec.pl_typ_opt_typ_id ;
12178                   --
12179                   for l_pon_rec in c_pon1(l_parent_rec.pl_typ_opt_typ_id,l_mirror_src_entity_result_id,'PON') loop
12180                     --
12181                     l_table_route_id := null ;
12182                     open ben_plan_design_program_module.g_table_route('PON');
12183                       fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
12184                     close ben_plan_design_program_module.g_table_route ;
12185                     --
12186                     l_information5  := hr_general.decode_lookup('BEN_OPT_TYP',l_pon_rec.pl_typ_opt_typ_cd); --'Intersection';
12187                     --
12188                     if p_effective_date between l_pon_rec.effective_start_date
12189                        and l_pon_rec.effective_end_date then
12190                      --
12191                        l_result_type_cd := 'DISPLAY';
12192                     else
12193                        l_result_type_cd := 'NO DISPLAY';
12194                     end if;
12195                       --
12196                     l_copy_entity_result_id := null;
12197                     l_object_version_number := null;
12198                     ben_copy_entity_results_api.create_copy_entity_results(
12199                       p_copy_entity_result_id           => l_copy_entity_result_id,
12200                       p_copy_entity_txn_id             => p_copy_entity_txn_id,
12201                       p_result_type_cd                 => l_result_type_cd,
12202                       p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
12203                       p_parent_entity_result_id        => l_parent_entity_result_id,
12204                       p_number_of_copies               => l_number_of_copies,
12205                       p_table_alias					 => 'PON',
12206                       p_table_route_id                 => l_table_route_id,
12207                       p_information1     => l_pon_rec.pl_typ_opt_typ_id,
12208                       p_information2     => l_pon_rec.EFFECTIVE_START_DATE,
12209                       p_information3     => l_pon_rec.EFFECTIVE_END_DATE,
12210                       p_information4     => l_pon_rec.business_group_id,
12211                       p_information5     => l_information5 , -- 9999 put name for h-grid
12212                       p_information247     => l_pon_rec.opt_id,
12213                       p_information248     => l_pon_rec.pl_typ_id,
12214                       p_information11     => l_pon_rec.pl_typ_opt_typ_cd,
12215                       p_information111     => l_pon_rec.pon_attribute1,
12216                       p_information120     => l_pon_rec.pon_attribute10,
12217                       p_information121     => l_pon_rec.pon_attribute11,
12218                       p_information122     => l_pon_rec.pon_attribute12,
12219                       p_information123     => l_pon_rec.pon_attribute13,
12220                       p_information124     => l_pon_rec.pon_attribute14,
12221                       p_information125     => l_pon_rec.pon_attribute15,
12222                       p_information126     => l_pon_rec.pon_attribute16,
12223                       p_information127     => l_pon_rec.pon_attribute17,
12224                       p_information128     => l_pon_rec.pon_attribute18,
12225                       p_information129     => l_pon_rec.pon_attribute19,
12226                       p_information112     => l_pon_rec.pon_attribute2,
12227                       p_information130     => l_pon_rec.pon_attribute20,
12228                       p_information131     => l_pon_rec.pon_attribute21,
12229                       p_information132     => l_pon_rec.pon_attribute22,
12230                       p_information133     => l_pon_rec.pon_attribute23,
12231                       p_information134     => l_pon_rec.pon_attribute24,
12232                       p_information135     => l_pon_rec.pon_attribute25,
12233                       p_information136     => l_pon_rec.pon_attribute26,
12234                       p_information137     => l_pon_rec.pon_attribute27,
12235                       p_information138     => l_pon_rec.pon_attribute28,
12236                       p_information139     => l_pon_rec.pon_attribute29,
12237                       p_information113     => l_pon_rec.pon_attribute3,
12238                       p_information140     => l_pon_rec.pon_attribute30,
12239                       p_information114     => l_pon_rec.pon_attribute4,
12240                       p_information115     => l_pon_rec.pon_attribute5,
12241                       p_information116     => l_pon_rec.pon_attribute6,
12242                       p_information117     => l_pon_rec.pon_attribute7,
12243                       p_information118     => l_pon_rec.pon_attribute8,
12244                       p_information119     => l_pon_rec.pon_attribute9,
12245             	        p_information110     => l_pon_rec.pon_attribute_category,
12246                       p_information265     => l_pon_rec.object_version_number,
12247                       p_object_version_number          => l_object_version_number,
12248                       p_effective_date                 => p_effective_date       );
12249                       --
12250 
12251                       if l_out_pon_result_id is null then
12252                         l_out_pon_result_id := l_copy_entity_result_id;
12253                       end if;
12254 
12255                       if l_result_type_cd = 'DISPLAY' then
12256                          l_out_pon_result_id := l_copy_entity_result_id ;
12257                       end if;
12258                       --
12259                    end loop;
12260                    --
12261                       ---------------------------------------------------------------
12262                       -- START OF BEN_PL_TYP_F ----------------------
12263                       ---------------------------------------------------------------
12264                       --
12265                       for l_parent_rec  in c_ptp1_from_parent(l_PL_TYP_OPT_TYP_ID) loop
12266                         create_pl_typ_result
12267                         ( p_validate                  => p_validate
12268                         ,p_copy_entity_result_id      => l_out_pon_result_id
12269                         ,p_copy_entity_txn_id         => p_copy_entity_txn_id
12270                         ,p_pl_typ_id                  => l_parent_rec.pl_typ_id
12271                         ,p_business_group_id          => p_business_group_id
12272                         ,p_number_of_copies           => p_number_of_copies
12273                         ,p_object_version_number      => l_object_version_number
12274                         ,p_effective_date             => p_effective_date
12275                         ,p_parent_entity_result_id    => l_out_pon_result_id
12276                         );
12277                       end loop;
12278                      ---------------------------------------------------------------
12279                      -- END OF BEN_PL_TYP_F ----------------------
12280                      ---------------------------------------------------------------
12281                  end loop;
12282               ---------------------------------------------------------------
12283               -- END OF BEN_PL_TYP_OPT_TYP_F ----------------------
12284               ---------------------------------------------------------------
12285 
12286             end if;
12287             ---------------------------------------------------------------
12288             -- END OF BEN_OPT_F ----------------------
12289             ---------------------------------------------------------------
12290   --
12291 end create_opt_result ;
12292 --
12293 procedure create_pl_typ_result
12294   (  p_validate                       in  number     default 0 -- false
12295     ,p_copy_entity_result_id          in  number
12296     ,p_copy_entity_txn_id             in  number
12297     ,p_pl_typ_id                      in  number
12298     ,p_business_group_id              in  number    default null
12299     ,p_number_of_copies               in  number    default 0
12300     ,p_object_version_number          out nocopy number
12301     ,p_effective_date                 in  date
12302     ,p_parent_entity_result_id        in  number
12303     ,p_no_dup_rslt                    in  varchar2  default null
12304     ) is
12305     --
12306     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
12307     l_proc varchar2(72) := g_package||'create_pl_typ_result';
12308     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
12309     --
12310     l_result_type_cd   varchar2(30) :=  'DISPLAY' ;
12311     -- Cursor to get mirror_src_entity_result_id
12312     cursor c_parent_result(c_parent_pk_id number,
12313                         c_parent_table_alias varchar2,
12314                         c_copy_entity_txn_id number) is
12315     select copy_entity_result_id mirror_src_entity_result_id
12316     from ben_copy_entity_results cpe
12317 --         pqh_table_route trt
12318     where cpe.information1        = c_parent_pk_id
12319     and   cpe.result_type_cd      = l_result_type_cd
12320     and   cpe.copy_entity_txn_id  = c_copy_entity_txn_id
12321 --    and   cpe.table_route_id      = trt.table_route_id
12322     and   cpe.table_alias         = c_parent_table_alias;
12323     --
12324     -- Bug : 3752407 : Global cursor g_table_route will now be used
12325     -- Cursor to get table_route_id
12326     --
12327     -- cursor c_table_route(c_parent_table_alias varchar2) is
12328     -- select table_route_id
12329     -- from pqh_table_route trt
12330     -- where trt.table_alias         = c_parent_table_alias;
12331     --
12332    ---------------------------------------------------------------
12333    -- START OF BEN_PL_TYP_F ----------------------
12334    ---------------------------------------------------------------
12335    cursor c_ptp(c_pl_typ_id number,c_mirror_src_entity_result_id number,
12336                 c_table_alias varchar2) is
12337    select  ptp.*
12338    from BEN_PL_TYP_F ptp
12339    where  ptp.pl_typ_id = c_pl_typ_id
12340      -- and ptp.business_group_id = p_business_group_id
12341      and not exists (
12342          select /*+  */ null
12343          from ben_copy_entity_results cpe
12344 --              pqh_table_route trt
12345          where copy_entity_txn_id = p_copy_entity_txn_id
12346 --         and trt.table_route_id = cpe.table_route_id
12347          and ( -- c_mirror_src_entity_result_id is null or
12348                mirror_src_entity_result_id = c_mirror_src_entity_result_id )
12349          -- and trt.where_clause = 'BEN_PL_TYP_F'
12350          and cpe.table_alias = c_table_alias
12351          and information1 = c_pl_typ_id
12352          -- and information4 = ptp.business_group_id
12353            and information2 = ptp.effective_start_date
12354            and information3 = ptp.effective_end_date
12355         );
12356 
12357    l_pl_typ_id                 number(15);
12358    l_out_ptp_result_id   number(15);
12359    ---------------------------------------------------------------
12360    -- END OF BEN_PL_TYP_F ----------------------
12361    ---------------------------------------------------------------
12362 
12363    cursor c_object_exists(c_pk_id                number,
12364                           c_table_alias          varchar2) is
12365     select null
12366     from ben_copy_entity_results cpe
12367 --         pqh_table_route trt
12368     where copy_entity_txn_id = p_copy_entity_txn_id
12369 --    and trt.table_route_id = cpe.table_route_id
12370     and cpe.table_alias = c_table_alias
12371     and information1 = c_pk_id;
12372 
12373    l_dummy                     varchar2(1);
12374 
12375    l_mirror_src_entity_result_id    number(15);
12376    l_parent_entity_result_id        number(15);
12377    l_table_route_id                 number(15);
12378    l_information5                   ben_copy_entity_results.information5%TYPE;
12379    l_number_of_copies               number := p_number_of_copies ;
12380    --
12381 
12382 begin
12383   --
12384       ---------------------------------------------------------------
12385       -- START OF BEN_PL_TYP_F ----------------------
12386       ---------------------------------------------------------------
12387       --
12388       --
12389         if p_no_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
12390           ben_plan_design_program_module.g_pdw_allow_dup_rslt := ben_plan_design_program_module.g_pdw_no_dup_rslt;
12391         end if;
12392 
12393         if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
12394           open c_object_exists(p_pl_typ_id,'PTP');
12395           fetch c_object_exists into l_dummy;
12396           if c_object_exists%found then
12397             close c_object_exists;
12398             return;
12399           end if;
12400           close c_object_exists;
12401         end if;
12402 
12403         l_mirror_src_entity_result_id := p_copy_entity_result_id;
12404         l_parent_entity_result_id := p_parent_entity_result_id;
12405 
12406         --
12407         l_pl_typ_id := p_pl_typ_id ;
12408         --
12409         for l_ptp_rec in c_ptp(p_pl_typ_id,l_mirror_src_entity_result_id,'PTP') loop
12410           --
12411           l_table_route_id := null ;
12412           open ben_plan_design_program_module.g_table_route('PTP');
12413             fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
12414           close ben_plan_design_program_module.g_table_route ;
12415           --
12416           l_information5  := l_ptp_rec.name;
12417           --
12418           if p_effective_date between l_ptp_rec.effective_start_date
12419              and l_ptp_rec.effective_end_date then
12420            --
12421              l_result_type_cd := 'DISPLAY';
12422           else
12423              l_result_type_cd := 'NO DISPLAY';
12424           end if;
12425             --
12426           l_copy_entity_result_id := null;
12427           l_object_version_number := null;
12428           ben_copy_entity_results_api.create_copy_entity_results(
12429             p_copy_entity_result_id           => l_copy_entity_result_id,
12430             p_copy_entity_txn_id             => p_copy_entity_txn_id,
12431             p_result_type_cd                 => l_result_type_cd,
12432             p_mirror_src_entity_result_id    => l_mirror_src_entity_result_id,
12433             p_parent_entity_result_id        => l_parent_entity_result_id,
12434             p_number_of_copies               => l_number_of_copies,
12435             p_table_alias					 => 'PTP',
12436             p_table_route_id                 => l_table_route_id,
12437             p_information1     => l_ptp_rec.pl_typ_id,
12438             p_information2     => l_ptp_rec.EFFECTIVE_START_DATE,
12439             p_information3     => l_ptp_rec.EFFECTIVE_END_DATE,
12440             p_information4     => l_ptp_rec.business_group_id,
12441             p_information5     => l_information5 , -- 9999 put name for h-grid
12442             p_information16     => l_ptp_rec.comp_typ_cd,
12443             p_information141     => l_ptp_rec.ivr_ident,
12444             p_information261     => l_ptp_rec.mn_enrl_rqd_num,
12445             p_information260     => l_ptp_rec.mx_enrl_alwd_num,
12446             p_information170     => l_ptp_rec.name,
12447             p_information14     => l_ptp_rec.no_mn_enrl_num_dfnd_flag,
12448             p_information13     => l_ptp_rec.no_mx_enrl_num_dfnd_flag,
12449             p_information15     => l_ptp_rec.opt_dsply_fmt_cd,
12450             p_information18     => l_ptp_rec.opt_typ_cd,
12451             p_information17     => l_ptp_rec.pl_typ_stat_cd,
12452             p_information111     => l_ptp_rec.ptp_attribute1,
12453             p_information120     => l_ptp_rec.ptp_attribute10,
12454             p_information121     => l_ptp_rec.ptp_attribute11,
12455             p_information122     => l_ptp_rec.ptp_attribute12,
12456             p_information123     => l_ptp_rec.ptp_attribute13,
12457             p_information124     => l_ptp_rec.ptp_attribute14,
12458             p_information125     => l_ptp_rec.ptp_attribute15,
12459             p_information126     => l_ptp_rec.ptp_attribute16,
12460             p_information127     => l_ptp_rec.ptp_attribute17,
12461             p_information128     => l_ptp_rec.ptp_attribute18,
12462             p_information129     => l_ptp_rec.ptp_attribute19,
12463             p_information112     => l_ptp_rec.ptp_attribute2,
12464             p_information130     => l_ptp_rec.ptp_attribute20,
12465             p_information131     => l_ptp_rec.ptp_attribute21,
12466             p_information132     => l_ptp_rec.ptp_attribute22,
12467             p_information133     => l_ptp_rec.ptp_attribute23,
12468             p_information134     => l_ptp_rec.ptp_attribute24,
12469             p_information135     => l_ptp_rec.ptp_attribute25,
12470             p_information136     => l_ptp_rec.ptp_attribute26,
12471             p_information137     => l_ptp_rec.ptp_attribute27,
12472             p_information138     => l_ptp_rec.ptp_attribute28,
12473             p_information139     => l_ptp_rec.ptp_attribute29,
12474             p_information113     => l_ptp_rec.ptp_attribute3,
12475             p_information140     => l_ptp_rec.ptp_attribute30,
12476             p_information114     => l_ptp_rec.ptp_attribute4,
12477             p_information115     => l_ptp_rec.ptp_attribute5,
12478             p_information116     => l_ptp_rec.ptp_attribute6,
12479             p_information117     => l_ptp_rec.ptp_attribute7,
12480             p_information118     => l_ptp_rec.ptp_attribute8,
12481             p_information119     => l_ptp_rec.ptp_attribute9,
12482             p_information110     => l_ptp_rec.ptp_attribute_category,
12483             p_information11     => l_ptp_rec.short_code,
12484             p_information12     => l_ptp_rec.short_name,
12485             p_information265    => l_ptp_rec.object_version_number,
12486             p_object_version_number          => l_object_version_number,
12487             p_effective_date                 => p_effective_date       );
12488             --
12489 
12490             if l_out_ptp_result_id is null then
12491               l_out_ptp_result_id := l_copy_entity_result_id;
12492             end if;
12493 
12494             if l_result_type_cd = 'DISPLAY' then
12495                l_out_ptp_result_id := l_copy_entity_result_id ;
12496             end if;
12497             --
12498         end loop;
12499         --
12500     ---------------------------------------------------------------
12501     -- END OF BEN_PL_TYP_F ----------------------
12502     ---------------------------------------------------------------
12503   --
12504 end create_pl_typ_result ;
12505 --
12506 procedure create_yr_perd_result
12507   (  p_validate                       in  number     default 0 -- false
12508     ,p_copy_entity_result_id          in  number
12509     ,p_copy_entity_txn_id             in  number
12510     ,p_yr_perd_id                     in  number
12511     ,p_business_group_id              in  number    default null
12512     ,p_number_of_copies               in  number    default 0
12513     ,p_object_version_number          out nocopy number
12514     ,p_effective_date                 in  date
12515     ,p_parent_entity_result_id        in  number
12516     ,p_no_dup_rslt                    in  varchar2  default null
12517     ) is
12518     --
12519     l_copy_entity_result_id ben_copy_entity_results.copy_entity_result_id%TYPE;
12520     l_proc varchar2(72) := g_package||'create_yr_perd_result';
12521     l_object_version_number ben_copy_entity_results.object_version_number%TYPE;
12522     --
12523     l_result_type_cd   varchar2(30) :=  'DISPLAY' ;
12524     -- Cursor to get mirror_src_entity_result_id
12525     cursor c_parent_result(c_parent_pk_id number,
12526                         c_parent_table_alias varchar2,
12527                         c_copy_entity_txn_id number) is
12528     select copy_entity_result_id mirror_src_entity_result_id
12529     from ben_copy_entity_results cpe
12530 --         pqh_table_route trt
12531     where cpe.information1        = c_parent_pk_id
12532     and   cpe.result_type_cd      = l_result_type_cd
12533     and   cpe.copy_entity_txn_id  = c_copy_entity_txn_id
12534 --    and   cpe.table_route_id      = trt.table_route_id
12535     and   cpe.table_alias         = c_parent_table_alias;
12536     --
12537     -- Bug : 3752407 : Global cursor g_table_route will now be used
12538     -- Cursor to get table_route_id
12539     --
12540     -- cursor c_table_route(c_parent_table_alias varchar2) is
12541     -- select table_route_id
12542     -- from pqh_table_route trt
12543     -- where trt.table_alias         = c_parent_table_alias;
12544     --
12545    ---------------------------------------------------------------
12546    -- START OF BEN_YR_PERD ----------------------
12547    ---------------------------------------------------------------
12548 
12549    cursor c_yrp(c_yr_perd_id number,c_mirror_src_entity_result_id number,
12550                 c_table_alias varchar2) is
12551    select  yrp.*
12552    from BEN_YR_PERD yrp
12553    where  yrp.yr_perd_id = c_yr_perd_id
12554      -- and yrp.business_group_id = p_business_group_id
12555      and not exists (
12556          select /*+  */ null
12557          from ben_copy_entity_results cpe
12558 --              pqh_table_route trt
12559          where copy_entity_txn_id = p_copy_entity_txn_id
12560 --           and trt.table_route_id = cpe.table_route_id
12561            and ( -- c_mirror_src_entity_result_id is null or
12562                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
12563            -- and trt.where_clause = 'BEN_YR_PERD'
12564            and cpe.table_alias = c_table_alias
12565            and information1 = c_yr_perd_id
12566            -- and information4 = yrp.business_group_id
12567     );
12568     l_out_yrp_result_id  number(15);
12569     ---------------------------------------------------------------
12570     -- END OF BEN_YR_PERD ----------------------
12571     ---------------------------------------------------------------
12572     ---
12573     ---------------------------------------------------------------
12574     -- START OF BEN_WTHN_YR_PERD ----------------------
12575     ---------------------------------------------------------------
12576     cursor c_wyp_from_parent(c_YR_PERD_ID number) is
12577     select  wthn_yr_perd_id
12578     from BEN_WTHN_YR_PERD
12579     where  YR_PERD_ID = c_YR_PERD_ID ;
12580     --
12581     cursor c_wyp(c_wthn_yr_perd_id number,c_mirror_src_entity_result_id number,
12582                 c_table_alias varchar2) is
12583     select  wyp.*
12584     from BEN_WTHN_YR_PERD wyp
12585     where  wyp.wthn_yr_perd_id = c_wthn_yr_perd_id
12586      -- and wyp.business_group_id = p_business_group_id
12587      and not exists (
12588          select /*+  */ null
12589          from ben_copy_entity_results cpe
12590 --              pqh_table_route trt
12591          where copy_entity_txn_id = p_copy_entity_txn_id
12592 --           and trt.table_route_id = cpe.table_route_id
12593            and ( -- c_mirror_src_entity_result_id is null or
12594                  mirror_src_entity_result_id = c_mirror_src_entity_result_id )
12595            -- and trt.where_clause = 'BEN_WTHN_YR_PERD'
12596            and cpe.table_alias = c_table_alias
12597            and information1 = c_wthn_yr_perd_id
12598            -- and information4 = wyp.business_group_id
12599      );
12600      l_out_wyp_result_id  number(15);
12601     ---------------------------------------------------------------
12602     -- END OF BEN_WTHN_YR_PERD ----------------------
12603     ---------------------------------------------------------------
12604 
12605     l_yr_perd_id                number(15);
12606     l_wthn_yr_perd_id           number(15);
12607 
12608     cursor c_object_exists(c_pk_id                number,
12609                           c_table_alias          varchar2) is
12610     select null
12611     from ben_copy_entity_results cpe
12612 --         pqh_table_route trt
12613     where copy_entity_txn_id = p_copy_entity_txn_id
12614 --    and trt.table_route_id = cpe.table_route_id
12615     and cpe.table_alias = c_table_alias
12616     and information1 = c_pk_id;
12617 
12618    l_dummy                     varchar2(1);
12619 
12620    l_mirror_src_entity_result_id    number(15);
12621    l_parent_entity_result_id        number(15);
12622    l_table_route_id                 number(15);
12623    l_information5                   ben_copy_entity_results.information5%TYPE;
12624    l_number_of_copies               number := p_number_of_copies ;
12625    --
12626 
12627 begin
12628   --
12629   ---------------------------------------------------------------
12630   -- START OF BEN_YR_PERD ----------------------
12631   ---------------------------------------------------------------
12632 
12633     if p_no_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
12634       ben_plan_design_program_module.g_pdw_allow_dup_rslt := ben_plan_design_program_module.g_pdw_no_dup_rslt;
12635     end if;
12636 
12637     l_mirror_src_entity_result_id := p_copy_entity_result_id ;
12638 
12639     l_yr_perd_id := p_yr_perd_id ;
12640 
12641     if ben_plan_design_program_module.g_pdw_allow_dup_rslt = ben_plan_design_program_module.g_pdw_no_dup_rslt then
12642       open c_object_exists(l_yr_perd_id,'YRP');
12643       fetch c_object_exists into l_dummy;
12644       if c_object_exists%found then
12645         close c_object_exists;
12646         return;
12647       end if;
12648       close c_object_exists;
12649     end if;
12650 
12651     --
12652     for l_yrp_rec in c_yrp(l_yr_perd_id,l_mirror_src_entity_result_id,'YRP') loop
12653     --
12654     --
12655       l_table_route_id := null ;
12656       open ben_plan_design_program_module.g_table_route('YRP');
12657       fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
12658       close ben_plan_design_program_module.g_table_route ;
12659       --
12660       l_information5  := TO_CHAR(l_yrp_rec.start_date,'DD-Mon-YYYY')||' -  '||
12661                          TO_CHAR(l_yrp_rec.end_date,'DD-Mon-YYYY'); --'Intersection';
12662       --
12663 
12664       l_result_type_cd := 'DISPLAY';
12665       --
12666       l_copy_entity_result_id := null;
12667       l_object_version_number := null;
12668       ben_copy_entity_results_api.create_copy_entity_results(
12669         p_copy_entity_result_id           => l_copy_entity_result_id,
12670         p_copy_entity_txn_id             => p_copy_entity_txn_id,
12671         p_result_type_cd                 => l_result_type_cd,
12672         p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
12673         p_parent_entity_result_id        => l_mirror_src_entity_result_id,
12674         p_number_of_copies               => l_number_of_copies,
12675         p_table_alias					 => 'YRP',
12676         p_table_route_id                 => l_table_route_id,
12677         p_information1     => l_yrp_rec.yr_perd_id,
12678         p_information2     => null,
12679         p_information3     => null,
12680         p_information4     => l_yrp_rec.business_group_id,
12681         p_information5     => l_information5 , -- 9999 put name for h-grid
12682         p_information308     => l_yrp_rec.end_date,
12683         p_information311     => l_yrp_rec.lmtn_yr_end_dt,
12684         p_information310     => l_yrp_rec.lmtn_yr_strt_dt,
12685         p_information11     => l_yrp_rec.perd_tm_uom_cd,
12686         p_information12     => l_yrp_rec.perd_typ_cd,
12687         p_information260     => l_yrp_rec.perds_in_yr_num,
12688         p_information309     => l_yrp_rec.start_date,
12689         p_information111     => l_yrp_rec.yrp_attribute1,
12690         p_information120     => l_yrp_rec.yrp_attribute10,
12691         p_information121     => l_yrp_rec.yrp_attribute11,
12692         p_information122     => l_yrp_rec.yrp_attribute12,
12693         p_information123     => l_yrp_rec.yrp_attribute13,
12694         p_information124     => l_yrp_rec.yrp_attribute14,
12695         p_information125     => l_yrp_rec.yrp_attribute15,
12696         p_information126     => l_yrp_rec.yrp_attribute16,
12697         p_information127     => l_yrp_rec.yrp_attribute17,
12698         p_information128     => l_yrp_rec.yrp_attribute18,
12699         p_information129     => l_yrp_rec.yrp_attribute19,
12700         p_information112     => l_yrp_rec.yrp_attribute2,
12701         p_information130     => l_yrp_rec.yrp_attribute20,
12702         p_information131     => l_yrp_rec.yrp_attribute21,
12703         p_information132     => l_yrp_rec.yrp_attribute22,
12704         p_information133     => l_yrp_rec.yrp_attribute23,
12705         p_information134     => l_yrp_rec.yrp_attribute24,
12706         p_information135     => l_yrp_rec.yrp_attribute25,
12707         p_information136     => l_yrp_rec.yrp_attribute26,
12708         p_information137     => l_yrp_rec.yrp_attribute27,
12709         p_information138     => l_yrp_rec.yrp_attribute28,
12710         p_information139     => l_yrp_rec.yrp_attribute29,
12711         p_information113     => l_yrp_rec.yrp_attribute3,
12712         p_information140     => l_yrp_rec.yrp_attribute30,
12713         p_information114     => l_yrp_rec.yrp_attribute4,
12714         p_information115     => l_yrp_rec.yrp_attribute5,
12715         p_information116     => l_yrp_rec.yrp_attribute6,
12716         p_information117     => l_yrp_rec.yrp_attribute7,
12717         p_information118     => l_yrp_rec.yrp_attribute8,
12718         p_information119     => l_yrp_rec.yrp_attribute9,
12719         p_information110     => l_yrp_rec.yrp_attribute_category,
12720         p_information265     => l_yrp_rec.object_version_number,
12721         p_object_version_number          => l_object_version_number,
12722         p_effective_date                 => p_effective_date       );
12723         --
12724 
12725       if l_out_yrp_result_id is null then
12726         l_out_yrp_result_id := l_copy_entity_result_id;
12727       end if;
12728 
12729       if l_result_type_cd = 'DISPLAY' then
12730         l_out_yrp_result_id := l_copy_entity_result_id ;
12731       end if;
12732     end loop;
12733     --
12734     -- Create within year period only if year period row
12735     -- has been created
12736     --
12737 
12738     if l_out_yrp_result_id is not null then
12739     --
12740      ---------------------------------------------------------------
12741      -- START OF BEN_WTHN_YR_PERD ----------------------
12742      ---------------------------------------------------------------
12743      --
12744      for l_parent_rec  in c_wyp_from_parent(l_YR_PERD_ID) loop
12745      --
12746       l_mirror_src_entity_result_id := l_out_yrp_result_id ;
12747 
12748       l_wthn_yr_perd_id := l_parent_rec.wthn_yr_perd_id ;
12749       --
12750       for l_wyp_rec in c_wyp(l_parent_rec.wthn_yr_perd_id,l_mirror_src_entity_result_id,'WYP') loop
12751       --
12752       --
12753         l_table_route_id := null ;
12754         open ben_plan_design_program_module.g_table_route('WYP');
12755         fetch ben_plan_design_program_module.g_table_route into l_table_route_id ;
12756         close ben_plan_design_program_module.g_table_route ;
12757         --
12758         l_information5  := TO_CHAR(l_wyp_rec.strt_mo) || '/' || TO_CHAR(l_wyp_rec.strt_day)|| ' - ' ||
12759                            TO_CHAR(l_wyp_rec.end_mo) || '/' || TO_CHAR(l_wyp_rec.end_day); --'Intersection';
12760         --
12761         l_result_type_cd := 'DISPLAY';
12762         --
12763         l_copy_entity_result_id := null;
12764         l_object_version_number := null;
12765         ben_copy_entity_results_api.create_copy_entity_results(
12766           p_copy_entity_result_id           => l_copy_entity_result_id,
12767           p_copy_entity_txn_id             => p_copy_entity_txn_id,
12768           p_result_type_cd                 => l_result_type_cd,
12769           p_mirror_src_entity_result_id        => l_mirror_src_entity_result_id,
12770           p_parent_entity_result_id        => l_mirror_src_entity_result_id,
12771           p_number_of_copies               => l_number_of_copies,
12772           p_table_alias					 => 'WYP',
12773           p_table_route_id                 => l_table_route_id,
12774           p_information1     => l_wyp_rec.wthn_yr_perd_id,
12775           p_information2     => null,
12776           p_information3     => null,
12777           p_information4     => l_wyp_rec.business_group_id,
12778           p_information5     => l_information5 , -- 9999 put name for h-grid
12779           p_information294     => l_wyp_rec.end_day,
12780           p_information296     => l_wyp_rec.end_mo,
12781           p_information293     => l_wyp_rec.strt_day,
12782           p_information295     => l_wyp_rec.strt_mo,
12783           p_information11     => l_wyp_rec.tm_uom,
12784           p_information111     => l_wyp_rec.wyp_attribute1,
12785           p_information120     => l_wyp_rec.wyp_attribute10,
12786           p_information121     => l_wyp_rec.wyp_attribute11,
12787           p_information122     => l_wyp_rec.wyp_attribute12,
12788           p_information123     => l_wyp_rec.wyp_attribute13,
12789           p_information124     => l_wyp_rec.wyp_attribute14,
12790           p_information125     => l_wyp_rec.wyp_attribute15,
12791           p_information126     => l_wyp_rec.wyp_attribute16,
12792           p_information127     => l_wyp_rec.wyp_attribute17,
12793           p_information128     => l_wyp_rec.wyp_attribute18,
12794           p_information129     => l_wyp_rec.wyp_attribute19,
12795           p_information112     => l_wyp_rec.wyp_attribute2,
12796           p_information130     => l_wyp_rec.wyp_attribute20,
12797           p_information131     => l_wyp_rec.wyp_attribute21,
12798           p_information132     => l_wyp_rec.wyp_attribute22,
12799           p_information133     => l_wyp_rec.wyp_attribute23,
12800           p_information134     => l_wyp_rec.wyp_attribute24,
12801           p_information135     => l_wyp_rec.wyp_attribute25,
12802           p_information136     => l_wyp_rec.wyp_attribute26,
12803           p_information137     => l_wyp_rec.wyp_attribute27,
12804           p_information138     => l_wyp_rec.wyp_attribute28,
12805           p_information139     => l_wyp_rec.wyp_attribute29,
12806           p_information113     => l_wyp_rec.wyp_attribute3,
12807           p_information140     => l_wyp_rec.wyp_attribute30,
12808           p_information114     => l_wyp_rec.wyp_attribute4,
12809           p_information115     => l_wyp_rec.wyp_attribute5,
12810           p_information116     => l_wyp_rec.wyp_attribute6,
12811           p_information117     => l_wyp_rec.wyp_attribute7,
12812           p_information118     => l_wyp_rec.wyp_attribute8,
12813           p_information119     => l_wyp_rec.wyp_attribute9,
12814           p_information110     => l_wyp_rec.wyp_attribute_category,
12815           p_information240     => l_wyp_rec.yr_perd_id,
12816           p_information265     => l_wyp_rec.object_version_number,
12817           p_object_version_number          => l_object_version_number,
12818           p_effective_date                 => p_effective_date       );
12819           --
12820 
12821         if l_out_wyp_result_id is null then
12822           l_out_wyp_result_id := l_copy_entity_result_id;
12823         end if;
12824 
12825         if l_result_type_cd = 'DISPLAY' then
12826           l_out_wyp_result_id := l_copy_entity_result_id ;
12827         end if;
12828       end loop;
12829       --
12830      end loop;
12831      ---------------------------------------------------------------
12832      -- END OF BEN_WTHN_YR_PERD ----------------------
12833      ---------------------------------------------------------------
12834     end if;
12835   ---------------------------------------------------------------
12836   -- END OF BEN_YR_PERD ----------------------
12837   ---------------------------------------------------------------
12838 
12839   --
12840 end create_yr_perd_result ;
12841 
12842 end ben_plan_design_plan_module;