DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PEN_INS

Source


1 Package Body ben_pen_ins as
2 /* $Header: bepenrhi.pkb 120.23.12020000.2 2012/07/03 14:17:34 amnaraya ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_pen_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_pen_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_prtt_enrt_rslt_f t
70     where  t.prtt_enrt_rslt_id       = p_rec.prtt_enrt_rslt_id
71     and    t.effective_start_date =
72              ben_pen_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_prtt_enrt_rslt_f.created_by%TYPE;
77   l_creation_date       ben_prtt_enrt_rslt_f.creation_date%TYPE;
78   l_last_update_date   	ben_prtt_enrt_rslt_f.last_update_date%TYPE;
79   l_last_updated_by     ben_prtt_enrt_rslt_f.last_updated_by%TYPE;
80   l_last_update_login   ben_prtt_enrt_rslt_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_prtt_enrt_rslt_f',
90      p_base_key_column => 'prtt_enrt_rslt_id',
91      p_base_key_value  => p_rec.prtt_enrt_rslt_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_pen_shd.g_api_dml := true;  -- Set the api dml status
130   --
131   -- Insert the row into: ben_prtt_enrt_rslt_f
132   --
133   insert into ben_prtt_enrt_rslt_f
134   (	prtt_enrt_rslt_id,
135     effective_start_date,
136     effective_end_date,
137     business_group_id,
138     oipl_id,
139     person_id,
140     assignment_id,
141     pgm_id,
142     pl_id,
143     rplcs_sspndd_rslt_id,
144     ptip_id,
145     pl_typ_id,
146     ler_id,
147     sspndd_flag,
148     prtt_is_cvrd_flag,
149     bnft_amt,
150     uom     ,
151     orgnl_enrt_dt,
152     enrt_mthd_cd,
153         no_lngr_elig_flag,
154     enrt_ovridn_flag,
155     enrt_ovrid_rsn_cd,
156     erlst_deenrt_dt,
157     enrt_cvg_strt_dt,
158     enrt_cvg_thru_dt,
159     enrt_ovrid_thru_dt,
160         pl_ordr_num,
161         plip_ordr_num,
162         ptip_ordr_num,
163         oipl_ordr_num,
164     pen_attribute_category,
165     pen_attribute1,
166     pen_attribute2,
167     pen_attribute3,
168     pen_attribute4,
169     pen_attribute5,
170     pen_attribute6,
171     pen_attribute7,
172     pen_attribute8,
173     pen_attribute9,
174     pen_attribute10,
175     pen_attribute11,
176     pen_attribute12,
177     pen_attribute13,
178     pen_attribute14,
179     pen_attribute15,
180     pen_attribute16,
181     pen_attribute17,
182     pen_attribute18,
183     pen_attribute19,
184     pen_attribute20,
185     pen_attribute21,
186     pen_attribute22,
187     pen_attribute23,
188     pen_attribute24,
189     pen_attribute25,
190     pen_attribute26,
191     pen_attribute27,
192     pen_attribute28,
193     pen_attribute29,
194     pen_attribute30,
195     request_id,
196     program_application_id,
197     program_id,
198     program_update_date,
199     object_version_number,
200     per_in_ler_id,
201     bnft_typ_cd,
202       bnft_ordr_num,
203       prtt_enrt_rslt_stat_cd,
204     bnft_nnmntry_uom,
205       comp_lvl_cd,
206    	created_by,
207    	creation_date,
208    	last_update_date,
209    	last_updated_by,
210    	last_update_login
211   )
212   Values
213   (	p_rec.prtt_enrt_rslt_id,
214     p_rec.effective_start_date,
215     p_rec.effective_end_date,
216     p_rec.business_group_id,
217     p_rec.oipl_id,
218     p_rec.person_id,
219     p_rec.assignment_id,
220     p_rec.pgm_id,
221     p_rec.pl_id,
222     p_rec.rplcs_sspndd_rslt_id,
223     p_rec.ptip_id,
224     p_rec.pl_typ_id,
225     p_rec.ler_id,
226     p_rec.sspndd_flag,
227     p_rec.prtt_is_cvrd_flag,
228     p_rec.bnft_amt,
229     p_rec.uom     ,
230     p_rec.orgnl_enrt_dt,
231     p_rec.enrt_mthd_cd,
232         p_rec.no_lngr_elig_flag,
233     p_rec.enrt_ovridn_flag,
234     p_rec.enrt_ovrid_rsn_cd,
235     p_rec.erlst_deenrt_dt,
236     p_rec.enrt_cvg_strt_dt,
237     p_rec.enrt_cvg_thru_dt,
238     p_rec.enrt_ovrid_thru_dt,
239         p_rec.pl_ordr_num,
240         p_rec.plip_ordr_num,
241         p_rec.ptip_ordr_num,
242         p_rec.oipl_ordr_num,
243     p_rec.pen_attribute_category,
244     p_rec.pen_attribute1,
245     p_rec.pen_attribute2,
246     p_rec.pen_attribute3,
247     p_rec.pen_attribute4,
248     p_rec.pen_attribute5,
249     p_rec.pen_attribute6,
250     p_rec.pen_attribute7,
251     p_rec.pen_attribute8,
252     p_rec.pen_attribute9,
253     p_rec.pen_attribute10,
254     p_rec.pen_attribute11,
255     p_rec.pen_attribute12,
256     p_rec.pen_attribute13,
257     p_rec.pen_attribute14,
258     p_rec.pen_attribute15,
259     p_rec.pen_attribute16,
260     p_rec.pen_attribute17,
261     p_rec.pen_attribute18,
262     p_rec.pen_attribute19,
263     p_rec.pen_attribute20,
264     p_rec.pen_attribute21,
265     p_rec.pen_attribute22,
266     p_rec.pen_attribute23,
267     p_rec.pen_attribute24,
268     p_rec.pen_attribute25,
269     p_rec.pen_attribute26,
270     p_rec.pen_attribute27,
271     p_rec.pen_attribute28,
272     p_rec.pen_attribute29,
273     p_rec.pen_attribute30,
274     p_rec.request_id,
275     p_rec.program_application_id,
276     p_rec.program_id,
277     p_rec.program_update_date,
278     p_rec.object_version_number,
279     p_rec.per_in_ler_id,
280     p_rec.bnft_typ_cd,
281       p_rec.bnft_ordr_num,
282       p_rec.prtt_enrt_rslt_stat_cd,
283     p_rec.bnft_nnmntry_uom,
284     p_rec.comp_lvl_cd,
285     l_created_by,
286    	l_creation_date,
287    	l_last_update_date,
288    	l_last_updated_by,
289    	l_last_update_login
290   );
291   --
292   ben_pen_shd.g_api_dml := false;   -- Unset the api dml status
293   hr_utility.set_location(' Leaving:'||l_proc, 15);
294 --
295 Exception
296   When hr_api.check_integrity_violated Then
297     -- A check constraint has been violated
298     ben_pen_shd.g_api_dml := false;   -- Unset the api dml status
299     ben_pen_shd.constraint_error
300       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
301   When hr_api.unique_integrity_violated Then
302     -- Unique integrity has been violated
303     ben_pen_shd.g_api_dml := false;   -- Unset the api dml status
304     ben_pen_shd.constraint_error
305       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
306   When Others Then
307     ben_pen_shd.g_api_dml := false;   -- Unset the api dml status
308     Raise;
309 End dt_insert_dml;
310 --
311 -- ----------------------------------------------------------------------------
312 -- |------------------------------< insert_dml >------------------------------|
313 -- ----------------------------------------------------------------------------
314 Procedure insert_dml
315     (p_rec 			         in out nocopy ben_pen_shd.g_rec_type,
316      p_effective_date	     in	    date,
317      p_datetrack_mode	     in     varchar2,
318      p_validation_start_date in	    date,
319      p_validation_end_date	 in	    date) is
320 --
321   l_proc	varchar2(72) := g_package||'insert_dml';
322 --
323 Begin
324   hr_utility.set_location('Entering:'||l_proc, 5);
325   --
326   dt_insert_dml(p_rec			=> p_rec,
327         p_effective_date	    => p_effective_date,
328         p_datetrack_mode	    => p_datetrack_mode,
329        	p_validation_start_date	=> p_validation_start_date,
330         p_validation_end_date	=> p_validation_end_date);
331   --
332   hr_utility.set_location(' Leaving:'||l_proc, 10);
333 End insert_dml;
334 --
335 -- ----------------------------------------------------------------------------
336 -- |------------------------------< pre_insert >------------------------------|
337 -- ----------------------------------------------------------------------------
338 -- {Start Of Comments}
339 --
340 -- Description:
341 --   This private procedure contains any processing which is required before
342 --   the insert dml. Presently, if the entity has a corresponding primary
343 --   key which is maintained by an associating sequence, the primary key for
344 --   the entity will be populated with the next sequence value in
345 --   preparation for the insert dml.
346 --   Also, if comments are defined for this entity, the comments insert
347 --   logic will also be called, generating a comment_id if required.
348 --
349 -- Prerequisites:
350 --   This is an internal procedure which is called from the ins procedure.
351 --
352 -- In Parameters:
353 --   A Pl/Sql record structre.
354 --
355 -- Post Success:
356 --   Processing continues.
357 --
358 -- Post Failure:
359 --   If an error has occurred, an error message and exception will be raised
360 --   but not handled.
361 --
362 -- Developer Implementation Notes:
363 --   Any pre-processing required before the insert dml is issued should be
364 --   coded within this procedure. As stated above, a good example is the
365 --   generation of a primary key number via a corresponding sequence.
366 --   It is important to note that any 3rd party maintenance should be reviewed
367 --   before placing in this procedure.
368 --
369 -- Access Status:
370 --   Internal Row Handler Use Only.
371 --
372 -- {End Of Comments}
373 -- ----------------------------------------------------------------------------
374 Procedure pre_insert
375     (p_rec  			     in out nocopy ben_pen_shd.g_rec_type,
376      p_effective_date		 in     date,
377      p_datetrack_mode		 in     varchar2,
378      p_validation_start_date in     date,
379      p_validation_end_date	 in     date) is
380 --
381   l_proc	varchar2(72) := g_package||'pre_insert';
382   Cursor C_Sel1 is
383     select ben_prtt_enrt_rslt_f_s.nextval from sys.dual;
384 --
385 --
386 --
387 Begin
388   hr_utility.set_location('Entering:'||l_proc, 5);
389   --
390   -- Select the next sequence number
391   --
392   Open C_Sel1;
393   Fetch C_Sel1 Into p_rec.prtt_enrt_rslt_id;
394   Close C_Sel1;
395 
396   if p_rec.enrt_cvg_strt_dt >
397      nvl(p_rec.enrt_cvg_thru_dt, p_rec.enrt_cvg_strt_dt) then
398      p_rec.prtt_enrt_rslt_stat_cd := 'VOIDD';
399   end if;
400 
401   --
402   --
403   hr_utility.set_location(' Leaving:'||l_proc, 10);
404 End pre_insert;
405 --
406 -- ----------------------------------------------------------------------------
407 -- |-----------------------------< post_insert >------------------------------|
408 -- ----------------------------------------------------------------------------
409 -- {Start Of Comments}
410 --
411 -- Description:
412 --   This private procedure contains any processing which is required after the
413 --   insert dml.
414 --
415 -- Prerequisites:
416 --   This is an internal procedure which is called from the ins procedure.
417 --
418 -- In Parameters:
419 --   A Pl/Sql record structre.
420 --
421 -- Post Success:
422 --   Processing continues.
423 --
424 -- Post Failure:
425 --   If an error has occurred, an error message and exception will be raised
426 --   but not handled.
427 --
428 -- Developer Implementation Notes:
429 --   Any post-processing required after the insert dml is issued should be
430 --   coded within this procedure. It is important to note that any 3rd party
431 --   maintenance should be reviewed before placing in this procedure.
432 --
433 -- Access Status:
434 --   Internal Row Handler Use Only.
435 --
436 -- {End Of Comments}
437 -- ----------------------------------------------------------------------------
438 Procedure post_insert
439     (p_rec 			         in     ben_pen_shd.g_rec_type,
440      p_effective_date	     in     date,
441      p_datetrack_mode	     in     varchar2,
442      p_validation_start_date in     date,
443      p_validation_end_date	 in     date) is
444 --
445   l_proc	varchar2(72) := g_package||'post_insert';
446 --
447 Begin
448   hr_utility.set_location('Entering:'||l_proc, 5);
449 --
450  ben_dt_trgr_handle.prtt_enrt_rslt
451     (p_rowid                 => null
452     ,p_prtt_enrt_rslt_id     => p_rec.prtt_enrt_rslt_id
453     ,p_business_group_id     => p_rec.business_group_id
454     ,p_person_id             => p_rec.person_id
455     ,p_enrt_cvg_strt_dt      => p_rec.enrt_cvg_strt_dt
456     ,p_enrt_cvg_thru_dt      => p_rec.enrt_cvg_thru_dt
457     ,p_bnft_amt              => p_rec.bnft_amt
458     ,p_effective_start_date  => p_rec.effective_start_date
459     ,p_effective_end_date    => p_rec.effective_end_date
460     );
461   --
462   --
463   -- Start of API User Hook for post_insert.
464   --
465   begin
466     --
467     ben_pen_rki.after_insert
468       (p_prtt_enrt_rslt_id             =>p_rec.prtt_enrt_rslt_id
469       ,p_effective_start_date          =>p_rec.effective_start_date
470       ,p_effective_end_date            =>p_rec.effective_end_date
471       ,p_business_group_id             =>p_rec.business_group_id
472       ,p_oipl_id                       =>p_rec.oipl_id
473       ,p_person_id                     =>p_rec.person_id
474       ,p_assignment_id                 =>p_rec.assignment_id
475       ,p_pgm_id                        =>p_rec.pgm_id
476       ,p_pl_id                         =>p_rec.pl_id
477       ,p_rplcs_sspndd_rslt_id          =>p_rec.rplcs_sspndd_rslt_id
478       ,p_ptip_id                       =>p_rec.ptip_id
479       ,p_pl_typ_id                     =>p_rec.pl_typ_id
480       ,p_ler_id                        =>p_rec.ler_id
481       ,p_sspndd_flag                   =>p_rec.sspndd_flag
482       ,p_prtt_is_cvrd_flag             =>p_rec.prtt_is_cvrd_flag
483       ,p_bnft_amt                      =>p_rec.bnft_amt
484       ,p_uom                           =>p_rec.uom
485       ,p_orgnl_enrt_dt                 =>p_rec.orgnl_enrt_dt
486       ,p_enrt_mthd_cd                  =>p_rec.enrt_mthd_cd
487       ,p_no_lngr_elig_flag             =>p_rec.no_lngr_elig_flag
488       ,p_enrt_ovridn_flag              =>p_rec.enrt_ovridn_flag
489       ,p_enrt_ovrid_rsn_cd             =>p_rec.enrt_ovrid_rsn_cd
490       ,p_erlst_deenrt_dt               =>p_rec.erlst_deenrt_dt
491       ,p_enrt_cvg_strt_dt              =>p_rec.enrt_cvg_strt_dt
492       ,p_enrt_cvg_thru_dt              =>p_rec.enrt_cvg_thru_dt
493       ,p_enrt_ovrid_thru_dt            =>p_rec.enrt_ovrid_thru_dt
494       ,p_pl_ordr_num                     =>p_rec.pl_ordr_num
495       ,p_plip_ordr_num                   =>p_rec.plip_ordr_num
496       ,p_ptip_ordr_num                   =>p_rec.ptip_ordr_num
497       ,p_oipl_ordr_num                   =>p_rec.oipl_ordr_num
498       ,p_pen_attribute_category        =>p_rec.pen_attribute_category
499       ,p_pen_attribute1                =>p_rec.pen_attribute1
500       ,p_pen_attribute2                =>p_rec.pen_attribute2
501       ,p_pen_attribute3                =>p_rec.pen_attribute3
502       ,p_pen_attribute4                =>p_rec.pen_attribute4
503       ,p_pen_attribute5                =>p_rec.pen_attribute5
504       ,p_pen_attribute6                =>p_rec.pen_attribute6
505       ,p_pen_attribute7                =>p_rec.pen_attribute7
506       ,p_pen_attribute8                =>p_rec.pen_attribute8
507       ,p_pen_attribute9                =>p_rec.pen_attribute9
508       ,p_pen_attribute10               =>p_rec.pen_attribute10
509       ,p_pen_attribute11               =>p_rec.pen_attribute11
510       ,p_pen_attribute12               =>p_rec.pen_attribute12
511       ,p_pen_attribute13               =>p_rec.pen_attribute13
512       ,p_pen_attribute14               =>p_rec.pen_attribute14
513       ,p_pen_attribute15               =>p_rec.pen_attribute15
514       ,p_pen_attribute16               =>p_rec.pen_attribute16
515       ,p_pen_attribute17               =>p_rec.pen_attribute17
516       ,p_pen_attribute18               =>p_rec.pen_attribute18
517       ,p_pen_attribute19               =>p_rec.pen_attribute19
518       ,p_pen_attribute20               =>p_rec.pen_attribute20
519       ,p_pen_attribute21               =>p_rec.pen_attribute21
520       ,p_pen_attribute22               =>p_rec.pen_attribute22
521       ,p_pen_attribute23               =>p_rec.pen_attribute23
522       ,p_pen_attribute24               =>p_rec.pen_attribute24
523       ,p_pen_attribute25               =>p_rec.pen_attribute25
524       ,p_pen_attribute26               =>p_rec.pen_attribute26
525       ,p_pen_attribute27               =>p_rec.pen_attribute27
526       ,p_pen_attribute28               =>p_rec.pen_attribute28
527       ,p_pen_attribute29               =>p_rec.pen_attribute29
528       ,p_pen_attribute30               =>p_rec.pen_attribute30
529       ,p_request_id                    =>p_rec.request_id
530       ,p_program_application_id        =>p_rec.program_application_id
531       ,p_program_id                    =>p_rec.program_id
532       ,p_program_update_date           =>p_rec.program_update_date
533       ,p_object_version_number         =>p_rec.object_version_number
534       ,p_per_in_ler_id                 =>p_rec.per_in_ler_id
535       ,p_bnft_typ_cd                   =>p_rec.bnft_typ_cd
536       ,p_bnft_ordr_num                 =>p_rec.bnft_ordr_num
537       ,p_prtt_enrt_rslt_stat_cd        =>p_rec.prtt_enrt_rslt_stat_cd
538       ,p_bnft_nnmntry_uom              =>p_rec.bnft_nnmntry_uom
539       ,p_comp_lvl_cd                   =>p_rec.comp_lvl_cd
540       ,p_effective_date                =>p_effective_date
541       ,p_validation_start_date         =>p_validation_start_date
542       ,p_validation_end_date           =>p_validation_end_date
543       );
544   Exception
545     --
546     when hr_api.cannot_find_prog_unit then
547       hr_api.cannot_find_prog_unit_error
548         (p_module_name => 'ben_prtt_enrt_rslt_f'
549         ,p_hook_type   => 'AI');
550   End;
551   --
552   -- End of API User Hook for post_insert.
553   --
554   --
555   hr_utility.set_location(' Leaving:'||l_proc, 10);
556 End post_insert;
557 --
558 -- ----------------------------------------------------------------------------
559 -- |-------------------------------< ins_lck >--------------------------------|
560 -- ----------------------------------------------------------------------------
561 -- {Start Of Comments}
562 --
563 -- Description:
564 --   The ins_lck process has one main function to perform. When inserting
565 --   a datetracked row, we must validate the DT mode.
566 --   be manipulated.
567 --
568 -- Prerequisites:
569 --   This procedure can only be called for the datetrack mode of INSERT.
570 --
571 -- In Parameters:
572 --
573 -- Post Success:
574 --   On successful completion of the ins_lck process the parental
575 --   datetracked rows will be locked providing the p_enforce_foreign_locking
576 --   argument value is TRUE.
577 --   If the p_enforce_foreign_locking argument value is FALSE then the
578 --   parential rows are not locked.
579 --
580 -- Post Failure:
581 --   The Lck process can fail for:
582 --   1) When attempting to lock the row the row could already be locked by
583 --      another user. This will raise the HR_Api.Object_Locked exception.
584 --   2) When attempting to the lock the parent which doesn't exist.
585 --      For the entity to be locked the parent must exist!
586 --
587 -- Developer Implementation Notes:
588 --   None.
589 --
590 -- Access Status:
591 --   Internal Row Handler Use Only.
592 --
593 -- {End Of Comments}
594 -- ----------------------------------------------------------------------------
595 Procedure ins_lck
596     (p_effective_date	 in  date,
597      p_datetrack_mode	 in  varchar2,
598      p_rec	 		 in  ben_pen_shd.g_rec_type,
599      p_validation_start_date out nocopy date,
600      p_validation_end_date	 out nocopy date) is
601   l_proc		  varchar2(72) := g_package||'ins_lck';
602   l_validation_start_date date;
603   l_validation_end_date	  date;
604 --
605 Begin
606   hr_utility.set_location('Entering:'||l_proc, 5);
607   --
608   -- Validate the datetrack mode mode getting the validation start
609   -- and end dates for the specified datetrack operation.
610   --
611   dt_api.validate_dt_mode
612     (p_effective_date          => p_effective_date,
613      p_datetrack_mode          => p_datetrack_mode,
614      p_base_table_name         => 'ben_prtt_enrt_rslt_f',
615      p_base_key_column         => 'prtt_enrt_rslt_id',
616      p_base_key_value          => p_rec.prtt_enrt_rslt_id,
617      p_parent_table_name1      => 'ben_pgm_f',
618      p_parent_key_column1      => 'pgm_id',
619      p_parent_key_value1       => p_rec.pgm_id,
620      p_parent_table_name2      => 'ben_oipl_f',
621      p_parent_key_column2      => 'oipl_id',
622      p_parent_key_value2       => p_rec.oipl_id,
623      p_parent_table_name3      => 'ben_pl_f',
624      p_parent_key_column3      => 'pl_id',
625      p_parent_key_value3       => p_rec.pl_id,
626      p_parent_table_name4      => 'ben_pl_typ_f',
627      p_parent_key_column4      => 'pl_typ_id',
628      p_parent_key_value4       => p_rec.pl_typ_id,
629      p_parent_table_name5      => 'ben_prtt_enrt_rslt_f',
630      p_parent_key_column5      => 'prtt_enrt_rslt_id',
631      p_parent_key_value5       => p_rec.prtt_enrt_rslt_id,
632      p_parent_table_name6      => 'ben_ptip_f',
633      p_parent_key_column6      => 'ptip_id',
634      p_parent_key_value6       => p_rec.ptip_id,
635      p_parent_table_name7      => 'ben_ler_f',
636      p_parent_key_column7      => 'ler_id',
637      p_parent_key_value7       => p_rec.ler_id,
638      p_enforce_foreign_locking => false,
639      p_validation_start_date   => l_validation_start_date,
640  	 p_validation_end_date	   => l_validation_end_date);
641   --
642   -- Set the validation start and end date OUT arguments
643   --
644   p_validation_start_date := l_validation_start_date;
645   p_validation_end_date   := l_validation_end_date;
646   --
647   hr_utility.set_location(' Leaving:'||l_proc, 10);
648 End ins_lck;
649 --
650 -- ----------------------------------------------------------------------------
651 -- |---------------------------------< ins >----------------------------------|
652 -- ----------------------------------------------------------------------------
653 Procedure ins
654   (
655   p_rec            in out nocopy ben_pen_shd.g_rec_type,
656   p_effective_date in     date
657   ) is
658 --
659   l_proc			varchar2(72) := g_package||'ins';
660   l_datetrack_mode		varchar2(30) := 'INSERT';
661   l_validation_start_date	date;
662   l_validation_end_date		date;
663 --
664 Begin
665   hr_utility.set_location('Entering:'||l_proc, 5);
666   --
667   -- Call the lock operation
668   --
669   ins_lck
670     (p_effective_date	     => p_effective_date,
671      p_datetrack_mode	     => l_datetrack_mode,
672      p_rec	 		         => p_rec,
673      p_validation_start_date => l_validation_start_date,
674      p_validation_end_date	 => l_validation_end_date);
675   --
676   -- Call the supporting insert validate operations
677   --
678   ben_pen_bus.insert_validate
679     (p_rec			         => p_rec,
680      p_effective_date	     => p_effective_date,
681      p_datetrack_mode	     => l_datetrack_mode,
682      p_validation_start_date => l_validation_start_date,
683      p_validation_end_date	 => l_validation_end_date);
684   --
685   -- Call the supporting pre-insert operation
686   --
687   pre_insert
688  	(p_rec			         => p_rec,
689      p_effective_date	     => p_effective_date,
690      p_datetrack_mode	     => l_datetrack_mode,
691      p_validation_start_date => l_validation_start_date,
692      p_validation_end_date	 => l_validation_end_date);
693   --
694   -- Insert the row
695   --
696   insert_dml
697  	(p_rec			         => p_rec,
698      p_effective_date	     => p_effective_date,
699      p_datetrack_mode	     => l_datetrack_mode,
700      p_validation_start_date => l_validation_start_date,
701      p_validation_end_date	 => l_validation_end_date);
702   --
703   -- Multi_rows_Edit validation
704   --
705   if (ben_prtt_enrt_result_api.g_multi_rows_validate) then
706         ben_pen_bus.multi_rows_edit
707           (p_person_id          => p_rec.person_id,
708            p_effective_date     => p_effective_date,
709            p_business_group_id 	=> p_rec.business_group_id,
710            p_pgm_id 		    => p_rec.pgm_id
711           );
712   end if;
713   --
714   -- Call the supporting post-insert operation
715   --
716   post_insert
717  	(p_rec			 => p_rec,
718      p_effective_date	 => p_effective_date,
719      p_datetrack_mode	 => l_datetrack_mode,
720      p_validation_start_date => l_validation_start_date,
721      p_validation_end_date	 => l_validation_end_date);
722 
723   --
724     -- DBI - Added DBI Event Logging Hooks
725   /* Commented. Need to uncomment when DBI goes into mainline
726   5554590 : Enabled DBI logging into mainline */
727   -- Bug 12939188
728     /* if HRI_BPL_BEN_UTIL.enable_ben_col_evt_que then
729       hr_utility.set_location('Logging PEN insert event'|| l_proc, 5);
730       hri_opl_ben_elig_enrl_eq.insert_event (
731                  p_rec              => p_rec ,
732                  p_effective_date   => p_effective_date,
733                  p_datetrack_mode   => l_datetrack_mode );
734     end if;*/
735   --
736 end ins;
737 --
738 -- ----------------------------------------------------------------------------
739 -- |---------------------------------< ins >----------------------------------|
740 -- ----------------------------------------------------------------------------
741 Procedure ins
742   (
743   p_prtt_enrt_rslt_id            out nocopy number,
744   p_effective_start_date         out nocopy date,
745   p_effective_end_date           out nocopy date,
746   p_business_group_id            in number,
747   p_oipl_id                      in number           default null,
748   p_person_id                    in number,
749   p_assignment_id                in number           default null,
750   p_pgm_id                       in number           default null,
751   p_pl_id                        in number,
752   p_rplcs_sspndd_rslt_id         in number           default null,
753   p_ptip_id                      in number           default null,
754   p_pl_typ_id                    in number           default null,
755   p_ler_id                       in number,
756   p_sspndd_flag                  in varchar2,
757   p_prtt_is_cvrd_flag            in varchar2,
758   p_bnft_amt                     in number           default null,
759   p_uom                          in varchar2         default null,
760   p_orgnl_enrt_dt                in date             default null,
761   p_enrt_mthd_cd                 in varchar2,
762   p_no_lngr_elig_flag            in varchar2,
763   p_enrt_ovridn_flag             in varchar2,
764   p_enrt_ovrid_rsn_cd            in varchar2         default null,
765   p_erlst_deenrt_dt              in date             default null,
766   p_enrt_cvg_strt_dt             in date             default null,
767   p_enrt_cvg_thru_dt             in date             default null,
768   p_enrt_ovrid_thru_dt           in date             default null,
769   p_pl_ordr_num                  in number           default null,
770   p_plip_ordr_num                in number           default null,
771   p_ptip_ordr_num                in number           default null,
772   p_oipl_ordr_num                in number           default null,
773   p_pen_attribute_category       in varchar2         default null,
774   p_pen_attribute1               in varchar2         default null,
775   p_pen_attribute2               in varchar2         default null,
776   p_pen_attribute3               in varchar2         default null,
777   p_pen_attribute4               in varchar2         default null,
778   p_pen_attribute5               in varchar2         default null,
779   p_pen_attribute6               in varchar2         default null,
780   p_pen_attribute7               in varchar2         default null,
781   p_pen_attribute8               in varchar2         default null,
782   p_pen_attribute9               in varchar2         default null,
783   p_pen_attribute10              in varchar2         default null,
784   p_pen_attribute11              in varchar2         default null,
785   p_pen_attribute12              in varchar2         default null,
786   p_pen_attribute13              in varchar2         default null,
787   p_pen_attribute14              in varchar2         default null,
788   p_pen_attribute15              in varchar2         default null,
789   p_pen_attribute16              in varchar2         default null,
790   p_pen_attribute17              in varchar2         default null,
791   p_pen_attribute18              in varchar2         default null,
792   p_pen_attribute19              in varchar2         default null,
793   p_pen_attribute20              in varchar2         default null,
794   p_pen_attribute21              in varchar2         default null,
795   p_pen_attribute22              in varchar2         default null,
796   p_pen_attribute23              in varchar2         default null,
797   p_pen_attribute24              in varchar2         default null,
798   p_pen_attribute25              in varchar2         default null,
799   p_pen_attribute26              in varchar2         default null,
800   p_pen_attribute27              in varchar2         default null,
801   p_pen_attribute28              in varchar2         default null,
802   p_pen_attribute29              in varchar2         default null,
803   p_pen_attribute30              in varchar2         default null,
804   p_request_id                   in number           default null,
805   p_program_application_id       in number           default null,
806   p_program_id                   in number           default null,
807   p_program_update_date          in date             default null,
808   p_object_version_number        out nocopy number,
809   p_per_in_ler_id                in number           default null,
810   p_bnft_typ_cd                  in varchar2         default null,
811   p_bnft_ordr_num                in number           default null,
812   p_prtt_enrt_rslt_stat_cd       in varchar2         default null,
813   p_bnft_nnmntry_uom             in varchar2         default null,
814   p_comp_lvl_cd                  in varchar2         default null,
815   p_effective_date		 in date
816   ) is
817 --
818   l_rec		ben_pen_shd.g_rec_type;
819   l_proc	varchar2(72) := g_package||'ins';
820 --
821 Begin
822   hr_utility.set_location('Entering:'||l_proc, 5);
823   --
824   -- Call conversion function to turn arguments into the
825   -- p_rec structure.
826   --
827   l_rec :=
828   ben_pen_shd.convert_args
829   (
830   null,
831   null,
832   null,
833   p_business_group_id,
834   p_oipl_id,
835   p_person_id,
836   p_assignment_id,
837   p_pgm_id,
838   p_pl_id,
839   p_rplcs_sspndd_rslt_id,
840   p_ptip_id,
841   p_pl_typ_id,
842   p_ler_id,
843   p_sspndd_flag,
844   p_prtt_is_cvrd_flag,
845   p_bnft_amt,
846   p_uom     ,
847   p_orgnl_enrt_dt,
848   p_enrt_mthd_cd,
849   p_no_lngr_elig_flag,
850   p_enrt_ovridn_flag,
851   p_enrt_ovrid_rsn_cd,
852   p_erlst_deenrt_dt,
853   p_enrt_cvg_strt_dt,
854   p_enrt_cvg_thru_dt,
855   p_enrt_ovrid_thru_dt,
856   p_pl_ordr_num,
857   p_plip_ordr_num,
858   p_ptip_ordr_num,
859   p_oipl_ordr_num,
860   p_pen_attribute_category,
861   p_pen_attribute1,
862   p_pen_attribute2,
863   p_pen_attribute3,
864   p_pen_attribute4,
865   p_pen_attribute5,
866   p_pen_attribute6,
867   p_pen_attribute7,
868   p_pen_attribute8,
869   p_pen_attribute9,
870   p_pen_attribute10,
871   p_pen_attribute11,
872   p_pen_attribute12,
873   p_pen_attribute13,
874   p_pen_attribute14,
875   p_pen_attribute15,
876   p_pen_attribute16,
877   p_pen_attribute17,
878   p_pen_attribute18,
879   p_pen_attribute19,
880   p_pen_attribute20,
881   p_pen_attribute21,
882   p_pen_attribute22,
883   p_pen_attribute23,
884   p_pen_attribute24,
885   p_pen_attribute25,
886   p_pen_attribute26,
887   p_pen_attribute27,
888   p_pen_attribute28,
889   p_pen_attribute29,
890   p_pen_attribute30,
891   p_request_id,
892   p_program_application_id,
893   p_program_id,
894   p_program_update_date,
895   null,
896   p_per_in_ler_id,
897   p_bnft_typ_cd,
898   p_bnft_ordr_num,
899   p_prtt_enrt_rslt_stat_cd,
900   p_bnft_nnmntry_uom,
901   p_comp_lvl_cd
902    );
903   --
904   -- Having converted the arguments into the ben_pen_rec
905   -- plsql record structure we call the corresponding record
906   -- business process.
907   --
908   ins(l_rec, p_effective_date);
909   --
910   -- Set the OUT arguments.
911   --
912   p_prtt_enrt_rslt_id       := l_rec.prtt_enrt_rslt_id;
913   p_effective_start_date  	:= l_rec.effective_start_date;
914   p_effective_end_date    	:= l_rec.effective_end_date;
915   p_object_version_number 	:= l_rec.object_version_number;
916   --
917   --
918   hr_utility.set_location(' Leaving:'||l_proc, 10);
919 End ins;
920 --
921 end ben_pen_ins;