DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PRC_INS

Source


1 Package Body ben_prc_ins as
2 /* $Header: beprcrhi.pkb 120.7.12010000.2 2008/08/05 15:19:06 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_prc_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_prc_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_reimbmt_rqst_f t
70     where  t.prtt_reimbmt_rqst_id       = p_rec.prtt_reimbmt_rqst_id
71     and    t.effective_start_date =
72              ben_prc_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_reimbmt_rqst_f.created_by%TYPE;
77   l_creation_date       ben_prtt_reimbmt_rqst_f.creation_date%TYPE;
78   l_last_update_date   	ben_prtt_reimbmt_rqst_f.last_update_date%TYPE;
79   l_last_updated_by     ben_prtt_reimbmt_rqst_f.last_updated_by%TYPE;
80   l_last_update_login   ben_prtt_reimbmt_rqst_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_reimbmt_rqst_f',
90 	 p_base_key_column => 'prtt_reimbmt_rqst_id',
91 	 p_base_key_value  => p_rec.prtt_reimbmt_rqst_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_prc_shd.g_api_dml := true;  -- Set the api dml status
130   --
131   -- Insert the row into: ben_prtt_reimbmt_rqst_f
132   --
133   insert into ben_prtt_reimbmt_rqst_f
134   (	prtt_reimbmt_rqst_id,
135 	effective_start_date,
136 	effective_end_date,
137 	incrd_from_dt,
138 	incrd_to_dt,
139 	rqst_num,
140 	rqst_amt,
141 	rqst_amt_uom,
142 	rqst_btch_num,
143 	prtt_reimbmt_rqst_stat_cd,
144 	reimbmt_ctfn_typ_prvdd_cd,
145 	rcrrg_cd,
146 	submitter_person_id,
147 	recipient_person_id,
148 	provider_person_id,
149 	provider_ssn_person_id,
150 	pl_id,
151 	gd_or_svc_typ_id,
152 	contact_relationship_id,
153 	business_group_id,
154         opt_id,
155         popl_yr_perd_id_1 ,
156         popl_yr_perd_id_2 ,
157         amt_year1         ,
158         amt_year2      ,
159 	prc_attribute_category,
160 	prc_attribute1,
161 	prc_attribute2,
162 	prc_attribute3,
163 	prc_attribute4,
164 	prc_attribute5,
165 	prc_attribute6,
166 	prc_attribute7,
167 	prc_attribute8,
168 	prc_attribute9,
169 	prc_attribute10,
170 	prc_attribute11,
171 	prc_attribute12,
172 	prc_attribute13,
173 	prc_attribute14,
174 	prc_attribute15,
175 	prc_attribute16,
176 	prc_attribute17,
177 	prc_attribute18,
178 	prc_attribute19,
179 	prc_attribute20,
180 	prc_attribute21,
181 	prc_attribute22,
182 	prc_attribute23,
183 	prc_attribute24,
184 	prc_attribute25,
185 	prc_attribute26,
186 	prc_attribute27,
187 	prc_attribute28,
188 	prc_attribute29,
189 	prc_attribute30,
190 	object_version_number ,
191         prtt_enrt_rslt_id,
192         comment_id ,
193    	created_by,
194    	creation_date,
195    	last_update_date,
196    	last_updated_by,
197    	last_update_login ,
198         stat_rsn_cd,
199         pymt_stat_cd,
200         pymt_stat_rsn_cd,
201         stat_ovrdn_flag,
202         stat_ovrdn_rsn_cd,
203         stat_prr_to_ovrd,
204         pymt_stat_ovrdn_flag,
205         pymt_stat_ovrdn_rsn_cd,
206         pymt_stat_prr_to_ovrd,
207         adjmt_flag,
208         submtd_dt,
209         ttl_rqst_amt,
210         aprvd_for_pymt_amt,
211         exp_incurd_dt
212   )
213   Values
214   (	p_rec.prtt_reimbmt_rqst_id,
215 	p_rec.effective_start_date,
216 	p_rec.effective_end_date,
217 	p_rec.incrd_from_dt,
218 	p_rec.incrd_to_dt,
219 	p_rec.rqst_num,
220 	p_rec.rqst_amt,
221 	p_rec.rqst_amt_uom,
222 	p_rec.rqst_btch_num,
223 	p_rec.prtt_reimbmt_rqst_stat_cd,
224 	p_rec.reimbmt_ctfn_typ_prvdd_cd,
225 	p_rec.rcrrg_cd,
226 	p_rec.submitter_person_id,
227 	p_rec.recipient_person_id,
228 	p_rec.provider_person_id,
229 	p_rec.provider_ssn_person_id,
230 	p_rec.pl_id,
231 	p_rec.gd_or_svc_typ_id,
232 	p_rec.contact_relationship_id,
233 	p_rec.business_group_id,
234         p_rec.opt_id,
235         p_rec.popl_yr_perd_id_1 ,
236         p_rec.popl_yr_perd_id_2 ,
237         p_rec.amt_year1         ,
238         p_rec.amt_year2      ,
239 	p_rec.prc_attribute_category,
240 	p_rec.prc_attribute1,
241 	p_rec.prc_attribute2,
242 	p_rec.prc_attribute3,
243 	p_rec.prc_attribute4,
244 	p_rec.prc_attribute5,
245 	p_rec.prc_attribute6,
246 	p_rec.prc_attribute7,
247 	p_rec.prc_attribute8,
248 	p_rec.prc_attribute9,
249 	p_rec.prc_attribute10,
250 	p_rec.prc_attribute11,
251 	p_rec.prc_attribute12,
252 	p_rec.prc_attribute13,
253 	p_rec.prc_attribute14,
254 	p_rec.prc_attribute15,
255 	p_rec.prc_attribute16,
256 	p_rec.prc_attribute17,
257 	p_rec.prc_attribute18,
258 	p_rec.prc_attribute19,
259 	p_rec.prc_attribute20,
260 	p_rec.prc_attribute21,
261 	p_rec.prc_attribute22,
262 	p_rec.prc_attribute23,
263 	p_rec.prc_attribute24,
264 	p_rec.prc_attribute25,
265 	p_rec.prc_attribute26,
266 	p_rec.prc_attribute27,
267 	p_rec.prc_attribute28,
268 	p_rec.prc_attribute29,
269 	p_rec.prc_attribute30,
270 	p_rec.object_version_number ,
271         p_rec.prtt_enrt_rslt_id ,
272         p_rec.comment_id  ,
273 	l_created_by,
274    	l_creation_date,
275    	l_last_update_date,
276    	l_last_updated_by,
277    	l_last_update_login  ,
278         p_rec.stat_rsn_cd,
279         p_rec.pymt_stat_cd,
280         p_rec.pymt_stat_rsn_cd,
281         p_rec.stat_ovrdn_flag,
282         p_rec.stat_ovrdn_rsn_cd,
283         p_rec.stat_prr_to_ovrd,
284         p_rec.pymt_stat_ovrdn_flag,
285         p_rec.pymt_stat_ovrdn_rsn_cd,
286         p_rec.pymt_stat_prr_to_ovrd,
287         p_rec.adjmt_flag,
288         p_rec.submtd_dt,
289         p_rec.ttl_rqst_amt,
290         p_rec.aprvd_for_pymt_amt,
291         p_rec.exp_incurd_dt
292   );
293   --
294   ben_prc_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_prc_shd.g_api_dml := false;   -- Unset the api dml status
301     ben_prc_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_prc_shd.g_api_dml := false;   -- Unset the api dml status
306     ben_prc_shd.constraint_error
307       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
308   When Others Then
309     ben_prc_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_prc_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 --   This procedure will also use a sequence generator to automatically
351 --   populate a value for the RQST_AMT field.
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_prc_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
388       select ben_prc_rqst_num_s.nextval
389       from sys.dual;
390 --
391 cursor c2 is
392        select ben_prc_rqst_num_s.nextval
393        from sys.dual;
394 --
395 --
396 Begin
397   hr_utility.set_location('Entering:'||l_proc, 5);
398   --
399       open c1;
400       fetch c1 into p_rec.prtt_reimbmt_rqst_id;
401       close c1;
402       --
403       open c2;
404       fetch c2 into p_rec.rqst_num;
405       close c2;
406   --
407   --
408   hr_utility.set_location(' Leaving:'||l_proc, 10);
409 End pre_insert;
410 --
411 -- ----------------------------------------------------------------------------
412 -- |-----------------------------< post_insert >------------------------------|
413 -- ----------------------------------------------------------------------------
414 -- {Start Of Comments}
415 --
416 -- Description:
417 --   This private procedure contains any processing which is required after the
418 --   insert dml.
419 --
420 -- Prerequisites:
421 --   This is an internal procedure which is called from the ins procedure.
422 --
423 -- In Parameters:
424 --   A Pl/Sql record structre.
425 --
426 -- Post Success:
427 --   Processing continues.
428 --
429 -- Post Failure:
430 --   If an error has occurred, an error message and exception will be raised
431 --   but not handled.
432 --
433 -- Developer Implementation Notes:
434 --   Any post-processing required after the insert dml is issued should be
435 --   coded within this procedure. It is important to note that any 3rd party
436 --   maintenance should be reviewed before placing in this procedure.
437 --
438 -- Access Status:
442 -- ----------------------------------------------------------------------------
439 --   Internal Row Handler Use Only.
440 --
441 -- {End Of Comments}
443 Procedure post_insert
444 	(p_rec 			 in ben_prc_shd.g_rec_type,
445 	 p_effective_date	 in date,
446 	 p_datetrack_mode	 in varchar2,
447 	 p_validation_start_date in date,
448 	 p_validation_end_date	 in date) is
449 --
450   l_proc	varchar2(72) := g_package||'post_insert';
451 --
452 Begin
453   hr_utility.set_location('Entering:'||l_proc, 5);
454 --
455   --
456   -- Start of API User Hook for post_insert.
457   --
458   begin
459     --
460     ben_prc_rki.after_insert
461       (
462   p_prtt_reimbmt_rqst_id          =>p_rec.prtt_reimbmt_rqst_id
463  ,p_effective_start_date          =>p_rec.effective_start_date
464  ,p_effective_end_date            =>p_rec.effective_end_date
465  ,p_incrd_from_dt                 =>p_rec.incrd_from_dt
466  ,p_incrd_to_dt                   =>p_rec.incrd_to_dt
467  ,p_rqst_num                      =>p_rec.rqst_num
468  ,p_rqst_amt                      =>p_rec.rqst_amt
469  ,p_rqst_amt_uom                  =>p_rec.rqst_amt_uom
470  ,p_rqst_btch_num                 =>p_rec.rqst_btch_num
471  ,p_prtt_reimbmt_rqst_stat_cd     =>p_rec.prtt_reimbmt_rqst_stat_cd
472  ,p_reimbmt_ctfn_typ_prvdd_cd     =>p_rec.reimbmt_ctfn_typ_prvdd_cd
473  ,p_rcrrg_cd                      =>p_rec.rcrrg_cd
474  ,p_submitter_person_id           =>p_rec.submitter_person_id
475  ,p_recipient_person_id           =>p_rec.recipient_person_id
476  ,p_provider_person_id            =>p_rec.provider_person_id
477  ,p_provider_ssn_person_id        =>p_rec.provider_ssn_person_id
478  ,p_pl_id                         =>p_rec.pl_id
479  ,p_gd_or_svc_typ_id              =>p_rec.gd_or_svc_typ_id
480  ,p_contact_relationship_id       =>p_rec.contact_relationship_id
481  ,p_business_group_id             =>p_rec.business_group_id
482  ,p_opt_id                        =>p_rec.opt_id
483  ,p_popl_yr_perd_id_1             =>p_rec.popl_yr_perd_id_1
484  ,p_popl_yr_perd_id_2             =>p_rec.popl_yr_perd_id_2
485  ,p_amt_year1                     =>p_rec.amt_year1
486  ,p_amt_year2                     =>p_rec.amt_year2
487  ,p_prc_attribute_category        =>p_rec.prc_attribute_category
488  ,p_prc_attribute1                =>p_rec.prc_attribute1
489  ,p_prc_attribute2                =>p_rec.prc_attribute2
490  ,p_prc_attribute3                =>p_rec.prc_attribute3
491  ,p_prc_attribute4                =>p_rec.prc_attribute4
492  ,p_prc_attribute5                =>p_rec.prc_attribute5
493  ,p_prc_attribute6                =>p_rec.prc_attribute6
494  ,p_prc_attribute7                =>p_rec.prc_attribute7
495  ,p_prc_attribute8                =>p_rec.prc_attribute8
496  ,p_prc_attribute9                =>p_rec.prc_attribute9
497  ,p_prc_attribute10               =>p_rec.prc_attribute10
498  ,p_prc_attribute11               =>p_rec.prc_attribute11
499  ,p_prc_attribute12               =>p_rec.prc_attribute12
500  ,p_prc_attribute13               =>p_rec.prc_attribute13
501  ,p_prc_attribute14               =>p_rec.prc_attribute14
502  ,p_prc_attribute15               =>p_rec.prc_attribute15
503  ,p_prc_attribute16               =>p_rec.prc_attribute16
504  ,p_prc_attribute17               =>p_rec.prc_attribute17
505  ,p_prc_attribute18               =>p_rec.prc_attribute18
506  ,p_prc_attribute19               =>p_rec.prc_attribute19
507  ,p_prc_attribute20               =>p_rec.prc_attribute20
508  ,p_prc_attribute21               =>p_rec.prc_attribute21
509  ,p_prc_attribute22               =>p_rec.prc_attribute22
510  ,p_prc_attribute23               =>p_rec.prc_attribute23
511  ,p_prc_attribute24               =>p_rec.prc_attribute24
512  ,p_prc_attribute25               =>p_rec.prc_attribute25
513  ,p_prc_attribute26               =>p_rec.prc_attribute26
514  ,p_prc_attribute27               =>p_rec.prc_attribute27
515  ,p_prc_attribute28               =>p_rec.prc_attribute28
516  ,p_prc_attribute29               =>p_rec.prc_attribute29
517  ,p_prc_attribute30               =>p_rec.prc_attribute30
518  ,p_object_version_number         =>p_rec.object_version_number
519  ,p_prtt_enrt_rslt_id             =>p_rec.prtt_enrt_rslt_id
520  ,p_comment_id                    =>p_rec.comment_id
521  ,p_stat_rsn_cd                   => p_rec.stat_rsn_cd
522  ,p_pymt_stat_cd                  => p_rec.pymt_stat_cd
523  ,p_pymt_stat_rsn_cd              => p_rec.pymt_stat_rsn_cd
524  ,p_stat_ovrdn_flag               => p_rec.stat_ovrdn_flag
525  ,p_stat_ovrdn_rsn_cd             => p_rec.stat_ovrdn_rsn_cd
526  ,p_stat_prr_to_ovrd              => p_rec.stat_prr_to_ovrd
527  ,p_pymt_stat_ovrdn_flag          => p_rec.pymt_stat_ovrdn_flag
528  ,p_pymt_stat_ovrdn_rsn_cd        => p_rec.pymt_stat_ovrdn_rsn_cd
529  ,p_pymt_stat_prr_to_ovrd         => p_rec.pymt_stat_prr_to_ovrd
530  ,p_adjmt_flag                    => p_rec.adjmt_flag
531  ,p_submtd_dt                     => p_rec.submtd_dt
532  ,p_ttl_rqst_amt                  => p_rec.ttl_rqst_amt
533  ,p_aprvd_for_pymt_amt            => p_rec.aprvd_for_pymt_amt
534  ,p_effective_date                =>p_effective_date
535  ,p_validation_start_date         =>p_validation_start_date
536  ,p_validation_end_date           =>p_validation_end_date
537  ,p_exp_incurd_dt		  =>p_rec.exp_incurd_dt
538       );
539     --
540   exception
541     --
542     when hr_api.cannot_find_prog_unit then
543       --
544       hr_api.cannot_find_prog_unit_error
545         (p_module_name => 'ben_prtt_reimbmt_rqst_f'
549   --
546         ,p_hook_type   => 'AI');
547       --
548   end;
550   -- End of API User Hook for post_insert.
551   --
552   --
553   hr_utility.set_location(' Leaving:'||l_proc, 10);
554 End post_insert;
555 --
556 -- ----------------------------------------------------------------------------
557 -- |-------------------------------< ins_lck >--------------------------------|
558 -- ----------------------------------------------------------------------------
559 -- {Start Of Comments}
560 --
561 -- Description:
562 --   The ins_lck process has one main function to perform. When inserting
563 --   a datetracked row, we must validate the DT mode.
564 --   be manipulated.
565 --
566 -- Prerequisites:
567 --   This procedure can only be called for the datetrack mode of INSERT.
568 --
569 -- In Parameters:
570 --
571 -- Post Success:
572 --   On successful completion of the ins_lck process the parental
573 --   datetracked rows will be locked providing the p_enforce_foreign_locking
574 --   argument value is TRUE.
575 --   If the p_enforce_foreign_locking argument value is FALSE then the
576 --   parential rows are not locked.
577 --
578 -- Post Failure:
579 --   The Lck process can fail for:
580 --   1) When attempting to lock the row the row could already be locked by
581 --      another user. This will raise the HR_Api.Object_Locked exception.
582 --   2) When attempting to the lock the parent which doesn't exist.
583 --      For the entity to be locked the parent must exist!
584 --
585 -- Developer Implementation Notes:
586 --   None.
587 --
588 -- Access Status:
589 --   Internal Row Handler Use Only.
590 --
591 -- {End Of Comments}
592 -- ----------------------------------------------------------------------------
593 Procedure ins_lck
594 	(p_effective_date	 in  date,
595 	 p_datetrack_mode	 in  varchar2,
596 	 p_rec	 		 in  ben_prc_shd.g_rec_type,
597 	 p_validation_start_date out nocopy date,
598 	 p_validation_end_date	 out nocopy date) is
599 --
600   l_proc		  varchar2(72) := g_package||'ins_lck';
601   l_validation_start_date date;
602   l_validation_end_date	  date;
603 --
604 Begin
605   hr_utility.set_location('Entering:'||l_proc, 5);
606   --
607   -- Validate the datetrack mode mode getting the validation start
608   -- and end dates for the specified datetrack operation.
609   --
610   dt_api.validate_dt_mode
611 	(p_effective_date	   => p_effective_date,
612 	 p_datetrack_mode	   => p_datetrack_mode,
613 	 p_base_table_name	   => 'ben_prtt_reimbmt_rqst_f',
614 	 p_base_key_column	   => 'prtt_reimbmt_rqst_id',
615 	 p_base_key_value 	   => p_rec.prtt_reimbmt_rqst_id,
616 	 p_parent_table_name1      => 'ben_pl_f',
617 	 p_parent_key_column1      => 'pl_id',
618 	 p_parent_key_value1       => p_rec.pl_id,
619          p_enforce_foreign_locking => true,
620 	 p_validation_start_date   => l_validation_start_date,
621  	 p_validation_end_date	   => l_validation_end_date);
622   --
623   -- Set the validation start and end date OUT arguments
624   --
625   p_validation_start_date := l_validation_start_date;
626   p_validation_end_date   := l_validation_end_date;
627   --
628   hr_utility.set_location(' Leaving:'||l_proc, 10);
629 --
630 End ins_lck;
631 --
632 -- ----------------------------------------------------------------------------
633 -- |---------------------------------< ins >----------------------------------|
634 -- ----------------------------------------------------------------------------
635 Procedure ins
636   (
637   p_rec		   in out nocopy ben_prc_shd.g_rec_type,
638   p_effective_date in     date
639   ) is
640 --
641   l_proc			varchar2(72) := g_package||'ins';
642   l_datetrack_mode		varchar2(30) := 'INSERT';
643   l_validation_start_date	date;
644   l_validation_end_date		date;
645 --
646 Begin
647   hr_utility.set_location('Entering:'||l_proc, 5);
648   --
649   -- Call the lock operation
650   --
651   ins_lck
652 	(p_effective_date	 => p_effective_date,
653 	 p_datetrack_mode	 => l_datetrack_mode,
654 	 p_rec	 		 => p_rec,
655 	 p_validation_start_date => l_validation_start_date,
656 	 p_validation_end_date	 => l_validation_end_date);
657   --
658   -- Call the supporting insert validate operations
659   --
660   ben_prc_bus.insert_validate
661 	(p_rec			 => p_rec,
662 	 p_effective_date	 => p_effective_date,
663 	 p_datetrack_mode	 => l_datetrack_mode,
664 	 p_validation_start_date => l_validation_start_date,
665 	 p_validation_end_date	 => l_validation_end_date);
666 
667  hr_utility.set_location('after date  check ' || p_rec.prtt_reimbmt_rqst_stat_cd, 110);
668  hr_utility.set_location('after date  check ' || p_rec.stat_rsn_cd, 110);
669  hr_utility.set_location('after date  check ' || p_rec.Pymt_stat_cd, 110);
670  hr_utility.set_location('after date  check ' || p_rec.pymt_stat_rsn_cd, 110);
671 
672   --
673   -- Call the supporting pre-insert operation
674   --
675   pre_insert
676  	(p_rec			 => p_rec,
677 	 p_effective_date	 => p_effective_date,
678 	 p_datetrack_mode	 => l_datetrack_mode,
679 	 p_validation_start_date => l_validation_start_date,
680 	 p_validation_end_date	 => l_validation_end_date);
681   --
682   -- Insert the row
683   --
684   insert_dml
688 	 p_validation_start_date => l_validation_start_date,
685  	(p_rec			 => p_rec,
686 	 p_effective_date	 => p_effective_date,
687 	 p_datetrack_mode	 => l_datetrack_mode,
689 	 p_validation_end_date	 => l_validation_end_date);
690   --
691   -- Call the supporting post-insert operation
692   --
693   post_insert
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 end ins;
700 --
701 -- ----------------------------------------------------------------------------
702 -- |---------------------------------< ins >----------------------------------|
703 -- ----------------------------------------------------------------------------
704 Procedure ins
705   (
706   p_prtt_reimbmt_rqst_id         out nocopy number,
707   p_effective_start_date         out nocopy date,
708   p_effective_end_date           out nocopy date,
709   p_incrd_from_dt                in date             ,
710   p_incrd_to_dt                  in date             ,
711   p_rqst_num                     in out nocopy number       ,
712   p_rqst_amt                     in number           ,
713   p_rqst_amt_uom                 in varchar2         ,
714   p_rqst_btch_num                in number           ,
715   p_prtt_reimbmt_rqst_stat_cd    in out nocopy varchar2     ,
716   p_reimbmt_ctfn_typ_prvdd_cd    in varchar2         ,
717   p_rcrrg_cd                     in varchar2         ,
718   p_submitter_person_id          in number           ,
719   p_recipient_person_id          in number           ,
720   p_provider_person_id           in number           ,
721   p_provider_ssn_person_id       in number           ,
722   p_pl_id                        in number,
723   p_gd_or_svc_typ_id             in number           ,
724   p_contact_relationship_id      in number           ,
725   p_business_group_id            in number
726  ,p_opt_id                         in  number
727  ,p_popl_yr_perd_id_1              in  number
728  ,p_popl_yr_perd_id_2              in  number
729  ,p_amt_year1                      in  number
730  ,p_amt_year2                      in  number,
731   p_prc_attribute_category       in varchar2         ,
732   p_prc_attribute1               in varchar2         ,
733   p_prc_attribute2               in varchar2         ,
734   p_prc_attribute3               in varchar2         ,
735   p_prc_attribute4               in varchar2         ,
736   p_prc_attribute5               in varchar2         ,
737   p_prc_attribute6               in varchar2         ,
738   p_prc_attribute7               in varchar2         ,
739   p_prc_attribute8               in varchar2         ,
740   p_prc_attribute9               in varchar2         ,
741   p_prc_attribute10              in varchar2         ,
742   p_prc_attribute11              in varchar2         ,
743   p_prc_attribute12              in varchar2         ,
744   p_prc_attribute13              in varchar2         ,
745   p_prc_attribute14              in varchar2         ,
746   p_prc_attribute15              in varchar2         ,
747   p_prc_attribute16              in varchar2         ,
748   p_prc_attribute17              in varchar2         ,
749   p_prc_attribute18              in varchar2         ,
750   p_prc_attribute19              in varchar2         ,
751   p_prc_attribute20              in varchar2         ,
752   p_prc_attribute21              in varchar2         ,
753   p_prc_attribute22              in varchar2         ,
754   p_prc_attribute23              in varchar2         ,
755   p_prc_attribute24              in varchar2         ,
756   p_prc_attribute25              in varchar2         ,
757   p_prc_attribute26              in varchar2         ,
758   p_prc_attribute27              in varchar2         ,
759   p_prc_attribute28              in varchar2         ,
760   p_prc_attribute29              in varchar2         ,
761   p_prc_attribute30              in varchar2         ,
762   p_prtt_enrt_rslt_id            in number           ,
763   p_comment_id                   in number           ,
764   p_object_version_number        out nocopy number,
765   -- Fide enh
766   p_stat_rsn_cd                  in out nocopy varchar2 ,
767   p_pymt_stat_cd                 in out nocopy varchar2 ,
768   p_pymt_stat_rsn_cd             in out nocopy varchar2 ,
769   p_stat_ovrdn_flag              in varchar2  ,
770   p_stat_ovrdn_rsn_cd            in varchar2  ,
771   p_stat_prr_to_ovrd             in varchar2  ,
772   p_pymt_stat_ovrdn_flag         in varchar2  ,
773   p_pymt_stat_ovrdn_rsn_cd       in varchar2  ,
774   p_pymt_stat_prr_to_ovrd        in varchar2  ,
775   p_adjmt_flag                   in varchar2  ,
776   p_submtd_dt                    in date  ,
777   p_ttl_rqst_amt                 in  number    ,
778   p_aprvd_for_pymt_amt           in  out nocopy number,
779   p_pymt_amount                  out nocopy number ,
780   p_exp_incurd_dt		 in date      ,
781   p_effective_date		 in date
782   ) is
783 --
784   l_rec		ben_prc_shd.g_rec_type;
785   l_proc	varchar2(72) := g_package||'ins';
786 --
787 Begin
788   hr_utility.set_location('Entering:'||l_proc, 5);
789   --
790   -- Call conversion function to turn arguments into the
791   -- p_rec structure.
792   --
793   l_rec :=
794   ben_prc_shd.convert_args
795   (
796   null,
797   null,
798   null,
799   p_incrd_from_dt,
800   p_incrd_to_dt,
801   p_rqst_num,
802   p_rqst_amt,
803   p_rqst_amt_uom,
804   p_rqst_btch_num,
805   p_prtt_reimbmt_rqst_stat_cd,
806   p_reimbmt_ctfn_typ_prvdd_cd,
807   p_rcrrg_cd,
808   p_submitter_person_id,
809   p_recipient_person_id,
810   p_provider_person_id,
811   p_provider_ssn_person_id,
812   p_pl_id,
813   p_gd_or_svc_typ_id,
814   p_contact_relationship_id,
815   p_business_group_id,
816   p_opt_id,
817   p_popl_yr_perd_id_1,
818   p_popl_yr_perd_id_2,
819   p_amt_year1,
820   p_amt_year2 ,
821   p_prc_attribute_category,
822   p_prc_attribute1,
823   p_prc_attribute2,
824   p_prc_attribute3,
825   p_prc_attribute4,
826   p_prc_attribute5,
827   p_prc_attribute6,
828   p_prc_attribute7,
829   p_prc_attribute8,
830   p_prc_attribute9,
831   p_prc_attribute10,
832   p_prc_attribute11,
833   p_prc_attribute12,
834   p_prc_attribute13,
835   p_prc_attribute14,
836   p_prc_attribute15,
837   p_prc_attribute16,
838   p_prc_attribute17,
839   p_prc_attribute18,
840   p_prc_attribute19,
841   p_prc_attribute20,
842   p_prc_attribute21,
843   p_prc_attribute22,
844   p_prc_attribute23,
845   p_prc_attribute24,
846   p_prc_attribute25,
847   p_prc_attribute26,
848   p_prc_attribute27,
849   p_prc_attribute28,
850   p_prc_attribute29,
851   p_prc_attribute30,
852   p_prtt_enrt_rslt_id ,
853   p_comment_id        ,
854   null ,
855   p_stat_rsn_cd,
856   p_pymt_stat_cd,
857   p_pymt_stat_rsn_cd,
858   p_stat_ovrdn_flag,
859   p_stat_ovrdn_rsn_cd,
860   p_stat_prr_to_ovrd,
861   p_pymt_stat_ovrdn_flag,
862   p_pymt_stat_ovrdn_rsn_cd,
863   p_pymt_stat_prr_to_ovrd,
864   p_adjmt_flag,
865   p_submtd_dt,
866   p_ttl_rqst_amt,
867   p_aprvd_for_pymt_amt,
868   null ,
869   p_exp_incurd_dt
870   );
871   --
872   -- Having converted the arguments into the ben_prc_rec
873   -- plsql record structure we call the corresponding record
874   -- business process.
875   --
876   ins(l_rec, p_effective_date);
877   --
878   -- Set the OUT arguments.
879   --
880   p_prtt_reimbmt_rqst_id      	:= l_rec.prtt_reimbmt_rqst_id;
881   p_effective_start_date  	:= l_rec.effective_start_date;
882   p_effective_end_date    	:= l_rec.effective_end_date;
883   p_object_version_number 	:= l_rec.object_version_number;
884   p_rqst_num                    := l_rec.rqst_num ;
885   p_prtt_reimbmt_rqst_Stat_cd   := l_rec.prtt_reimbmt_rqst_Stat_cd;
886   p_stat_rsn_cd                 := l_rec.stat_rsn_cd ;
887   p_pymt_stat_rsn_cd            := l_rec.pymt_stat_rsn_cd;
888   p_pymt_stat_cd                := l_rec.pymt_stat_cd ;
889   p_pymt_amount                 := l_rec.pymt_amount ;
890   p_aprvd_for_pymt_amt          := l_rec.aprvd_for_pymt_amt ;
891   --
892   --
893   hr_utility.set_location(' Leaving:'||l_proc, 10);
894 End ins;
895 --
896 end ben_prc_ins;