DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_COP_INS

Source


1 Package Body ben_cop_ins as
2 /* $Header: becoprhi.pkb 120.5 2007/12/04 10:59:29 bachakra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_cop_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_cop_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_oipl_f t
70     where  t.oipl_id       = p_rec.oipl_id
71     and    t.effective_start_date =
72              ben_cop_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_oipl_f.created_by%TYPE;
77   l_creation_date       ben_oipl_f.creation_date%TYPE;
78   l_last_update_date   	ben_oipl_f.last_update_date%TYPE;
79   l_last_updated_by     ben_oipl_f.last_updated_by%TYPE;
80   l_last_update_login   ben_oipl_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_oipl_f',
90 	 p_base_key_column => 'oipl_id',
91 	 p_base_key_value  => p_rec.oipl_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       hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
116       hr_utility.set_message_token('PROCEDURE', l_proc);
117       hr_utility.set_message_token('STEP','10');
118       hr_utility.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_cop_shd.g_api_dml := true;  -- Set the api dml status
130   --
131   -- Insert the row into: ben_oipl_f
132   --
133   insert into ben_oipl_f
134   (	oipl_id,
135 	effective_start_date,
136 	effective_end_date,
137 	ivr_ident,
138         url_ref_name,
139 	opt_id,
140 	business_group_id,
141 	pl_id,
142 	ordr_num,
143 	rqd_perd_enrt_nenrt_val,
144 	actl_prem_id,
145 	dflt_flag,
146 	mndtry_flag,
147 	oipl_stat_cd,
148       pcp_dsgn_cd,
149       pcp_dpnt_dsgn_cd,
150 	rqd_perd_enrt_nenrt_uom,
151 	elig_apls_flag,
152 	dflt_enrt_det_rl,
153 	trk_inelig_per_flag,
154 	drvbl_fctr_prtn_elig_flag,
155 	mndtry_rl,
156 	rqd_perd_enrt_nenrt_rl,
157 	dflt_enrt_cd,
158 	prtn_elig_ovrid_alwd_flag,
159 	drvbl_fctr_apls_rts_flag,
160         per_cvrd_cd,
161         postelcn_edit_rl,
162         vrfy_fmly_mmbr_cd,
163         vrfy_fmly_mmbr_rl,
164         enrt_cd,
165         enrt_rl,
166         auto_enrt_flag,
167         auto_enrt_mthd_rl,
168         short_name,		/*FHR*/
169         short_code,		/*FHR*/
170                 legislation_code,		/*FHR*/
171                 legislation_subgroup,		/*FHR*/
172         hidden_flag,
173         susp_if_ctfn_not_prvd_flag,
174         ctfn_determine_cd,
175 	cop_attribute_category,
176 	cop_attribute1,
177 	cop_attribute2,
178 	cop_attribute3,
179 	cop_attribute4,
180 	cop_attribute5,
181 	cop_attribute6,
182 	cop_attribute7,
183 	cop_attribute8,
184 	cop_attribute9,
185 	cop_attribute10,
186 	cop_attribute11,
187 	cop_attribute12,
188 	cop_attribute13,
189 	cop_attribute14,
190 	cop_attribute15,
191 	cop_attribute16,
192 	cop_attribute17,
193 	cop_attribute18,
194 	cop_attribute19,
195 	cop_attribute20,
196 	cop_attribute21,
197 	cop_attribute22,
198 	cop_attribute23,
199 	cop_attribute24,
200 	cop_attribute25,
201 	cop_attribute26,
202 	cop_attribute27,
203 	cop_attribute28,
204 	cop_attribute29,
205 	cop_attribute30,
206 	object_version_number
207    	, created_by,
208    	creation_date,
209    	last_update_date,
210    	last_updated_by,
211    	last_update_login
212   )
213   Values
214   (	p_rec.oipl_id,
215 	p_rec.effective_start_date,
216 	p_rec.effective_end_date,
217 	p_rec.ivr_ident,
218         p_rec.url_ref_name,
219 	p_rec.opt_id,
220 	p_rec.business_group_id,
221 	p_rec.pl_id,
222 	p_rec.ordr_num,
223 	p_rec.rqd_perd_enrt_nenrt_val,
224 	p_rec.actl_prem_id,
225 	p_rec.dflt_flag,
226 	p_rec.mndtry_flag,
227 	p_rec.oipl_stat_cd,
228       p_rec.pcp_dsgn_cd,
229       p_rec.pcp_dpnt_dsgn_cd,
230 	p_rec.rqd_perd_enrt_nenrt_uom,
231 	p_rec.elig_apls_flag,
232 	p_rec.dflt_enrt_det_rl,
233 	p_rec.trk_inelig_per_flag,
234 	p_rec.drvbl_fctr_prtn_elig_flag,
235 	p_rec.mndtry_rl,
236 	p_rec.rqd_perd_enrt_nenrt_rl,
237 	p_rec.dflt_enrt_cd,
238 	p_rec.prtn_elig_ovrid_alwd_flag,
239 	p_rec.drvbl_fctr_apls_rts_flag,
240         p_rec.per_cvrd_cd,
241         p_rec.postelcn_edit_rl,
242         p_rec.vrfy_fmly_mmbr_cd,
243         p_rec.vrfy_fmly_mmbr_rl,
244         p_rec.enrt_cd,
245         p_rec.enrt_rl,
246         p_rec.auto_enrt_flag,
247         p_rec.auto_enrt_mthd_rl,
248         p_rec.short_name,		/*FHR*/
249         p_rec.short_code,		/*FHR*/
250                 p_rec.legislation_code,		/*FHR*/
251                 p_rec.legislation_subgroup,		/*FHR*/
252         nvl(p_rec.hidden_flag,'N'),
253         p_rec.susp_if_ctfn_not_prvd_flag,
254         p_rec.ctfn_determine_cd,
255 	p_rec.cop_attribute_category,
256 	p_rec.cop_attribute1,
257 	p_rec.cop_attribute2,
258 	p_rec.cop_attribute3,
259 	p_rec.cop_attribute4,
260 	p_rec.cop_attribute5,
261 	p_rec.cop_attribute6,
262 	p_rec.cop_attribute7,
263 	p_rec.cop_attribute8,
264 	p_rec.cop_attribute9,
265 	p_rec.cop_attribute10,
266 	p_rec.cop_attribute11,
267 	p_rec.cop_attribute12,
268 	p_rec.cop_attribute13,
269 	p_rec.cop_attribute14,
270 	p_rec.cop_attribute15,
271 	p_rec.cop_attribute16,
272 	p_rec.cop_attribute17,
273 	p_rec.cop_attribute18,
274 	p_rec.cop_attribute19,
275 	p_rec.cop_attribute20,
276 	p_rec.cop_attribute21,
277 	p_rec.cop_attribute22,
278 	p_rec.cop_attribute23,
279 	p_rec.cop_attribute24,
280 	p_rec.cop_attribute25,
281 	p_rec.cop_attribute26,
282 	p_rec.cop_attribute27,
283 	p_rec.cop_attribute28,
284 	p_rec.cop_attribute29,
285 	p_rec.cop_attribute30,
286 	p_rec.object_version_number,
287 	l_created_by,
288    	l_creation_date,
289    	l_last_update_date,
290    	l_last_updated_by,
291    	l_last_update_login
292   );
293   --
294   ben_cop_shd.g_api_dml := false;   -- Unset the api dml status
295   hr_utility.set_location(' Leaving:'||l_proc, 15);
296 --
297 Exception
298   When hr_api.check_integrity_violated Then
299     -- A check constraint has been violated
300     ben_cop_shd.g_api_dml := false;   -- Unset the api dml status
301     ben_cop_shd.constraint_error
302       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
303   When hr_api.unique_integrity_violated Then
304     -- Unique integrity has been violated
305     ben_cop_shd.g_api_dml := false;   -- Unset the api dml status
306     ben_cop_shd.constraint_error
307       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
308   When Others Then
309     ben_cop_shd.g_api_dml := false;   -- Unset the api dml status
310     Raise;
311 End dt_insert_dml;
312 --
313 -- ----------------------------------------------------------------------------
314 -- |------------------------------< insert_dml >------------------------------|
315 -- ----------------------------------------------------------------------------
316 Procedure insert_dml
317 	(p_rec 			 in out nocopy ben_cop_shd.g_rec_type,
318 	 p_effective_date	 in	date,
319 	 p_datetrack_mode	 in	varchar2,
320 	 p_validation_start_date in	date,
321 	 p_validation_end_date	 in	date) is
322 --
323   l_proc	varchar2(72) := g_package||'insert_dml';
324 --
325 Begin
326   hr_utility.set_location('Entering:'||l_proc, 5);
327   --
328   dt_insert_dml(p_rec			=> p_rec,
329 		p_effective_date	=> p_effective_date,
330 		p_datetrack_mode	=> p_datetrack_mode,
331     		p_validation_start_date	=> p_validation_start_date,
332 		p_validation_end_date	=> p_validation_end_date);
333   --
334   hr_utility.set_location(' Leaving:'||l_proc, 10);
335 End insert_dml;
336 --
337 -- ----------------------------------------------------------------------------
338 -- |------------------------------< pre_insert >------------------------------|
339 -- ----------------------------------------------------------------------------
340 -- {Start Of Comments}
341 --
342 -- Description:
343 --   This private procedure contains any processing which is required before
344 --   the insert dml. Presently, if the entity has a corresponding primary
345 --   key which is maintained by an associating sequence, the primary key for
346 --   the entity will be populated with the next sequence value in
347 --   preparation for the insert dml.
348 --   Also, if comments are defined for this entity, the comments insert
349 --   logic will also be called, generating a comment_id if required.
350 --
351 -- Prerequisites:
352 --   This is an internal procedure which is called from the ins procedure.
353 --
354 -- In Parameters:
355 --   A Pl/Sql record structre.
356 --
357 -- Post Success:
358 --   Processing continues.
359 --
360 -- Post Failure:
361 --   If an error has occurred, an error message and exception will be raised
362 --   but not handled.
363 --
364 -- Developer Implementation Notes:
365 --   Any pre-processing required before the insert dml is issued should be
366 --   coded within this procedure. As stated above, a good example is the
367 --   generation of a primary key number via a corresponding sequence.
368 --   It is important to note that any 3rd party maintenance should be reviewed
369 --   before placing in this procedure.
370 --
371 -- Access Status:
372 --   Internal Row Handler Use Only.
373 --
374 -- {End Of Comments}
375 -- ----------------------------------------------------------------------------
376 Procedure pre_insert
377 	(p_rec  			in out nocopy ben_cop_shd.g_rec_type,
378 	 p_effective_date		in date,
379 	 p_datetrack_mode		in varchar2,
380 	 p_validation_start_date	in date,
381 	 p_validation_end_date		in date) is
382 --
383   l_proc	varchar2(72) := g_package||'pre_insert';
384 --
385   Cursor c1 is select ben_oipl_f_s.nextval from sys.dual;
386 --
387 cursor c_icm_opt_track_flag is
388   select ptp.opt_typ_cd
389   from   ben_pl_typ_f ptp,ben_pl_f pln
390   where  pln.pl_id = p_rec.pl_id
391   and    pln.pl_typ_id = ptp.pl_typ_id
392   and    pln.business_group_id = p_rec.business_group_id
393   and    p_effective_date between pln.effective_start_date and pln.effective_end_date
394   and    p_effective_date between ptp.effective_start_date and ptp.effective_end_date;
395 --
396  l_icm_opt_track_flag ben_pl_typ_f.opt_typ_cd%TYPE;
397 --
398 Begin
399   hr_utility.set_location('Entering:'||l_proc, 5);
400   --
401   open c1;
402   fetch c1 into p_rec.oipl_id;
403   close c1;
404   --
405   open c_icm_opt_track_flag;
406    fetch c_icm_opt_track_flag into l_icm_opt_track_flag;
407   --
408   if l_icm_opt_track_flag = 'ICM' then
409   p_rec.trk_inelig_per_flag := 'Y';
410   end if;
411    close c_icm_opt_track_flag;
412   --
413   hr_utility.set_location(' Leaving:'||l_proc, 10);
414 End pre_insert;
415 --
416 -- ----------------------------------------------------------------------------
417 -- |-----------------------------< post_insert >------------------------------|
418 -- ----------------------------------------------------------------------------
419 -- {Start Of Comments}
420 --
421 -- Description:
422 --   This private procedure contains any processing which is required after the
423 --   insert dml.
424 --
425 -- Prerequisites:
426 --   This is an internal procedure which is called from the ins procedure.
427 --
428 -- In Parameters:
429 --   A Pl/Sql record structre.
430 --
431 -- Post Success:
432 --   Processing continues.
433 --
434 -- Post Failure:
435 --   If an error has occurred, an error message and exception will be raised
436 --   but not handled.
437 --
438 -- Developer Implementation Notes:
439 --   Any post-processing required after the insert dml is issued should be
440 --   coded within this procedure. It is important to note that any 3rd party
441 --   maintenance should be reviewed before placing in this procedure.
442 --
443 -- Access Status:
444 --   Internal Row Handler Use Only.
445 --
446 -- {End Of Comments}
447 -- ----------------------------------------------------------------------------
448 Procedure post_insert
449 	(p_rec 			 in ben_cop_shd.g_rec_type,
450 	 p_effective_date	 in date,
451 	 p_datetrack_mode	 in varchar2,
452 	 p_validation_start_date in date,
453 	 p_validation_end_date	 in date) is
454 --
455   l_proc	varchar2(72) := g_package||'post_insert';
456 --
457 Begin
458   hr_utility.set_location('Entering:'||l_proc, 5);
459   --
460   -- Added for GSP validations
461   pqh_gsp_ben_validations.oipl_validations
462   	(  p_oipl_id			=> p_rec.oipl_id
463   	 , p_dml_operation 		=> 'I'
464   	 , p_effective_date 		=> p_effective_date
465   	 , p_business_group_id  	=> p_rec.business_group_id
466   	 , p_oipl_stat_cd		=> p_rec.oipl_stat_cd
467   	 );
468 
469   -- Start of API User Hook for post_insert.
470 
471   --
472   begin
473     --
474     ben_cop_rki.after_insert
475     (p_oipl_id                        => p_rec.oipl_id
476     ,p_effective_start_date           => p_rec.effective_start_date
477     ,p_effective_end_date             => p_rec.effective_end_date
478     ,p_ivr_ident                      => p_rec.ivr_ident
479     ,p_url_ref_name                   => p_rec.url_ref_name
480     ,p_opt_id                         => p_rec.opt_id
481     ,p_business_group_id              => p_rec.business_group_id
482     ,p_pl_id                          => p_rec.pl_id
483     ,p_ordr_num                       => p_rec.ordr_num
484     ,p_rqd_perd_enrt_nenrt_val        => p_rec.rqd_perd_enrt_nenrt_val
485     ,p_actl_prem_id                   => p_rec.actl_prem_id
486     ,p_dflt_flag                      => p_rec.dflt_flag
487     ,p_mndtry_flag                    => p_rec.mndtry_flag
488     ,p_oipl_stat_cd                   => p_rec.oipl_stat_cd
489     ,p_pcp_dsgn_cd                    => p_rec.pcp_dsgn_cd
490     ,p_pcp_dpnt_dsgn_cd               => p_rec.pcp_dpnt_dsgn_cd
491     ,p_rqd_perd_enrt_nenrt_uom        => p_rec.rqd_perd_enrt_nenrt_uom
492     ,p_elig_apls_flag                 => p_rec.elig_apls_flag
493     ,p_dflt_enrt_det_rl               => p_rec.dflt_enrt_det_rl
494     ,p_trk_inelig_per_flag            => p_rec.trk_inelig_per_flag
495     ,p_drvbl_fctr_prtn_elig_flag      => p_rec.drvbl_fctr_prtn_elig_flag
496     ,p_mndtry_rl                      => p_rec.mndtry_rl
497     ,p_rqd_perd_enrt_nenrt_rl                      => p_rec.rqd_perd_enrt_nenrt_rl
498     ,p_dflt_enrt_cd                   => p_rec.dflt_enrt_cd
499     ,p_prtn_elig_ovrid_alwd_flag      => p_rec.prtn_elig_ovrid_alwd_flag
500     ,p_drvbl_fctr_apls_rts_flag       => p_rec.drvbl_fctr_apls_rts_flag
501     ,p_per_cvrd_cd                    => p_rec.per_cvrd_cd
502     ,p_postelcn_edit_rl               => p_rec.postelcn_edit_rl
503     ,p_vrfy_fmly_mmbr_cd              => p_rec.vrfy_fmly_mmbr_cd
504     ,p_vrfy_fmly_mmbr_rl              => p_rec.vrfy_fmly_mmbr_rl
505     ,p_enrt_cd                        => p_rec.enrt_cd
506     ,p_enrt_rl                        => p_rec.enrt_rl
507     ,p_auto_enrt_flag                 => p_rec.auto_enrt_flag
508     ,p_auto_enrt_mthd_rl              => p_rec.auto_enrt_mthd_rl
509     ,p_short_name		      => p_rec.short_name		/*FHR*/
510     ,p_short_code		      => p_rec.short_code		/*FHR*/
511         ,p_legislation_code		      => p_rec.legislation_code		/*FHR*/
512         ,p_legislation_subgroup		      => p_rec.legislation_subgroup		/*FHR*/
513     ,p_hidden_flag		      => p_rec.hidden_flag
514     ,p_susp_if_ctfn_not_prvd_flag     =>  p_rec.susp_if_ctfn_not_prvd_flag
515     ,p_ctfn_determine_cd         =>  p_rec.ctfn_determine_cd
516     ,p_cop_attribute_category         => p_rec.cop_attribute_category
517     ,p_cop_attribute1                 => p_rec.cop_attribute1
518     ,p_cop_attribute2                 => p_rec.cop_attribute2
519     ,p_cop_attribute3                 => p_rec.cop_attribute3
520     ,p_cop_attribute4                 => p_rec.cop_attribute4
521     ,p_cop_attribute5                 => p_rec.cop_attribute5
522     ,p_cop_attribute6                 => p_rec.cop_attribute6
523     ,p_cop_attribute7                 => p_rec.cop_attribute7
524     ,p_cop_attribute8                 => p_rec.cop_attribute8
525     ,p_cop_attribute9                 => p_rec.cop_attribute9
526     ,p_cop_attribute10                => p_rec.cop_attribute10
527     ,p_cop_attribute11                => p_rec.cop_attribute11
528     ,p_cop_attribute12                => p_rec.cop_attribute12
529     ,p_cop_attribute13                => p_rec.cop_attribute13
530     ,p_cop_attribute14                => p_rec.cop_attribute14
531     ,p_cop_attribute15                => p_rec.cop_attribute15
532     ,p_cop_attribute16                => p_rec.cop_attribute16
533     ,p_cop_attribute17                => p_rec.cop_attribute17
534     ,p_cop_attribute18                => p_rec.cop_attribute18
535     ,p_cop_attribute19                => p_rec.cop_attribute19
536     ,p_cop_attribute20                => p_rec.cop_attribute20
537     ,p_cop_attribute21                => p_rec.cop_attribute21
538     ,p_cop_attribute22                => p_rec.cop_attribute22
539     ,p_cop_attribute23                => p_rec.cop_attribute23
540     ,p_cop_attribute24                => p_rec.cop_attribute24
541     ,p_cop_attribute25                => p_rec.cop_attribute25
542     ,p_cop_attribute26                => p_rec.cop_attribute26
543     ,p_cop_attribute27                => p_rec.cop_attribute27
544     ,p_cop_attribute28                => p_rec.cop_attribute28
545     ,p_cop_attribute29                => p_rec.cop_attribute29
546     ,p_cop_attribute30                => p_rec.cop_attribute30
547     ,p_object_version_number          => p_rec.object_version_number
548     ,p_effective_date                 => p_effective_date
549     ,p_validation_start_date          => p_validation_start_date
550     ,p_validation_end_date            => p_validation_end_date
551     );
552     --
553   exception
554     --
555     when hr_api.cannot_find_prog_unit then
556       --
557       hr_api.cannot_find_prog_unit_error
558         (p_module_name => 'ben_oipl_f'
559         ,p_hook_type   => 'AI');
560       --
561   end;
562   --
563   -- End of API User Hook for post_insert.
564   --
565   hr_utility.set_location(' Leaving:'||l_proc, 10);
566 End post_insert;
567 --
568 -- ----------------------------------------------------------------------------
569 -- |-------------------------------< ins_lck >--------------------------------|
570 -- ----------------------------------------------------------------------------
571 -- {Start Of Comments}
572 --
573 -- Description:
574 --   The ins_lck process has one main function to perform. When inserting
575 --   a datetracked row, we must validate the DT mode.
576 --   be manipulated.
577 --
578 -- Prerequisites:
579 --   This procedure can only be called for the datetrack mode of INSERT.
580 --
581 -- In Parameters:
582 --
583 -- Post Success:
584 --   On successful completion of the ins_lck process the parental
585 --   datetracked rows will be locked providing the p_enforce_foreign_locking
586 --   argument value is TRUE.
587 --   If the p_enforce_foreign_locking argument value is FALSE then the
588 --   parential rows are not locked.
589 --
590 -- Post Failure:
591 --   The Lck process can fail for:
592 --   1) When attempting to lock the row the row could already be locked by
593 --      another user. This will raise the HR_Api.Object_Locked exception.
594 --   2) When attempting to the lock the parent which doesn't exist.
595 --      For the entity to be locked the parent must exist!
596 --
597 -- Developer Implementation Notes:
598 --   None.
599 --
600 -- Access Status:
601 --   Internal Row Handler Use Only.
602 --
603 -- {End Of Comments}
604 -- ----------------------------------------------------------------------------
605 Procedure ins_lck
606 	(p_effective_date	 in  date,
607 	 p_datetrack_mode	 in  varchar2,
608 	 p_rec	 		 in  ben_cop_shd.g_rec_type,
609 	 p_validation_start_date out nocopy date,
610 	 p_validation_end_date	 out nocopy date) is
611 --
612   l_proc		  varchar2(72) := g_package||'ins_lck';
613   l_validation_start_date date;
614   l_validation_end_date	  date;
615 --
616 Begin
617   hr_utility.set_location('Entering:'||l_proc, 5);
618   --
619   -- Validate the datetrack mode mode getting the validation start
620   -- and end dates for the specified datetrack operation.
621   --
622   dt_api.validate_dt_mode
623 	(p_effective_date	   => p_effective_date,
624 	 p_datetrack_mode	   => p_datetrack_mode,
625 	 p_base_table_name	   => 'ben_oipl_f',
626 	 p_base_key_column	   => 'oipl_id',
627 	 p_base_key_value 	   => p_rec.oipl_id,
628 	 p_parent_table_name1      => 'ff_formulas_f',
629 	 p_parent_key_column1      => 'formula_id',
630 	 p_parent_key_value1       => p_rec.dflt_enrt_det_rl,
631 	 p_parent_table_name2      => 'ff_formulas_f',
632 	 p_parent_key_column2      => 'formula_id',
633 	 p_parent_key_value2       => p_rec.mndtry_rl,
634 	 p_parent_table_name3      => 'ff_formulas_f',
635 	 p_parent_key_column3      => 'formula_id',
636 	 p_parent_key_value3       => p_rec.postelcn_edit_rl,
637 	 p_parent_table_name4      => 'ff_formulas_f',
638 	 p_parent_key_column4      => 'formula_id',
639 	 p_parent_key_value4       => p_rec.vrfy_fmly_mmbr_rl,
640 	 p_parent_table_name5      => 'ben_actl_prem_f',
641 	 p_parent_key_column5      => 'actl_prem_id',
642 	 p_parent_key_value5       => p_rec.actl_prem_id,
643 	 p_parent_table_name6      => 'ben_pl_f',
644 	 p_parent_key_column6      => 'pl_id',
645 	 p_parent_key_value6       => p_rec.pl_id,
646 	 p_parent_table_name7      => 'ben_opt_f',
647 	 p_parent_key_column7      => 'opt_id',
648 	 p_parent_key_value7       => p_rec.opt_id,
649          p_enforce_foreign_locking => true,
650 	 p_validation_start_date   => l_validation_start_date,
651  	 p_validation_end_date	   => l_validation_end_date);
652   --
653   -- Set the validation start and end date OUT arguments
654   --
655   p_validation_start_date := l_validation_start_date;
656   p_validation_end_date   := l_validation_end_date;
657   --
658   hr_utility.set_location(' Leaving:'||l_proc, 10);
659 --
660 End ins_lck;
661 --
662 -- ----------------------------------------------------------------------------
663 -- |---------------------------------< ins >----------------------------------|
664 -- ----------------------------------------------------------------------------
665 Procedure ins
666   (
667   p_rec		   in out nocopy ben_cop_shd.g_rec_type,
668   p_effective_date in     date
669   ) is
670 --
671   l_proc			varchar2(72) := g_package||'ins';
672   l_datetrack_mode		varchar2(30) := 'INSERT';
673   l_validation_start_date	date;
674   l_validation_end_date		date;
675 --
676 Begin
677   hr_utility.set_location('Entering:'||l_proc, 5);
678   --
679   -- Call the lock operation
680   --
681   ins_lck
682 	(p_effective_date	 => p_effective_date,
683 	 p_datetrack_mode	 => l_datetrack_mode,
684 	 p_rec	 		 => p_rec,
685 	 p_validation_start_date => l_validation_start_date,
686 	 p_validation_end_date	 => l_validation_end_date);
687   --
688   -- Call the supporting insert validate operations
689   --
690   ben_cop_bus.insert_validate
691 	(p_rec			 => p_rec,
692 	 p_effective_date	 => p_effective_date,
693 	 p_datetrack_mode	 => l_datetrack_mode,
694 	 p_validation_start_date => l_validation_start_date,
695 	 p_validation_end_date	 => l_validation_end_date);
696   --
697   -- Call the supporting pre-insert operation
698   --
699   pre_insert
700  	(p_rec			 => p_rec,
701 	 p_effective_date	 => p_effective_date,
702 	 p_datetrack_mode	 => l_datetrack_mode,
703 	 p_validation_start_date => l_validation_start_date,
704 	 p_validation_end_date	 => l_validation_end_date);
705   --
706   -- Insert the row
707   --
708   insert_dml
709  	(p_rec			 => p_rec,
710 	 p_effective_date	 => p_effective_date,
711 	 p_datetrack_mode	 => l_datetrack_mode,
712 	 p_validation_start_date => l_validation_start_date,
713 	 p_validation_end_date	 => l_validation_end_date);
714   --
715   -- Call the supporting post-insert operation
716   --
717   post_insert
718  	(p_rec			 => p_rec,
719 	 p_effective_date	 => p_effective_date,
720 	 p_datetrack_mode	 => l_datetrack_mode,
721 	 p_validation_start_date => l_validation_start_date,
722 	 p_validation_end_date	 => l_validation_end_date);
723 end ins;
724 --
725 -- ----------------------------------------------------------------------------
726 -- |---------------------------------< ins >----------------------------------|
727 -- ----------------------------------------------------------------------------
728 Procedure ins
729   (
730   p_oipl_id                      out nocopy number,
731   p_effective_start_date         out nocopy date,
732   p_effective_end_date           out nocopy date,
733   p_ivr_ident                    in varchar2         default null,
734   p_url_ref_name                 in varchar2         default null,
735   p_opt_id                       in number,
736   p_business_group_id            in number,
737   p_pl_id                        in number,
738   p_ordr_num                     in number           default null,
739   p_rqd_perd_enrt_nenrt_val      in number           default null,
740   p_dflt_flag                    in varchar2,
741   p_actl_prem_id                 in number           default null,
742   p_mndtry_flag                  in varchar2,
743   p_oipl_stat_cd                 in varchar2,
744   p_pcp_dsgn_cd                  in varchar2        default null,
745   p_pcp_dpnt_dsgn_cd             in varchar2        default null,
746   p_rqd_perd_enrt_nenrt_uom      in varchar2,
747   p_elig_apls_flag               in varchar2,
748   p_dflt_enrt_det_rl             in number           default null,
749   p_trk_inelig_per_flag          in varchar2,
750   p_drvbl_fctr_prtn_elig_flag    in varchar2,
751   p_mndtry_rl                    in number           default null,
752   p_rqd_perd_enrt_nenrt_rl                    in number           default null,
753   p_dflt_enrt_cd                 in varchar2         default null,
754   p_prtn_elig_ovrid_alwd_flag    in varchar2,
755   p_drvbl_fctr_apls_rts_flag     in varchar2,
756   p_per_cvrd_cd                  in varchar2         default null,
757   p_postelcn_edit_rl             in number           default null,
758   p_vrfy_fmly_mmbr_cd            in varchar2         default null,
759   p_vrfy_fmly_mmbr_rl            in number           default null,
760   p_enrt_cd                      in varchar2         default null,
761   p_enrt_rl                      in number           default null,
762   p_auto_enrt_flag               in varchar2         default null,
763   p_auto_enrt_mthd_rl            in number           default null,
764   p_short_name			 in varchar2	     default null,	--FHR
765   p_short_code			 in varchar2	     default null,	--FHR
766     p_legislation_code			 in varchar2	     default null,
767     p_legislation_subgroup			 in varchar2	     default null,
768   p_hidden_flag			 in varchar2,
769   p_susp_if_ctfn_not_prvd_flag   in  varchar2  default 'Y',
770   p_ctfn_determine_cd            in  varchar2  default null,
771   p_cop_attribute_category       in varchar2         default null,
772   p_cop_attribute1               in varchar2         default null,
773   p_cop_attribute2               in varchar2         default null,
774   p_cop_attribute3               in varchar2         default null,
775   p_cop_attribute4               in varchar2         default null,
776   p_cop_attribute5               in varchar2         default null,
777   p_cop_attribute6               in varchar2         default null,
778   p_cop_attribute7               in varchar2         default null,
779   p_cop_attribute8               in varchar2         default null,
780   p_cop_attribute9               in varchar2         default null,
781   p_cop_attribute10              in varchar2         default null,
782   p_cop_attribute11              in varchar2         default null,
783   p_cop_attribute12              in varchar2         default null,
784   p_cop_attribute13              in varchar2         default null,
785   p_cop_attribute14              in varchar2         default null,
786   p_cop_attribute15              in varchar2         default null,
787   p_cop_attribute16              in varchar2         default null,
788   p_cop_attribute17              in varchar2         default null,
789   p_cop_attribute18              in varchar2         default null,
790   p_cop_attribute19              in varchar2         default null,
791   p_cop_attribute20              in varchar2         default null,
792   p_cop_attribute21              in varchar2         default null,
793   p_cop_attribute22              in varchar2         default null,
794   p_cop_attribute23              in varchar2         default null,
795   p_cop_attribute24              in varchar2         default null,
796   p_cop_attribute25              in varchar2         default null,
797   p_cop_attribute26              in varchar2         default null,
798   p_cop_attribute27              in varchar2         default null,
799   p_cop_attribute28              in varchar2         default null,
800   p_cop_attribute29              in varchar2         default null,
801   p_cop_attribute30              in varchar2         default null,
802   p_object_version_number        out nocopy number,
803   p_effective_date               in date
804   ) is
805 --
806   l_rec		ben_cop_shd.g_rec_type;
807   l_proc	varchar2(72) := g_package||'ins';
808 --
809 Begin
810   hr_utility.set_location('Entering:'||l_proc, 5);
811   --
812   -- Call conversion function to turn arguments into the
813   -- p_rec structure.
814   --
815   l_rec :=
816   ben_cop_shd.convert_args
817   (
818   null,
819   null,
820   null,
821   p_ivr_ident,
822   p_url_ref_name,
823   p_opt_id,
824   p_business_group_id,
825   p_pl_id,
826   p_ordr_num,
827   p_rqd_perd_enrt_nenrt_val,
828   p_dflt_flag,
829   p_actl_prem_id,
830   p_mndtry_flag,
831   p_oipl_stat_cd,
832   p_pcp_dsgn_cd,
833   p_pcp_dpnt_dsgn_cd,
834   p_rqd_perd_enrt_nenrt_uom,
835   p_elig_apls_flag,
836   p_dflt_enrt_det_rl,
837   p_trk_inelig_per_flag,
838   p_drvbl_fctr_prtn_elig_flag,
839   p_mndtry_rl,
840   p_rqd_perd_enrt_nenrt_rl,
841   p_dflt_enrt_cd,
842   p_prtn_elig_ovrid_alwd_flag,
843   p_drvbl_fctr_apls_rts_flag,
844   p_per_cvrd_cd,
845   p_postelcn_edit_rl,
846   p_vrfy_fmly_mmbr_cd,
847   p_vrfy_fmly_mmbr_rl,
848   p_enrt_cd,
849   p_enrt_rl,
850   p_auto_enrt_flag,
851   p_auto_enrt_mthd_rl,
852   p_short_name,		--FHR
853   p_short_code,		--FHR
854     p_legislation_code,
855     p_legislation_subgroup,
856   p_hidden_flag,
857   p_susp_if_ctfn_not_prvd_flag,
858   p_ctfn_determine_cd,
859   p_cop_attribute_category,
860   p_cop_attribute1,
861   p_cop_attribute2,
862   p_cop_attribute3,
863   p_cop_attribute4,
864   p_cop_attribute5,
865   p_cop_attribute6,
866   p_cop_attribute7,
867   p_cop_attribute8,
868   p_cop_attribute9,
869   p_cop_attribute10,
870   p_cop_attribute11,
871   p_cop_attribute12,
872   p_cop_attribute13,
873   p_cop_attribute14,
874   p_cop_attribute15,
875   p_cop_attribute16,
876   p_cop_attribute17,
877   p_cop_attribute18,
878   p_cop_attribute19,
879   p_cop_attribute20,
880   p_cop_attribute21,
881   p_cop_attribute22,
882   p_cop_attribute23,
883   p_cop_attribute24,
884   p_cop_attribute25,
885   p_cop_attribute26,
886   p_cop_attribute27,
887   p_cop_attribute28,
888   p_cop_attribute29,
889   p_cop_attribute30,
890   null
891   );
892   --
893   -- Having converted the arguments into the ben_cop_rec
894   -- plsql record structure we call the corresponding record
895   -- business process.
896   --
897   ins(l_rec, p_effective_date);
898   --
899   -- Set the OUT arguments.
900   --
901   p_oipl_id        	:= l_rec.oipl_id;
902   p_effective_start_date  	:= l_rec.effective_start_date;
903   p_effective_end_date    	:= l_rec.effective_end_date;
904   p_object_version_number 	:= l_rec.object_version_number;
905   --
906   --
907   hr_utility.set_location(' Leaving:'||l_proc, 10);
908 End ins;
909 --
910 end ben_cop_ins;