DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PCD_INS

Source


1 Package Body ben_pcd_ins as
2 /* $Header: bepcdrhi.pkb 115.9 2002/12/16 11:57:29 vsethi ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_pcd_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_pcd_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_per_cm_prvdd_f t
70     where  t.per_cm_prvdd_id       = p_rec.per_cm_prvdd_id
71     and    t.effective_start_date =
72              ben_pcd_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_per_cm_prvdd_f.created_by%TYPE;
77   l_creation_date       ben_per_cm_prvdd_f.creation_date%TYPE;
78   l_last_update_date   	ben_per_cm_prvdd_f.last_update_date%TYPE;
79   l_last_updated_by     ben_per_cm_prvdd_f.last_updated_by%TYPE;
80   l_last_update_login   ben_per_cm_prvdd_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_per_cm_prvdd_f',
90 	 p_base_key_column => 'per_cm_prvdd_id',
91 	 p_base_key_value  => p_rec.per_cm_prvdd_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_pcd_shd.g_api_dml := true;  -- Set the api dml status
130   --
131   -- Insert the row into: ben_per_cm_prvdd_f
132   --
133   insert into ben_per_cm_prvdd_f
134   (	per_cm_prvdd_id,
135 	effective_start_date,
136 	effective_end_date,
137 	rqstd_flag,
138 	inspn_rqd_flag,
139         resnd_rsn_cd,
140         resnd_cmnt_txt,
141 	per_cm_prvdd_stat_cd,
142 	cm_dlvry_med_cd,
143 	cm_dlvry_mthd_cd,
144 	sent_dt,
145 	instnc_num,
146 	to_be_sent_dt,
147 	dlvry_instn_txt,
148 	per_cm_id,
149 	address_id,
150 	business_group_id,
151 	pcd_attribute_category,
152 	pcd_attribute1,
153 	pcd_attribute2,
154 	pcd_attribute3,
155 	pcd_attribute4,
156 	pcd_attribute5,
157 	pcd_attribute6,
158 	pcd_attribute7,
159 	pcd_attribute8,
160 	pcd_attribute9,
161 	pcd_attribute10,
162 	pcd_attribute11,
163 	pcd_attribute12,
164 	pcd_attribute13,
165 	pcd_attribute14,
166 	pcd_attribute15,
167 	pcd_attribute16,
168 	pcd_attribute17,
169 	pcd_attribute18,
170 	pcd_attribute19,
171 	pcd_attribute20,
172 	pcd_attribute21,
173 	pcd_attribute22,
174 	pcd_attribute23,
175 	pcd_attribute24,
176 	pcd_attribute25,
177 	pcd_attribute26,
178 	pcd_attribute27,
179 	pcd_attribute28,
180 	pcd_attribute29,
181 	pcd_attribute30,
182 	request_id,
183 	program_application_id,
184 	program_id,
185 	program_update_date,
186 	object_version_number
187    	, created_by,
188    	creation_date,
189    	last_update_date,
190    	last_updated_by,
191    	last_update_login
192   )
193   Values
194   (	p_rec.per_cm_prvdd_id,
195 	p_rec.effective_start_date,
196 	p_rec.effective_end_date,
197 	p_rec.rqstd_flag,
198 	p_rec.inspn_rqd_flag,
199         p_rec.resnd_rsn_cd,
200         p_rec.resnd_cmnt_txt,
201 	p_rec.per_cm_prvdd_stat_cd,
202 	p_rec.cm_dlvry_med_cd,
203 	p_rec.cm_dlvry_mthd_cd,
204 	p_rec.sent_dt,
205 	p_rec.instnc_num,
206 	p_rec.to_be_sent_dt,
207 	p_rec.dlvry_instn_txt,
208 	p_rec.per_cm_id,
209 	p_rec.address_id,
210 	p_rec.business_group_id,
211 	p_rec.pcd_attribute_category,
212 	p_rec.pcd_attribute1,
213 	p_rec.pcd_attribute2,
214 	p_rec.pcd_attribute3,
215 	p_rec.pcd_attribute4,
216 	p_rec.pcd_attribute5,
217 	p_rec.pcd_attribute6,
218 	p_rec.pcd_attribute7,
219 	p_rec.pcd_attribute8,
220 	p_rec.pcd_attribute9,
221 	p_rec.pcd_attribute10,
222 	p_rec.pcd_attribute11,
223 	p_rec.pcd_attribute12,
224 	p_rec.pcd_attribute13,
225 	p_rec.pcd_attribute14,
226 	p_rec.pcd_attribute15,
227 	p_rec.pcd_attribute16,
228 	p_rec.pcd_attribute17,
229 	p_rec.pcd_attribute18,
230 	p_rec.pcd_attribute19,
231 	p_rec.pcd_attribute20,
232 	p_rec.pcd_attribute21,
233 	p_rec.pcd_attribute22,
234 	p_rec.pcd_attribute23,
235 	p_rec.pcd_attribute24,
236 	p_rec.pcd_attribute25,
237 	p_rec.pcd_attribute26,
238 	p_rec.pcd_attribute27,
239 	p_rec.pcd_attribute28,
240 	p_rec.pcd_attribute29,
241 	p_rec.pcd_attribute30,
242 	p_rec.request_id,
243 	p_rec.program_application_id,
244 	p_rec.program_id,
245 	p_rec.program_update_date,
246 	p_rec.object_version_number
247 	, l_created_by,
248    	l_creation_date,
249    	l_last_update_date,
250    	l_last_updated_by,
251    	l_last_update_login
252   );
253   --
254   ben_pcd_shd.g_api_dml := false;   -- Unset the api dml status
255   hr_utility.set_location(' Leaving:'||l_proc, 15);
256 --
257 Exception
258   When hr_api.check_integrity_violated Then
259     -- A check constraint has been violated
260     ben_pcd_shd.g_api_dml := false;   -- Unset the api dml status
261     ben_pcd_shd.constraint_error
262       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
263   When hr_api.unique_integrity_violated Then
264     -- Unique integrity has been violated
265     ben_pcd_shd.g_api_dml := false;   -- Unset the api dml status
266     ben_pcd_shd.constraint_error
267       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
268   When Others Then
269     ben_pcd_shd.g_api_dml := false;   -- Unset the api dml status
270     Raise;
271 End dt_insert_dml;
272 --
273 -- ----------------------------------------------------------------------------
274 -- |------------------------------< insert_dml >------------------------------|
275 -- ----------------------------------------------------------------------------
276 Procedure insert_dml
277 	(p_rec 			 in out nocopy ben_pcd_shd.g_rec_type,
278 	 p_effective_date	 in	date,
279 	 p_datetrack_mode	 in	varchar2,
280 	 p_validation_start_date in	date,
281 	 p_validation_end_date	 in	date) is
282 --
283   l_proc	varchar2(72) := g_package||'insert_dml';
284 --
285 Begin
286   hr_utility.set_location('Entering:'||l_proc, 5);
287   --
288   dt_insert_dml(p_rec			=> p_rec,
289 		p_effective_date	=> p_effective_date,
290 		p_datetrack_mode	=> p_datetrack_mode,
291        		p_validation_start_date	=> p_validation_start_date,
292 		p_validation_end_date	=> p_validation_end_date);
293   --
294   hr_utility.set_location(' Leaving:'||l_proc, 10);
295 End insert_dml;
296 --
297 -- ----------------------------------------------------------------------------
298 -- |------------------------------< pre_insert >------------------------------|
299 -- ----------------------------------------------------------------------------
300 -- {Start Of Comments}
301 --
302 -- Description:
303 --   This private procedure contains any processing which is required before
304 --   the insert dml. Presently, if the entity has a corresponding primary
305 --   key which is maintained by an associating sequence, the primary key for
306 --   the entity will be populated with the next sequence value in
307 --   preparation for the insert dml.
308 --   Also, if comments are defined for this entity, the comments insert
309 --   logic will also be called, generating a comment_id if required.
310 --
311 -- Prerequisites:
312 --   This is an internal procedure which is called from the ins procedure.
313 --
314 -- In Parameters:
315 --   A Pl/Sql record structre.
316 --
317 -- Post Success:
318 --   Processing continues.
319 --
320 -- Post Failure:
321 --   If an error has occurred, an error message and exception will be raised
322 --   but not handled.
323 --
324 -- Developer Implementation Notes:
325 --   Any pre-processing required before the insert dml is issued should be
326 --   coded within this procedure. As stated above, a good example is the
327 --   generation of a primary key number via a corresponding sequence.
328 --   It is important to note that any 3rd party maintenance should be reviewed
329 --   before placing in this procedure.
330 --
331 -- Access Status:
332 --   Internal Row Handler Use Only.
333 --
334 -- {End Of Comments}
335 -- ----------------------------------------------------------------------------
336 Procedure pre_insert
337 	(p_rec  			in out nocopy ben_pcd_shd.g_rec_type,
338 	 p_effective_date		in date,
339 	 p_datetrack_mode		in varchar2,
340 	 p_validation_start_date	in date,
341 	 p_validation_end_date		in date) is
342 --
343   l_proc	varchar2(72) := g_package||'pre_insert';
344 
345   cursor c1 is
346      select ben_per_cm_prvdd_f_s.nextval
347      from dual;
348 
349   -- find the maximum number of times this communication can be sent
350   cursor c2 is
351      select mx_num_avlbl_val
352      from ben_cm_typ_f cct, ben_per_cm_f pcm
353      where pcm.per_cm_id = p_rec.per_cm_id
354        and pcm.cm_typ_id = cct.cm_typ_id
355        and p_effective_date between
356            pcm.effective_start_date and pcm.effective_end_date
357        and p_effective_date between
358            cct.effective_start_date and cct.effective_end_date;
359 
360   -- determine what number-of-times THIS communication instance will be
361   cursor c3 is
362      select (max(instnc_num) + 1)
363        from ben_per_cm_prvdd_f pcd
364      where pcd.per_cm_id = p_rec.per_cm_id
365        and p_effective_date between
366            pcd.effective_start_date and pcd.effective_end_date;
367 
368   l_max_num     number;
369   l_this_instnc number := 0;
370 
371 --
372 --
373 Begin
374   hr_utility.set_location('Entering:'||l_proc, 5);
375   --
376   --
377   open c1;
378   fetch c1 into p_rec.per_cm_prvdd_id;
379   close c1;
380 
381   open c2;
382   fetch c2 into l_max_num;
383   close c2;
384 
385   open c3;
386   fetch c3 into l_this_instnc;
387   close c3;
388 
389   if l_this_instnc = 0 or l_this_instnc is null then
390      -- there were no other sendings of this communication, this one is
391      -- the first.
392      p_rec.instnc_num := 1;
393   else
394     if l_max_num is null then
395        -- there is no max number of times, set this one to the next instance
396        -- number.
397        p_rec.instnc_num := l_this_instnc;
398      elsif l_this_instnc > l_max_num then
399       -- there is a max and this one would exceed it, error out.
400       fnd_message.set_name('BEN','BEN_91883_PCD_TOO_MANY_TIMES');
401       fnd_message.raise_error;
402      else
403        -- there is a max and this one doesn't exceed it, set this one to the
404        -- next instance number.
405        p_rec.instnc_num := l_this_instnc;
406      end if;
407   end if;
408 
409   hr_utility.set_location(' Leaving:'||l_proc, 10);
410 End pre_insert;
411 --
412 -- ----------------------------------------------------------------------------
413 -- |-----------------------------< post_insert >------------------------------|
414 -- ----------------------------------------------------------------------------
415 -- {Start Of Comments}
416 --
417 -- Description:
418 --   This private procedure contains any processing which is required after the
419 --   insert dml.
420 --
421 -- Prerequisites:
422 --   This is an internal procedure which is called from the ins procedure.
423 --
424 -- In Parameters:
425 --   A Pl/Sql record structre.
426 --
427 -- Post Success:
428 --   Processing continues.
429 --
430 -- Post Failure:
431 --   If an error has occurred, an error message and exception will be raised
432 --   but not handled.
433 --
434 -- Developer Implementation Notes:
435 --   Any post-processing required after the insert dml is issued should be
436 --   coded within this procedure. It is important to note that any 3rd party
437 --   maintenance should be reviewed before placing in this procedure.
438 --
439 -- Access Status:
440 --   Internal Row Handler Use Only.
441 --
442 -- {End Of Comments}
443 -- ----------------------------------------------------------------------------
444 Procedure post_insert
448 	 p_validation_start_date in date,
445 	(p_rec 			 in ben_pcd_shd.g_rec_type,
446 	 p_effective_date	 in date,
447 	 p_datetrack_mode	 in varchar2,
449 	 p_validation_end_date	 in date) is
450 --
451   l_proc	varchar2(72) := g_package||'post_insert';
452 --
453 Begin
454   hr_utility.set_location('Entering:'||l_proc, 5);
455 --
456   --
457   -- Start of API User Hook for post_insert.
458   --
459   begin
460     --
461     ben_pcd_rki.after_insert
462       (
463   p_per_cm_prvdd_id               =>p_rec.per_cm_prvdd_id
464  ,p_effective_start_date          =>p_rec.effective_start_date
465  ,p_effective_end_date            =>p_rec.effective_end_date
466  ,p_rqstd_flag                    =>p_rec.rqstd_flag
467  ,p_inspn_rqd_flag                =>p_rec.inspn_rqd_flag
468  ,p_resnd_rsn_cd                  =>p_rec.resnd_rsn_cd
469  ,p_resnd_cmnt_txt                =>p_rec.resnd_cmnt_txt
470  ,p_per_cm_prvdd_stat_cd          =>p_rec.per_cm_prvdd_stat_cd
471  ,p_cm_dlvry_med_cd               =>p_rec.cm_dlvry_med_cd
472  ,p_cm_dlvry_mthd_cd              =>p_rec.cm_dlvry_mthd_cd
473  ,p_sent_dt                       =>p_rec.sent_dt
474  ,p_instnc_num                    =>p_rec.instnc_num
475  ,p_to_be_sent_dt                 =>p_rec.to_be_sent_dt
476  ,p_dlvry_instn_txt               =>p_rec.dlvry_instn_txt
477  ,p_per_cm_id                     =>p_rec.per_cm_id
478  ,p_address_id                    =>p_rec.address_id
479  ,p_business_group_id             =>p_rec.business_group_id
480  ,p_pcd_attribute_category        =>p_rec.pcd_attribute_category
481  ,p_pcd_attribute1                =>p_rec.pcd_attribute1
482  ,p_pcd_attribute2                =>p_rec.pcd_attribute2
483  ,p_pcd_attribute3                =>p_rec.pcd_attribute3
484  ,p_pcd_attribute4                =>p_rec.pcd_attribute4
485  ,p_pcd_attribute5                =>p_rec.pcd_attribute5
486  ,p_pcd_attribute6                =>p_rec.pcd_attribute6
487  ,p_pcd_attribute7                =>p_rec.pcd_attribute7
488  ,p_pcd_attribute8                =>p_rec.pcd_attribute8
489  ,p_pcd_attribute9                =>p_rec.pcd_attribute9
490  ,p_pcd_attribute10               =>p_rec.pcd_attribute10
491  ,p_pcd_attribute11               =>p_rec.pcd_attribute11
492  ,p_pcd_attribute12               =>p_rec.pcd_attribute12
493  ,p_pcd_attribute13               =>p_rec.pcd_attribute13
494  ,p_pcd_attribute14               =>p_rec.pcd_attribute14
495  ,p_pcd_attribute15               =>p_rec.pcd_attribute15
496  ,p_pcd_attribute16               =>p_rec.pcd_attribute16
497  ,p_pcd_attribute17               =>p_rec.pcd_attribute17
498  ,p_pcd_attribute18               =>p_rec.pcd_attribute18
499  ,p_pcd_attribute19               =>p_rec.pcd_attribute19
500  ,p_pcd_attribute20               =>p_rec.pcd_attribute20
501  ,p_pcd_attribute21               =>p_rec.pcd_attribute21
502  ,p_pcd_attribute22               =>p_rec.pcd_attribute22
503  ,p_pcd_attribute23               =>p_rec.pcd_attribute23
504  ,p_pcd_attribute24               =>p_rec.pcd_attribute24
505  ,p_pcd_attribute25               =>p_rec.pcd_attribute25
506  ,p_pcd_attribute26               =>p_rec.pcd_attribute26
507  ,p_pcd_attribute27               =>p_rec.pcd_attribute27
508  ,p_pcd_attribute28               =>p_rec.pcd_attribute28
509  ,p_pcd_attribute29               =>p_rec.pcd_attribute29
510  ,p_pcd_attribute30               =>p_rec.pcd_attribute30
511  ,p_request_id                    =>p_rec.request_id
512  ,p_program_application_id        =>p_rec.program_application_id
513  ,p_program_id                    =>p_rec.program_id
514  ,p_program_update_date           =>p_rec.program_update_date
515  ,p_object_version_number         =>p_rec.object_version_number
516  ,p_effective_date                =>p_effective_date
517  ,p_validation_start_date         =>p_validation_start_date
518  ,p_validation_end_date           =>p_validation_end_date
519       );
520     --
521   exception
522     --
523     when hr_api.cannot_find_prog_unit then
524       --
525       hr_api.cannot_find_prog_unit_error
526         (p_module_name => 'ben_per_cm_prvdd_f'
527         ,p_hook_type   => 'AI');
528       --
529   end;
530   --
531   -- End of API User Hook for post_insert.
532   --
533   --
534   hr_utility.set_location(' Leaving:'||l_proc, 10);
535 End post_insert;
536 --
537 -- ----------------------------------------------------------------------------
538 -- |-------------------------------< ins_lck >--------------------------------|
539 -- ----------------------------------------------------------------------------
540 -- {Start Of Comments}
541 --
542 -- Description:
543 --   The ins_lck process has one main function to perform. When inserting
544 --   a datetracked row, we must validate the DT mode.
545 --   be manipulated.
546 --
547 -- Prerequisites:
548 --   This procedure can only be called for the datetrack mode of INSERT.
549 --
550 -- In Parameters:
551 --
552 -- Post Success:
553 --   On successful completion of the ins_lck process the parental
554 --   datetracked rows will be locked providing the p_enforce_foreign_locking
555 --   argument value is TRUE.
556 --   If the p_enforce_foreign_locking argument value is FALSE then the
557 --   parential rows are not locked.
558 --
559 -- Post Failure:
560 --   The Lck process can fail for:
561 --   1) When attempting to lock the row the row could already be locked by
562 --      another user. This will raise the HR_Api.Object_Locked exception.
563 --   2) When attempting to the lock the parent which doesn't exist.
564 --      For the entity to be locked the parent must exist!
565 --
566 -- Developer Implementation Notes:
570 --   Internal Row Handler Use Only.
567 --   None.
568 --
569 -- Access Status:
571 --
572 -- {End Of Comments}
573 -- ----------------------------------------------------------------------------
574 Procedure ins_lck
575 	(p_effective_date	 in  date,
576 	 p_datetrack_mode	 in  varchar2,
577 	 p_rec	 		 in  ben_pcd_shd.g_rec_type,
578 	 p_validation_start_date out nocopy date,
579 	 p_validation_end_date	 out nocopy date) is
580 --
581   l_proc		  varchar2(72) := g_package||'ins_lck';
582   l_validation_start_date date;
583   l_validation_end_date	  date;
584 --
585 Begin
586   hr_utility.set_location('Entering:'||l_proc, 5);
587   --
588   -- Validate the datetrack mode mode getting the validation start
589   -- and end dates for the specified datetrack operation.
590   --
591   dt_api.validate_dt_mode
592 	(p_effective_date	   => p_effective_date,
593 	 p_datetrack_mode	   => p_datetrack_mode,
594 	 p_base_table_name	   => 'ben_per_cm_prvdd_f',
595 	 p_base_key_column	   => 'per_cm_prvdd_id',
596 	 p_base_key_value 	   => p_rec.per_cm_prvdd_id,
597 	 p_parent_table_name1      => 'ben_per_cm_f',
598 	 p_parent_key_column1      => 'per_cm_id',
599 	 p_parent_key_value1       => p_rec.per_cm_id,
600          p_enforce_foreign_locking => true,
601 	 p_validation_start_date   => l_validation_start_date,
602  	 p_validation_end_date	   => l_validation_end_date);
603   --
604   -- Set the validation start and end date OUT arguments
605   --
606   p_validation_start_date := l_validation_start_date;
607   p_validation_end_date   := l_validation_end_date;
608   --
609   hr_utility.set_location(' Leaving:'||l_proc, 10);
610 --
611 End ins_lck;
612 --
613 -- ----------------------------------------------------------------------------
614 -- |---------------------------------< ins >----------------------------------|
615 -- ----------------------------------------------------------------------------
616 Procedure ins
617   (
618   p_rec		   in out nocopy ben_pcd_shd.g_rec_type,
619   p_effective_date in     date
620   ) is
621 --
622   l_proc			varchar2(72) := g_package||'ins';
623   l_datetrack_mode		varchar2(30) := 'INSERT';
624   l_validation_start_date	date;
625   l_validation_end_date		date;
626 --
627 Begin
628   hr_utility.set_location('Entering:'||l_proc, 5);
629   --
630   -- Call the lock operation
631   --
632   ins_lck
633 	(p_effective_date	 => p_effective_date,
634 	 p_datetrack_mode	 => l_datetrack_mode,
635 	 p_rec	 		 => p_rec,
636 	 p_validation_start_date => l_validation_start_date,
637 	 p_validation_end_date	 => l_validation_end_date);
638   --
639   -- Call the supporting insert validate operations
640   --
641   ben_pcd_bus.insert_validate
642 	(p_rec			 => p_rec,
643 	 p_effective_date	 => p_effective_date,
644 	 p_datetrack_mode	 => l_datetrack_mode,
645 	 p_validation_start_date => l_validation_start_date,
646 	 p_validation_end_date	 => l_validation_end_date);
647   --
648   -- Call the supporting pre-insert operation
649   --
650   pre_insert
651  	(p_rec			 => p_rec,
652 	 p_effective_date	 => p_effective_date,
653 	 p_datetrack_mode	 => l_datetrack_mode,
654 	 p_validation_start_date => l_validation_start_date,
655 	 p_validation_end_date	 => l_validation_end_date);
656   --
657   -- Insert the row
658   --
659   insert_dml
660  	(p_rec			 => p_rec,
661 	 p_effective_date	 => p_effective_date,
662 	 p_datetrack_mode	 => l_datetrack_mode,
663 	 p_validation_start_date => l_validation_start_date,
664 	 p_validation_end_date	 => l_validation_end_date);
665   --
666   -- Call the supporting post-insert operation
667   --
668   post_insert
669  	(p_rec			 => p_rec,
670 	 p_effective_date	 => p_effective_date,
671 	 p_datetrack_mode	 => l_datetrack_mode,
672 	 p_validation_start_date => l_validation_start_date,
673 	 p_validation_end_date	 => l_validation_end_date);
674 end ins;
675 --
676 -- ----------------------------------------------------------------------------
677 -- |---------------------------------< ins >----------------------------------|
678 -- ----------------------------------------------------------------------------
679 Procedure ins
680   (
681   p_per_cm_prvdd_id              out nocopy number,
682   p_effective_start_date         out nocopy date,
683   p_effective_end_date           out nocopy date,
684   p_rqstd_flag                   in varchar2,
685   p_per_cm_prvdd_stat_cd         in varchar2         default null,
686   p_cm_dlvry_med_cd              in varchar2         default null,
687   p_cm_dlvry_mthd_cd             in varchar2         default null,
688   p_sent_dt                      in date             default null,
689   p_instnc_num                   in number           default null,
690   p_to_be_sent_dt                in date             default null,
691   p_dlvry_instn_txt              in varchar2         default null,
692   p_inspn_rqd_flag               in varchar2,
693   p_resnd_rsn_cd                 in varchar2         default null,
694   p_resnd_cmnt_txt               in varchar2         default null,
695   p_per_cm_id                    in number,
696   p_address_id                   in number           default null,
697   p_business_group_id            in number,
698   p_pcd_attribute_category       in varchar2         default null,
699   p_pcd_attribute1               in varchar2         default null,
700   p_pcd_attribute2               in varchar2         default null,
704   p_pcd_attribute6               in varchar2         default null,
701   p_pcd_attribute3               in varchar2         default null,
702   p_pcd_attribute4               in varchar2         default null,
703   p_pcd_attribute5               in varchar2         default null,
705   p_pcd_attribute7               in varchar2         default null,
706   p_pcd_attribute8               in varchar2         default null,
707   p_pcd_attribute9               in varchar2         default null,
708   p_pcd_attribute10              in varchar2         default null,
709   p_pcd_attribute11              in varchar2         default null,
710   p_pcd_attribute12              in varchar2         default null,
711   p_pcd_attribute13              in varchar2         default null,
712   p_pcd_attribute14              in varchar2         default null,
713   p_pcd_attribute15              in varchar2         default null,
714   p_pcd_attribute16              in varchar2         default null,
715   p_pcd_attribute17              in varchar2         default null,
716   p_pcd_attribute18              in varchar2         default null,
717   p_pcd_attribute19              in varchar2         default null,
718   p_pcd_attribute20              in varchar2         default null,
719   p_pcd_attribute21              in varchar2         default null,
720   p_pcd_attribute22              in varchar2         default null,
721   p_pcd_attribute23              in varchar2         default null,
722   p_pcd_attribute24              in varchar2         default null,
723   p_pcd_attribute25              in varchar2         default null,
724   p_pcd_attribute26              in varchar2         default null,
725   p_pcd_attribute27              in varchar2         default null,
726   p_pcd_attribute28              in varchar2         default null,
727   p_pcd_attribute29              in varchar2         default null,
728   p_pcd_attribute30              in varchar2         default null,
729   p_request_id                   in number           default null,
730   p_program_application_id       in number           default null,
731   p_program_id                   in number           default null,
732   p_program_update_date          in date             default null,
733   p_object_version_number        out nocopy number,
734   p_effective_date		 in date
735   ) is
736 --
737   l_rec		ben_pcd_shd.g_rec_type;
738   l_proc	varchar2(72) := g_package||'ins';
739 --
740 Begin
741   hr_utility.set_location('Entering:'||l_proc, 5);
742   --
743   -- Call conversion function to turn arguments into the
744   -- p_rec structure.
745   --
746   l_rec :=
747   ben_pcd_shd.convert_args
748   (
749   null,
750   null,
751   null,
752   p_rqstd_flag,
753   p_per_cm_prvdd_stat_cd,
754   p_cm_dlvry_med_cd,
755   p_cm_dlvry_mthd_cd,
756   p_sent_dt,
757   p_instnc_num,
758   p_to_be_sent_dt,
759   p_dlvry_instn_txt,
760   p_inspn_rqd_flag,
761   p_resnd_rsn_cd,
762   p_resnd_cmnt_txt,
763   p_per_cm_id,
764   p_address_id,
765   p_business_group_id,
766   p_pcd_attribute_category,
767   p_pcd_attribute1,
768   p_pcd_attribute2,
769   p_pcd_attribute3,
770   p_pcd_attribute4,
771   p_pcd_attribute5,
772   p_pcd_attribute6,
773   p_pcd_attribute7,
774   p_pcd_attribute8,
775   p_pcd_attribute9,
776   p_pcd_attribute10,
777   p_pcd_attribute11,
778   p_pcd_attribute12,
779   p_pcd_attribute13,
780   p_pcd_attribute14,
781   p_pcd_attribute15,
782   p_pcd_attribute16,
783   p_pcd_attribute17,
784   p_pcd_attribute18,
785   p_pcd_attribute19,
786   p_pcd_attribute20,
787   p_pcd_attribute21,
788   p_pcd_attribute22,
789   p_pcd_attribute23,
790   p_pcd_attribute24,
791   p_pcd_attribute25,
792   p_pcd_attribute26,
793   p_pcd_attribute27,
794   p_pcd_attribute28,
795   p_pcd_attribute29,
796   p_pcd_attribute30,
797   p_request_id,
798   p_program_application_id,
799   p_program_id,
800   p_program_update_date,
801   null
802   );
803   --
804   -- Having converted the arguments into the ben_pcd_rec
805   -- plsql record structure we call the corresponding record
806   -- business process.
807   --
808   ins(l_rec, p_effective_date);
809   --
810   -- Set the OUT arguments.
811   --
812   p_per_cm_prvdd_id        	:= l_rec.per_cm_prvdd_id;
813   p_effective_start_date  	:= l_rec.effective_start_date;
814   p_effective_end_date    	:= l_rec.effective_end_date;
815   p_object_version_number 	:= l_rec.object_version_number;
816   --
817   --
818   hr_utility.set_location(' Leaving:'||l_proc, 10);
819 End ins;
820 --
821 end ben_pcd_ins;