DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_COP_INS

Source


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