DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_APR_INS

Source


1 Package Body ben_apr_ins as
2 /* $Header: beaprrhi.pkb 120.0 2005/05/28 00:26:53 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_apr_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_apr_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_actl_prem_f t
70     where  t.actl_prem_id       = p_rec.actl_prem_id
71     and    t.effective_start_date =
72              ben_apr_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_actl_prem_f.created_by%TYPE;
77   l_creation_date       ben_actl_prem_f.creation_date%TYPE;
78   l_last_update_date   	ben_actl_prem_f.last_update_date%TYPE;
79   l_last_updated_by     ben_actl_prem_f.last_updated_by%TYPE;
80   l_last_update_login   ben_actl_prem_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_actl_prem_f',
90 	 p_base_key_column => 'actl_prem_id',
91 	 p_base_key_value  => p_rec.actl_prem_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_apr_shd.g_api_dml := true;  -- Set the api dml status
130   --
131   -- Insert the row into: ben_actl_prem_f
132   --
133   insert into ben_actl_prem_f
134   (	actl_prem_id,
135 	effective_start_date,
136 	effective_end_date,
137 	name,
138 	acty_ref_perd_cd,
139 	uom,
140 	rt_typ_cd,
141 	bnft_rt_typ_cd,
142 	val,
143 	mlt_cd,
144 	prdct_cd,
145 	rndg_cd,
146 	rndg_rl,
147         val_calc_rl,
148 	prem_asnmt_cd,
149 	prem_asnmt_lvl_cd,
150 	actl_prem_typ_cd,
151 	prem_pyr_cd,
152 	cr_lkbk_val,
153 	cr_lkbk_uom,
154 	cr_lkbk_crnt_py_only_flag,
155 	prsptv_r_rtsptv_cd,
156 	upr_lmt_val,
157 	upr_lmt_calc_rl,
158 	lwr_lmt_val,
159 	lwr_lmt_calc_rl,
160 	cost_allocation_keyflex_id,
161 	organization_id,
162 	oipl_id,
163 	pl_id,
164 	comp_lvl_fctr_id,
165 	business_group_id,
166         prtl_mo_det_mthd_cd,
167         prtl_mo_det_mthd_rl,
168         wsh_rl_dy_mo_num,
169         vrbl_rt_add_on_calc_rl,
170 	apr_attribute_category,
171 	apr_attribute1,
172 	apr_attribute2,
173 	apr_attribute3,
174 	apr_attribute4,
175 	apr_attribute5,
176 	apr_attribute6,
177 	apr_attribute7,
178 	apr_attribute8,
179 	apr_attribute9,
180 	apr_attribute10,
181 	apr_attribute11,
182 	apr_attribute12,
183 	apr_attribute13,
184 	apr_attribute14,
185 	apr_attribute15,
186 	apr_attribute16,
187 	apr_attribute17,
188 	apr_attribute18,
189 	apr_attribute19,
190 	apr_attribute20,
191 	apr_attribute21,
192 	apr_attribute22,
193 	apr_attribute23,
194 	apr_attribute24,
195 	apr_attribute25,
196 	apr_attribute26,
197 	apr_attribute27,
198 	apr_attribute28,
199 	apr_attribute29,
200 	apr_attribute30,
201 	object_version_number
202    	, created_by,
203    	creation_date,
204    	last_update_date,
205    	last_updated_by,
206    	last_update_login
207   )
208   Values
209   (	p_rec.actl_prem_id,
210 	p_rec.effective_start_date,
211 	p_rec.effective_end_date,
212 	p_rec.name,
213 	p_rec.acty_ref_perd_cd,
214 	p_rec.uom,
215 	p_rec.rt_typ_cd,
216 	p_rec.bnft_rt_typ_cd,
217 	p_rec.val,
218 	p_rec.mlt_cd,
219 	p_rec.prdct_cd,
220 	p_rec.rndg_cd,
221 	p_rec.rndg_rl,
222         p_rec.val_calc_rl,
223 	p_rec.prem_asnmt_cd,
224 	p_rec.prem_asnmt_lvl_cd,
225 	p_rec.actl_prem_typ_cd,
226 	p_rec.prem_pyr_cd,
227 	p_rec.cr_lkbk_val,
228 	p_rec.cr_lkbk_uom,
229 	p_rec.cr_lkbk_crnt_py_only_flag,
230 	p_rec.prsptv_r_rtsptv_cd,
231 	p_rec.upr_lmt_val,
232 	p_rec.upr_lmt_calc_rl,
233 	p_rec.lwr_lmt_val,
234 	p_rec.lwr_lmt_calc_rl,
235 	p_rec.cost_allocation_keyflex_id,
236 	p_rec.organization_id,
237 	p_rec.oipl_id,
238 	p_rec.pl_id,
239 	p_rec.comp_lvl_fctr_id,
240 	p_rec.business_group_id,
241         p_rec.prtl_mo_det_mthd_cd,
242         p_rec.prtl_mo_det_mthd_rl,
243         p_rec.wsh_rl_dy_mo_num,
244         p_rec.vrbl_rt_add_on_calc_rl,
245 	p_rec.apr_attribute_category,
246 	p_rec.apr_attribute1,
247 	p_rec.apr_attribute2,
248 	p_rec.apr_attribute3,
249 	p_rec.apr_attribute4,
250 	p_rec.apr_attribute5,
251 	p_rec.apr_attribute6,
252 	p_rec.apr_attribute7,
253 	p_rec.apr_attribute8,
254 	p_rec.apr_attribute9,
255 	p_rec.apr_attribute10,
256 	p_rec.apr_attribute11,
257 	p_rec.apr_attribute12,
258 	p_rec.apr_attribute13,
259 	p_rec.apr_attribute14,
260 	p_rec.apr_attribute15,
261 	p_rec.apr_attribute16,
262 	p_rec.apr_attribute17,
263 	p_rec.apr_attribute18,
264 	p_rec.apr_attribute19,
265 	p_rec.apr_attribute20,
266 	p_rec.apr_attribute21,
267 	p_rec.apr_attribute22,
268 	p_rec.apr_attribute23,
269 	p_rec.apr_attribute24,
270 	p_rec.apr_attribute25,
271 	p_rec.apr_attribute26,
272 	p_rec.apr_attribute27,
273 	p_rec.apr_attribute28,
274 	p_rec.apr_attribute29,
275 	p_rec.apr_attribute30,
276 	p_rec.object_version_number
277 	, l_created_by,
278    	l_creation_date,
279    	l_last_update_date,
280    	l_last_updated_by,
281    	l_last_update_login
282   );
283   --
284   ben_apr_shd.g_api_dml := false;   -- Unset the api dml status
285   hr_utility.set_location(' Leaving:'||l_proc, 15);
286 --
287 Exception
288   When hr_api.check_integrity_violated Then
289     -- A check constraint has been violated
290     ben_apr_shd.g_api_dml := false;   -- Unset the api dml status
291     ben_apr_shd.constraint_error
292       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
293   When hr_api.unique_integrity_violated Then
294     -- Unique integrity has been violated
295     ben_apr_shd.g_api_dml := false;   -- Unset the api dml status
296     ben_apr_shd.constraint_error
297       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
298   When Others Then
299     ben_apr_shd.g_api_dml := false;   -- Unset the api dml status
300     Raise;
301 End dt_insert_dml;
302 --
303 -- ----------------------------------------------------------------------------
304 -- |------------------------------< insert_dml >------------------------------|
305 -- ----------------------------------------------------------------------------
306 Procedure insert_dml
307 	(p_rec 			 in out nocopy ben_apr_shd.g_rec_type,
308 	 p_effective_date	 in	date,
309 	 p_datetrack_mode	 in	varchar2,
310 	 p_validation_start_date in	date,
311 	 p_validation_end_date	 in	date) is
312 --
313   l_proc	varchar2(72) := g_package||'insert_dml';
314 --
315 Begin
316   hr_utility.set_location('Entering:'||l_proc, 5);
317   --
318   dt_insert_dml(p_rec			=> p_rec,
319 		p_effective_date	=> p_effective_date,
320 		p_datetrack_mode	=> p_datetrack_mode,
321        		p_validation_start_date	=> p_validation_start_date,
322 		p_validation_end_date	=> p_validation_end_date);
323   --
324   hr_utility.set_location(' Leaving:'||l_proc, 10);
325 End insert_dml;
326 --
327 -- ----------------------------------------------------------------------------
328 -- |------------------------------< pre_insert >------------------------------|
329 -- ----------------------------------------------------------------------------
330 -- {Start Of Comments}
331 --
332 -- Description:
333 --   This private procedure contains any processing which is required before
334 --   the insert dml. Presently, if the entity has a corresponding primary
335 --   key which is maintained by an associating sequence, the primary key for
336 --   the entity will be populated with the next sequence value in
337 --   preparation for the insert dml.
338 --   Also, if comments are defined for this entity, the comments insert
339 --   logic will also be called, generating a comment_id if required.
340 --
341 -- Prerequisites:
342 --   This is an internal procedure which is called from the ins procedure.
343 --
344 -- In Parameters:
345 --   A Pl/Sql record structre.
346 --
347 -- Post Success:
348 --   Processing continues.
349 --
350 -- Post Failure:
351 --   If an error has occurred, an error message and exception will be raised
352 --   but not handled.
353 --
354 -- Developer Implementation Notes:
355 --   Any pre-processing required before the insert dml is issued should be
356 --   coded within this procedure. As stated above, a good example is the
357 --   generation of a primary key number via a corresponding sequence.
358 --   It is important to note that any 3rd party maintenance should be reviewed
359 --   before placing in this procedure.
360 --
361 -- Access Status:
362 --   Internal Row Handler Use Only.
363 --
364 -- {End Of Comments}
365 -- ----------------------------------------------------------------------------
366 Procedure pre_insert
367 	(p_rec  			in out nocopy ben_apr_shd.g_rec_type,
368 	 p_effective_date		in date,
369 	 p_datetrack_mode		in varchar2,
370 	 p_validation_start_date	in date,
371 	 p_validation_end_date		in date) is
372 --
373   l_proc	varchar2(72) := g_package||'pre_insert';
374   cursor c1 is select ben_actl_prem_f_s.nextval
375                from   sys.dual;
376 --
377 --
378 --
379 Begin
380   hr_utility.set_location('Entering:'||l_proc, 5);
381   --
382   --
383   open c1;
384   fetch c1 into p_rec.actl_prem_id;
385   close c1;
386   --
387   --
388   hr_utility.set_location(' Leaving:'||l_proc, 10);
389 End pre_insert;
390 --
391 -- ----------------------------------------------------------------------------
392 -- |-----------------------------< post_insert >------------------------------|
393 -- ----------------------------------------------------------------------------
394 -- {Start Of Comments}
395 --
396 -- Description:
397 --   This private procedure contains any processing which is required after the
398 --   insert dml.
399 --
400 -- Prerequisites:
401 --   This is an internal procedure which is called from the ins procedure.
402 --
403 -- In Parameters:
404 --   A Pl/Sql record structre.
405 --
406 -- Post Success:
407 --   Processing continues.
408 --
409 -- Post Failure:
410 --   If an error has occurred, an error message and exception will be raised
411 --   but not handled.
412 --
413 -- Developer Implementation Notes:
414 --   Any post-processing required after the insert dml is issued should be
415 --   coded within this procedure. It is important to note that any 3rd party
416 --   maintenance should be reviewed before placing in this procedure.
417 --
418 -- Access Status:
419 --   Internal Row Handler Use Only.
420 --
421 -- {End Of Comments}
422 -- ----------------------------------------------------------------------------
423 Procedure post_insert
424 	(p_rec 			 in ben_apr_shd.g_rec_type,
425 	 p_effective_date	 in date,
426 	 p_datetrack_mode	 in varchar2,
427 	 p_validation_start_date in date,
428 	 p_validation_end_date	 in date) is
429 --
430   l_proc	varchar2(72) := g_package||'post_insert';
431 --
432 Begin
433   hr_utility.set_location('Entering:'||l_proc, 5);
434 --
435   --
436   -- Start of API User Hook for post_insert.
437   --
438   begin
439     --
440     ben_apr_rki.after_insert
441       (
442   p_actl_prem_id                  =>p_rec.actl_prem_id
443  ,p_effective_start_date          =>p_rec.effective_start_date
444  ,p_effective_end_date            =>p_rec.effective_end_date
445  ,p_name                          =>p_rec.name
446  ,p_acty_ref_perd_cd              =>p_rec.acty_ref_perd_cd
447  ,p_uom                           =>p_rec.uom
448  ,p_rt_typ_cd                     =>p_rec.rt_typ_cd
449  ,p_bnft_rt_typ_cd                =>p_rec.bnft_rt_typ_cd
453  ,p_rndg_cd                       =>p_rec.rndg_cd
450  ,p_val                           =>p_rec.val
451  ,p_mlt_cd                        =>p_rec.mlt_cd
452  ,p_prdct_cd                      =>p_rec.prdct_cd
454  ,p_rndg_rl                       =>p_rec.rndg_rl
455  ,p_val_calc_rl                   =>p_rec.val_calc_rl
456  ,p_prem_asnmt_cd                 =>p_rec.prem_asnmt_cd
457  ,p_prem_asnmt_lvl_cd             =>p_rec.prem_asnmt_lvl_cd
458  ,p_actl_prem_typ_cd              =>p_rec.actl_prem_typ_cd
459  ,p_prem_pyr_cd                   =>p_rec.prem_pyr_cd
460  ,p_cr_lkbk_val                   =>p_rec.cr_lkbk_val
461  ,p_cr_lkbk_uom                   =>p_rec.cr_lkbk_uom
462  ,p_cr_lkbk_crnt_py_only_flag     =>p_rec.cr_lkbk_crnt_py_only_flag
463  ,p_prsptv_r_rtsptv_cd            =>p_rec.prsptv_r_rtsptv_cd
464  ,p_upr_lmt_val                   =>p_rec.upr_lmt_val
465  ,p_upr_lmt_calc_rl               =>p_rec.upr_lmt_calc_rl
466  ,p_lwr_lmt_val                   =>p_rec.lwr_lmt_val
467  ,p_lwr_lmt_calc_rl               =>p_rec.lwr_lmt_calc_rl
468  ,p_cost_allocation_keyflex_id    =>p_rec.cost_allocation_keyflex_id
469  ,p_organization_id               =>p_rec.organization_id
470  ,p_oipl_id                       =>p_rec.oipl_id
471  ,p_pl_id                         =>p_rec.pl_id
472  ,p_comp_lvl_fctr_id              =>p_rec.comp_lvl_fctr_id
473  ,p_business_group_id             =>p_rec.business_group_id
474  ,p_prtl_mo_det_mthd_cd           =>p_rec.prtl_mo_det_mthd_cd
475  ,p_prtl_mo_det_mthd_rl           =>p_rec.prtl_mo_det_mthd_rl
476  ,p_wsh_rl_dy_mo_num              =>p_rec.wsh_rl_dy_mo_num
477  ,p_vrbl_rt_add_on_calc_rl        =>p_rec.vrbl_rt_add_on_calc_rl
478  ,p_apr_attribute_category        =>p_rec.apr_attribute_category
479  ,p_apr_attribute1                =>p_rec.apr_attribute1
480  ,p_apr_attribute2                =>p_rec.apr_attribute2
481  ,p_apr_attribute3                =>p_rec.apr_attribute3
482  ,p_apr_attribute4                =>p_rec.apr_attribute4
483  ,p_apr_attribute5                =>p_rec.apr_attribute5
484  ,p_apr_attribute6                =>p_rec.apr_attribute6
485  ,p_apr_attribute7                =>p_rec.apr_attribute7
486  ,p_apr_attribute8                =>p_rec.apr_attribute8
487  ,p_apr_attribute9                =>p_rec.apr_attribute9
488  ,p_apr_attribute10               =>p_rec.apr_attribute10
489  ,p_apr_attribute11               =>p_rec.apr_attribute11
490  ,p_apr_attribute12               =>p_rec.apr_attribute12
491  ,p_apr_attribute13               =>p_rec.apr_attribute13
492  ,p_apr_attribute14               =>p_rec.apr_attribute14
493  ,p_apr_attribute15               =>p_rec.apr_attribute15
494  ,p_apr_attribute16               =>p_rec.apr_attribute16
495  ,p_apr_attribute17               =>p_rec.apr_attribute17
496  ,p_apr_attribute18               =>p_rec.apr_attribute18
497  ,p_apr_attribute19               =>p_rec.apr_attribute19
498  ,p_apr_attribute20               =>p_rec.apr_attribute20
499  ,p_apr_attribute21               =>p_rec.apr_attribute21
500  ,p_apr_attribute22               =>p_rec.apr_attribute22
501  ,p_apr_attribute23               =>p_rec.apr_attribute23
502  ,p_apr_attribute24               =>p_rec.apr_attribute24
503  ,p_apr_attribute25               =>p_rec.apr_attribute25
504  ,p_apr_attribute26               =>p_rec.apr_attribute26
505  ,p_apr_attribute27               =>p_rec.apr_attribute27
506  ,p_apr_attribute28               =>p_rec.apr_attribute28
507  ,p_apr_attribute29               =>p_rec.apr_attribute29
508  ,p_apr_attribute30               =>p_rec.apr_attribute30
509  ,p_object_version_number         =>p_rec.object_version_number
510  ,p_effective_date                =>p_effective_date
511  ,p_validation_start_date         =>p_validation_start_date
512  ,p_validation_end_date           =>p_validation_end_date
513       );
514     --
515   exception
516     --
517     when hr_api.cannot_find_prog_unit then
518       --
519       hr_api.cannot_find_prog_unit_error
520         (p_module_name => 'ben_actl_prem_f'
521         ,p_hook_type   => 'AI');
522       --
523   end;
524   --
525   -- End of API User Hook for post_insert.
526   --
527   --
528   hr_utility.set_location(' Leaving:'||l_proc, 10);
529 End post_insert;
530 --
531 -- ----------------------------------------------------------------------------
532 -- |-------------------------------< ins_lck >--------------------------------|
533 -- ----------------------------------------------------------------------------
534 -- {Start Of Comments}
535 --
536 -- Description:
537 --   The ins_lck process has one main function to perform. When inserting
538 --   a datetracked row, we must validate the DT mode.
539 --   be manipulated.
540 --
541 -- Prerequisites:
542 --   This procedure can only be called for the datetrack mode of INSERT.
543 --
544 -- In Parameters:
545 --
546 -- Post Success:
547 --   On successful completion of the ins_lck process the parental
548 --   datetracked rows will be locked providing the p_enforce_foreign_locking
549 --   argument value is TRUE.
550 --   If the p_enforce_foreign_locking argument value is FALSE then the
551 --   parential rows are not locked.
552 --
553 -- Post Failure:
554 --   The Lck process can fail for:
555 --   1) When attempting to lock the row the row could already be locked by
556 --      another user. This will raise the HR_Api.Object_Locked exception.
557 --   2) When attempting to the lock the parent which doesn't exist.
561 --   None.
558 --      For the entity to be locked the parent must exist!
559 --
560 -- Developer Implementation Notes:
562 --
563 -- Access Status:
564 --   Internal Row Handler Use Only.
565 --
566 -- {End Of Comments}
567 -- ----------------------------------------------------------------------------
568 Procedure ins_lck
569 	(p_effective_date	 in  date,
570 	 p_datetrack_mode	 in  varchar2,
571 	 p_rec	 		 in  ben_apr_shd.g_rec_type,
572 	 p_validation_start_date out nocopy date,
573 	 p_validation_end_date	 out nocopy date) is
574 --
575   l_proc		  varchar2(72) := g_package||'ins_lck';
576   l_validation_start_date date;
577   l_validation_end_date	  date;
578 --
579 Begin
580   hr_utility.set_location('Entering:'||l_proc, 5);
581   --
582   -- Validate the datetrack mode mode getting the validation start
583   -- and end dates for the specified datetrack operation.
584   --
585   dt_api.validate_dt_mode
586 	(p_effective_date	   => p_effective_date,
587 	 p_datetrack_mode	   => p_datetrack_mode,
588 	 p_base_table_name	   => 'ben_actl_prem_f',
589 	 p_base_key_column	   => 'actl_prem_id',
590 	 p_base_key_value 	   => p_rec.actl_prem_id,
591 --	 p_parent_table_name1      => 'ben_comp_lvl_fctr',
592 --	 p_parent_key_column1      => 'comp_lvl_fctr_id',
593 --	 p_parent_key_value1       => p_rec.comp_lvl_fctr_id,
594          p_enforce_foreign_locking => false,
595 	 p_validation_start_date   => l_validation_start_date,
596  	 p_validation_end_date	   => l_validation_end_date);
597   --
598   -- Set the validation start and end date OUT arguments
599   --
600   p_validation_start_date := l_validation_start_date;
601   p_validation_end_date   := l_validation_end_date;
602   --
603   hr_utility.set_location(' Leaving:'||l_proc, 10);
604 --
605 End ins_lck;
606 --
607 -- ----------------------------------------------------------------------------
608 -- |---------------------------------< ins >----------------------------------|
609 -- ----------------------------------------------------------------------------
610 Procedure ins
611   (
612   p_rec		   in out nocopy ben_apr_shd.g_rec_type,
613   p_effective_date in     date
614   ) is
615 --
616   l_proc			varchar2(72) := g_package||'ins';
617   l_datetrack_mode		varchar2(30) := 'INSERT';
618   l_validation_start_date	date;
619   l_validation_end_date		date;
620 --
621 Begin
622   hr_utility.set_location('Entering:'||l_proc, 5);
623   --
624   -- Call the lock operation
625   --
626   ins_lck
627 	(p_effective_date	 => p_effective_date,
628 	 p_datetrack_mode	 => l_datetrack_mode,
629 	 p_rec	 		 => p_rec,
630 	 p_validation_start_date => l_validation_start_date,
631 	 p_validation_end_date	 => l_validation_end_date);
632   --
633   -- Call the supporting insert validate operations
634   --
635   ben_apr_bus.insert_validate
636 	(p_rec			 => p_rec,
637 	 p_effective_date	 => p_effective_date,
638 	 p_datetrack_mode	 => l_datetrack_mode,
639 	 p_validation_start_date => l_validation_start_date,
640 	 p_validation_end_date	 => l_validation_end_date);
641   --
642   -- Call the supporting pre-insert operation
643   --
644   pre_insert
645  	(p_rec			 => p_rec,
646 	 p_effective_date	 => p_effective_date,
647 	 p_datetrack_mode	 => l_datetrack_mode,
648 	 p_validation_start_date => l_validation_start_date,
649 	 p_validation_end_date	 => l_validation_end_date);
650   --
651   -- Insert the row
652   --
653   insert_dml
654  	(p_rec			 => p_rec,
655 	 p_effective_date	 => p_effective_date,
656 	 p_datetrack_mode	 => l_datetrack_mode,
657 	 p_validation_start_date => l_validation_start_date,
658 	 p_validation_end_date	 => l_validation_end_date);
659   --
660   -- Call the supporting post-insert operation
661   --
662   post_insert
663  	(p_rec			 => p_rec,
664 	 p_effective_date	 => p_effective_date,
665 	 p_datetrack_mode	 => l_datetrack_mode,
666 	 p_validation_start_date => l_validation_start_date,
667 	 p_validation_end_date	 => l_validation_end_date);
668 end ins;
669 --
670 -- ----------------------------------------------------------------------------
671 -- |---------------------------------< ins >----------------------------------|
672 -- ----------------------------------------------------------------------------
673 Procedure ins
674   (
675   p_actl_prem_id                 out nocopy number,
676   p_effective_start_date         out nocopy date,
677   p_effective_end_date           out nocopy date,
678   p_name                         in varchar2,
679   p_acty_ref_perd_cd             in varchar2,
680   p_uom                          in varchar2,
681   p_rt_typ_cd                    in varchar2         default null,
682   p_bnft_rt_typ_cd               in varchar2         default null,
683   p_val                          in number           default null,
684   p_mlt_cd                       in varchar2         default null,
685   p_prdct_cd                     in varchar2         default null,
686   p_rndg_cd                      in varchar2         default null,
687   p_rndg_rl                      in number           default null,
691   p_actl_prem_typ_cd              in varchar2       default null,
688   p_val_calc_rl                   in number         default null,
689   p_prem_asnmt_cd                 in varchar2       default null,
690   p_prem_asnmt_lvl_cd             in varchar2       default null,
692   p_prem_pyr_cd                   in varchar2       default null,
693   p_cr_lkbk_val                   in number         default null,
694   p_cr_lkbk_uom                   in varchar2       default null,
695   p_cr_lkbk_crnt_py_only_flag     in varchar2,
696   p_prsptv_r_rtsptv_cd            in varchar2      default null,
697   p_upr_lmt_val                   in number         default null,
698   p_upr_lmt_calc_rl               in number         default null,
699   p_lwr_lmt_val                   in number         default null,
700   p_lwr_lmt_calc_rl               in number         default null,
701   p_cost_allocation_keyflex_id    in number         default null,
702   p_organization_id               in number         default null,
703   p_oipl_id                       in number         default null,
704   p_pl_id                         in number          default null,
705   p_comp_lvl_fctr_id             in number           default null,
706   p_business_group_id            in number,
707   p_prtl_mo_det_mthd_cd          in varchar2         default null,
708   p_prtl_mo_det_mthd_rl          in number            default null,
709   p_wsh_rl_dy_mo_num             in number ,
710   p_vrbl_rt_add_on_calc_rl       in number            default null,
711   p_apr_attribute_category       in varchar2         default null,
712   p_apr_attribute1               in varchar2         default null,
713   p_apr_attribute2               in varchar2         default null,
714   p_apr_attribute3               in varchar2         default null,
715   p_apr_attribute4               in varchar2         default null,
716   p_apr_attribute5               in varchar2         default null,
717   p_apr_attribute6               in varchar2         default null,
718   p_apr_attribute7               in varchar2         default null,
719   p_apr_attribute8               in varchar2         default null,
720   p_apr_attribute9               in varchar2         default null,
721   p_apr_attribute10              in varchar2         default null,
722   p_apr_attribute11              in varchar2         default null,
723   p_apr_attribute12              in varchar2         default null,
724   p_apr_attribute13              in varchar2         default null,
725   p_apr_attribute14              in varchar2         default null,
726   p_apr_attribute15              in varchar2         default null,
727   p_apr_attribute16              in varchar2         default null,
728   p_apr_attribute17              in varchar2         default null,
729   p_apr_attribute18              in varchar2         default null,
730   p_apr_attribute19              in varchar2         default null,
731   p_apr_attribute20              in varchar2         default null,
732   p_apr_attribute21              in varchar2         default null,
733   p_apr_attribute22              in varchar2         default null,
734   p_apr_attribute23              in varchar2         default null,
735   p_apr_attribute24              in varchar2         default null,
736   p_apr_attribute25              in varchar2         default null,
737   p_apr_attribute26              in varchar2         default null,
738   p_apr_attribute27              in varchar2         default null,
739   p_apr_attribute28              in varchar2         default null,
740   p_apr_attribute29              in varchar2         default null,
741   p_apr_attribute30              in varchar2         default null,
742   p_object_version_number        out nocopy number,
743   p_effective_date		 in date
744   ) is
745 --
746   l_rec		ben_apr_shd.g_rec_type;
747   l_proc	varchar2(72) := g_package||'ins';
748 --
749 Begin
750   hr_utility.set_location('Entering:'||l_proc, 5);
751   --
752   -- Call conversion function to turn arguments into the
753   -- p_rec structure.
754   --
755   l_rec :=
756   ben_apr_shd.convert_args
757   (
758   null,
759   null,
760   null,
761   p_name,
762   p_acty_ref_perd_cd,
763   p_uom,
764   p_rt_typ_cd,
765   p_bnft_rt_typ_cd,
766   p_val,
767   p_mlt_cd,
768   p_prdct_cd,
769   p_rndg_cd,
770   p_rndg_rl,
771   p_val_calc_rl,
772   p_prem_asnmt_cd,
773   p_prem_asnmt_lvl_cd,
774   p_actl_prem_typ_cd,
775   p_prem_pyr_cd,
776   p_cr_lkbk_val,
777   p_cr_lkbk_uom,
778   p_cr_lkbk_crnt_py_only_flag,
779   p_prsptv_r_rtsptv_cd,
780   p_upr_lmt_val,
781   p_upr_lmt_calc_rl,
782   p_lwr_lmt_val,
783   p_lwr_lmt_calc_rl,
784   p_cost_allocation_keyflex_id,
785   p_organization_id,
786   p_oipl_id,
787   p_pl_id,
788   p_comp_lvl_fctr_id,
789   p_business_group_id,
790   p_prtl_mo_det_mthd_cd  ,
791   p_prtl_mo_det_mthd_rl  ,
792   p_wsh_rl_dy_mo_num     ,
793   p_vrbl_rt_add_on_calc_rl,
794   p_apr_attribute_category,
795   p_apr_attribute1,
796   p_apr_attribute2,
797   p_apr_attribute3,
798   p_apr_attribute4,
799   p_apr_attribute5,
800   p_apr_attribute6,
801   p_apr_attribute7,
802   p_apr_attribute8,
803   p_apr_attribute9,
804   p_apr_attribute10,
805   p_apr_attribute11,
806   p_apr_attribute12,
807   p_apr_attribute13,
808   p_apr_attribute14,
809   p_apr_attribute15,
813   p_apr_attribute19,
810   p_apr_attribute16,
811   p_apr_attribute17,
812   p_apr_attribute18,
814   p_apr_attribute20,
815   p_apr_attribute21,
816   p_apr_attribute22,
817   p_apr_attribute23,
818   p_apr_attribute24,
819   p_apr_attribute25,
820   p_apr_attribute26,
821   p_apr_attribute27,
822   p_apr_attribute28,
826   );
823   p_apr_attribute29,
824   p_apr_attribute30,
825   null
827   --
828   -- Having converted the arguments into the ben_apr_rec
829   -- plsql record structure we call the corresponding record
830   -- business process.
831   --
832   ins(l_rec, p_effective_date);
833   --
834   -- Set the OUT arguments.
835   --
836   p_actl_prem_id        	:= l_rec.actl_prem_id;
837   p_effective_start_date  	:= l_rec.effective_start_date;
838   p_effective_end_date    	:= l_rec.effective_end_date;
839   p_object_version_number 	:= l_rec.object_version_number;
840   --
841   --
842   hr_utility.set_location(' Leaving:'||l_proc, 10);
843 End ins;
844 --
845 end ben_apr_ins;