DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CTP_INS

Source


1 Package Body ben_ctp_ins as
2 /* $Header: bectprhi.pkb 120.0.12020000.2 2012/07/03 12:06:46 amnaraya ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_ctp_ins.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_insert_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml insert logic for datetrack. The
17 --   functions of this procedure are as follows:
18 --   1) Get the object_version_number.
19 --   2) To set the effective start and end dates to the corresponding
20 --      validation start and end dates. Also, the object version number
21 --      record attribute is set.
22 --   3) To set and unset the g_api_dml status as required (as we are about to
23 --      perform dml).
24 --   4) To insert the row into the schema with the derived effective start
25 --      and end dates and the object version number.
26 --   5) To trap any constraint violations that may have occurred.
27 --   6) To raise any other errors.
28 --
29 -- Prerequisites:
30 --   This is an internal private procedure which must be called from the
31 --   insert_dml and pre_update (logic permitting) procedure and must have
32 --   all mandatory arguments set.
33 --
34 -- In Parameters:
35 --   A Pl/Sql record structre.
36 --
37 -- Post Success:
38 --   The specified row will be inserted into the schema.
39 --
40 -- Post Failure:
41 --   On the insert dml failure it is important to note that we always reset the
42 --   g_api_dml status to false.
43 --   If a check or unique integrity constraint violation is raised the
44 --   constraint_error procedure will be called.
45 --   If any other error is reported, the error will be raised after the
46 --   g_api_dml status is reset.
47 --
48 -- Developer Implementation Notes:
49 --   This is an internal datetrack maintenance procedure which should
50 --   not be modified in anyway.
51 --
52 -- Access Status:
53 --   Internal Row Handler Use Only.
54 --
55 -- {End Of Comments}
56 -- ----------------------------------------------------------------------------
57 Procedure dt_insert_dml
58 	(p_rec 			 in out nocopy ben_ctp_shd.g_rec_type,
59 	 p_effective_date	 in	date,
60 	 p_datetrack_mode	 in	varchar2,
61 	 p_validation_start_date in	date,
62 	 p_validation_end_date	 in	date) is
63 --
64 -- Cursor to select 'old' created AOL who column values
65 --
66   Cursor C_Sel1 Is
67     select t.created_by,
68            t.creation_date
69     from   ben_ptip_f t
70     where  t.ptip_id       = p_rec.ptip_id
71     and    t.effective_start_date =
72              ben_ctp_shd.g_old_rec.effective_start_date
73     and    t.effective_end_date   = (p_validation_start_date - 1);
74 --
75   l_proc		varchar2(72) := g_package||'dt_insert_dml';
76   l_created_by          ben_ptip_f.created_by%TYPE;
77   l_creation_date       ben_ptip_f.creation_date%TYPE;
78   l_last_update_date   	ben_ptip_f.last_update_date%TYPE;
79   l_last_updated_by     ben_ptip_f.last_updated_by%TYPE;
80   l_last_update_login   ben_ptip_f.last_update_login%TYPE;
81 --
82 Begin
83   hr_utility.set_location('Entering:'||l_proc, 5);
84   --
88     dt_api.get_object_version_number
85   -- Get the object version number for the insert
86   --
87   p_rec.object_version_number :=
89 	(p_base_table_name => 'ben_ptip_f',
90 	 p_base_key_column => 'ptip_id',
91 	 p_base_key_value  => p_rec.ptip_id);
92   --
93   -- Set the effective start and end dates to the corresponding
94   -- validation start and end dates
95   --
96   p_rec.effective_start_date := p_validation_start_date;
97   p_rec.effective_end_date   := p_validation_end_date;
98   --
99   -- If the datetrack_mode is not INSERT then we must populate the WHO
100   -- columns with the 'old' creation values and 'new' updated values.
101   --
102   If (p_datetrack_mode <> 'INSERT') then
103     hr_utility.set_location(l_proc, 10);
104     --
105     -- Select the 'old' created values
106     --
107     Open C_Sel1;
108     Fetch C_Sel1 Into l_created_by, l_creation_date;
109     If C_Sel1%notfound Then
110       --
111       -- The previous 'old' created row has not been found. We need
112       -- to error as an internal datetrack problem exists.
113       --
114       Close C_Sel1;
115       fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
116       fnd_message.set_token('PROCEDURE', l_proc);
117       fnd_message.set_token('STEP','10');
118       fnd_message.raise_error;
119     End If;
120     Close C_Sel1;
121     --
122     -- Set the AOL updated WHO values
123     --
124     l_last_update_date   := sysdate;
125     l_last_updated_by    := fnd_global.user_id;
126     l_last_update_login  := fnd_global.login_id;
127   End If;
128   --
129   ben_ctp_shd.g_api_dml := true;  -- Set the api dml status
130   --
131   -- Insert the row into: ben_ptip_f
132   --
133   insert into ben_ptip_f
134   (	ptip_id,
135 	effective_start_date,
136 	effective_end_date,
137 	business_group_id,
138 	pgm_id,
139         cmbn_ptip_id,
140         cmbn_ptip_opt_id,
141         acrs_ptip_cvg_id,
142 	pl_typ_id,
143 	coord_cvg_for_all_pls_flag,
144 	dpnt_dsgn_cd,
145         dpnt_cvg_strt_dt_rl,
146         dpnt_cvg_end_dt_rl,
147         postelcn_edit_rl,
148         rt_end_dt_rl,
149         rt_strt_dt_rl,
150         enrt_cvg_end_dt_rl,
151         enrt_cvg_strt_dt_rl,
152         rqd_perd_enrt_nenrt_rl,
153         auto_enrt_mthd_rl,
154         enrt_mthd_cd,
155         enrt_cd,
156         enrt_rl,
157         dflt_enrt_cd,
158         dflt_enrt_det_rl,
159         drvbl_fctr_apls_rts_flag,
160         drvbl_fctr_prtn_elig_flag,
161         elig_apls_flag,
162         prtn_elig_ovrid_alwd_flag,
163         trk_inelig_per_flag,
164         dpnt_cvg_strt_dt_cd,
165         rt_end_dt_cd,
166         rt_strt_dt_cd,
167         enrt_cvg_end_dt_cd,
168         enrt_cvg_strt_dt_cd,
169         dpnt_cvg_end_dt_cd,
170 	crs_this_pl_typ_only_flag,
171 	ptip_stat_cd,
172 	mx_cvg_alwd_amt,
173 	mx_enrd_alwd_ovrid_num,
174 	mn_enrd_rqd_ovrid_num,
175 	no_mx_pl_typ_ovrid_flag,
176 	ordr_num,
177 	prvds_cr_flag,
178 	rqd_perd_enrt_nenrt_val,
179 	rqd_perd_enrt_nenrt_tm_uom,
180 	wvbl_flag,
181         dpnt_adrs_rqd_flag,
182         dpnt_cvg_no_ctfn_rqd_flag,
183         dpnt_dob_rqd_flag,
184         dpnt_legv_id_rqd_flag,
185         susp_if_dpnt_ssn_nt_prv_cd,
186         susp_if_dpnt_dob_nt_prv_cd,
187         susp_if_dpnt_adr_nt_prv_cd,
188         susp_if_ctfn_not_dpnt_flag,
189         dpnt_ctfn_determine_cd,
190 	drvd_fctr_dpnt_cvg_flag,
191 	no_mn_pl_typ_overid_flag,
192       sbj_to_sps_lf_ins_mx_flag,
193       sbj_to_dpnt_lf_ins_mx_flag,
194       use_to_sum_ee_lf_ins_flag,
195       per_cvrd_cd,
196       short_name,
197       short_code ,
198             legislation_code ,
199             legislation_subgroup ,
200       vrfy_fmly_mmbr_cd,
201       vrfy_fmly_mmbr_rl,
202 	ivr_ident,
203         url_ref_name,
204 	rqd_enrt_perd_tco_cd,
205 	ctp_attribute_category,
206 	ctp_attribute1,
207 	ctp_attribute2,
208 	ctp_attribute3,
209 	ctp_attribute4,
210 	ctp_attribute5,
211 	ctp_attribute6,
212 	ctp_attribute7,
213 	ctp_attribute8,
214 	ctp_attribute9,
215 	ctp_attribute10,
216 	ctp_attribute11,
217 	ctp_attribute12,
218 	ctp_attribute13,
219 	ctp_attribute14,
220 	ctp_attribute15,
221 	ctp_attribute16,
222 	ctp_attribute17,
223 	ctp_attribute18,
224 	ctp_attribute19,
225 	ctp_attribute20,
226 	ctp_attribute21,
227 	ctp_attribute22,
228 	ctp_attribute23,
229 	ctp_attribute24,
230 	ctp_attribute25,
231 	ctp_attribute26,
232 	ctp_attribute27,
233 	ctp_attribute28,
234 	ctp_attribute29,
235 	ctp_attribute30,
236 	object_version_number
237    	, created_by,
238    	creation_date,
239    	last_update_date,
240    	last_updated_by,
241    	last_update_login,
242 	all_inelig
243   )
244   Values
245   (	p_rec.ptip_id,
246 	p_rec.effective_start_date,
247 	p_rec.effective_end_date,
248 	p_rec.business_group_id,
249 	p_rec.pgm_id,
250         p_rec.cmbn_ptip_id,
251         p_rec.cmbn_ptip_opt_id,
252         p_rec.acrs_ptip_cvg_id,
253 	p_rec.pl_typ_id,
254 	p_rec.coord_cvg_for_all_pls_flag,
255 	p_rec.dpnt_dsgn_cd,
256         p_rec.dpnt_cvg_strt_dt_rl,
257         p_rec.dpnt_cvg_end_dt_rl,
258         p_rec.postelcn_edit_rl,
259         p_rec.rt_end_dt_rl,
260         p_rec.rt_strt_dt_rl,
261         p_rec.enrt_cvg_end_dt_rl,
265         p_rec.enrt_mthd_cd,
262         p_rec.enrt_cvg_strt_dt_rl,
263         p_rec.rqd_perd_enrt_nenrt_rl,
264         p_rec.auto_enrt_mthd_rl,
266         p_rec.enrt_cd,
267         p_rec.enrt_rl,
268         p_rec.dflt_enrt_cd,
269         p_rec.dflt_enrt_det_rl,
270         p_rec.drvbl_fctr_apls_rts_flag,
271         p_rec.drvbl_fctr_prtn_elig_flag,
272         p_rec.elig_apls_flag,
273         p_rec.prtn_elig_ovrid_alwd_flag,
274         p_rec.trk_inelig_per_flag,
275         p_rec.dpnt_cvg_strt_dt_cd,
276         p_rec.rt_end_dt_cd,
277         p_rec.rt_strt_dt_cd,
278         p_rec.enrt_cvg_end_dt_cd,
279         p_rec.enrt_cvg_strt_dt_cd,
280         p_rec.dpnt_cvg_end_dt_cd,
281 	p_rec.crs_this_pl_typ_only_flag,
282 	p_rec.ptip_stat_cd,
283 	p_rec.mx_cvg_alwd_amt,
284 	p_rec.mx_enrd_alwd_ovrid_num,
285 	p_rec.mn_enrd_rqd_ovrid_num,
286 	p_rec.no_mx_pl_typ_ovrid_flag,
287 	p_rec.ordr_num,
288 	p_rec.prvds_cr_flag,
289 	p_rec.rqd_perd_enrt_nenrt_val,
290 	p_rec.rqd_perd_enrt_nenrt_tm_uom,
291 	p_rec.wvbl_flag,
292         p_rec.dpnt_adrs_rqd_flag,
293         p_rec.dpnt_cvg_no_ctfn_rqd_flag,
294         p_rec.dpnt_dob_rqd_flag,
295         p_rec.dpnt_legv_id_rqd_flag,
296         p_rec.susp_if_dpnt_ssn_nt_prv_cd,
297         p_rec.susp_if_dpnt_dob_nt_prv_cd,
298         p_rec.susp_if_dpnt_adr_nt_prv_cd,
299         p_rec.susp_if_ctfn_not_dpnt_flag,
300         p_rec.dpnt_ctfn_determine_cd,
301 	p_rec.drvd_fctr_dpnt_cvg_flag,
302 	p_rec.no_mn_pl_typ_overid_flag,
303       p_rec.sbj_to_sps_lf_ins_mx_flag,
304       p_rec.sbj_to_dpnt_lf_ins_mx_flag,
305       p_rec.use_to_sum_ee_lf_ins_flag,
306       p_rec.per_cvrd_cd,
307       p_rec.short_name,
308       p_rec.short_code,
309             p_rec.legislation_code,
310             p_rec.legislation_subgroup,
311       p_rec.vrfy_fmly_mmbr_cd,
312       p_rec.vrfy_fmly_mmbr_rl,
313 	p_rec.ivr_ident,
314         p_rec.url_ref_name,
315 	p_rec.rqd_enrt_perd_tco_cd,
316 	p_rec.ctp_attribute_category,
317 	p_rec.ctp_attribute1,
318 	p_rec.ctp_attribute2,
319 	p_rec.ctp_attribute3,
320 	p_rec.ctp_attribute4,
321 	p_rec.ctp_attribute5,
322 	p_rec.ctp_attribute6,
323 	p_rec.ctp_attribute7,
324 	p_rec.ctp_attribute8,
325 	p_rec.ctp_attribute9,
326 	p_rec.ctp_attribute10,
327 	p_rec.ctp_attribute11,
328 	p_rec.ctp_attribute12,
329 	p_rec.ctp_attribute13,
330 	p_rec.ctp_attribute14,
331 	p_rec.ctp_attribute15,
332 	p_rec.ctp_attribute16,
333 	p_rec.ctp_attribute17,
334 	p_rec.ctp_attribute18,
335 	p_rec.ctp_attribute19,
336 	p_rec.ctp_attribute20,
337 	p_rec.ctp_attribute21,
338 	p_rec.ctp_attribute22,
339 	p_rec.ctp_attribute23,
340 	p_rec.ctp_attribute24,
341 	p_rec.ctp_attribute25,
342 	p_rec.ctp_attribute26,
343 	p_rec.ctp_attribute27,
344 	p_rec.ctp_attribute28,
345 	p_rec.ctp_attribute29,
346 	p_rec.ctp_attribute30,
347 	p_rec.object_version_number
348 	, l_created_by,
349    	l_creation_date,
350    	l_last_update_date,
351    	l_last_updated_by,
352    	l_last_update_login,
353 	p_rec.all_inelig
354   );
355   --
356   ben_ctp_shd.g_api_dml := false;   -- Unset the api dml status
357   hr_utility.set_location(' Leaving:'||l_proc, 15);
358 --
359 Exception
360   When hr_api.check_integrity_violated Then
361     -- A check constraint has been violated
362     ben_ctp_shd.g_api_dml := false;   -- Unset the api dml status
363     ben_ctp_shd.constraint_error
364       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
365   When hr_api.unique_integrity_violated Then
366     -- Unique integrity has been violated
367     ben_ctp_shd.g_api_dml := false;   -- Unset the api dml status
368     ben_ctp_shd.constraint_error
369       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
370   When Others Then
371     ben_ctp_shd.g_api_dml := false;   -- Unset the api dml status
372     Raise;
373 End dt_insert_dml;
374 --
375 -- ----------------------------------------------------------------------------
376 -- |------------------------------< insert_dml >------------------------------|
377 -- ----------------------------------------------------------------------------
378 Procedure insert_dml
379 	(p_rec 			 in out nocopy ben_ctp_shd.g_rec_type,
380 	 p_effective_date	 in	date,
381 	 p_datetrack_mode	 in	varchar2,
382 	 p_validation_start_date in	date,
383 	 p_validation_end_date	 in	date) is
384 --
385   l_proc	varchar2(72) := g_package||'insert_dml';
386 --
387 Begin
388   hr_utility.set_location('Entering:'||l_proc, 5);
389   --
390   dt_insert_dml(p_rec			=> p_rec,
391 		p_effective_date	=> p_effective_date,
392 		p_datetrack_mode	=> p_datetrack_mode,
393        		p_validation_start_date	=> p_validation_start_date,
394 		p_validation_end_date	=> p_validation_end_date);
395   --
396   hr_utility.set_location(' Leaving:'||l_proc, 10);
397 End insert_dml;
398 --
399 -- ----------------------------------------------------------------------------
400 -- |------------------------------< pre_insert >------------------------------|
401 -- ----------------------------------------------------------------------------
402 -- {Start Of Comments}
403 --
404 -- Description:
405 --   This private procedure contains any processing which is required before
406 --   the insert dml. Presently, if the entity has a corresponding primary
407 --   key which is maintained by an associating sequence, the primary key for
408 --   the entity will be populated with the next sequence value in
409 --   preparation for the insert dml.
413 -- Prerequisites:
410 --   Also, if comments are defined for this entity, the comments insert
411 --   logic will also be called, generating a comment_id if required.
412 --
414 --   This is an internal procedure which is called from the ins procedure.
415 --
416 -- In Parameters:
417 --   A Pl/Sql record structre.
418 --
419 -- Post Success:
420 --   Processing continues.
421 --
422 -- Post Failure:
423 --   If an error has occurred, an error message and exception will be raised
424 --   but not handled.
425 --
426 -- Developer Implementation Notes:
427 --   Any pre-processing required before the insert dml is issued should be
428 --   coded within this procedure. As stated above, a good example is the
429 --   generation of a primary key number via a corresponding sequence.
430 --   It is important to note that any 3rd party maintenance should be reviewed
431 --   before placing in this procedure.
432 --
433 -- Access Status:
434 --   Internal Row Handler Use Only.
435 --
436 -- {End Of Comments}
437 -- ----------------------------------------------------------------------------
438 Procedure pre_insert
439 	(p_rec  			in out nocopy ben_ctp_shd.g_rec_type,
440 	 p_effective_date		in date,
441 	 p_datetrack_mode		in varchar2,
442 	 p_validation_start_date	in date,
443 	 p_validation_end_date		in date) is
444 --
445   l_proc	varchar2(72) := g_package||'pre_insert';
446 --
447 --
448   cursor c1 is select ben_ptip_f_s.nextval
449                from sys.dual;
450 --
451 Begin
452   hr_utility.set_location('Entering:'||l_proc, 5);
453   --
454   --
455   open c1;
456   fetch c1 into p_rec.ptip_id;
457   close c1;
458   --
459   --
460   hr_utility.set_location(' Leaving:'||l_proc, 10);
461 End pre_insert;
462 --
463 -- ----------------------------------------------------------------------------
464 -- |-----------------------------< post_insert >------------------------------|
465 -- ----------------------------------------------------------------------------
466 -- {Start Of Comments}
467 --
468 -- Description:
469 --   This private procedure contains any processing which is required after the
470 --   insert dml.
471 --
472 -- Prerequisites:
473 --   This is an internal procedure which is called from the ins procedure.
474 --
475 -- In Parameters:
476 --   A Pl/Sql record structre.
477 --
478 -- Post Success:
479 --   Processing continues.
480 --
481 -- Post Failure:
482 --   If an error has occurred, an error message and exception will be raised
483 --   but not handled.
484 --
485 -- Developer Implementation Notes:
486 --   Any post-processing required after the insert dml is issued should be
487 --   coded within this procedure. It is important to note that any 3rd party
488 --   maintenance should be reviewed before placing in this procedure.
489 --
490 -- Access Status:
491 --   Internal Row Handler Use Only.
492 --
493 -- {End Of Comments}
494 -- ----------------------------------------------------------------------------
495 Procedure post_insert
496 	(p_rec 			 in ben_ctp_shd.g_rec_type,
497 	 p_effective_date	 in date,
498 	 p_datetrack_mode	 in varchar2,
499 	 p_validation_start_date in date,
500 	 p_validation_end_date	 in date) is
501 --
502   l_proc	varchar2(72) := g_package||'post_insert';
503 --
504 Begin
505   hr_utility.set_location('Entering:'||l_proc, 5);
506 --
507   --
508   -- Start of API User Hook for post_insert.
509   --
510   begin
511     --
512     ben_ctp_rki.after_insert
513       (
514   p_ptip_id                       =>p_rec.ptip_id
515  ,p_effective_start_date          =>p_rec.effective_start_date
516  ,p_effective_end_date            =>p_rec.effective_end_date
517  ,p_business_group_id             =>p_rec.business_group_id
518  ,p_pgm_id                        =>p_rec.pgm_id
519  ,p_cmbn_ptip_id                  =>p_rec.cmbn_ptip_id
520  ,p_cmbn_ptip_opt_id              =>p_rec.cmbn_ptip_opt_id
521  ,p_acrs_ptip_cvg_id              =>p_rec.acrs_ptip_cvg_id
522  ,p_pl_typ_id                     =>p_rec.pl_typ_id
523  ,p_coord_cvg_for_all_pls_flag    =>p_rec.coord_cvg_for_all_pls_flag
524  ,p_dpnt_dsgn_cd                  =>p_rec.dpnt_dsgn_cd
525  ,p_dpnt_cvg_strt_dt_rl           =>p_rec.dpnt_cvg_strt_dt_rl
526  ,p_dpnt_cvg_end_dt_rl            =>p_rec.dpnt_cvg_end_dt_rl
527  ,p_postelcn_edit_rl              =>p_rec.postelcn_edit_rl
528  ,p_rt_end_dt_rl                  =>p_rec.rt_end_dt_rl
529  ,p_rt_strt_dt_rl                 =>p_rec.rt_strt_dt_rl
530  ,p_enrt_cvg_end_dt_rl            =>p_rec.enrt_cvg_end_dt_rl
531  ,p_enrt_cvg_strt_dt_rl           =>p_rec.enrt_cvg_strt_dt_rl
532  ,p_rqd_perd_enrt_nenrt_rl        =>p_rec.rqd_perd_enrt_nenrt_rl
533  ,p_auto_enrt_mthd_rl             =>p_rec.auto_enrt_mthd_rl
534  ,p_enrt_mthd_cd                  =>p_rec.enrt_mthd_cd
535  ,p_enrt_cd                       =>p_rec.enrt_cd
536  ,p_enrt_rl                       =>p_rec.enrt_rl
537  ,p_dflt_enrt_cd                  =>p_rec.dflt_enrt_cd
538  ,p_dflt_enrt_det_rl              =>p_rec.dflt_enrt_det_rl
539  ,p_drvbl_fctr_apls_rts_flag      =>p_rec.drvbl_fctr_apls_rts_flag
540  ,p_drvbl_fctr_prtn_elig_flag     =>p_rec.drvbl_fctr_prtn_elig_flag
541  ,p_elig_apls_flag                =>p_rec.elig_apls_flag
542  ,p_prtn_elig_ovrid_alwd_flag     =>p_rec.prtn_elig_ovrid_alwd_flag
543  ,p_trk_inelig_per_flag           =>p_rec.trk_inelig_per_flag
544  ,p_rt_end_dt_cd                  =>p_rec.rt_end_dt_cd
545  ,p_rt_strt_dt_cd                 =>p_rec.rt_strt_dt_cd
546  ,p_enrt_cvg_end_dt_cd            =>p_rec.enrt_cvg_end_dt_cd
550  ,p_crs_this_pl_typ_only_flag     =>p_rec.crs_this_pl_typ_only_flag
547  ,p_enrt_cvg_strt_dt_cd           =>p_rec.enrt_cvg_strt_dt_cd
548  ,p_dpnt_cvg_end_dt_cd            =>p_rec.dpnt_cvg_end_dt_cd
549  ,p_dpnt_cvg_strt_dt_cd           =>p_rec.dpnt_cvg_strt_dt_cd
551  ,p_ptip_stat_cd                  =>p_rec.ptip_stat_cd
552  ,p_mx_cvg_alwd_amt               =>p_rec.mx_cvg_alwd_amt
553  ,p_mx_enrd_alwd_ovrid_num        =>p_rec.mx_enrd_alwd_ovrid_num
554  ,p_mn_enrd_rqd_ovrid_num         =>p_rec.mn_enrd_rqd_ovrid_num
555  ,p_no_mx_pl_typ_ovrid_flag       =>p_rec.no_mx_pl_typ_ovrid_flag
556  ,p_ordr_num                      =>p_rec.ordr_num
557  ,p_prvds_cr_flag                 =>p_rec.prvds_cr_flag
558  ,p_rqd_perd_enrt_nenrt_val       =>p_rec.rqd_perd_enrt_nenrt_val
559  ,p_rqd_perd_enrt_nenrt_tm_uom    =>p_rec.rqd_perd_enrt_nenrt_tm_uom
560  ,p_wvbl_flag                     =>p_rec.wvbl_flag
561  ,p_dpnt_adrs_rqd_flag            =>p_rec.dpnt_adrs_rqd_flag
562  ,p_dpnt_cvg_no_ctfn_rqd_flag     =>p_rec.dpnt_cvg_no_ctfn_rqd_flag
563  ,p_dpnt_dob_rqd_flag             =>p_rec.dpnt_dob_rqd_flag
564  ,p_dpnt_legv_id_rqd_flag         =>p_rec.dpnt_legv_id_rqd_flag
565  ,p_susp_if_dpnt_ssn_nt_prv_cd    =>p_rec.susp_if_dpnt_ssn_nt_prv_cd
566  ,p_susp_if_dpnt_dob_nt_prv_cd    =>p_rec.susp_if_dpnt_dob_nt_prv_cd
567  ,p_susp_if_dpnt_adr_nt_prv_cd    =>p_rec.susp_if_dpnt_adr_nt_prv_cd
568  ,p_susp_if_ctfn_not_dpnt_flag    =>p_rec.susp_if_ctfn_not_dpnt_flag
569  ,p_dpnt_ctfn_determine_cd        =>p_rec.dpnt_ctfn_determine_cd
570  ,p_drvd_fctr_dpnt_cvg_flag       =>p_rec.drvd_fctr_dpnt_cvg_flag
571  ,p_no_mn_pl_typ_overid_flag      =>p_rec.no_mn_pl_typ_overid_flag
572  ,p_sbj_to_sps_lf_ins_mx_flag   =>p_rec.sbj_to_sps_lf_ins_mx_flag
573  ,p_sbj_to_dpnt_lf_ins_mx_flag  =>p_rec.sbj_to_dpnt_lf_ins_mx_flag
574  ,p_use_to_sum_ee_lf_ins_flag     =>p_rec.use_to_sum_ee_lf_ins_flag
575  ,p_per_cvrd_cd                   =>p_rec.per_cvrd_cd
576  ,p_short_name                   =>p_rec.short_name
577  ,p_short_code                   =>p_rec.short_code
578   ,p_legislation_code                   =>p_rec.legislation_code
579   ,p_legislation_subgroup                   =>p_rec.legislation_subgroup
580  ,p_vrfy_fmly_mmbr_cd             =>p_rec.vrfy_fmly_mmbr_cd
581  ,p_vrfy_fmly_mmbr_rl             =>p_rec.vrfy_fmly_mmbr_rl
582  ,p_ivr_ident                     =>p_rec.ivr_ident
583  ,p_url_ref_name                  =>p_rec.url_ref_name
584  ,p_rqd_enrt_perd_tco_cd          =>p_rec.rqd_enrt_perd_tco_cd
585  ,p_ctp_attribute_category        =>p_rec.ctp_attribute_category
586  ,p_ctp_attribute1                =>p_rec.ctp_attribute1
587  ,p_ctp_attribute2                =>p_rec.ctp_attribute2
588  ,p_ctp_attribute3                =>p_rec.ctp_attribute3
589  ,p_ctp_attribute4                =>p_rec.ctp_attribute4
590  ,p_ctp_attribute5                =>p_rec.ctp_attribute5
591  ,p_ctp_attribute6                =>p_rec.ctp_attribute6
592  ,p_ctp_attribute7                =>p_rec.ctp_attribute7
593  ,p_ctp_attribute8                =>p_rec.ctp_attribute8
594  ,p_ctp_attribute9                =>p_rec.ctp_attribute9
595  ,p_ctp_attribute10               =>p_rec.ctp_attribute10
596  ,p_ctp_attribute11               =>p_rec.ctp_attribute11
597  ,p_ctp_attribute12               =>p_rec.ctp_attribute12
598  ,p_ctp_attribute13               =>p_rec.ctp_attribute13
599  ,p_ctp_attribute14               =>p_rec.ctp_attribute14
600  ,p_ctp_attribute15               =>p_rec.ctp_attribute15
601  ,p_ctp_attribute16               =>p_rec.ctp_attribute16
602  ,p_ctp_attribute17               =>p_rec.ctp_attribute17
603  ,p_ctp_attribute18               =>p_rec.ctp_attribute18
604  ,p_ctp_attribute19               =>p_rec.ctp_attribute19
605  ,p_ctp_attribute20               =>p_rec.ctp_attribute20
606  ,p_ctp_attribute21               =>p_rec.ctp_attribute21
607  ,p_ctp_attribute22               =>p_rec.ctp_attribute22
608  ,p_ctp_attribute23               =>p_rec.ctp_attribute23
609  ,p_ctp_attribute24               =>p_rec.ctp_attribute24
610  ,p_ctp_attribute25               =>p_rec.ctp_attribute25
611  ,p_ctp_attribute26               =>p_rec.ctp_attribute26
612  ,p_ctp_attribute27               =>p_rec.ctp_attribute27
613  ,p_ctp_attribute28               =>p_rec.ctp_attribute28
614  ,p_ctp_attribute29               =>p_rec.ctp_attribute29
615  ,p_ctp_attribute30               =>p_rec.ctp_attribute30
616  ,p_all_inelig                    =>p_rec.all_inelig
617  ,p_object_version_number         =>p_rec.object_version_number
618  ,p_effective_date                =>p_effective_date
619  ,p_validation_start_date         =>p_validation_start_date
620  ,p_validation_end_date           =>p_validation_end_date
621       );
622     --
623   exception
624     --
625     when hr_api.cannot_find_prog_unit then
626       --
627       hr_api.cannot_find_prog_unit_error
628         (p_module_name => 'ben_ptip_f'
629         ,p_hook_type   => 'AI');
630       --
631   end;
632   --
633   -- End of API User Hook for post_insert.
634   --
635   --
636   hr_utility.set_location(' Leaving:'||l_proc, 10);
637 End post_insert;
638 --
639 -- ----------------------------------------------------------------------------
640 -- |-------------------------------< ins_lck >--------------------------------|
641 -- ----------------------------------------------------------------------------
642 -- {Start Of Comments}
643 --
644 -- Description:
645 --   The ins_lck process has one main function to perform. When inserting
646 --   a datetracked row, we must validate the DT mode.
647 --   be manipulated.
648 --
649 -- Prerequisites:
650 --   This procedure can only be called for the datetrack mode of INSERT.
651 --
652 -- In Parameters:
653 --
654 -- Post Success:
655 --   On successful completion of the ins_lck process the parental
659 --   parential rows are not locked.
656 --   datetracked rows will be locked providing the p_enforce_foreign_locking
657 --   argument value is TRUE.
658 --   If the p_enforce_foreign_locking argument value is FALSE then the
660 --
661 -- Post Failure:
662 --   The Lck process can fail for:
663 --   1) When attempting to lock the row the row could already be locked by
664 --      another user. This will raise the HR_Api.Object_Locked exception.
665 --   2) When attempting to the lock the parent which doesn't exist.
666 --      For the entity to be locked the parent must exist!
667 --
668 -- Developer Implementation Notes:
669 --   None.
670 --
671 -- Access Status:
672 --   Internal Row Handler Use Only.
673 --
674 -- {End Of Comments}
675 -- ----------------------------------------------------------------------------
676 Procedure ins_lck
677 	(p_effective_date	 in  date,
678 	 p_datetrack_mode	 in  varchar2,
679 	 p_rec	 		 in  ben_ctp_shd.g_rec_type,
680 	 p_validation_start_date out nocopy date,
681 	 p_validation_end_date	 out nocopy date) is
682 --
683   l_proc		  varchar2(72) := g_package||'ins_lck';
684   l_validation_start_date date;
685   l_validation_end_date	  date;
686 --
687 Begin
688   hr_utility.set_location('Entering:'||l_proc, 5);
689   --
690   -- Validate the datetrack mode mode getting the validation start
691   -- and end dates for the specified datetrack operation.
692   --
693   dt_api.validate_dt_mode
694 	(p_effective_date	   => p_effective_date,
695 	 p_datetrack_mode	   => p_datetrack_mode,
696 	 p_base_table_name	   => 'ben_ptip_f',
697 	 p_base_key_column	   => 'ptip_id',
698 	 p_base_key_value 	   => p_rec.ptip_id,
699 	 p_parent_table_name1      => 'ben_pgm_f',
700 	 p_parent_key_column1      => 'pgm_id',
701 	 p_parent_key_value1       => p_rec.pgm_id,
702 	 p_parent_table_name2      => 'ben_pl_typ_f',
703 	 p_parent_key_column2      => 'pl_typ_id',
704 	 p_parent_key_value2       => p_rec.pl_typ_id,
705 	 p_parent_table_name3      => 'ben_cmbn_ptip_f',
706 	 p_parent_key_column3      => 'cmbn_ptip_id',
707 	 p_parent_key_value3       => p_rec.cmbn_ptip_id,
708 	 p_parent_table_name4      => 'ben_cmbn_ptip_opt_f',
709 	 p_parent_key_column4      => 'cmbn_ptip_opt_id',
710 	 p_parent_key_value4       => p_rec.cmbn_ptip_opt_id,
711          p_parent_table_name5      => 'ben_acrs_ptip_cvg_f',
712          p_parent_key_column5      => 'acrs_ptip_cvg_id',
713          p_parent_key_value5       => p_rec.acrs_ptip_cvg_id,
714          p_enforce_foreign_locking => true,
715 	 p_validation_start_date   => l_validation_start_date,
716  	 p_validation_end_date	   => l_validation_end_date);
717   --
718   -- Set the validation start and end date OUT arguments
719   --
720   p_validation_start_date := l_validation_start_date;
721   p_validation_end_date   := l_validation_end_date;
722   --
723   hr_utility.set_location(' Leaving:'||l_proc, 10);
724 --
725 End ins_lck;
726 --
727 -- ----------------------------------------------------------------------------
728 -- |---------------------------------< ins >----------------------------------|
729 -- ----------------------------------------------------------------------------
730 Procedure ins
731   (
732   p_rec		   in out nocopy ben_ctp_shd.g_rec_type,
733   p_effective_date in     date
734   ) is
735 --
736   l_proc			varchar2(72) := g_package||'ins';
737   l_datetrack_mode		varchar2(30) := 'INSERT';
738   l_validation_start_date	date;
739   l_validation_end_date		date;
740 --
741 Begin
742   hr_utility.set_location('Entering:'||l_proc, 5);
743   --
744   -- Call the lock operation
745   --
746   ins_lck
747 	(p_effective_date	 => p_effective_date,
748 	 p_datetrack_mode	 => l_datetrack_mode,
749 	 p_rec	 		 => p_rec,
750 	 p_validation_start_date => l_validation_start_date,
751 	 p_validation_end_date	 => l_validation_end_date);
752   --
753   -- Call the supporting insert validate operations
754   --
755   ben_ctp_bus.insert_validate
756 	(p_rec			 => p_rec,
757 	 p_effective_date	 => p_effective_date,
758 	 p_datetrack_mode	 => l_datetrack_mode,
759 	 p_validation_start_date => l_validation_start_date,
760 	 p_validation_end_date	 => l_validation_end_date);
761   --
762   -- Call the supporting pre-insert operation
763   --
764   pre_insert
765  	(p_rec			 => p_rec,
766 	 p_effective_date	 => p_effective_date,
767 	 p_datetrack_mode	 => l_datetrack_mode,
768 	 p_validation_start_date => l_validation_start_date,
769 	 p_validation_end_date	 => l_validation_end_date);
770   --
771   -- Insert the row
772   --
773   insert_dml
774  	(p_rec			 => p_rec,
775 	 p_effective_date	 => p_effective_date,
776 	 p_datetrack_mode	 => l_datetrack_mode,
777 	 p_validation_start_date => l_validation_start_date,
778 	 p_validation_end_date	 => l_validation_end_date);
779   --
780   -- Call the supporting post-insert operation
781   --
782   post_insert
783  	(p_rec			 => p_rec,
784 	 p_effective_date	 => p_effective_date,
785 	 p_datetrack_mode	 => l_datetrack_mode,
786 	 p_validation_start_date => l_validation_start_date,
787 	 p_validation_end_date	 => l_validation_end_date);
788 end ins;
789 --
790 -- ----------------------------------------------------------------------------
791 -- |---------------------------------< ins >----------------------------------|
792 -- ----------------------------------------------------------------------------
793 Procedure ins
794   (
795   p_ptip_id                      out nocopy number,
796   p_effective_start_date         out nocopy date,
797   p_effective_end_date           out nocopy date,
798   p_coord_cvg_for_all_pls_flag   in varchar2         default 'N',
802   p_rt_end_dt_cd                 in varchar2         default null,
799   p_dpnt_dsgn_cd                 in varchar2         default null,
800   p_dpnt_cvg_no_ctfn_rqd_flag    in varchar2         default 'N',
801   p_dpnt_cvg_strt_dt_cd          in varchar2         default null,
803   p_rt_strt_dt_cd                in varchar2         default null,
804   p_enrt_cvg_end_dt_cd           in varchar2         default null,
805   p_enrt_cvg_strt_dt_cd          in varchar2         default null,
806   p_dpnt_cvg_strt_dt_rl          in number           default null,
807   p_dpnt_cvg_end_dt_cd           in varchar2         default null,
808   p_dpnt_cvg_end_dt_rl           in number           default null,
809   p_dpnt_adrs_rqd_flag           in varchar2         default 'N',
810   p_dpnt_legv_id_rqd_flag        in varchar2         default 'N',
811   p_susp_if_dpnt_ssn_nt_prv_cd      in  varchar2   default null,
812   p_susp_if_dpnt_dob_nt_prv_cd      in  varchar2   default null,
813   p_susp_if_dpnt_adr_nt_prv_cd      in  varchar2   default null,
814   p_susp_if_ctfn_not_dpnt_flag      in  varchar2   default 'Y',
815   p_dpnt_ctfn_determine_cd          in  varchar2   default null,
816   p_postelcn_edit_rl             in number           default null,
817   p_rt_end_dt_rl                 in number           default null,
818   p_rt_strt_dt_rl                in number           default null,
819   p_enrt_cvg_end_dt_rl           in number           default null,
820   p_enrt_cvg_strt_dt_rl          in number           default null,
821   p_rqd_perd_enrt_nenrt_rl       in number           default null,
822   p_auto_enrt_mthd_rl            in number           default null,
823   p_enrt_mthd_cd                 in varchar2         default null,
824   p_enrt_cd                      in varchar2         default null,
825   p_enrt_rl                      in number           default null,
826   p_dflt_enrt_cd                 in varchar2         default null,
827   p_dflt_enrt_det_rl             in number           default null,
828   p_drvbl_fctr_apls_rts_flag     in varchar2         default 'N',
829   p_drvbl_fctr_prtn_elig_flag    in varchar2         default 'N',
830   p_elig_apls_flag               in varchar2         default 'N',
831   p_prtn_elig_ovrid_alwd_flag    in varchar2         default 'N',
832   p_trk_inelig_per_flag          in varchar2         default 'N',
833   p_dpnt_dob_rqd_flag            in varchar2         default 'N',
834   p_crs_this_pl_typ_only_flag    in varchar2         default 'N',
835   p_ptip_stat_cd                 in varchar2         default null,
836   p_mx_cvg_alwd_amt              in number           default null,
837   p_mx_enrd_alwd_ovrid_num       in number           default null,
838   p_mn_enrd_rqd_ovrid_num        in number           default null,
839   p_no_mx_pl_typ_ovrid_flag      in varchar2         default 'N',
840   p_ordr_num                     in number           default null,
841   p_prvds_cr_flag                in varchar2         default 'N',
842   p_rqd_perd_enrt_nenrt_val      in number           default null,
843   p_rqd_perd_enrt_nenrt_tm_uom   in varchar2         default null,
844   p_wvbl_flag                    in varchar2         default 'N',
845   p_drvd_fctr_dpnt_cvg_flag      in varchar2         default 'N',
846   p_no_mn_pl_typ_overid_flag     in varchar2         default 'N',
847   p_sbj_to_sps_lf_ins_mx_flag    in varchar2         default 'N',
848   p_sbj_to_dpnt_lf_ins_mx_flag   in varchar2         default 'N',
849   p_use_to_sum_ee_lf_ins_flag    in varchar2         default 'N',
850   p_per_cvrd_cd                  in varchar2         default null,
851   p_short_name                  in varchar2         default null,
852   p_short_code                  in varchar2         default null,
853     p_legislation_code                  in varchar2         default null,
854     p_legislation_subgroup                  in varchar2         default null,
855   p_vrfy_fmly_mmbr_cd            in varchar2         default null,
856   p_vrfy_fmly_mmbr_rl            in number           default null,
857   p_ivr_ident                    in varchar2         default null,
858   p_url_ref_name                 in varchar2         default null,
859   p_rqd_enrt_perd_tco_cd         in varchar2         default null,
860   p_pgm_id                       in number,
861   p_pl_typ_id                    in number,
862   p_cmbn_ptip_id                 in number           default null,
863   p_cmbn_ptip_opt_id             in number           default null,
864   p_acrs_ptip_cvg_id             in number           default null,
865   p_business_group_id            in number,
866   p_ctp_attribute_category       in varchar2         default null,
867   p_ctp_attribute1               in varchar2         default null,
868   p_ctp_attribute2               in varchar2         default null,
869   p_ctp_attribute3               in varchar2         default null,
870   p_ctp_attribute4               in varchar2         default null,
871   p_ctp_attribute5               in varchar2         default null,
872   p_ctp_attribute6               in varchar2         default null,
873   p_ctp_attribute7               in varchar2         default null,
874   p_ctp_attribute8               in varchar2         default null,
875   p_ctp_attribute9               in varchar2         default null,
876   p_ctp_attribute10              in varchar2         default null,
877   p_ctp_attribute11              in varchar2         default null,
878   p_ctp_attribute12              in varchar2         default null,
879   p_ctp_attribute13              in varchar2         default null,
880   p_ctp_attribute14              in varchar2         default null,
881   p_ctp_attribute15              in varchar2         default null,
882   p_ctp_attribute16              in varchar2         default null,
883   p_ctp_attribute17              in varchar2         default null,
884   p_ctp_attribute18              in varchar2         default null,
885   p_ctp_attribute19              in varchar2         default null,
886   p_ctp_attribute20              in varchar2         default null,
890   p_ctp_attribute24              in varchar2         default null,
887   p_ctp_attribute21              in varchar2         default null,
888   p_ctp_attribute22              in varchar2         default null,
889   p_ctp_attribute23              in varchar2         default null,
891   p_ctp_attribute25              in varchar2         default null,
892   p_ctp_attribute26              in varchar2         default null,
893   p_ctp_attribute27              in varchar2         default null,
894   p_ctp_attribute28              in varchar2         default null,
895   p_ctp_attribute29              in varchar2         default null,
896   p_ctp_attribute30              in varchar2         default null,
897   p_all_inelig                   in varchar2         default null,
898   p_object_version_number        out nocopy number,
899   p_effective_date               in date
900   ) is
901 --
902   l_rec		ben_ctp_shd.g_rec_type;
903   l_proc	varchar2(72) := g_package||'ins';
904 --
905 Begin
906   hr_utility.set_location('Entering:'||l_proc, 5);
907   --
908   -- Call conversion function to turn arguments into the
909   -- p_rec structure.
910   --
911   l_rec :=
912   ben_ctp_shd.convert_args
913   (
914   null,
915   null,
916   null,
917   p_coord_cvg_for_all_pls_flag,
918   p_dpnt_dsgn_cd,
919   p_dpnt_cvg_no_ctfn_rqd_flag,
920   p_dpnt_cvg_strt_dt_cd,
921   p_rt_end_dt_cd,
922   p_rt_strt_dt_cd,
923   p_enrt_cvg_end_dt_cd,
924   p_enrt_cvg_strt_dt_cd,
925   p_dpnt_cvg_strt_dt_rl,
926   p_dpnt_cvg_end_dt_cd,
927   p_dpnt_cvg_end_dt_rl,
928   p_dpnt_adrs_rqd_flag,
929   p_dpnt_legv_id_rqd_flag,
930   p_susp_if_dpnt_ssn_nt_prv_cd,
931   p_susp_if_dpnt_dob_nt_prv_cd,
932   p_susp_if_dpnt_adr_nt_prv_cd,
933   p_susp_if_ctfn_not_dpnt_flag,
934   p_dpnt_ctfn_determine_cd,
935   p_postelcn_edit_rl,
936   p_rt_end_dt_rl,
937   p_rt_strt_dt_rl,
938   p_enrt_cvg_end_dt_rl,
939   p_enrt_cvg_strt_dt_rl,
940   p_rqd_perd_enrt_nenrt_rl,
941   p_auto_enrt_mthd_rl,
942   p_enrt_mthd_cd,
943   p_enrt_cd,
944   p_enrt_rl,
945   p_dflt_enrt_cd,
946   p_dflt_enrt_det_rl,
947   p_drvbl_fctr_apls_rts_flag,
948   p_drvbl_fctr_prtn_elig_flag,
949   p_elig_apls_flag,
950   p_prtn_elig_ovrid_alwd_flag,
951   p_trk_inelig_per_flag,
952   p_dpnt_dob_rqd_flag,
953   p_crs_this_pl_typ_only_flag,
954   p_ptip_stat_cd,
955   p_mx_cvg_alwd_amt,
956   p_mx_enrd_alwd_ovrid_num,
957   p_mn_enrd_rqd_ovrid_num,
958   p_no_mx_pl_typ_ovrid_flag,
959   p_ordr_num,
960   p_prvds_cr_flag,
961   p_rqd_perd_enrt_nenrt_val,
962   p_rqd_perd_enrt_nenrt_tm_uom,
963   p_wvbl_flag,
964   p_drvd_fctr_dpnt_cvg_flag,
965   p_no_mn_pl_typ_overid_flag,
966   p_sbj_to_sps_lf_ins_mx_flag,
967   p_sbj_to_dpnt_lf_ins_mx_flag,
968   p_use_to_sum_ee_lf_ins_flag,
969   p_per_cvrd_cd,
970   p_short_name,
971   p_short_code,
972     p_legislation_code,
973     p_legislation_subgroup,
974   p_vrfy_fmly_mmbr_cd,
975   p_vrfy_fmly_mmbr_rl,
976   p_ivr_ident,
977   p_url_ref_name,
978   p_rqd_enrt_perd_tco_cd,
979   p_pgm_id,
980   p_pl_typ_id,
981   p_cmbn_ptip_id,
982   p_cmbn_ptip_opt_id,
983   p_acrs_ptip_cvg_id,
984   p_business_group_id,
985   p_ctp_attribute_category,
986   p_ctp_attribute1,
987   p_ctp_attribute2,
988   p_ctp_attribute3,
989   p_ctp_attribute4,
990   p_ctp_attribute5,
991   p_ctp_attribute6,
992   p_ctp_attribute7,
993   p_ctp_attribute8,
994   p_ctp_attribute9,
995   p_ctp_attribute10,
996   p_ctp_attribute11,
997   p_ctp_attribute12,
998   p_ctp_attribute13,
999   p_ctp_attribute14,
1000   p_ctp_attribute15,
1001   p_ctp_attribute16,
1002   p_ctp_attribute17,
1003   p_ctp_attribute18,
1004   p_ctp_attribute19,
1005   p_ctp_attribute20,
1006   p_ctp_attribute21,
1007   p_ctp_attribute22,
1008   p_ctp_attribute23,
1009   p_ctp_attribute24,
1010   p_ctp_attribute25,
1011   p_ctp_attribute26,
1012   p_ctp_attribute27,
1013   p_ctp_attribute28,
1014   p_ctp_attribute29,
1015   p_ctp_attribute30,
1016   p_all_inelig,
1017   null);
1018   --
1019   -- Having converted the arguments into the ben_ctp_rec
1020   -- plsql record structure we call the corresponding record
1021   -- business process.
1022   --
1023   ins(l_rec, p_effective_date);
1024   --
1025   -- Set the OUT arguments.
1026   --
1027   p_ptip_id        	:= l_rec.ptip_id;
1028   p_effective_start_date  	:= l_rec.effective_start_date;
1029   p_effective_end_date    	:= l_rec.effective_end_date;
1030   p_object_version_number 	:= l_rec.object_version_number;
1031   --
1032   --
1033   hr_utility.set_location(' Leaving:'||l_proc, 10);
1034 End ins;
1035 --
1036 end ben_ctp_ins;