DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BPP_INS

Source


1 Package Body ben_bpp_ins as
2 /* $Header: bebpprhi.pkb 115.13 2002/12/22 20:25:09 pabodla ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_bpp_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_bpp_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_bnft_prvdr_pool_f t
70     where  t.bnft_prvdr_pool_id       = p_rec.bnft_prvdr_pool_id
71     and    t.effective_start_date =
72              ben_bpp_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_bnft_prvdr_pool_f.created_by%TYPE;
77   l_creation_date       ben_bnft_prvdr_pool_f.creation_date%TYPE;
78   l_last_update_date   	ben_bnft_prvdr_pool_f.last_update_date%TYPE;
79   l_last_updated_by     ben_bnft_prvdr_pool_f.last_updated_by%TYPE;
80   l_last_update_login   ben_bnft_prvdr_pool_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_bnft_prvdr_pool_f',
90 	 p_base_key_column => 'bnft_prvdr_pool_id',
91 	 p_base_key_value  => p_rec.bnft_prvdr_pool_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_bpp_shd.g_api_dml := true;  -- Set the api dml status
130   --
131   -- Insert the row into: ben_bnft_prvdr_pool_f
132   --
133 
134   insert into ben_bnft_prvdr_pool_f
135   (	bnft_prvdr_pool_id,
136 	effective_start_date,
137 	effective_end_date,
138 	name,
139 	pgm_pool_flag,
140 	excs_alwys_fftd_flag,
141 	use_for_pgm_pool_flag,
142 	pct_rndg_cd,
143 	pct_rndg_rl,
144 	val_rndg_cd,
145 	val_rndg_rl,
146 	dflt_excs_trtmt_cd,
147 	dflt_excs_trtmt_rl,
148 	rlovr_rstrcn_cd,
149 	no_mn_dstrbl_pct_flag,
150 	no_mn_dstrbl_val_flag,
151 	no_mx_dstrbl_pct_flag,
152 	no_mx_dstrbl_val_flag,
153         auto_alct_excs_flag,
154         alws_ngtv_crs_flag ,
155         uses_net_crs_mthd_flag,
156         mx_dfcit_pct_pool_crs_num ,
157         mx_dfcit_pct_comp_num ,
158         comp_lvl_fctr_id,
159 	mn_dstrbl_pct_num,
160 	mn_dstrbl_val,
161 	mx_dstrbl_pct_num,
162 	mx_dstrbl_val,
163 	excs_trtmt_cd,
164 	ptip_id,
165 	plip_id,
166 	pgm_id,
167 	oiplip_id,
168 	cmbn_plip_id,
169 	cmbn_ptip_id,
170 	cmbn_ptip_opt_id,
171 	business_group_id,
172 	bpp_attribute_category,
173 	bpp_attribute1,
174 	bpp_attribute2,
175 	bpp_attribute3,
176 	bpp_attribute4,
177 	bpp_attribute5,
178 	bpp_attribute6,
179 	bpp_attribute7,
180 	bpp_attribute8,
181 	bpp_attribute9,
182 	bpp_attribute10,
183 	bpp_attribute11,
184 	bpp_attribute12,
185 	bpp_attribute13,
186 	bpp_attribute14,
187 	bpp_attribute15,
188 	bpp_attribute16,
189 	bpp_attribute17,
190 	bpp_attribute18,
191 	bpp_attribute19,
192 	bpp_attribute20,
193 	bpp_attribute21,
194 	bpp_attribute22,
195 	bpp_attribute23,
196 	bpp_attribute24,
197 	bpp_attribute25,
198 	bpp_attribute26,
199 	bpp_attribute27,
200 	bpp_attribute28,
201 	bpp_attribute29,
202 	bpp_attribute30,
203 	object_version_number,
204    	created_by,
205    	creation_date,
206    	last_update_date,
207    	last_updated_by,
208    	last_update_login
209   )
210   Values
211   (	p_rec.bnft_prvdr_pool_id,
212 	p_rec.effective_start_date,
213 	p_rec.effective_end_date,
214 	p_rec.name,
215 	p_rec.pgm_pool_flag,
216 	p_rec.excs_alwys_fftd_flag,
217 	p_rec.use_for_pgm_pool_flag,
218 	p_rec.pct_rndg_cd,
219 	p_rec.pct_rndg_rl,
220 	p_rec.val_rndg_cd,
221 	p_rec.val_rndg_rl,
222 	p_rec.dflt_excs_trtmt_cd,
223 	p_rec.dflt_excs_trtmt_rl,
224 	p_rec.rlovr_rstrcn_cd,
225 	p_rec.no_mn_dstrbl_pct_flag,
226 	p_rec.no_mn_dstrbl_val_flag,
227 	p_rec.no_mx_dstrbl_pct_flag,
228 	p_rec.no_mx_dstrbl_val_flag,
229         p_rec.auto_alct_excs_flag,
230         p_rec.alws_ngtv_crs_flag ,
231         p_rec.uses_net_crs_mthd_flag,
232         p_rec.mx_dfcit_pct_pool_crs_num ,
233         p_rec.mx_dfcit_pct_comp_num ,
234         p_rec.comp_lvl_fctr_id,
235 	p_rec.mn_dstrbl_pct_num,
236 	p_rec.mn_dstrbl_val,
237 	p_rec.mx_dstrbl_pct_num,
238 	p_rec.mx_dstrbl_val,
239 	p_rec.excs_trtmt_cd,
240 	p_rec.ptip_id,
241 	p_rec.plip_id,
242 	p_rec.pgm_id,
243 	p_rec.oiplip_id,
244 	p_rec.cmbn_plip_id,
245 	p_rec.cmbn_ptip_id,
246 	p_rec.cmbn_ptip_opt_id,
247 	p_rec.business_group_id,
248 	p_rec.bpp_attribute_category,
249 	p_rec.bpp_attribute1,
250 	p_rec.bpp_attribute2,
251 	p_rec.bpp_attribute3,
252 	p_rec.bpp_attribute4,
253 	p_rec.bpp_attribute5,
254 	p_rec.bpp_attribute6,
255 	p_rec.bpp_attribute7,
256 	p_rec.bpp_attribute8,
257 	p_rec.bpp_attribute9,
258 	p_rec.bpp_attribute10,
259 	p_rec.bpp_attribute11,
260 	p_rec.bpp_attribute12,
261 	p_rec.bpp_attribute13,
262 	p_rec.bpp_attribute14,
263 	p_rec.bpp_attribute15,
264 	p_rec.bpp_attribute16,
265 	p_rec.bpp_attribute17,
266 	p_rec.bpp_attribute18,
267 	p_rec.bpp_attribute19,
268 	p_rec.bpp_attribute20,
269 	p_rec.bpp_attribute21,
270 	p_rec.bpp_attribute22,
271 	p_rec.bpp_attribute23,
272 	p_rec.bpp_attribute24,
273 	p_rec.bpp_attribute25,
274 	p_rec.bpp_attribute26,
275 	p_rec.bpp_attribute27,
276 	p_rec.bpp_attribute28,
277 	p_rec.bpp_attribute29,
278 	p_rec.bpp_attribute30,
279 	p_rec.object_version_number ,
280 	l_created_by,
281    	l_creation_date,
282    	l_last_update_date,
283    	l_last_updated_by,
284    	l_last_update_login
285   );
286   --
287 
288   ben_bpp_shd.g_api_dml := false;   -- Unset the api dml status
289   hr_utility.set_location(' Leaving:'||l_proc, 15);
290 --
291 Exception
292   When hr_api.check_integrity_violated Then
293     -- A check constraint has been violated
294     ben_bpp_shd.g_api_dml := false;   -- Unset the api dml status
295     ben_bpp_shd.constraint_error
296       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
297   When hr_api.unique_integrity_violated Then
298     -- Unique integrity has been violated
299     ben_bpp_shd.g_api_dml := false;   -- Unset the api dml status
300     ben_bpp_shd.constraint_error
301       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
302   When Others Then
303     ben_bpp_shd.g_api_dml := false;   -- Unset the api dml status
304     Raise;
305 End dt_insert_dml;
306 --
307 -- ----------------------------------------------------------------------------
308 -- |------------------------------< insert_dml >------------------------------|
309 -- ----------------------------------------------------------------------------
310 Procedure insert_dml
311 	(p_rec 			 in out nocopy ben_bpp_shd.g_rec_type,
312 	 p_effective_date	 in	date,
313 	 p_datetrack_mode	 in	varchar2,
314 	 p_validation_start_date in	date,
315 	 p_validation_end_date	 in	date) is
316 --
317   l_proc	varchar2(72) := g_package||'insert_dml';
318 --
319 Begin
320   hr_utility.set_location('Entering:'||l_proc, 5);
321   --
322   dt_insert_dml(p_rec			=> p_rec,
323 		p_effective_date	=> p_effective_date,
324 		p_datetrack_mode	=> p_datetrack_mode,
325        		p_validation_start_date	=> p_validation_start_date,
326 		p_validation_end_date	=> p_validation_end_date);
327   --
328   hr_utility.set_location(' Leaving:'||l_proc, 10);
329 End insert_dml;
330 --
331 -- ----------------------------------------------------------------------------
332 -- |------------------------------< pre_insert >------------------------------|
333 -- ----------------------------------------------------------------------------
334 -- {Start Of Comments}
335 --
336 -- Description:
337 --   This private procedure contains any processing which is required before
338 --   the insert dml. Presently, if the entity has a corresponding primary
339 --   key which is maintained by an associating sequence, the primary key for
340 --   the entity will be populated with the next sequence value in
341 --   preparation for the insert dml.
342 --   Also, if comments are defined for this entity, the comments insert
343 --   logic will also be called, generating a comment_id if required.
344 --
345 -- Prerequisites:
346 --   This is an internal procedure which is called from the ins procedure.
347 --
348 -- In Parameters:
349 --   A Pl/Sql record structre.
350 --
351 -- Post Success:
352 --   Processing continues.
353 --
354 -- Post Failure:
355 --   If an error has occurred, an error message and exception will be raised
356 --   but not handled.
357 --
358 -- Developer Implementation Notes:
359 --   Any pre-processing required before the insert dml is issued should be
360 --   coded within this procedure. As stated above, a good example is the
361 --   generation of a primary key number via a corresponding sequence.
362 --   It is important to note that any 3rd party maintenance should be reviewed
363 --   before placing in this procedure.
364 --
365 -- Access Status:
366 --   Internal Row Handler Use Only.
367 --
368 -- {End Of Comments}
369 -- ----------------------------------------------------------------------------
370 Procedure pre_insert
371 	(p_rec  			in out nocopy ben_bpp_shd.g_rec_type,
372 	 p_effective_date		in date,
373 	 p_datetrack_mode		in varchar2,
374 	 p_validation_start_date	in date,
375 	 p_validation_end_date		in date) is
376 --
377   l_proc	varchar2(72) := g_package||'pre_insert';
378 --
379   CURSOR c1 is
380     select ben_bnft_prvdr_pool_f_s.nextval
381     from   sys.dual;
382 --
383 Begin
384   hr_utility.set_location('Entering:'||l_proc, 5);
385   --
386   open c1;
387   fetch c1 into p_rec.bnft_prvdr_pool_id;
388   close c1;
389   --
390   hr_utility.set_location(' Leaving:'||l_proc, 10);
391 End pre_insert;
392 --
393 -- ----------------------------------------------------------------------------
394 -- |-----------------------------< post_insert >------------------------------|
395 -- ----------------------------------------------------------------------------
396 -- {Start Of Comments}
397 --
398 -- Description:
399 --   This private procedure contains any processing which is required after the
400 --   insert dml.
401 --
402 -- Prerequisites:
403 --   This is an internal procedure which is called from the ins procedure.
404 --
405 -- In Parameters:
406 --   A Pl/Sql record structre.
407 --
408 -- Post Success:
409 --   Processing continues.
410 --
411 -- Post Failure:
412 --   If an error has occurred, an error message and exception will be raised
413 --   but not handled.
414 --
415 -- Developer Implementation Notes:
416 --   Any post-processing required after the insert dml is issued should be
417 --   coded within this procedure. It is important to note that any 3rd party
418 --   maintenance should be reviewed before placing in this procedure.
419 --
420 -- Access Status:
421 --   Internal Row Handler Use Only.
422 --
423 -- {End Of Comments}
424 -- ----------------------------------------------------------------------------
425 Procedure post_insert
426 	(p_rec 			 in ben_bpp_shd.g_rec_type,
427 	 p_effective_date	 in date,
428 	 p_datetrack_mode	 in varchar2,
429 	 p_validation_start_date in date,
430 	 p_validation_end_date	 in date) is
431 --
432   l_proc	varchar2(72) := g_package||'post_insert';
433 --
434 Begin
435   hr_utility.set_location('Entering:'||l_proc, 5);
436   --
437   -- Start of API User Hook for post_insert.
438   --
439   begin
440     --
441     ben_bpp_rki.after_insert
442       (
443   p_bnft_prvdr_pool_id             => p_rec.bnft_prvdr_pool_id
444  ,p_effective_start_date           => p_rec.effective_start_date
445  ,p_effective_end_date             => p_rec.effective_end_date
446  ,p_name                           => p_rec.name
447  ,p_pgm_pool_flag                  => p_rec.pgm_pool_flag
448  ,p_excs_alwys_fftd_flag           => p_rec.excs_alwys_fftd_flag
449  ,p_use_for_pgm_pool_flag          => p_rec.use_for_pgm_pool_flag
450  ,p_pct_rndg_cd                    => p_rec.pct_rndg_cd
451  ,p_pct_rndg_rl                    => p_rec.pct_rndg_rl
452  ,p_val_rndg_cd                    => p_rec.val_rndg_cd
453  ,p_val_rndg_rl                    => p_rec.val_rndg_rl
454  ,p_dflt_excs_trtmt_cd             => p_rec.dflt_excs_trtmt_cd
455  ,p_dflt_excs_trtmt_rl             => p_rec.dflt_excs_trtmt_rl
456  ,p_rlovr_rstrcn_cd                => p_rec.rlovr_rstrcn_cd
457  ,p_no_mn_dstrbl_pct_flag          => p_rec.no_mn_dstrbl_pct_flag
458  ,p_no_mn_dstrbl_val_flag          => p_rec.no_mn_dstrbl_val_flag
459  ,p_no_mx_dstrbl_pct_flag          => p_rec.no_mx_dstrbl_pct_flag
460  ,p_no_mx_dstrbl_val_flag          => p_rec.no_mx_dstrbl_val_flag
461  ,p_auto_alct_excs_flag            => p_rec.auto_alct_excs_flag
462  ,p_alws_ngtv_crs_flag             => p_rec.alws_ngtv_crs_flag
463  ,p_uses_net_crs_mthd_flag         => p_rec.uses_net_crs_mthd_flag
464  ,p_mx_dfcit_pct_pool_crs_num      => p_rec.mx_dfcit_pct_pool_crs_num
465  ,p_mx_dfcit_pct_comp_num           => p_rec.mx_dfcit_pct_comp_num
466  ,p_comp_lvl_fctr_id               => p_rec.comp_lvl_fctr_id
467  ,p_mn_dstrbl_pct_num              => p_rec.mn_dstrbl_pct_num
468  ,p_mn_dstrbl_val                  => p_rec.mn_dstrbl_val
469  ,p_mx_dstrbl_pct_num              => p_rec.mx_dstrbl_pct_num
470  ,p_mx_dstrbl_val                  => p_rec.mx_dstrbl_val
471  ,p_excs_trtmt_cd                  => p_rec.excs_trtmt_cd
472  ,p_ptip_id                        => p_rec.ptip_id
473  ,p_plip_id                        => p_rec.plip_id
474  ,p_pgm_id                         => p_rec.pgm_id
475  ,p_oiplip_id                      => p_rec.oiplip_id
476  ,p_cmbn_plip_id                   => p_rec.cmbn_plip_id
477  ,p_cmbn_ptip_id                   => p_rec.cmbn_ptip_id
478  ,p_cmbn_ptip_opt_id               => p_rec.cmbn_ptip_opt_id
479  ,p_business_group_id              => p_rec.business_group_id
480  ,p_bpp_attribute_category         => p_rec.bpp_attribute_category
481  ,p_bpp_attribute1                 => p_rec.bpp_attribute1
482  ,p_bpp_attribute2                 => p_rec.bpp_attribute2
483  ,p_bpp_attribute3                 => p_rec.bpp_attribute3
484  ,p_bpp_attribute4                 => p_rec.bpp_attribute4
485  ,p_bpp_attribute5                 => p_rec.bpp_attribute5
486  ,p_bpp_attribute6                 => p_rec.bpp_attribute6
487  ,p_bpp_attribute7                 => p_rec.bpp_attribute7
488  ,p_bpp_attribute8                 => p_rec.bpp_attribute8
489  ,p_bpp_attribute9                 => p_rec.bpp_attribute9
490  ,p_bpp_attribute10                => p_rec.bpp_attribute10
491  ,p_bpp_attribute11                => p_rec.bpp_attribute11
492  ,p_bpp_attribute12                => p_rec.bpp_attribute12
493  ,p_bpp_attribute13                => p_rec.bpp_attribute13
494  ,p_bpp_attribute14                => p_rec.bpp_attribute14
495  ,p_bpp_attribute15                => p_rec.bpp_attribute15
496  ,p_bpp_attribute16                => p_rec.bpp_attribute16
497  ,p_bpp_attribute17                => p_rec.bpp_attribute17
498  ,p_bpp_attribute18                => p_rec.bpp_attribute18
499  ,p_bpp_attribute19                => p_rec.bpp_attribute19
500  ,p_bpp_attribute20                => p_rec.bpp_attribute20
501  ,p_bpp_attribute21                => p_rec.bpp_attribute21
502  ,p_bpp_attribute22                => p_rec.bpp_attribute22
503  ,p_bpp_attribute23                => p_rec.bpp_attribute23
504  ,p_bpp_attribute24                => p_rec.bpp_attribute24
505  ,p_bpp_attribute25                => p_rec.bpp_attribute25
506  ,p_bpp_attribute26                => p_rec.bpp_attribute26
507  ,p_bpp_attribute27                => p_rec.bpp_attribute27
508  ,p_bpp_attribute28                => p_rec.bpp_attribute28
509  ,p_bpp_attribute29                => p_rec.bpp_attribute29
510  ,p_bpp_attribute30                => p_rec.bpp_attribute30
511  ,p_object_version_number          => p_rec.object_version_number
512  ,p_effective_date                 => p_effective_date
513  ,p_validation_start_date          => p_validation_start_date
514  ,p_validation_end_date            => p_validation_end_date
515   );
516     --
517   exception
518     --
519     when hr_api.cannot_find_prog_unit then
520       --
521       hr_api.cannot_find_prog_unit_error
522         (p_module_name => 'ben_bnft_prvdr_pool_f'
523         ,p_hook_type   => 'AI');
524       --
525   end;
526   --
527   -- End of API User Hook for post_insert.
528   --
529   --
530   hr_utility.set_location(' Leaving:'||l_proc, 10);
531 End post_insert;
532 --
533 -- ----------------------------------------------------------------------------
534 -- |-------------------------------< ins_lck >--------------------------------|
535 -- ----------------------------------------------------------------------------
536 -- {Start Of Comments}
537 --
538 -- Description:
539 --   The ins_lck process has one main function to perform. When inserting
540 --   a datetracked row, we must validate the DT mode.
541 --   be manipulated.
542 --
543 -- Prerequisites:
544 --   This procedure can only be called for the datetrack mode of INSERT.
545 --
546 -- In Parameters:
547 --
548 -- Post Success:
549 --   On successful completion of the ins_lck process the parental
550 --   datetracked rows will be locked providing the p_enforce_foreign_locking
551 --   argument value is TRUE.
552 --   If the p_enforce_foreign_locking argument value is FALSE then the
553 --   parential rows are not locked.
554 --
555 -- Post Failure:
556 --   The Lck process can fail for:
557 --   1) When attempting to lock the row the row could already be locked by
558 --      another user. This will raise the HR_Api.Object_Locked exception.
559 --   2) When attempting to the lock the parent which doesn't exist.
560 --      For the entity to be locked the parent must exist!
561 --
562 -- Developer Implementation Notes:
563 --   None.
564 --
565 -- Access Status:
566 --   Internal Row Handler Use Only.
567 --
568 -- {End Of Comments}
569 -- ----------------------------------------------------------------------------
570 Procedure ins_lck
571 	(p_effective_date	 in  date,
572 	 p_datetrack_mode	 in  varchar2,
573 	 p_rec	 		 in  ben_bpp_shd.g_rec_type,
574 	 p_validation_start_date out nocopy date,
575 	 p_validation_end_date	 out nocopy date) is
576 --
577   l_proc		  varchar2(72) := g_package||'ins_lck';
578   l_validation_start_date date;
579   l_validation_end_date	  date;
580 --
581 Begin
582   hr_utility.set_location('Entering:'||l_proc, 5);
583   --
584   -- Validate the datetrack mode mode getting the validation start
585   -- and end dates for the specified datetrack operation.
586   --
587   dt_api.validate_dt_mode
588 	(p_effective_date	   => p_effective_date,
589 	 p_datetrack_mode	   => p_datetrack_mode,
590 	 p_base_table_name	   => 'ben_bnft_prvdr_pool_f',
591 	 p_base_key_column	   => 'bnft_prvdr_pool_id',
592 	 p_base_key_value 	   => p_rec.bnft_prvdr_pool_id,
593 	 p_parent_table_name1      => 'ben_pgm_f',
594 	 p_parent_key_column1      => 'pgm_id',
595 	 p_parent_key_value1       => p_rec.pgm_id,
596 	 p_parent_table_name2      => 'ben_plip_f',
597 	 p_parent_key_column2      => 'plip_id',
598 	 p_parent_key_value2       => p_rec.plip_id,
599 	 p_parent_table_name3      => 'ben_ptip_f',
600 	 p_parent_key_column3      => 'ptip_id',
601 	 p_parent_key_value3       => p_rec.ptip_id,
602 	 p_parent_table_name4      => 'ben_cmbn_plip_f',
603 	 p_parent_key_column4      => 'cmbn_plip_id',
604 	 p_parent_key_value4       => p_rec.cmbn_plip_id,
605 	 p_parent_table_name5      => 'ben_cmbn_ptip_f',
606 	 p_parent_key_column5      => 'cmbn_ptip_id',
607 	 p_parent_key_value5       => p_rec.cmbn_ptip_id,
608 	 p_parent_table_name6      => 'ben_cmbn_ptip_opt_f',
609 	 p_parent_key_column6      => 'cmbn_ptip_opt_id',
610 	 p_parent_key_value6       => p_rec.cmbn_ptip_opt_id,
611 	 p_parent_table_name7      => 'ben_oiplip_f',
612 	 p_parent_key_column7      => 'oiplip_id',
613 	 p_parent_key_value7       => p_rec.oiplip_id,
614          p_enforce_foreign_locking => true,
615 	 p_validation_start_date   => l_validation_start_date,
616  	 p_validation_end_date	   => l_validation_end_date);
617   --
618   -- Set the validation start and end date OUT arguments
619   --
620   p_validation_start_date := l_validation_start_date;
621   p_validation_end_date   := l_validation_end_date;
622   --
623   hr_utility.set_location(' Leaving:'||l_proc, 10);
624 --
625 End ins_lck;
626 --
627 -- ----------------------------------------------------------------------------
628 -- |---------------------------------< ins >----------------------------------|
629 -- ----------------------------------------------------------------------------
630 Procedure ins
631   (
632   p_rec		   in out nocopy ben_bpp_shd.g_rec_type,
633   p_effective_date in     date
634   ) is
635 --
636   l_proc			varchar2(72) := g_package||'ins';
637   l_datetrack_mode		varchar2(30) := 'INSERT';
638   l_validation_start_date	date;
639   l_validation_end_date		date;
640 --
641 Begin
642   hr_utility.set_location('Entering:'||l_proc, 5);
643   --
644   -- Call the lock operation
645   --
646   ins_lck
647 	(p_effective_date	 => p_effective_date,
648 	 p_datetrack_mode	 => l_datetrack_mode,
649 	 p_rec	 		 => p_rec,
650 	 p_validation_start_date => l_validation_start_date,
651 	 p_validation_end_date	 => l_validation_end_date);
652   --
653   -- Call the supporting insert validate operations
654   --
655   ben_bpp_bus.insert_validate
656 	(p_rec			 => p_rec,
657 	 p_effective_date	 => p_effective_date,
658 	 p_datetrack_mode	 => l_datetrack_mode,
659 	 p_validation_start_date => l_validation_start_date,
660 	 p_validation_end_date	 => l_validation_end_date);
661   --
662   -- Call the supporting pre-insert operation
663   --
664   pre_insert
665  	(p_rec			 => p_rec,
666 	 p_effective_date	 => p_effective_date,
667 	 p_datetrack_mode	 => l_datetrack_mode,
668 	 p_validation_start_date => l_validation_start_date,
669 	 p_validation_end_date	 => l_validation_end_date);
670   --
671   -- Insert the row
672   --
673   insert_dml
674  	(p_rec			 => p_rec,
675 	 p_effective_date	 => p_effective_date,
676 	 p_datetrack_mode	 => l_datetrack_mode,
677 	 p_validation_start_date => l_validation_start_date,
678 	 p_validation_end_date	 => l_validation_end_date);
679   --
680   -- Call the supporting post-insert operation
681   --
682   post_insert
683  	(p_rec			 => p_rec,
684 	 p_effective_date	 => p_effective_date,
685 	 p_datetrack_mode	 => l_datetrack_mode,
686 	 p_validation_start_date => l_validation_start_date,
687 	 p_validation_end_date	 => l_validation_end_date);
688 end ins;
689 --
690 -- ----------------------------------------------------------------------------
691 -- |---------------------------------< ins >----------------------------------|
692 -- ----------------------------------------------------------------------------
693 Procedure ins
694   (
695   p_bnft_prvdr_pool_id           out nocopy number,
696   p_effective_start_date         out nocopy date,
697   p_effective_end_date           out nocopy date,
698   p_name                         in varchar2,
699   p_pgm_pool_flag                in varchar2,
700   p_excs_alwys_fftd_flag         in varchar2,
701   p_use_for_pgm_pool_flag        in varchar2,
702   p_pct_rndg_cd                  in varchar2         default null,
703   p_pct_rndg_rl                  in number           default null,
704   p_val_rndg_cd                  in varchar2         default null,
705   p_val_rndg_rl                  in number           default null,
706   p_dflt_excs_trtmt_cd           in varchar2         default null,
707   p_dflt_excs_trtmt_rl           in number           default null,
708   p_rlovr_rstrcn_cd              in varchar2         default null,
709   p_no_mn_dstrbl_pct_flag        in varchar2,
710   p_no_mn_dstrbl_val_flag        in varchar2,
711   p_no_mx_dstrbl_pct_flag        in varchar2,
712   p_no_mx_dstrbl_val_flag        in varchar2,
713   p_auto_alct_excs_flag          in varchar2         default 'N',
714   p_alws_ngtv_crs_flag           in varchar2         default 'N',
715   p_uses_net_crs_mthd_flag       in varchar2         default 'N',
716   p_mx_dfcit_pct_pool_crs_num    in number           default null,
717   p_mx_dfcit_pct_comp_num         in number           default null,
718   p_comp_lvl_fctr_id             in number           default null,
719   p_mn_dstrbl_pct_num            in number           default null,
720   p_mn_dstrbl_val                in number           default null,
721   p_mx_dstrbl_pct_num            in number           default null,
722   p_mx_dstrbl_val                in number           default null,
723   p_excs_trtmt_cd                in varchar2         default null,
724   p_ptip_id                      in number           default null,
725   p_plip_id                      in number           default null,
726   p_pgm_id                       in number,
727   p_oiplip_id                    in number           default null,
728   p_cmbn_plip_id                 in number           default null,
729   p_cmbn_ptip_id                 in number           default null,
730   p_cmbn_ptip_opt_id             in number           default null,
731   p_business_group_id            in number,
732   p_bpp_attribute_category       in varchar2         default null,
733   p_bpp_attribute1               in varchar2         default null,
734   p_bpp_attribute2               in varchar2         default null,
735   p_bpp_attribute3               in varchar2         default null,
736   p_bpp_attribute4               in varchar2         default null,
737   p_bpp_attribute5               in varchar2         default null,
738   p_bpp_attribute6               in varchar2         default null,
739   p_bpp_attribute7               in varchar2         default null,
740   p_bpp_attribute8               in varchar2         default null,
741   p_bpp_attribute9               in varchar2         default null,
742   p_bpp_attribute10              in varchar2         default null,
743   p_bpp_attribute11              in varchar2         default null,
744   p_bpp_attribute12              in varchar2         default null,
745   p_bpp_attribute13              in varchar2         default null,
746   p_bpp_attribute14              in varchar2         default null,
747   p_bpp_attribute15              in varchar2         default null,
748   p_bpp_attribute16              in varchar2         default null,
749   p_bpp_attribute17              in varchar2         default null,
750   p_bpp_attribute18              in varchar2         default null,
751   p_bpp_attribute19              in varchar2         default null,
752   p_bpp_attribute20              in varchar2         default null,
753   p_bpp_attribute21              in varchar2         default null,
754   p_bpp_attribute22              in varchar2         default null,
755   p_bpp_attribute23              in varchar2         default null,
756   p_bpp_attribute24              in varchar2         default null,
757   p_bpp_attribute25              in varchar2         default null,
758   p_bpp_attribute26              in varchar2         default null,
759   p_bpp_attribute27              in varchar2         default null,
760   p_bpp_attribute28              in varchar2         default null,
761   p_bpp_attribute29              in varchar2         default null,
762   p_bpp_attribute30              in varchar2         default null,
763   p_object_version_number        out nocopy number,
764   p_effective_date		 in date
765   ) is
766 --
767   l_rec		ben_bpp_shd.g_rec_type;
768   l_proc	varchar2(72) := g_package||'ins';
769 --
770 Begin
771   hr_utility.set_location('Entering:'||l_proc, 5);
772   --
773   -- Call conversion function to turn arguments into the
774   -- p_rec structure.
775   --
776   l_rec :=
777   ben_bpp_shd.convert_args
778   (
779   null,
780   null,
781   null,
782   p_name,
783   p_pgm_pool_flag,
784   p_excs_alwys_fftd_flag,
785   p_use_for_pgm_pool_flag,
786   p_pct_rndg_cd,
787   p_pct_rndg_rl,
788   p_val_rndg_cd,
789   p_val_rndg_rl,
790   p_dflt_excs_trtmt_cd,
791   p_dflt_excs_trtmt_rl,
792   p_rlovr_rstrcn_cd,
793   p_no_mn_dstrbl_pct_flag,
794   p_no_mn_dstrbl_val_flag,
795   p_no_mx_dstrbl_pct_flag,
796   p_no_mx_dstrbl_val_flag,
797   p_auto_alct_excs_flag,
798   p_alws_ngtv_crs_flag ,
799   p_uses_net_crs_mthd_flag,
800   p_mx_dfcit_pct_pool_crs_num ,
801   p_mx_dfcit_pct_comp_num ,
802   p_comp_lvl_fctr_id,
803   p_mn_dstrbl_pct_num,
804   p_mn_dstrbl_val,
805   p_mx_dstrbl_pct_num,
806   p_mx_dstrbl_val,
807   p_excs_trtmt_cd,
808   p_ptip_id,
809   p_plip_id,
810   p_pgm_id,
811   p_oiplip_id,
812   p_cmbn_plip_id,
813   p_cmbn_ptip_id,
814   p_cmbn_ptip_opt_id,
815   p_business_group_id,
816   p_bpp_attribute_category,
817   p_bpp_attribute1,
818   p_bpp_attribute2,
819   p_bpp_attribute3,
820   p_bpp_attribute4,
821   p_bpp_attribute5,
822   p_bpp_attribute6,
823   p_bpp_attribute7,
824   p_bpp_attribute8,
825   p_bpp_attribute9,
826   p_bpp_attribute10,
827   p_bpp_attribute11,
828   p_bpp_attribute12,
829   p_bpp_attribute13,
830   p_bpp_attribute14,
831   p_bpp_attribute15,
832   p_bpp_attribute16,
833   p_bpp_attribute17,
834   p_bpp_attribute18,
835   p_bpp_attribute19,
836   p_bpp_attribute20,
837   p_bpp_attribute21,
838   p_bpp_attribute22,
839   p_bpp_attribute23,
840   p_bpp_attribute24,
841   p_bpp_attribute25,
842   p_bpp_attribute26,
843   p_bpp_attribute27,
844   p_bpp_attribute28,
845   p_bpp_attribute29,
846   p_bpp_attribute30,
847   null
848   );
849   --
850   -- Having converted the arguments into the ben_bpp_rec
851   -- plsql record structure we call the corresponding record
852   -- business process.
853   --
854   ins(l_rec, p_effective_date);
855   --
856   -- Set the OUT arguments.
857   --
858   p_bnft_prvdr_pool_id        	:= l_rec.bnft_prvdr_pool_id;
859   p_effective_start_date  	:= l_rec.effective_start_date;
860   p_effective_end_date    	:= l_rec.effective_end_date;
861   p_object_version_number 	:= l_rec.object_version_number;
862   --
863   --
864   hr_utility.set_location(' Leaving:'||l_proc, 10);
865 End ins;
866 --
867 end ben_bpp_ins;