DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CTP_INS

Source


1 Package Body ben_ctp_ins as
2 /* $Header: bectprhi.pkb 120.0 2005/05/28 01:26:14 appldev noship $ */
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   --
85   -- Get the object version number for the insert
86   --
87   p_rec.object_version_number :=
88     dt_api.get_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   )
243   Values
244   (	p_rec.ptip_id,
245 	p_rec.effective_start_date,
246 	p_rec.effective_end_date,
247 	p_rec.business_group_id,
248 	p_rec.pgm_id,
249         p_rec.cmbn_ptip_id,
250         p_rec.cmbn_ptip_opt_id,
251         p_rec.acrs_ptip_cvg_id,
252 	p_rec.pl_typ_id,
253 	p_rec.coord_cvg_for_all_pls_flag,
254 	p_rec.dpnt_dsgn_cd,
255         p_rec.dpnt_cvg_strt_dt_rl,
256         p_rec.dpnt_cvg_end_dt_rl,
257         p_rec.postelcn_edit_rl,
258         p_rec.rt_end_dt_rl,
259         p_rec.rt_strt_dt_rl,
260         p_rec.enrt_cvg_end_dt_rl,
261         p_rec.enrt_cvg_strt_dt_rl,
262         p_rec.rqd_perd_enrt_nenrt_rl,
263         p_rec.auto_enrt_mthd_rl,
264         p_rec.enrt_mthd_cd,
265         p_rec.enrt_cd,
266         p_rec.enrt_rl,
267         p_rec.dflt_enrt_cd,
268         p_rec.dflt_enrt_det_rl,
269         p_rec.drvbl_fctr_apls_rts_flag,
270         p_rec.drvbl_fctr_prtn_elig_flag,
271         p_rec.elig_apls_flag,
272         p_rec.prtn_elig_ovrid_alwd_flag,
273         p_rec.trk_inelig_per_flag,
274         p_rec.dpnt_cvg_strt_dt_cd,
275         p_rec.rt_end_dt_cd,
276         p_rec.rt_strt_dt_cd,
277         p_rec.enrt_cvg_end_dt_cd,
278         p_rec.enrt_cvg_strt_dt_cd,
279         p_rec.dpnt_cvg_end_dt_cd,
280 	p_rec.crs_this_pl_typ_only_flag,
281 	p_rec.ptip_stat_cd,
282 	p_rec.mx_cvg_alwd_amt,
283 	p_rec.mx_enrd_alwd_ovrid_num,
284 	p_rec.mn_enrd_rqd_ovrid_num,
285 	p_rec.no_mx_pl_typ_ovrid_flag,
286 	p_rec.ordr_num,
287 	p_rec.prvds_cr_flag,
288 	p_rec.rqd_perd_enrt_nenrt_val,
289 	p_rec.rqd_perd_enrt_nenrt_tm_uom,
290 	p_rec.wvbl_flag,
291         p_rec.dpnt_adrs_rqd_flag,
292         p_rec.dpnt_cvg_no_ctfn_rqd_flag,
293         p_rec.dpnt_dob_rqd_flag,
294         p_rec.dpnt_legv_id_rqd_flag,
295         p_rec.susp_if_dpnt_ssn_nt_prv_cd,
296         p_rec.susp_if_dpnt_dob_nt_prv_cd,
297         p_rec.susp_if_dpnt_adr_nt_prv_cd,
298         p_rec.susp_if_ctfn_not_dpnt_flag,
299         p_rec.dpnt_ctfn_determine_cd,
300 	p_rec.drvd_fctr_dpnt_cvg_flag,
301 	p_rec.no_mn_pl_typ_overid_flag,
302       p_rec.sbj_to_sps_lf_ins_mx_flag,
303       p_rec.sbj_to_dpnt_lf_ins_mx_flag,
304       p_rec.use_to_sum_ee_lf_ins_flag,
305       p_rec.per_cvrd_cd,
306       p_rec.short_name,
307       p_rec.short_code,
308             p_rec.legislation_code,
309             p_rec.legislation_subgroup,
310       p_rec.vrfy_fmly_mmbr_cd,
311       p_rec.vrfy_fmly_mmbr_rl,
312 	p_rec.ivr_ident,
313         p_rec.url_ref_name,
314 	p_rec.rqd_enrt_perd_tco_cd,
315 	p_rec.ctp_attribute_category,
316 	p_rec.ctp_attribute1,
317 	p_rec.ctp_attribute2,
318 	p_rec.ctp_attribute3,
319 	p_rec.ctp_attribute4,
320 	p_rec.ctp_attribute5,
321 	p_rec.ctp_attribute6,
322 	p_rec.ctp_attribute7,
323 	p_rec.ctp_attribute8,
324 	p_rec.ctp_attribute9,
325 	p_rec.ctp_attribute10,
326 	p_rec.ctp_attribute11,
327 	p_rec.ctp_attribute12,
328 	p_rec.ctp_attribute13,
329 	p_rec.ctp_attribute14,
330 	p_rec.ctp_attribute15,
331 	p_rec.ctp_attribute16,
332 	p_rec.ctp_attribute17,
333 	p_rec.ctp_attribute18,
334 	p_rec.ctp_attribute19,
335 	p_rec.ctp_attribute20,
336 	p_rec.ctp_attribute21,
337 	p_rec.ctp_attribute22,
338 	p_rec.ctp_attribute23,
339 	p_rec.ctp_attribute24,
340 	p_rec.ctp_attribute25,
341 	p_rec.ctp_attribute26,
342 	p_rec.ctp_attribute27,
343 	p_rec.ctp_attribute28,
344 	p_rec.ctp_attribute29,
345 	p_rec.ctp_attribute30,
346 	p_rec.object_version_number
347 	, l_created_by,
348    	l_creation_date,
349    	l_last_update_date,
350    	l_last_updated_by,
351    	l_last_update_login
352   );
353   --
354   ben_ctp_shd.g_api_dml := false;   -- Unset the api dml status
355   hr_utility.set_location(' Leaving:'||l_proc, 15);
356 --
357 Exception
358   When hr_api.check_integrity_violated Then
359     -- A check constraint has been violated
360     ben_ctp_shd.g_api_dml := false;   -- Unset the api dml status
361     ben_ctp_shd.constraint_error
362       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
363   When hr_api.unique_integrity_violated Then
364     -- Unique integrity has been violated
365     ben_ctp_shd.g_api_dml := false;   -- Unset the api dml status
366     ben_ctp_shd.constraint_error
367       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
368   When Others Then
369     ben_ctp_shd.g_api_dml := false;   -- Unset the api dml status
370     Raise;
371 End dt_insert_dml;
372 --
373 -- ----------------------------------------------------------------------------
374 -- |------------------------------< insert_dml >------------------------------|
375 -- ----------------------------------------------------------------------------
376 Procedure insert_dml
377 	(p_rec 			 in out nocopy ben_ctp_shd.g_rec_type,
378 	 p_effective_date	 in	date,
379 	 p_datetrack_mode	 in	varchar2,
380 	 p_validation_start_date in	date,
381 	 p_validation_end_date	 in	date) is
382 --
383   l_proc	varchar2(72) := g_package||'insert_dml';
384 --
385 Begin
386   hr_utility.set_location('Entering:'||l_proc, 5);
387   --
388   dt_insert_dml(p_rec			=> p_rec,
389 		p_effective_date	=> p_effective_date,
390 		p_datetrack_mode	=> p_datetrack_mode,
391        		p_validation_start_date	=> p_validation_start_date,
392 		p_validation_end_date	=> p_validation_end_date);
393   --
394   hr_utility.set_location(' Leaving:'||l_proc, 10);
395 End insert_dml;
396 --
397 -- ----------------------------------------------------------------------------
398 -- |------------------------------< pre_insert >------------------------------|
399 -- ----------------------------------------------------------------------------
400 -- {Start Of Comments}
401 --
402 -- Description:
403 --   This private procedure contains any processing which is required before
404 --   the insert dml. Presently, if the entity has a corresponding primary
405 --   key which is maintained by an associating sequence, the primary key for
406 --   the entity will be populated with the next sequence value in
407 --   preparation for the insert dml.
408 --   Also, if comments are defined for this entity, the comments insert
409 --   logic will also be called, generating a comment_id if required.
410 --
411 -- Prerequisites:
412 --   This is an internal procedure which is called from the ins procedure.
413 --
414 -- In Parameters:
415 --   A Pl/Sql record structre.
416 --
417 -- Post Success:
418 --   Processing continues.
419 --
420 -- Post Failure:
421 --   If an error has occurred, an error message and exception will be raised
422 --   but not handled.
423 --
424 -- Developer Implementation Notes:
425 --   Any pre-processing required before the insert dml is issued should be
426 --   coded within this procedure. As stated above, a good example is the
427 --   generation of a primary key number via a corresponding sequence.
428 --   It is important to note that any 3rd party maintenance should be reviewed
429 --   before placing in this procedure.
430 --
431 -- Access Status:
432 --   Internal Row Handler Use Only.
433 --
434 -- {End Of Comments}
435 -- ----------------------------------------------------------------------------
436 Procedure pre_insert
437 	(p_rec  			in out nocopy ben_ctp_shd.g_rec_type,
438 	 p_effective_date		in date,
439 	 p_datetrack_mode		in varchar2,
440 	 p_validation_start_date	in date,
441 	 p_validation_end_date		in date) is
442 --
443   l_proc	varchar2(72) := g_package||'pre_insert';
444 --
445 --
446   cursor c1 is select ben_ptip_f_s.nextval
447                from sys.dual;
448 --
449 Begin
450   hr_utility.set_location('Entering:'||l_proc, 5);
451   --
452   --
453   open c1;
454   fetch c1 into p_rec.ptip_id;
455   close c1;
456   --
457   --
458   hr_utility.set_location(' Leaving:'||l_proc, 10);
459 End pre_insert;
460 --
461 -- ----------------------------------------------------------------------------
462 -- |-----------------------------< post_insert >------------------------------|
463 -- ----------------------------------------------------------------------------
464 -- {Start Of Comments}
465 --
466 -- Description:
467 --   This private procedure contains any processing which is required after the
468 --   insert dml.
469 --
470 -- Prerequisites:
471 --   This is an internal procedure which is called from the ins procedure.
472 --
473 -- In Parameters:
474 --   A Pl/Sql record structre.
475 --
476 -- Post Success:
477 --   Processing continues.
478 --
479 -- Post Failure:
480 --   If an error has occurred, an error message and exception will be raised
481 --   but not handled.
482 --
483 -- Developer Implementation Notes:
484 --   Any post-processing required after the insert dml is issued should be
485 --   coded within this procedure. It is important to note that any 3rd party
486 --   maintenance should be reviewed before placing in this procedure.
487 --
488 -- Access Status:
489 --   Internal Row Handler Use Only.
490 --
491 -- {End Of Comments}
492 -- ----------------------------------------------------------------------------
493 Procedure post_insert
494 	(p_rec 			 in ben_ctp_shd.g_rec_type,
495 	 p_effective_date	 in date,
496 	 p_datetrack_mode	 in varchar2,
497 	 p_validation_start_date in date,
498 	 p_validation_end_date	 in date) is
499 --
500   l_proc	varchar2(72) := g_package||'post_insert';
501 --
502 Begin
503   hr_utility.set_location('Entering:'||l_proc, 5);
504 --
505   --
506   -- Start of API User Hook for post_insert.
507   --
508   begin
509     --
510     ben_ctp_rki.after_insert
511       (
512   p_ptip_id                       =>p_rec.ptip_id
513  ,p_effective_start_date          =>p_rec.effective_start_date
514  ,p_effective_end_date            =>p_rec.effective_end_date
515  ,p_business_group_id             =>p_rec.business_group_id
516  ,p_pgm_id                        =>p_rec.pgm_id
517  ,p_cmbn_ptip_id                  =>p_rec.cmbn_ptip_id
518  ,p_cmbn_ptip_opt_id              =>p_rec.cmbn_ptip_opt_id
519  ,p_acrs_ptip_cvg_id              =>p_rec.acrs_ptip_cvg_id
520  ,p_pl_typ_id                     =>p_rec.pl_typ_id
521  ,p_coord_cvg_for_all_pls_flag    =>p_rec.coord_cvg_for_all_pls_flag
522  ,p_dpnt_dsgn_cd                  =>p_rec.dpnt_dsgn_cd
523  ,p_dpnt_cvg_strt_dt_rl           =>p_rec.dpnt_cvg_strt_dt_rl
524  ,p_dpnt_cvg_end_dt_rl            =>p_rec.dpnt_cvg_end_dt_rl
525  ,p_postelcn_edit_rl              =>p_rec.postelcn_edit_rl
526  ,p_rt_end_dt_rl                  =>p_rec.rt_end_dt_rl
527  ,p_rt_strt_dt_rl                 =>p_rec.rt_strt_dt_rl
528  ,p_enrt_cvg_end_dt_rl            =>p_rec.enrt_cvg_end_dt_rl
529  ,p_enrt_cvg_strt_dt_rl           =>p_rec.enrt_cvg_strt_dt_rl
530  ,p_rqd_perd_enrt_nenrt_rl        =>p_rec.rqd_perd_enrt_nenrt_rl
531  ,p_auto_enrt_mthd_rl             =>p_rec.auto_enrt_mthd_rl
532  ,p_enrt_mthd_cd                  =>p_rec.enrt_mthd_cd
533  ,p_enrt_cd                       =>p_rec.enrt_cd
534  ,p_enrt_rl                       =>p_rec.enrt_rl
535  ,p_dflt_enrt_cd                  =>p_rec.dflt_enrt_cd
536  ,p_dflt_enrt_det_rl              =>p_rec.dflt_enrt_det_rl
537  ,p_drvbl_fctr_apls_rts_flag      =>p_rec.drvbl_fctr_apls_rts_flag
538  ,p_drvbl_fctr_prtn_elig_flag     =>p_rec.drvbl_fctr_prtn_elig_flag
539  ,p_elig_apls_flag                =>p_rec.elig_apls_flag
540  ,p_prtn_elig_ovrid_alwd_flag     =>p_rec.prtn_elig_ovrid_alwd_flag
541  ,p_trk_inelig_per_flag           =>p_rec.trk_inelig_per_flag
542  ,p_rt_end_dt_cd                  =>p_rec.rt_end_dt_cd
543  ,p_rt_strt_dt_cd                 =>p_rec.rt_strt_dt_cd
544  ,p_enrt_cvg_end_dt_cd            =>p_rec.enrt_cvg_end_dt_cd
545  ,p_enrt_cvg_strt_dt_cd           =>p_rec.enrt_cvg_strt_dt_cd
546  ,p_dpnt_cvg_end_dt_cd            =>p_rec.dpnt_cvg_end_dt_cd
547  ,p_dpnt_cvg_strt_dt_cd           =>p_rec.dpnt_cvg_strt_dt_cd
548  ,p_crs_this_pl_typ_only_flag     =>p_rec.crs_this_pl_typ_only_flag
549  ,p_ptip_stat_cd                  =>p_rec.ptip_stat_cd
550  ,p_mx_cvg_alwd_amt               =>p_rec.mx_cvg_alwd_amt
551  ,p_mx_enrd_alwd_ovrid_num        =>p_rec.mx_enrd_alwd_ovrid_num
552  ,p_mn_enrd_rqd_ovrid_num         =>p_rec.mn_enrd_rqd_ovrid_num
553  ,p_no_mx_pl_typ_ovrid_flag       =>p_rec.no_mx_pl_typ_ovrid_flag
554  ,p_ordr_num                      =>p_rec.ordr_num
555  ,p_prvds_cr_flag                 =>p_rec.prvds_cr_flag
556  ,p_rqd_perd_enrt_nenrt_val       =>p_rec.rqd_perd_enrt_nenrt_val
557  ,p_rqd_perd_enrt_nenrt_tm_uom    =>p_rec.rqd_perd_enrt_nenrt_tm_uom
558  ,p_wvbl_flag                     =>p_rec.wvbl_flag
559  ,p_dpnt_adrs_rqd_flag            =>p_rec.dpnt_adrs_rqd_flag
560  ,p_dpnt_cvg_no_ctfn_rqd_flag     =>p_rec.dpnt_cvg_no_ctfn_rqd_flag
561  ,p_dpnt_dob_rqd_flag             =>p_rec.dpnt_dob_rqd_flag
562  ,p_dpnt_legv_id_rqd_flag         =>p_rec.dpnt_legv_id_rqd_flag
563  ,p_susp_if_dpnt_ssn_nt_prv_cd    =>p_rec.susp_if_dpnt_ssn_nt_prv_cd
564  ,p_susp_if_dpnt_dob_nt_prv_cd    =>p_rec.susp_if_dpnt_dob_nt_prv_cd
565  ,p_susp_if_dpnt_adr_nt_prv_cd    =>p_rec.susp_if_dpnt_adr_nt_prv_cd
566  ,p_susp_if_ctfn_not_dpnt_flag    =>p_rec.susp_if_ctfn_not_dpnt_flag
567  ,p_dpnt_ctfn_determine_cd        =>p_rec.dpnt_ctfn_determine_cd
568  ,p_drvd_fctr_dpnt_cvg_flag       =>p_rec.drvd_fctr_dpnt_cvg_flag
569  ,p_no_mn_pl_typ_overid_flag      =>p_rec.no_mn_pl_typ_overid_flag
570  ,p_sbj_to_sps_lf_ins_mx_flag   =>p_rec.sbj_to_sps_lf_ins_mx_flag
571  ,p_sbj_to_dpnt_lf_ins_mx_flag  =>p_rec.sbj_to_dpnt_lf_ins_mx_flag
572  ,p_use_to_sum_ee_lf_ins_flag     =>p_rec.use_to_sum_ee_lf_ins_flag
573  ,p_per_cvrd_cd                   =>p_rec.per_cvrd_cd
574  ,p_short_name                   =>p_rec.short_name
575  ,p_short_code                   =>p_rec.short_code
576   ,p_legislation_code                   =>p_rec.legislation_code
577   ,p_legislation_subgroup                   =>p_rec.legislation_subgroup
578  ,p_vrfy_fmly_mmbr_cd             =>p_rec.vrfy_fmly_mmbr_cd
579  ,p_vrfy_fmly_mmbr_rl             =>p_rec.vrfy_fmly_mmbr_rl
580  ,p_ivr_ident                     =>p_rec.ivr_ident
581  ,p_url_ref_name                  =>p_rec.url_ref_name
582  ,p_rqd_enrt_perd_tco_cd          =>p_rec.rqd_enrt_perd_tco_cd
583  ,p_ctp_attribute_category        =>p_rec.ctp_attribute_category
584  ,p_ctp_attribute1                =>p_rec.ctp_attribute1
585  ,p_ctp_attribute2                =>p_rec.ctp_attribute2
586  ,p_ctp_attribute3                =>p_rec.ctp_attribute3
587  ,p_ctp_attribute4                =>p_rec.ctp_attribute4
588  ,p_ctp_attribute5                =>p_rec.ctp_attribute5
589  ,p_ctp_attribute6                =>p_rec.ctp_attribute6
590  ,p_ctp_attribute7                =>p_rec.ctp_attribute7
591  ,p_ctp_attribute8                =>p_rec.ctp_attribute8
592  ,p_ctp_attribute9                =>p_rec.ctp_attribute9
593  ,p_ctp_attribute10               =>p_rec.ctp_attribute10
594  ,p_ctp_attribute11               =>p_rec.ctp_attribute11
595  ,p_ctp_attribute12               =>p_rec.ctp_attribute12
596  ,p_ctp_attribute13               =>p_rec.ctp_attribute13
597  ,p_ctp_attribute14               =>p_rec.ctp_attribute14
598  ,p_ctp_attribute15               =>p_rec.ctp_attribute15
599  ,p_ctp_attribute16               =>p_rec.ctp_attribute16
600  ,p_ctp_attribute17               =>p_rec.ctp_attribute17
601  ,p_ctp_attribute18               =>p_rec.ctp_attribute18
602  ,p_ctp_attribute19               =>p_rec.ctp_attribute19
603  ,p_ctp_attribute20               =>p_rec.ctp_attribute20
604  ,p_ctp_attribute21               =>p_rec.ctp_attribute21
605  ,p_ctp_attribute22               =>p_rec.ctp_attribute22
606  ,p_ctp_attribute23               =>p_rec.ctp_attribute23
607  ,p_ctp_attribute24               =>p_rec.ctp_attribute24
608  ,p_ctp_attribute25               =>p_rec.ctp_attribute25
609  ,p_ctp_attribute26               =>p_rec.ctp_attribute26
610  ,p_ctp_attribute27               =>p_rec.ctp_attribute27
611  ,p_ctp_attribute28               =>p_rec.ctp_attribute28
612  ,p_ctp_attribute29               =>p_rec.ctp_attribute29
613  ,p_ctp_attribute30               =>p_rec.ctp_attribute30
614  ,p_object_version_number         =>p_rec.object_version_number
615  ,p_effective_date                =>p_effective_date
616  ,p_validation_start_date         =>p_validation_start_date
617  ,p_validation_end_date           =>p_validation_end_date
618       );
619     --
620   exception
621     --
622     when hr_api.cannot_find_prog_unit then
623       --
624       hr_api.cannot_find_prog_unit_error
625         (p_module_name => 'ben_ptip_f'
626         ,p_hook_type   => 'AI');
627       --
628   end;
629   --
630   -- End of API User Hook for post_insert.
631   --
632   --
633   hr_utility.set_location(' Leaving:'||l_proc, 10);
634 End post_insert;
635 --
636 -- ----------------------------------------------------------------------------
637 -- |-------------------------------< ins_lck >--------------------------------|
638 -- ----------------------------------------------------------------------------
639 -- {Start Of Comments}
640 --
641 -- Description:
642 --   The ins_lck process has one main function to perform. When inserting
643 --   a datetracked row, we must validate the DT mode.
644 --   be manipulated.
645 --
646 -- Prerequisites:
647 --   This procedure can only be called for the datetrack mode of INSERT.
648 --
649 -- In Parameters:
650 --
651 -- Post Success:
652 --   On successful completion of the ins_lck process the parental
653 --   datetracked rows will be locked providing the p_enforce_foreign_locking
654 --   argument value is TRUE.
655 --   If the p_enforce_foreign_locking argument value is FALSE then the
656 --   parential rows are not locked.
657 --
658 -- Post Failure:
659 --   The Lck process can fail for:
660 --   1) When attempting to lock the row the row could already be locked by
661 --      another user. This will raise the HR_Api.Object_Locked exception.
662 --   2) When attempting to the lock the parent which doesn't exist.
663 --      For the entity to be locked the parent must exist!
664 --
665 -- Developer Implementation Notes:
666 --   None.
667 --
668 -- Access Status:
669 --   Internal Row Handler Use Only.
670 --
671 -- {End Of Comments}
672 -- ----------------------------------------------------------------------------
673 Procedure ins_lck
674 	(p_effective_date	 in  date,
675 	 p_datetrack_mode	 in  varchar2,
676 	 p_rec	 		 in  ben_ctp_shd.g_rec_type,
677 	 p_validation_start_date out nocopy date,
678 	 p_validation_end_date	 out nocopy date) is
679 --
680   l_proc		  varchar2(72) := g_package||'ins_lck';
681   l_validation_start_date date;
682   l_validation_end_date	  date;
683 --
684 Begin
685   hr_utility.set_location('Entering:'||l_proc, 5);
686   --
687   -- Validate the datetrack mode mode getting the validation start
688   -- and end dates for the specified datetrack operation.
689   --
690   dt_api.validate_dt_mode
691 	(p_effective_date	   => p_effective_date,
692 	 p_datetrack_mode	   => p_datetrack_mode,
693 	 p_base_table_name	   => 'ben_ptip_f',
694 	 p_base_key_column	   => 'ptip_id',
695 	 p_base_key_value 	   => p_rec.ptip_id,
696 	 p_parent_table_name1      => 'ben_pgm_f',
697 	 p_parent_key_column1      => 'pgm_id',
698 	 p_parent_key_value1       => p_rec.pgm_id,
699 	 p_parent_table_name2      => 'ben_pl_typ_f',
700 	 p_parent_key_column2      => 'pl_typ_id',
701 	 p_parent_key_value2       => p_rec.pl_typ_id,
702 	 p_parent_table_name3      => 'ben_cmbn_ptip_f',
703 	 p_parent_key_column3      => 'cmbn_ptip_id',
704 	 p_parent_key_value3       => p_rec.cmbn_ptip_id,
705 	 p_parent_table_name4      => 'ben_cmbn_ptip_opt_f',
706 	 p_parent_key_column4      => 'cmbn_ptip_opt_id',
707 	 p_parent_key_value4       => p_rec.cmbn_ptip_opt_id,
708          p_parent_table_name5      => 'ben_acrs_ptip_cvg_f',
709          p_parent_key_column5      => 'acrs_ptip_cvg_id',
710          p_parent_key_value5       => p_rec.acrs_ptip_cvg_id,
711          p_enforce_foreign_locking => true,
712 	 p_validation_start_date   => l_validation_start_date,
713  	 p_validation_end_date	   => l_validation_end_date);
714   --
715   -- Set the validation start and end date OUT arguments
716   --
717   p_validation_start_date := l_validation_start_date;
718   p_validation_end_date   := l_validation_end_date;
719   --
720   hr_utility.set_location(' Leaving:'||l_proc, 10);
721 --
722 End ins_lck;
723 --
724 -- ----------------------------------------------------------------------------
725 -- |---------------------------------< ins >----------------------------------|
726 -- ----------------------------------------------------------------------------
727 Procedure ins
728   (
729   p_rec		   in out nocopy ben_ctp_shd.g_rec_type,
730   p_effective_date in     date
731   ) is
732 --
733   l_proc			varchar2(72) := g_package||'ins';
734   l_datetrack_mode		varchar2(30) := 'INSERT';
735   l_validation_start_date	date;
736   l_validation_end_date		date;
737 --
738 Begin
739   hr_utility.set_location('Entering:'||l_proc, 5);
740   --
741   -- Call the lock operation
742   --
743   ins_lck
744 	(p_effective_date	 => p_effective_date,
745 	 p_datetrack_mode	 => l_datetrack_mode,
746 	 p_rec	 		 => p_rec,
747 	 p_validation_start_date => l_validation_start_date,
748 	 p_validation_end_date	 => l_validation_end_date);
749   --
750   -- Call the supporting insert validate operations
751   --
752   ben_ctp_bus.insert_validate
753 	(p_rec			 => p_rec,
754 	 p_effective_date	 => p_effective_date,
755 	 p_datetrack_mode	 => l_datetrack_mode,
756 	 p_validation_start_date => l_validation_start_date,
757 	 p_validation_end_date	 => l_validation_end_date);
758   --
759   -- Call the supporting pre-insert operation
760   --
761   pre_insert
762  	(p_rec			 => p_rec,
763 	 p_effective_date	 => p_effective_date,
764 	 p_datetrack_mode	 => l_datetrack_mode,
765 	 p_validation_start_date => l_validation_start_date,
766 	 p_validation_end_date	 => l_validation_end_date);
767   --
768   -- Insert the row
769   --
770   insert_dml
771  	(p_rec			 => p_rec,
772 	 p_effective_date	 => p_effective_date,
773 	 p_datetrack_mode	 => l_datetrack_mode,
774 	 p_validation_start_date => l_validation_start_date,
775 	 p_validation_end_date	 => l_validation_end_date);
776   --
777   -- Call the supporting post-insert operation
778   --
779   post_insert
780  	(p_rec			 => p_rec,
781 	 p_effective_date	 => p_effective_date,
782 	 p_datetrack_mode	 => l_datetrack_mode,
783 	 p_validation_start_date => l_validation_start_date,
784 	 p_validation_end_date	 => l_validation_end_date);
785 end ins;
786 --
787 -- ----------------------------------------------------------------------------
788 -- |---------------------------------< ins >----------------------------------|
789 -- ----------------------------------------------------------------------------
790 Procedure ins
791   (
792   p_ptip_id                      out nocopy number,
793   p_effective_start_date         out nocopy date,
794   p_effective_end_date           out nocopy date,
795   p_coord_cvg_for_all_pls_flag   in varchar2         default 'N',
796   p_dpnt_dsgn_cd                 in varchar2         default null,
797   p_dpnt_cvg_no_ctfn_rqd_flag    in varchar2         default 'N',
798   p_dpnt_cvg_strt_dt_cd          in varchar2         default null,
799   p_rt_end_dt_cd                 in varchar2         default null,
800   p_rt_strt_dt_cd                in varchar2         default null,
801   p_enrt_cvg_end_dt_cd           in varchar2         default null,
802   p_enrt_cvg_strt_dt_cd          in varchar2         default null,
803   p_dpnt_cvg_strt_dt_rl          in number           default null,
804   p_dpnt_cvg_end_dt_cd           in varchar2         default null,
805   p_dpnt_cvg_end_dt_rl           in number           default null,
806   p_dpnt_adrs_rqd_flag           in varchar2         default 'N',
807   p_dpnt_legv_id_rqd_flag        in varchar2         default 'N',
808   p_susp_if_dpnt_ssn_nt_prv_cd      in  varchar2   default null,
809   p_susp_if_dpnt_dob_nt_prv_cd      in  varchar2   default null,
810   p_susp_if_dpnt_adr_nt_prv_cd      in  varchar2   default null,
811   p_susp_if_ctfn_not_dpnt_flag      in  varchar2   default 'Y',
812   p_dpnt_ctfn_determine_cd          in  varchar2   default null,
813   p_postelcn_edit_rl             in number           default null,
814   p_rt_end_dt_rl                 in number           default null,
815   p_rt_strt_dt_rl                in number           default null,
816   p_enrt_cvg_end_dt_rl           in number           default null,
817   p_enrt_cvg_strt_dt_rl          in number           default null,
818   p_rqd_perd_enrt_nenrt_rl       in number           default null,
819   p_auto_enrt_mthd_rl            in number           default null,
820   p_enrt_mthd_cd                 in varchar2         default null,
821   p_enrt_cd                      in varchar2         default null,
822   p_enrt_rl                      in number           default null,
823   p_dflt_enrt_cd                 in varchar2         default null,
824   p_dflt_enrt_det_rl             in number           default null,
825   p_drvbl_fctr_apls_rts_flag     in varchar2         default 'N',
826   p_drvbl_fctr_prtn_elig_flag    in varchar2         default 'N',
827   p_elig_apls_flag               in varchar2         default 'N',
828   p_prtn_elig_ovrid_alwd_flag    in varchar2         default 'N',
829   p_trk_inelig_per_flag          in varchar2         default 'N',
830   p_dpnt_dob_rqd_flag            in varchar2         default 'N',
831   p_crs_this_pl_typ_only_flag    in varchar2         default 'N',
832   p_ptip_stat_cd                 in varchar2         default null,
833   p_mx_cvg_alwd_amt              in number           default null,
834   p_mx_enrd_alwd_ovrid_num       in number           default null,
835   p_mn_enrd_rqd_ovrid_num        in number           default null,
836   p_no_mx_pl_typ_ovrid_flag      in varchar2         default 'N',
837   p_ordr_num                     in number           default null,
838   p_prvds_cr_flag                in varchar2         default 'N',
839   p_rqd_perd_enrt_nenrt_val      in number           default null,
840   p_rqd_perd_enrt_nenrt_tm_uom   in varchar2         default null,
841   p_wvbl_flag                    in varchar2         default 'N',
842   p_drvd_fctr_dpnt_cvg_flag      in varchar2         default 'N',
843   p_no_mn_pl_typ_overid_flag     in varchar2         default 'N',
844   p_sbj_to_sps_lf_ins_mx_flag    in varchar2         default 'N',
845   p_sbj_to_dpnt_lf_ins_mx_flag   in varchar2         default 'N',
846   p_use_to_sum_ee_lf_ins_flag    in varchar2         default 'N',
847   p_per_cvrd_cd                  in varchar2         default null,
848   p_short_name                  in varchar2         default null,
849   p_short_code                  in varchar2         default null,
850     p_legislation_code                  in varchar2         default null,
851     p_legislation_subgroup                  in varchar2         default null,
852   p_vrfy_fmly_mmbr_cd            in varchar2         default null,
853   p_vrfy_fmly_mmbr_rl            in number           default null,
854   p_ivr_ident                    in varchar2         default null,
855   p_url_ref_name                 in varchar2         default null,
856   p_rqd_enrt_perd_tco_cd         in varchar2         default null,
857   p_pgm_id                       in number,
858   p_pl_typ_id                    in number,
859   p_cmbn_ptip_id                 in number           default null,
860   p_cmbn_ptip_opt_id             in number           default null,
861   p_acrs_ptip_cvg_id             in number           default null,
862   p_business_group_id            in number,
863   p_ctp_attribute_category       in varchar2         default null,
864   p_ctp_attribute1               in varchar2         default null,
865   p_ctp_attribute2               in varchar2         default null,
866   p_ctp_attribute3               in varchar2         default null,
867   p_ctp_attribute4               in varchar2         default null,
868   p_ctp_attribute5               in varchar2         default null,
869   p_ctp_attribute6               in varchar2         default null,
870   p_ctp_attribute7               in varchar2         default null,
871   p_ctp_attribute8               in varchar2         default null,
872   p_ctp_attribute9               in varchar2         default null,
873   p_ctp_attribute10              in varchar2         default null,
874   p_ctp_attribute11              in varchar2         default null,
875   p_ctp_attribute12              in varchar2         default null,
876   p_ctp_attribute13              in varchar2         default null,
877   p_ctp_attribute14              in varchar2         default null,
878   p_ctp_attribute15              in varchar2         default null,
879   p_ctp_attribute16              in varchar2         default null,
880   p_ctp_attribute17              in varchar2         default null,
881   p_ctp_attribute18              in varchar2         default null,
882   p_ctp_attribute19              in varchar2         default null,
883   p_ctp_attribute20              in varchar2         default null,
884   p_ctp_attribute21              in varchar2         default null,
885   p_ctp_attribute22              in varchar2         default null,
886   p_ctp_attribute23              in varchar2         default null,
887   p_ctp_attribute24              in varchar2         default null,
888   p_ctp_attribute25              in varchar2         default null,
889   p_ctp_attribute26              in varchar2         default null,
890   p_ctp_attribute27              in varchar2         default null,
891   p_ctp_attribute28              in varchar2         default null,
892   p_ctp_attribute29              in varchar2         default null,
893   p_ctp_attribute30              in varchar2         default null,
894   p_object_version_number        out nocopy number,
895   p_effective_date               in date
896   ) is
897 --
898   l_rec		ben_ctp_shd.g_rec_type;
899   l_proc	varchar2(72) := g_package||'ins';
900 --
901 Begin
902   hr_utility.set_location('Entering:'||l_proc, 5);
903   --
904   -- Call conversion function to turn arguments into the
905   -- p_rec structure.
906   --
907   l_rec :=
908   ben_ctp_shd.convert_args
909   (
910   null,
911   null,
912   null,
913   p_coord_cvg_for_all_pls_flag,
914   p_dpnt_dsgn_cd,
915   p_dpnt_cvg_no_ctfn_rqd_flag,
916   p_dpnt_cvg_strt_dt_cd,
917   p_rt_end_dt_cd,
918   p_rt_strt_dt_cd,
919   p_enrt_cvg_end_dt_cd,
920   p_enrt_cvg_strt_dt_cd,
921   p_dpnt_cvg_strt_dt_rl,
922   p_dpnt_cvg_end_dt_cd,
923   p_dpnt_cvg_end_dt_rl,
924   p_dpnt_adrs_rqd_flag,
925   p_dpnt_legv_id_rqd_flag,
926   p_susp_if_dpnt_ssn_nt_prv_cd,
927   p_susp_if_dpnt_dob_nt_prv_cd,
928   p_susp_if_dpnt_adr_nt_prv_cd,
929   p_susp_if_ctfn_not_dpnt_flag,
930   p_dpnt_ctfn_determine_cd,
931   p_postelcn_edit_rl,
932   p_rt_end_dt_rl,
933   p_rt_strt_dt_rl,
934   p_enrt_cvg_end_dt_rl,
935   p_enrt_cvg_strt_dt_rl,
936   p_rqd_perd_enrt_nenrt_rl,
937   p_auto_enrt_mthd_rl,
938   p_enrt_mthd_cd,
939   p_enrt_cd,
940   p_enrt_rl,
941   p_dflt_enrt_cd,
942   p_dflt_enrt_det_rl,
943   p_drvbl_fctr_apls_rts_flag,
944   p_drvbl_fctr_prtn_elig_flag,
945   p_elig_apls_flag,
946   p_prtn_elig_ovrid_alwd_flag,
947   p_trk_inelig_per_flag,
948   p_dpnt_dob_rqd_flag,
949   p_crs_this_pl_typ_only_flag,
950   p_ptip_stat_cd,
951   p_mx_cvg_alwd_amt,
952   p_mx_enrd_alwd_ovrid_num,
953   p_mn_enrd_rqd_ovrid_num,
954   p_no_mx_pl_typ_ovrid_flag,
955   p_ordr_num,
956   p_prvds_cr_flag,
957   p_rqd_perd_enrt_nenrt_val,
958   p_rqd_perd_enrt_nenrt_tm_uom,
959   p_wvbl_flag,
960   p_drvd_fctr_dpnt_cvg_flag,
961   p_no_mn_pl_typ_overid_flag,
962   p_sbj_to_sps_lf_ins_mx_flag,
963   p_sbj_to_dpnt_lf_ins_mx_flag,
964   p_use_to_sum_ee_lf_ins_flag,
965   p_per_cvrd_cd,
966   p_short_name,
967   p_short_code,
968     p_legislation_code,
969     p_legislation_subgroup,
970   p_vrfy_fmly_mmbr_cd,
971   p_vrfy_fmly_mmbr_rl,
972   p_ivr_ident,
973   p_url_ref_name,
974   p_rqd_enrt_perd_tco_cd,
975   p_pgm_id,
976   p_pl_typ_id,
977   p_cmbn_ptip_id,
978   p_cmbn_ptip_opt_id,
979   p_acrs_ptip_cvg_id,
980   p_business_group_id,
981   p_ctp_attribute_category,
982   p_ctp_attribute1,
983   p_ctp_attribute2,
984   p_ctp_attribute3,
985   p_ctp_attribute4,
986   p_ctp_attribute5,
987   p_ctp_attribute6,
988   p_ctp_attribute7,
989   p_ctp_attribute8,
990   p_ctp_attribute9,
991   p_ctp_attribute10,
992   p_ctp_attribute11,
993   p_ctp_attribute12,
994   p_ctp_attribute13,
995   p_ctp_attribute14,
996   p_ctp_attribute15,
997   p_ctp_attribute16,
998   p_ctp_attribute17,
999   p_ctp_attribute18,
1000   p_ctp_attribute19,
1001   p_ctp_attribute20,
1002   p_ctp_attribute21,
1003   p_ctp_attribute22,
1004   p_ctp_attribute23,
1005   p_ctp_attribute24,
1006   p_ctp_attribute25,
1007   p_ctp_attribute26,
1008   p_ctp_attribute27,
1009   p_ctp_attribute28,
1010   p_ctp_attribute29,
1011   p_ctp_attribute30,
1012   null);
1013   --
1014   -- Having converted the arguments into the ben_ctp_rec
1015   -- plsql record structure we call the corresponding record
1016   -- business process.
1017   --
1018   ins(l_rec, p_effective_date);
1019   --
1020   -- Set the OUT arguments.
1021   --
1022   p_ptip_id        	:= l_rec.ptip_id;
1023   p_effective_start_date  	:= l_rec.effective_start_date;
1024   p_effective_end_date    	:= l_rec.effective_end_date;
1025   p_object_version_number 	:= l_rec.object_version_number;
1026   --
1027   --
1028   hr_utility.set_location(' Leaving:'||l_proc, 10);
1029 End ins;
1030 --
1031 end ben_ctp_ins;