DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PPM_INS

Source


1 Package Body pay_ppm_ins as
2 /* $Header: pyppmrhi.pkb 120.3.12010000.5 2010/03/30 06:46:19 priupadh ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_ppm_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 -- Pre Conditions:
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 Arguments:
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 Table Handler Use Only.
54 --
55 -- {End Of Comments}
56 -- ----------------------------------------------------------------------------
57 Procedure dt_insert_dml
58 	(p_rec 			 in out nocopy pay_ppm_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   pay_personal_payment_methods_f t
70     where  t.personal_payment_method_id       = p_rec.personal_payment_method_id
71 
72     and    t.effective_start_date =
73              pay_ppm_shd.g_old_rec.effective_start_date
74     and    t.effective_end_date   = (p_validation_start_date - 1);
75 --
76   l_proc		varchar2(72) := g_package||'dt_insert_dml';
77   l_created_by          pay_personal_payment_methods_f.created_by%TYPE;
78   l_creation_date       pay_personal_payment_methods_f.creation_date%TYPE;
79   l_last_update_date   	pay_personal_payment_methods_f.last_update_date%TYPE;
80   l_last_updated_by     pay_personal_payment_methods_f.last_updated_by%TYPE;
81   l_last_update_login   pay_personal_payment_methods_f.last_update_login%TYPE;
82 --
83 Begin
84   hr_utility.set_location('Entering:'||l_proc, 5);
85   --
86   -- Get the object version number for the insert
87   --
88   p_rec.object_version_number :=
89     dt_api.get_object_version_number
90 	(p_base_table_name => 'pay_personal_payment_methods_f',
91 	 p_base_key_column => 'personal_payment_method_id',
92 	 p_base_key_value  => p_rec.personal_payment_method_id);
93   --
94   -- Set the effective start and end dates to the corresponding
95   -- validation start and end dates
96   --
97   p_rec.effective_start_date := p_validation_start_date;
98   p_rec.effective_end_date   := p_validation_end_date;
99   --
100   -- If the datetrack_mode is not INSERT then we must populate the WHO
101   -- columns with the 'old' creation values and 'new' updated values.
102   --
103   If (p_datetrack_mode <> 'INSERT') then
104     hr_utility.set_location(l_proc, 10);
105     --
106     -- Select the 'old' created values
107     --
108     Open C_Sel1;
109     Fetch C_Sel1 Into l_created_by, l_creation_date;
110     If C_Sel1%notfound Then
111       --
112       -- The previous 'old' created row has not been found. We need
113       -- to error as an internal datetrack problem exists.
114       --
115       Close C_Sel1;
116       hr_utility.set_message(801, 'HR_51456_PPM_RETURN_DATE_NULL');
117       hr_utility.set_message_token('PROCEDURE', l_proc);
118       hr_utility.set_message_token('STEP','10');
119       hr_utility.raise_error;
120     End If;
121     Close C_Sel1;
122     --
123     -- Set the AOL updated WHO values
124     --
125     l_last_update_date   := sysdate;
126     l_last_updated_by    := fnd_global.user_id;
127     l_last_update_login  := fnd_global.login_id;
128   End If;
129   --
130   pay_ppm_shd.g_api_dml := true;  -- Set the api dml status
131   --
132   -- Insert the row into: pay_personal_payment_methods_f
133   --
134   insert into pay_personal_payment_methods_f
135   (	personal_payment_method_id,
136 	effective_start_date,
137 	effective_end_date,
138 	business_group_id,
139 	external_account_id,
140 	assignment_id,
141 	run_type_id,
142 	org_payment_method_id,
143 	amount,
144 	comment_id,
145 	percentage,
146 	priority,
147 	attribute_category,
148 	attribute1,
149 	attribute2,
150 	attribute3,
151 	attribute4,
152 	attribute5,
153 	attribute6,
154 	attribute7,
155 	attribute8,
156 	attribute9,
157 	attribute10,
158 	attribute11,
159 	attribute12,
160 	attribute13,
161 	attribute14,
162 	attribute15,
163 	attribute16,
164 	attribute17,
165 	attribute18,
166 	attribute19,
167 	attribute20,
168 	object_version_number,
169 	payee_type,
170 	payee_id,
171    	created_by,
172    	creation_date,
173    	last_update_date,
174    	last_updated_by,
175    	last_update_login,
176         ppm_information_category,
177         ppm_information1,
178         ppm_information2,
179         ppm_information3,
180         ppm_information4,
181         ppm_information5,
182         ppm_information6,
183         ppm_information7,
184         ppm_information8,
185         ppm_information9,
186         ppm_information10,
187         ppm_information11,
188         ppm_information12,
189         ppm_information13,
190         ppm_information14,
191         ppm_information15,
192         ppm_information16,
193         ppm_information17,
194         ppm_information18,
195         ppm_information19,
196         ppm_information20,
197         ppm_information21,
198         ppm_information22,
199         ppm_information23,
200         ppm_information24,
201         ppm_information25,
202         ppm_information26,
203         ppm_information27,
204         ppm_information28,
205         ppm_information29,
206         ppm_information30
207   )
208   Values
209   (	p_rec.personal_payment_method_id,
210 	p_rec.effective_start_date,
211 	p_rec.effective_end_date,
212 	p_rec.business_group_id,
213 	p_rec.external_account_id,
214 	p_rec.assignment_id,
215 	p_rec.run_type_id,
216 	p_rec.org_payment_method_id,
217 	p_rec.amount,
218 	p_rec.comment_id,
219 	p_rec.percentage,
220 	p_rec.priority,
221 	p_rec.attribute_category,
222 	p_rec.attribute1,
223 	p_rec.attribute2,
224 	p_rec.attribute3,
225 	p_rec.attribute4,
226 	p_rec.attribute5,
227 	p_rec.attribute6,
228 	p_rec.attribute7,
229 	p_rec.attribute8,
230 	p_rec.attribute9,
231 	p_rec.attribute10,
232 	p_rec.attribute11,
233 	p_rec.attribute12,
234 	p_rec.attribute13,
235 	p_rec.attribute14,
236 	p_rec.attribute15,
237 	p_rec.attribute16,
238 	p_rec.attribute17,
239 	p_rec.attribute18,
240 	p_rec.attribute19,
241 	p_rec.attribute20,
242 	p_rec.object_version_number,
243 	p_rec.payee_type,
244 	p_rec.payee_id,
245 	l_created_by,
246    	l_creation_date,
247    	l_last_update_date,
248    	l_last_updated_by,
249    	l_last_update_login,
250         p_rec.ppm_information_category,
251         p_rec.ppm_information1,
252         p_rec.ppm_information2,
253         p_rec.ppm_information3,
254         p_rec.ppm_information4,
255         p_rec.ppm_information5,
256         p_rec.ppm_information6,
257         p_rec.ppm_information7,
258         p_rec.ppm_information8,
259         p_rec.ppm_information9,
260         p_rec.ppm_information10,
261         p_rec.ppm_information11,
262         p_rec.ppm_information12,
263         p_rec.ppm_information13,
264         p_rec.ppm_information14,
265         p_rec.ppm_information15,
266         p_rec.ppm_information16,
267         p_rec.ppm_information17,
268         p_rec.ppm_information18,
269         p_rec.ppm_information19,
270         p_rec.ppm_information20,
271         p_rec.ppm_information21,
272         p_rec.ppm_information22,
273         p_rec.ppm_information23,
274         p_rec.ppm_information24,
275         p_rec.ppm_information25,
276         p_rec.ppm_information26,
277         p_rec.ppm_information27,
278         p_rec.ppm_information28,
279         p_rec.ppm_information29,
280         p_rec.ppm_information30
281   );
282   --
283   pay_ppm_shd.g_api_dml := false;   -- Unset the api dml status
284   hr_utility.set_location(' Leaving:'||l_proc, 15);
285 --
286 Exception
287   When hr_api.check_integrity_violated Then
288     -- A check constraint has been violated
289     pay_ppm_shd.g_api_dml := false;   -- Unset the api dml status
290     pay_ppm_shd.constraint_error
291       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
292   When hr_api.unique_integrity_violated Then
293     -- Unique integrity has been violated
294     pay_ppm_shd.g_api_dml := false;   -- Unset the api dml status
295     pay_ppm_shd.constraint_error
296       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
297   When Others Then
298     pay_ppm_shd.g_api_dml := false;   -- Unset the api dml status
299     Raise;
300 End dt_insert_dml;
301 --
302 -- ----------------------------------------------------------------------------
303 -- |------------------------------< insert_dml >------------------------------|
304 -- ----------------------------------------------------------------------------
305 Procedure insert_dml
306 	(p_rec 			 in out nocopy pay_ppm_shd.g_rec_type,
307 	 p_effective_date	 in	date,
308 	 p_datetrack_mode	 in	varchar2,
309 	 p_validation_start_date in	date,
310 	 p_validation_end_date	 in	date) is
311 --
312   l_proc	varchar2(72) := g_package||'insert_dml';
313 --
314 Begin
315   hr_utility.set_location('Entering:'||l_proc, 5);
316   --
317   dt_insert_dml(p_rec			=> p_rec,
318 		p_effective_date	=> p_effective_date,
319 		p_datetrack_mode	=> p_datetrack_mode,
320        		p_validation_start_date	=> p_validation_start_date,
321 		p_validation_end_date	=> p_validation_end_date);
322   --
323   hr_utility.set_location(' Leaving:'||l_proc, 10);
324 End insert_dml;
325 --
326 -- ----------------------------------------------------------------------------
327 -- |------------------------------< pre_insert >------------------------------|
328 -- ----------------------------------------------------------------------------
329 -- {Start Of Comments}
330 --
331 -- Description:
332 --   This private procedure contains any processing which is required before
333 --   the insert dml. Presently, if the entity has a corresponding primary
334 --   key which is maintained by an associating sequence, the primary key for
335 --   the entity will be populated with the next sequence value in
336 --   preparation for the insert dml.
337 --   Also, if comments are defined for this entity, the comments insert
338 --   logic will also be called, generating a comment_id if required.
339 --
340 -- Pre Conditions:
341 --   This is an internal procedure which is called from the ins procedure.
342 --
343 -- In Arguments:
344 --   A Pl/Sql record structre.
345 --
346 -- Post Success:
347 --   Processing continues.
348 --
349 -- Post Failure:
350 --   If an error has occurred, an error message and exception will be raised
351 --   but not handled.
352 --
353 -- Developer Implementation Notes:
354 --   Any pre-processing required before the insert dml is issued should be
355 --   coded within this procedure. As stated above, a good example is the
356 --   generation of a primary key number via a corresponding sequence.
357 --   It is important to note that any 3rd party maintenance should be reviewed
358 --   before placing in this procedure.
359 --
360 -- Access Status:
361 --   Internal Table Handler Use Only.
362 --
363 -- {End Of Comments}
364 -- ----------------------------------------------------------------------------
365 Procedure pre_insert
366 	(p_rec  			in out nocopy pay_ppm_shd.g_rec_type,
367 	 p_effective_date		in date,
368 	 p_datetrack_mode		in varchar2,
369 	 p_validation_start_date	in date,
370 	 p_validation_end_date		in date) is
371 --
372   l_proc	varchar2(72) := g_package||'pre_insert';
373 --
374   Cursor C_Sel1 is select pay_personal_payment_methods_s.nextval from sys.dual;
375 --
376 Begin
377   hr_utility.set_location('Entering:'||l_proc, 5);
378   --
379   --
380   -- Select the next sequence number
381   --
382   Open C_Sel1;
383   Fetch C_Sel1 Into p_rec.personal_payment_method_id;
384   Close C_Sel1;
385   --
386   --
387   -- Insert the comment text if comments exist
388   --
389   If (p_rec.comments is not null) then
390     hr_comm_api.ins(p_comment_id        => p_rec.comment_id,
391                     p_source_table_name => 'PAY_PERSONAL_PAYMENT_METHODS_F',
392                     p_comment_text      => p_rec.comments);
393   End If;
394   hr_utility.set_location(' Leaving:'||l_proc, 10);
395 End pre_insert;
396 --
397 -- ----------------------------------------------------------------------------
398 -- |-----------------------------< post_insert >------------------------------|
399 -- ----------------------------------------------------------------------------
400 -- {Start Of Comments}
401 --
402 -- Description:
403 --   This private procedure contains any processing which is required after the
404 --   insert dml.
405 --
406 -- Pre Conditions:
407 --   This is an internal procedure which is called from the ins procedure.
408 --
409 -- In Arguments:
410 --   A Pl/Sql record structre.
411 --
412 -- Post Success:
413 --   Processing continues.
414 --
415 -- Post Failure:
416 --   If an error has occurred, an error message and exception will be raised
417 --   but not handled.
418 --
419 -- Developer Implementation Notes:
420 --   Any post-processing required after the insert dml is issued should be
421 --   coded within this procedure. It is important to note that any 3rd party
422 --   maintenance should be reviewed before placing in this procedure.
423 --
424 -- Access Status:
425 --   Internal Table Handler Use Only.
426 --
427 -- {End Of Comments}
428 -- ----------------------------------------------------------------------------
429 Procedure post_insert
430 	(p_rec 			 in pay_ppm_shd.g_rec_type,
431 	 p_effective_date	 in date,
432 	 p_datetrack_mode	 in varchar2,
433 	 p_validation_start_date in date,
434 	 p_validation_end_date	 in date) is
435 --
436   l_proc	varchar2(72) := g_package||'post_insert';
437 --
438 Begin
439   hr_utility.set_location('Entering:'||l_proc, 5);
440   --
441   -- Start of API User Hook for post_insert.
442   begin
443     pay_ppm_rki.after_insert
444       (p_effective_date                 => p_effective_date
445       ,p_validation_start_date          => p_validation_start_date
446       ,p_validation_end_date            => p_validation_end_date
447       ,p_personal_payment_method_id     => p_rec.personal_payment_method_id
448       ,p_effective_start_date           => p_rec.effective_start_date
449       ,p_effective_end_date             => p_rec.effective_end_date
450       ,p_business_group_id              => p_rec.business_group_id
451       ,p_external_account_id            => p_rec.external_account_id
452       ,p_assignment_id                  => p_rec.assignment_id
453       ,p_org_payment_method_id          => p_rec.org_payment_method_id
454       ,p_amount                         => p_rec.amount
455       ,p_comment_id                     => p_rec.comment_id
456       ,p_percentage                     => p_rec.percentage
457       ,p_priority                       => p_rec.priority
458       ,p_attribute_category             => p_rec.attribute_category
459       ,p_attribute1                     => p_rec.attribute1
460       ,p_attribute2                     => p_rec.attribute2
461       ,p_attribute3                     => p_rec.attribute3
462       ,p_attribute4                     => p_rec.attribute4
463       ,p_attribute5                     => p_rec.attribute5
464       ,p_attribute6                     => p_rec.attribute6
465       ,p_attribute7                     => p_rec.attribute7
466       ,p_attribute8                     => p_rec.attribute8
467       ,p_attribute9                     => p_rec.attribute9
468       ,p_attribute10                    => p_rec.attribute10
469       ,p_attribute11                    => p_rec.attribute11
470       ,p_attribute12                    => p_rec.attribute12
471       ,p_attribute13                    => p_rec.attribute13
472       ,p_attribute14                    => p_rec.attribute14
473       ,p_attribute15                    => p_rec.attribute15
474       ,p_attribute16                    => p_rec.attribute16
475       ,p_attribute17                    => p_rec.attribute17
476       ,p_attribute18                    => p_rec.attribute18
477       ,p_attribute19                    => p_rec.attribute19
478       ,p_attribute20                    => p_rec.attribute20
479       ,p_object_version_number          => p_rec.object_version_number
480       ,p_payee_type                     => p_rec.payee_type
481       ,p_payee_id                       => p_rec.payee_id
482       ,p_ppm_information_category       => p_rec.ppm_information_category
483       ,p_ppm_information1               => p_rec.ppm_information1
484       ,p_ppm_information2               => p_rec.ppm_information2
485       ,p_ppm_information3               => p_rec.ppm_information3
486       ,p_ppm_information4               => p_rec.ppm_information4
487       ,p_ppm_information5               => p_rec.ppm_information5
488       ,p_ppm_information6               => p_rec.ppm_information6
489       ,p_ppm_information7               => p_rec.ppm_information7
490       ,p_ppm_information8               => p_rec.ppm_information8
491       ,p_ppm_information9               => p_rec.ppm_information9
492       ,p_ppm_information10              => p_rec.ppm_information10
493       ,p_ppm_information11              => p_rec.ppm_information11
494       ,p_ppm_information12              => p_rec.ppm_information12
495       ,p_ppm_information13              => p_rec.ppm_information13
496       ,p_ppm_information14              => p_rec.ppm_information14
497       ,p_ppm_information15              => p_rec.ppm_information15
498       ,p_ppm_information16              => p_rec.ppm_information16
499       ,p_ppm_information17              => p_rec.ppm_information17
500       ,p_ppm_information18              => p_rec.ppm_information18
501       ,p_ppm_information19              => p_rec.ppm_information19
502       ,p_ppm_information20              => p_rec.ppm_information20
503       ,p_ppm_information21              => p_rec.ppm_information21
504       ,p_ppm_information22              => p_rec.ppm_information22
505       ,p_ppm_information23              => p_rec.ppm_information23
506       ,p_ppm_information24              => p_rec.ppm_information24
507       ,p_ppm_information25              => p_rec.ppm_information25
508       ,p_ppm_information26              => p_rec.ppm_information26
509       ,p_ppm_information27              => p_rec.ppm_information27
510       ,p_ppm_information28              => p_rec.ppm_information28
511       ,p_ppm_information29              => p_rec.ppm_information29
512       ,p_ppm_information30              => p_rec.ppm_information30
513       );
514   exception
515     when hr_api.cannot_find_prog_unit then
516       hr_api.cannot_find_prog_unit_error
517         (p_module_name => 'PAY_PERSONAL_PAYMENT_METHODS_F'
518         ,p_hook_type   => 'AI'
519         );
520   end;
521   -- End of API User Hook for post_insert.
522   --
523   hr_utility.set_location(' Leaving:'||l_proc, 10);
524 End post_insert;
525 --
526 -- ----------------------------------------------------------------------------
527 -- |-------------------------------< ins_lck >--------------------------------|
528 -- ----------------------------------------------------------------------------
529 --
530 Procedure ins_lck
531 	(p_effective_date	 in  date,
532 	 p_datetrack_mode	 in  varchar2,
533 	 p_rec	 		 in  pay_ppm_shd.g_rec_type,
534 	 p_validation_start_date out nocopy date,
535 	 p_validation_end_date	 out nocopy date) is
536 --
537   l_proc		  varchar2(72) := g_package||'ins_lck';
538   l_validation_start_date date;
539   l_validation_end_date	  date;
540   l_lock_table            varchar2(30);
541   l_validation_start_date1 date;
542   l_validation_end_date1   date;
543   --
544 Begin
545   hr_utility.set_location('Entering:'||l_proc, 5);
546   begin
547     --
548     -- Need to validate against PAY_ORG_PAYMENT_METHODS_F and
549     -- PAY_ORG_PAY_METHOD_USAGES_F so lock in SHARE mode. This is because the
550     -- data is infrequently updated, but is referenced by many pay methods.
551     -- SELECT ... FOR UPDATE NOWAIT causes too many failures for concurrent
552     -- API usage cases such as self-service or data pump.
553     --
554     l_lock_table := 'pay_org_payment_methods_f';
555     lock table pay_org_payment_methods_f in share mode nowait;
556     --
557     l_lock_table := 'pay_org_pay_method_usages_f';
558     lock table pay_org_pay_method_usages_f in share mode nowait;
559   exception
560     When HR_Api.Object_Locked then
561       --
562       -- The object is locked therefore we need to supply a meaningful
563       -- error message.
564       --
565       hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
566       hr_utility.set_message_token('TABLE_NAME', l_lock_table);
567       hr_utility.raise_error;
568   end;
569   --
570   hr_utility.set_location(l_proc, 10);
571   --
572   -- Validate the datetrack mode mode getting the validation start
573   -- and end dates for the specified datetrack operation.
574   --
575   --
576   -- First do the datetrack locking/validation for PER_ALL_ASSIGNMENTS_F.
577   -- PER_ALL_ASSIGNMENTS_F cannot be locked in TABLE SHARE mode because
578   -- of the nature of updates to ASSIGNMENT information.
579   --
580   dt_api.validate_dt_mode
581         (p_effective_date          => p_effective_date,
582          p_datetrack_mode          => p_datetrack_mode,
583          p_base_table_name         => 'pay_personal_payment_methods_f',
584          p_base_key_column         => 'personal_payment_method_id',
585          p_base_key_value          => p_rec.personal_payment_method_id,
586          p_parent_table_name1      => 'per_all_assignments_f',
587          p_parent_key_column1      => 'assignment_id',
588          p_parent_key_value1       => p_rec.assignment_id,
589          p_enforce_foreign_locking => true,
590          p_validation_start_date   => l_validation_start_date,
591          p_validation_end_date     => l_validation_end_date);
592   --
593   -- Without relocking, do the datetrack validation for the parent tables
594   -- locked in shared mode.
595   --
596   dt_api.validate_dt_mode
597         (p_effective_date          => p_effective_date,
601          p_base_key_value          => p_rec.personal_payment_method_id,
598          p_datetrack_mode          => p_datetrack_mode,
599          p_base_table_name         => 'pay_personal_payment_methods_f',
600          p_base_key_column         => 'personal_payment_method_id',
602          p_parent_table_name1      => 'pay_org_payment_methods_f',
603          p_parent_key_column1      => 'org_payment_method_id',
604          p_parent_key_value1       => p_rec.org_payment_method_id,
605          p_enforce_foreign_locking => false,
606          p_validation_start_date   => l_validation_start_date1,
607          p_validation_end_date     => l_validation_end_date1);
608   --
609   -- Set the validation start and end date OUT arguments by getting the most
610   -- restrictive validation date range.
611   --
612   p_validation_start_date :=
613   greatest(l_validation_start_date, l_validation_start_date1);
614   p_validation_end_date   :=
615   least(l_validation_end_date, l_validation_end_date1);
616   --
617   hr_utility.set_location(' Leaving:'||l_proc, 15);
618 --
619 End ins_lck;
620 --
621 -- ----------------------------------------------------------------------------
622 -- |---------------------------------< ins >----------------------------------|
623 -- ----------------------------------------------------------------------------
624 Procedure ins
625   (
626   p_rec		   in out nocopy pay_ppm_shd.g_rec_type,
627   p_effective_date in     date,
628   p_validate	   in     boolean default false
629   ) IS
630 --
631   l_proc			varchar2(72) := g_package||'ins';
632   l_datetrack_mode		varchar2(30) := 'INSERT';
633   l_validation_start_date	date;
634   l_validation_end_date		date;
635 --
636 Begin
637   hr_utility.set_location('Entering:'||l_proc, 5);
638   --
639   -- Determine if the business process is to be validated.
640   --
641   If p_validate then
642     --
643     -- Issue the savepoint.
644     --
645     SAVEPOINT ins_pay_ppm;
646   End If;
647   --
648   -- Call the lock operation
649   --
650   ins_lck
651 	(p_effective_date	 => p_effective_date,
652 	 p_datetrack_mode	 => l_datetrack_mode,
653 	 p_rec	 		 => p_rec,
654 	 p_validation_start_date => l_validation_start_date,
655 	 p_validation_end_date	 => l_validation_end_date);
656   --
657   -- Ensure that the assignment is for an employee
658   --
659   l_validation_end_date := pay_ppm_bus.return_effective_end_date
660         (p_datetrack_mode              =>  l_datetrack_mode
661         ,p_effective_date              =>  p_effective_date
662         ,p_org_payment_method_id       =>  p_rec.org_payment_method_id
663         ,p_business_group_id           =>  p_rec.business_group_id
664         ,p_personal_payment_method_id  =>  p_rec.personal_payment_method_id
665         ,p_assignment_id               =>  p_rec.assignment_id
666         ,p_run_type_id                 =>  p_rec.run_type_id
667         ,p_priority                    =>  p_rec.priority
668         ,p_validation_start_date       =>  l_validation_start_date
669         ,p_validation_end_date         =>  l_validation_end_date
670         );
671   --
672   -- Call the supporting insert validate operations
673   --
674   pay_ppm_bus.insert_validate
675 	(p_rec			 => p_rec,
676 	 p_effective_date	 => p_effective_date,
677 	 p_datetrack_mode	 => l_datetrack_mode,
678 	 p_validation_start_date => l_validation_start_date,
679 	 p_validation_end_date	 => l_validation_end_date);
680   --
681   -- Call the supporting pre-insert operation
682   --
683   pre_insert
684  	(p_rec			 => p_rec,
685 	 p_effective_date	 => p_effective_date,
686 	 p_datetrack_mode	 => l_datetrack_mode,
687 	 p_validation_start_date => l_validation_start_date,
688 	 p_validation_end_date	 => l_validation_end_date);
689   --
690   -- Insert the row
691   --
692   insert_dml
693  	(p_rec			 => p_rec,
694 	 p_effective_date	 => p_effective_date,
695 	 p_datetrack_mode	 => l_datetrack_mode,
696 	 p_validation_start_date => l_validation_start_date,
697 	 p_validation_end_date	 => l_validation_end_date);
698   --
699   -- Call the supporting post-insert operation
700   --
701   post_insert
702  	(p_rec			 => p_rec,
703 	 p_effective_date	 => p_effective_date,
704 	 p_datetrack_mode	 => l_datetrack_mode,
705 	 p_validation_start_date => l_validation_start_date,
706 	 p_validation_end_date	 => l_validation_end_date);
707   --
708   -- If we are validating then raise the Validate_Enabled exception
709   --
710   If p_validate then
711     Raise HR_Api.Validate_Enabled;
712   End If;
713   --
714   hr_utility.set_location(' Leaving:'||l_proc, 10);
715 Exception
716   When HR_Api.Validate_Enabled Then
717     --
718     -- As the Validate_Enabled exception has been raised
719     -- we must rollback to the savepoint
720     --
721     ROLLBACK TO ins_pay_ppm;
722 end ins;
723 --
724 -- ----------------------------------------------------------------------------
725 -- |---------------------------------< ins >----------------------------------|
726 -- ----------------------------------------------------------------------------
727 Procedure ins
728   (
729   p_personal_payment_method_id   out nocopy number,
730   p_effective_start_date         out nocopy date,
731   p_effective_end_date           out nocopy date,
732   p_business_group_id            in number,
733   p_external_account_id          in number           default null,
734   p_assignment_id                in number,
735   p_run_type_id                  in number           default null,
736   p_org_payment_method_id        in number,
740   p_percentage                   in number           default null,
737   p_amount                       in number           default null,
738   p_comment_id                   out nocopy number,
739   p_comments                     in varchar2         default null,
741   p_priority                     in number           default null,
742   p_attribute_category           in varchar2         default null,
743   p_attribute1                   in varchar2         default null,
744   p_attribute2                   in varchar2         default null,
745   p_attribute3                   in varchar2         default null,
746   p_attribute4                   in varchar2         default null,
747   p_attribute5                   in varchar2         default null,
748   p_attribute6                   in varchar2         default null,
749   p_attribute7                   in varchar2         default null,
750   p_attribute8                   in varchar2         default null,
751   p_attribute9                   in varchar2         default null,
752   p_attribute10                  in varchar2         default null,
753   p_attribute11                  in varchar2         default null,
754   p_attribute12                  in varchar2         default null,
755   p_attribute13                  in varchar2         default null,
756   p_attribute14                  in varchar2         default null,
757   p_attribute15                  in varchar2         default null,
758   p_attribute16                  in varchar2         default null,
759   p_attribute17                  in varchar2         default null,
760   p_attribute18                  in varchar2         default null,
761   p_attribute19                  in varchar2         default null,
762   p_attribute20                  in varchar2         default null,
763   p_object_version_number        out nocopy number,
764   p_payee_type                   in varchar2         default null,
765   p_payee_id                     in number           default null,
766   p_effective_date		 in date,
767   p_validate			 in boolean          default false,
768   p_ppm_information_category     in varchar2         default null,
769   p_ppm_information1             in varchar2         default null,
770   p_ppm_information2             in varchar2         default null,
771   p_ppm_information3             in varchar2         default null,
772   p_ppm_information4             in varchar2         default null,
773   p_ppm_information5             in varchar2         default null,
774   p_ppm_information6             in varchar2         default null,
775   p_ppm_information7             in varchar2         default null,
776   p_ppm_information8             in varchar2         default null,
777   p_ppm_information9             in varchar2         default null,
778   p_ppm_information10            in varchar2         default null,
779   p_ppm_information11            in varchar2         default null,
780   p_ppm_information12            in varchar2         default null,
781   p_ppm_information13            in varchar2         default null,
782   p_ppm_information14            in varchar2         default null,
783   p_ppm_information15            in varchar2         default null,
784   p_ppm_information16            in varchar2         default null,
785   p_ppm_information17            in varchar2         default null,
786   p_ppm_information18            in varchar2         default null,
787   p_ppm_information19            in varchar2         default null,
788   p_ppm_information20            in varchar2         default null,
789   p_ppm_information21            in varchar2         default null,
790   p_ppm_information22            in varchar2         default null,
791   p_ppm_information23            in varchar2         default null,
792   p_ppm_information24            in varchar2         default null,
793   p_ppm_information25            in varchar2         default null,
794   p_ppm_information26            in varchar2         default null,
795   p_ppm_information27            in varchar2         default null,
796   p_ppm_information28            in varchar2         default null,
797   p_ppm_information29            in varchar2         default null,
798   p_ppm_information30            in varchar2         default null
799   ) is
800 --
801   l_rec		pay_ppm_shd.g_rec_type;
802   l_proc	varchar2(72) := g_package||'ins';
803 --
804 Begin
805   hr_utility.set_location('Entering:'||l_proc, 5);
806   --
807   -- Call conversion function to turn arguments into the
808   -- p_rec structure.
809   --
810   l_rec :=
811   pay_ppm_shd.convert_args
812   (
813   null,
814   null,
815   null,
816   p_business_group_id,
817   p_external_account_id,
818   p_assignment_id,
819   p_run_type_id,
820   p_org_payment_method_id,
821   p_amount,
822   null,
823   p_comments,
824   p_percentage,
825   p_priority,
826   p_attribute_category,
827   p_attribute1,
828   p_attribute2,
829   p_attribute3,
830   p_attribute4,
831   p_attribute5,
832   p_attribute6,
833   p_attribute7,
834   p_attribute8,
835   p_attribute9,
836   p_attribute10,
837   p_attribute11,
838   p_attribute12,
839   p_attribute13,
840   p_attribute14,
841   p_attribute15,
842   p_attribute16,
843   p_attribute17,
844   p_attribute18,
845   p_attribute19,
846   p_attribute20,
847   null,
848   p_payee_type,
849   p_payee_id,
850   p_ppm_information_category,
851   p_ppm_information1,
852   p_ppm_information2,
853   p_ppm_information3,
854   p_ppm_information4,
855   p_ppm_information5,
856   p_ppm_information6,
857   p_ppm_information7,
858   p_ppm_information8,
859   p_ppm_information9,
860   p_ppm_information10,
861   p_ppm_information11,
862   p_ppm_information12,
863   p_ppm_information13,
864   p_ppm_information14,
865   p_ppm_information15,
866   p_ppm_information16,
867   p_ppm_information17,
868   p_ppm_information18,
869   p_ppm_information19,
870   p_ppm_information20,
871   p_ppm_information21,
872   p_ppm_information22,
873   p_ppm_information23,
874   p_ppm_information24,
875   p_ppm_information25,
876   p_ppm_information26,
877   p_ppm_information27,
878   p_ppm_information28,
879   p_ppm_information29,
880   p_ppm_information30
881   );
882   --
883   -- Having converted the arguments into the pay_ppm_rec
884   -- plsql record structure we call the corresponding record
885   -- business process.
886   --
887   ins(l_rec, p_effective_date, p_validate);
888   --
889   -- Set the OUT arguments.
890   --
891   p_personal_payment_method_id  := l_rec.personal_payment_method_id;
892   p_effective_start_date  	:= l_rec.effective_start_date;
893   p_effective_end_date    	:= l_rec.effective_end_date;
894   p_object_version_number 	:= l_rec.object_version_number;
895   p_comment_id                  := l_rec.comment_id;
896   --
897   hr_utility.set_location(' Leaving:'||l_proc, 10);
898 End ins;
899 --
900 end pay_ppm_ins;