DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_OPM_INS

Source


1 Package Body pay_opm_ins as
2 /* $Header: pyopmrhi.pkb 120.4 2005/11/07 01:38:13 pgongada noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_opm_ins.';  -- Global package name
9 --
10 -- The following global variables are only to be used by
11 -- the set_base_key_value and pre_insert procedures.
12 --
13 g_org_payment_method_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_org_payment_method_id  in  number) is
20 --
21   l_proc       varchar2(72) := g_package||'set_base_key_value';
22 --
23 Begin
24   hr_utility.set_location('Entering:'||l_proc, 10);
25   --
26   pay_opm_ins.g_org_payment_method_id_i := p_org_payment_method_id;
27   --
28   hr_utility.set_location(' Leaving:'||l_proc, 20);
29 End set_base_key_value;
30 --
31 -- ----------------------------------------------------------------------------
32 -- |----------------------------< dt_insert_dml >-----------------------------|
33 -- ----------------------------------------------------------------------------
34 -- {Start Of Comments}
35 --
36 -- Description:
37 --   This procedure controls the actual dml insert logic for datetrack. The
38 --   functions of this procedure are as follows:
39 --   1) Get the object_version_number.
40 --   2) To set the effective start and end dates to the corresponding
41 --      validation start and end dates. Also, the object version number
42 --      record attribute is set.
43 --   3) To set and unset the g_api_dml status as required (as we are about to
44 --      perform dml).
45 --   4) To insert the row into the schema with the derived effective start
46 --      and end dates and the object version number.
47 --   5) To trap any constraint violations that may have occurred.
48 --   6) To raise any other errors.
49 --
50 -- Prerequisites:
51 --   This is an internal private procedure which must be called from the
52 --   insert_dml and pre_update (logic permitting) procedure and must have
53 --   all mandatory arguments set.
54 --
55 -- In Parameters:
56 --   A Pl/Sql record structure.
57 --
58 -- Post Success:
59 --   The specified row will be inserted into the schema.
60 --
61 -- Post Failure:
62 --   On the insert dml failure it is important to note that we always reset the
63 --   g_api_dml status to false.
64 --   If a check or unique integrity constraint violation is raised the
65 --   constraint_error procedure will be called.
66 --   If any other error is reported, the error will be raised after the
67 --   g_api_dml status is reset.
68 --
69 -- Developer Implementation Notes:
70 --   This is an internal datetrack maintenance procedure which should
71 --   not be modified in anyway.
72 --
73 -- Access Status:
74 --   Internal Row Handler Use Only.
75 --
76 -- {End Of Comments}
77 -- ----------------------------------------------------------------------------
78 Procedure dt_insert_dml
79   (p_rec                     in out nocopy pay_opm_shd.g_rec_type
80   ,p_effective_date          in            date
81   ,p_datetrack_mode          in            varchar2
82   ,p_validation_start_date   in            date
83   ,p_validation_end_date     in            date
84   ) is
85 -- Cursor to select 'old' created AOL who column values
86 --
87   Cursor C_Sel1 Is
88     select t.created_by,
89            t.creation_date
90     from   pay_org_payment_methods_f t
91     where  t.org_payment_method_id       = p_rec.org_payment_method_id
92     and    t.effective_start_date =
93              pay_opm_shd.g_old_rec.effective_start_date
94     and    t.effective_end_date   = (p_validation_start_date - 1);
95 --
96   l_proc                varchar2(72) := g_package||'dt_insert_dml';
97   l_created_by          pay_org_payment_methods_f.created_by%TYPE;
98   l_creation_date       pay_org_payment_methods_f.creation_date%TYPE;
99   l_last_update_date   	pay_org_payment_methods_f.last_update_date%TYPE;
100   l_last_updated_by     pay_org_payment_methods_f.last_updated_by%TYPE;
101   l_last_update_login   pay_org_payment_methods_f.last_update_login%TYPE;
102 --
103 Begin
104   hr_utility.set_location('Entering:'||l_proc, 5);
105   --
106   -- Get the object version number for the insert
107   --
108   p_rec.object_version_number :=
109     dt_api.get_object_version_number
110       (p_base_table_name => 'pay_org_payment_methods_f'
111       ,p_base_key_column => 'org_payment_method_id'
112       ,p_base_key_value  => p_rec.org_payment_method_id
113       );
114   --
115   -- Set the effective start and end dates to the corresponding
116   -- validation start and end dates
117   --
118   p_rec.effective_start_date := p_validation_start_date;
119   p_rec.effective_end_date   := p_validation_end_date;
120   --
121   -- If the datetrack_mode is not INSERT then we must populate the WHO
122   -- columns with the 'old' creation values and 'new' updated values.
123   --
124   If (p_datetrack_mode <> hr_api.g_insert) then
125     hr_utility.set_location(l_proc, 10);
126     --
127     -- Select the 'old' created values
128     --
129     Open C_Sel1;
130     Fetch C_Sel1 Into l_created_by, l_creation_date;
131     If C_Sel1%notfound Then
132       --
133       -- The previous 'old' created row has not been found. We need
134       -- to error as an internal datetrack problem exists.
135       --
136       Close C_Sel1;
137       fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
138       fnd_message.set_token('PROCEDURE', l_proc);
139       fnd_message.set_token('STEP','10');
140       fnd_message.raise_error;
141     End If;
142     Close C_Sel1;
143     --
144     -- Set the AOL updated WHO values
145     --
146     l_last_update_date   := sysdate;
147     l_last_updated_by    := fnd_global.user_id;
148     l_last_update_login  := fnd_global.login_id;
149   End If;
150   --
151   pay_opm_shd.g_api_dml := true;  -- Set the api dml status
152   --
153   -- Insert the row into: pay_org_payment_methods_f
154   --
155   insert into pay_org_payment_methods_f
156       (org_payment_method_id
157       ,effective_start_date
158       ,effective_end_date
159       ,business_group_id
160       ,external_account_id
161       ,currency_code
162       ,payment_type_id
163       ,defined_balance_id
164       ,org_payment_method_name
165       ,comment_id
166       ,attribute_category
167       ,attribute1
168       ,attribute2
169       ,attribute3
170       ,attribute4
171       ,attribute5
172       ,attribute6
173       ,attribute7
174       ,attribute8
175       ,attribute9
176       ,attribute10
177       ,attribute11
178       ,attribute12
179       ,attribute13
180       ,attribute14
181       ,attribute15
182       ,attribute16
183       ,attribute17
184       ,attribute18
185       ,attribute19
186       ,attribute20
187       ,pmeth_information_category
188       ,pmeth_information1
189       ,pmeth_information2
190       ,pmeth_information3
191       ,pmeth_information4
192       ,pmeth_information5
193       ,pmeth_information6
194       ,pmeth_information7
195       ,pmeth_information8
196       ,pmeth_information9
197       ,pmeth_information10
198       ,pmeth_information11
199       ,pmeth_information12
200       ,pmeth_information13
201       ,pmeth_information14
202       ,pmeth_information15
203       ,pmeth_information16
204       ,pmeth_information17
205       ,pmeth_information18
206       ,pmeth_information19
207       ,pmeth_information20
208       ,object_version_number
209       ,created_by
210       ,creation_date
211       ,last_update_date
212       ,last_updated_by
213       ,last_update_login
214       ,transfer_to_gl_flag
215       ,cost_payment
216       ,cost_cleared_payment
217       ,cost_cleared_void_payment
218       ,exclude_manual_payment
219       )
220   Values
221     (p_rec.org_payment_method_id
222     ,p_rec.effective_start_date
223     ,p_rec.effective_end_date
224     ,p_rec.business_group_id
225     ,p_rec.external_account_id
226     ,p_rec.currency_code
227     ,p_rec.payment_type_id
228     ,p_rec.defined_balance_id
229     ,p_rec.org_payment_method_name
230     ,p_rec.comment_id
231     ,p_rec.attribute_category
232     ,p_rec.attribute1
233     ,p_rec.attribute2
234     ,p_rec.attribute3
235     ,p_rec.attribute4
236     ,p_rec.attribute5
237     ,p_rec.attribute6
238     ,p_rec.attribute7
239     ,p_rec.attribute8
240     ,p_rec.attribute9
241     ,p_rec.attribute10
242     ,p_rec.attribute11
243     ,p_rec.attribute12
244     ,p_rec.attribute13
245     ,p_rec.attribute14
246     ,p_rec.attribute15
247     ,p_rec.attribute16
248     ,p_rec.attribute17
249     ,p_rec.attribute18
250     ,p_rec.attribute19
251     ,p_rec.attribute20
252     ,p_rec.pmeth_information_category
253     ,p_rec.pmeth_information1
254     ,p_rec.pmeth_information2
255     ,p_rec.pmeth_information3
256     ,p_rec.pmeth_information4
257     ,p_rec.pmeth_information5
258     ,p_rec.pmeth_information6
259     ,p_rec.pmeth_information7
260     ,p_rec.pmeth_information8
261     ,p_rec.pmeth_information9
262     ,p_rec.pmeth_information10
263     ,p_rec.pmeth_information11
264     ,p_rec.pmeth_information12
265     ,p_rec.pmeth_information13
266     ,p_rec.pmeth_information14
267     ,p_rec.pmeth_information15
268     ,p_rec.pmeth_information16
269     ,p_rec.pmeth_information17
270     ,p_rec.pmeth_information18
271     ,p_rec.pmeth_information19
272     ,p_rec.pmeth_information20
273     ,p_rec.object_version_number
274     ,l_created_by
275     ,l_creation_date
276     ,l_last_update_date
277     ,l_last_updated_by
278     ,l_last_update_login
279     ,p_rec.transfer_to_gl_flag
280     ,p_rec.cost_payment
281     ,p_rec.cost_cleared_payment
282     ,p_rec.cost_cleared_void_payment
283     ,p_rec.exclude_manual_payment
284     );
285   --
286   pay_opm_shd.g_api_dml := false;   -- Unset the api dml status
287   hr_utility.set_location(' Leaving:'||l_proc, 15);
288 --
289 Exception
290   When hr_api.check_integrity_violated Then
291     -- A check constraint has been violated
292     pay_opm_shd.g_api_dml := false;   -- Unset the api dml status
293     pay_opm_shd.constraint_error
294       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
295   When hr_api.unique_integrity_violated Then
296     -- Unique integrity has been violated
297     pay_opm_shd.g_api_dml := false;   -- Unset the api dml status
298     pay_opm_shd.constraint_error
299       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
300   When Others Then
301     pay_opm_shd.g_api_dml := false;   -- Unset the api dml status
302     Raise;
303 End dt_insert_dml;
304 --
305 -- ----------------------------------------------------------------------------
306 -- |------------------------------< insert_dml >------------------------------|
307 -- ----------------------------------------------------------------------------
308 Procedure insert_dml
309   (p_rec                   in out nocopy pay_opm_shd.g_rec_type
310   ,p_effective_date        in            date
311   ,p_datetrack_mode        in            varchar2
312   ,p_validation_start_date in            date
313   ,p_validation_end_date   in            date
314   ) is
315 --
316   l_proc	varchar2(72) := g_package||'insert_dml';
317 --
318 Begin
319   hr_utility.set_location('Entering:'||l_proc, 5);
320   --
321   pay_opm_ins.dt_insert_dml
322     (p_rec                   => p_rec
323     ,p_effective_date        => p_effective_date
324     ,p_datetrack_mode        => p_datetrack_mode
325     ,p_validation_start_date => p_validation_start_date
326     ,p_validation_end_date   => p_validation_end_date
327     );
328   --
329   hr_utility.set_location(' Leaving:'||l_proc, 10);
330 End insert_dml;
331 --
332 -- ----------------------------------------------------------------------------
333 -- |------------------------------< pre_insert >------------------------------|
334 -- ----------------------------------------------------------------------------
335 -- {Start Of Comments}
336 --
337 -- Description:
338 --   This private procedure contains any processing which is required before
339 --   the insert dml. Presently, if the entity has a corresponding primary
340 --   key which is maintained by an associating sequence, the primary key for
341 --   the entity will be populated with the next sequence value in
342 --   preparation for the insert dml.
343 --   Also, if comments are defined for this entity, the comments insert
344 --   logic will also be called, generating a comment_id if required.
345 --
346 -- Prerequisites:
347 --   This is an internal procedure which is called from the ins procedure.
348 --
349 -- In Parameters:
350 --   A Pl/Sql record structure.
351 --
352 -- Post Success:
353 --   Processing continues.
354 --
355 -- Post Failure:
356 --   If an error has occurred, an error message and exception will be raised
357 --   but not handled.
358 --
359 -- Developer Implementation Notes:
360 --   Any pre-processing required before the insert dml is issued should be
361 --   coded within this procedure. As stated above, a good example is the
362 --   generation of a primary key number via a corresponding sequence.
363 --   It is important to note that any 3rd party maintenance should be reviewed
364 --   before placing in this procedure.
365 --
366 -- Access Status:
367 --   Internal Row Handler Use Only.
368 --
369 -- {End Of Comments}
370 -- ----------------------------------------------------------------------------
371 Procedure pre_insert
372   (p_rec                   in out nocopy pay_opm_shd.g_rec_type
373   ,p_effective_date        in            date
374   ,p_datetrack_mode        in            varchar2
375   ,p_validation_start_date in            date
376   ,p_validation_end_date   in            date
377   ) is
378 --
379   Cursor C_Sel1 is select pay_org_payment_methods_s.nextval from sys.dual;
380 --
381   Cursor C_Sel2 is
382     Select null
383       from pay_org_payment_methods_f
384       where org_payment_method_id =
385              pay_opm_ins.g_org_payment_method_id_i;
386 --
387   l_proc	varchar2(72) := g_package||'pre_insert';
388   l_exists      varchar2(1);
389 
390 Begin
391   hr_utility.set_location('Entering:'||l_proc, 5);
392   --
393   If (pay_opm_ins.g_org_payment_method_id_i is not null ) Then
394     --
395     -- Verify registered primary key values not already in use
396     --
397     Open C_Sel2;
398     Fetch C_Sel2 into  l_exists;
399     If C_Sel2%found Then
400        Close C_Sel2;
401        --
402        -- The primary key values are already in use.
403        --
404        fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
405        fnd_message.set_token('TABLE_NAME','pay_org_payment_methods_f');
406        fnd_message.raise_error;
407     End If;
408     Close C_Sel2;
409     --
410     -- Use registered key values and clear globals
411     --
412     p_rec.org_payment_method_id :=  pay_opm_ins.g_org_payment_method_id_i;
413 
414     pay_opm_ins.g_org_payment_method_id_i := null;
415 
416   Else
417     --
418     -- No registerd key values, so select the next sequence number
419     --
420     -- Select the next sequence number
421     --
422        Open C_Sel1;
423        Fetch C_Sel1 Into p_rec.org_payment_method_id;
424        Close C_Sel1;
425   End If;
426   --
427   -- Insert the comment text if comments exist
428   --
429   If (p_rec.comments is not null) then
430     hr_comm_api.ins
431       (p_comment_id        => p_rec.comment_id
432       ,p_source_table_name => 'PAY_ORG_PAYMENT_METHODS_F'
433       ,p_comment_text      => p_rec.comments
434       );
435   End If;
436   hr_utility.set_location(' Leaving:'||l_proc, 10);
437 End pre_insert;
438 --
439 -- ----------------------------------------------------------------------------
440 -- |----------------------------< post_insert >-------------------------------|
441 -- ----------------------------------------------------------------------------
442 -- {Start Of Comments}
443 --
444 -- Description:
445 --   This private procedure contains any processing which is required after the
446 --   insert dml.
447 --
448 -- Prerequisites:
449 --   This is an internal procedure which is called from the ins procedure.
450 --
451 -- In Parameters:
452 --   A Pl/Sql record structure.
453 --
454 -- Post Success:
455 --   Processing continues.
456 --
457 -- Post Failure:
458 --   If an error has occurred, an error message and exception will be raised
459 --   but not handled.
460 --
461 -- Developer Implementation Notes:
462 --   Any post-processing required after the insert dml is issued should be
463 --   coded within this procedure. It is important to note that any 3rd party
464 --   maintenance should be reviewed before placing in this procedure.
465 --
466 -- Access Status:
467 --   Internal Row Handler Use Only.
468 --
469 -- {End Of Comments}
470 -- ----------------------------------------------------------------------------
471 Procedure post_insert
472   (p_rec                   in pay_opm_shd.g_rec_type
473   ,p_effective_date        in date
474   ,p_datetrack_mode        in varchar2
475   ,p_validation_start_date in date
476   ,p_validation_end_date   in date
477   ) is
478 --
479   l_proc	varchar2(72) := g_package||'post_insert';
480 --
481 Begin
482   hr_utility.set_location('Entering:'||l_proc, 5);
483   begin
484     --
485     pay_opm_rki.after_insert
486       (p_effective_date
487       => p_effective_date
488       ,p_validation_start_date
489       => p_validation_start_date
490       ,p_validation_end_date
491       => p_validation_end_date
492       ,p_org_payment_method_id
493       => p_rec.org_payment_method_id
494       ,p_effective_start_date
495       => p_rec.effective_start_date
496       ,p_effective_end_date
497       => p_rec.effective_end_date
498       ,p_business_group_id
499       => p_rec.business_group_id
500       ,p_external_account_id
501       => p_rec.external_account_id
502       ,p_currency_code
503       => p_rec.currency_code
504       ,p_payment_type_id
505       => p_rec.payment_type_id
506       ,p_defined_balance_id
507       => p_rec.defined_balance_id
508       ,p_org_payment_method_name
509       => p_rec.org_payment_method_name
510       ,p_comment_id
511       => p_rec.comment_id
512       ,p_comments
513       => p_rec.comments
514       ,p_attribute_category
515       => p_rec.attribute_category
516       ,p_attribute1
517       => p_rec.attribute1
518       ,p_attribute2
519       => p_rec.attribute2
520       ,p_attribute3
521       => p_rec.attribute3
522       ,p_attribute4
523       => p_rec.attribute4
524       ,p_attribute5
525       => p_rec.attribute5
526       ,p_attribute6
527       => p_rec.attribute6
528       ,p_attribute7
529       => p_rec.attribute7
530       ,p_attribute8
531       => p_rec.attribute8
532       ,p_attribute9
533       => p_rec.attribute9
534       ,p_attribute10
535       => p_rec.attribute10
536       ,p_attribute11
537       => p_rec.attribute11
538       ,p_attribute12
539       => p_rec.attribute12
540       ,p_attribute13
541       => p_rec.attribute13
542       ,p_attribute14
543       => p_rec.attribute14
544       ,p_attribute15
545       => p_rec.attribute15
546       ,p_attribute16
547       => p_rec.attribute16
548       ,p_attribute17
549       => p_rec.attribute17
550       ,p_attribute18
551       => p_rec.attribute18
552       ,p_attribute19
553       => p_rec.attribute19
554       ,p_attribute20
555       => p_rec.attribute20
556       ,p_pmeth_information_category
557       => p_rec.pmeth_information_category
558       ,p_pmeth_information1
559       => p_rec.pmeth_information1
560       ,p_pmeth_information2
561       => p_rec.pmeth_information2
562       ,p_pmeth_information3
563       => p_rec.pmeth_information3
564       ,p_pmeth_information4
565       => p_rec.pmeth_information4
566       ,p_pmeth_information5
567       => p_rec.pmeth_information5
568       ,p_pmeth_information6
569       => p_rec.pmeth_information6
570       ,p_pmeth_information7
571       => p_rec.pmeth_information7
572       ,p_pmeth_information8
573       => p_rec.pmeth_information8
574       ,p_pmeth_information9
575       => p_rec.pmeth_information9
576       ,p_pmeth_information10
577       => p_rec.pmeth_information10
578       ,p_pmeth_information11
579       => p_rec.pmeth_information11
580       ,p_pmeth_information12
581       => p_rec.pmeth_information12
582       ,p_pmeth_information13
583       => p_rec.pmeth_information13
584       ,p_pmeth_information14
585       => p_rec.pmeth_information14
586       ,p_pmeth_information15
587       => p_rec.pmeth_information15
588       ,p_pmeth_information16
589       => p_rec.pmeth_information16
590       ,p_pmeth_information17
591       => p_rec.pmeth_information17
592       ,p_pmeth_information18
593       => p_rec.pmeth_information18
594       ,p_pmeth_information19
595       => p_rec.pmeth_information19
596       ,p_pmeth_information20
597       => p_rec.pmeth_information20
598       ,p_object_version_number
599       => p_rec.object_version_number
600       ,p_transfer_to_gl_flag
601       => p_rec.transfer_to_gl_flag
602       ,p_cost_payment
603       => p_rec.cost_payment
604       ,p_cost_cleared_payment
605       => p_rec.cost_cleared_payment
606       ,p_cost_cleared_void_payment
607       => p_rec.cost_cleared_void_payment
608       ,p_exclude_manual_payment
609       => p_rec.exclude_manual_payment
610       );
611     --
612   exception
613     --
614     when hr_api.cannot_find_prog_unit then
615       --
616       hr_api.cannot_find_prog_unit_error
617         (p_module_name => 'PAY_ORG_PAYMENT_METHODS_F'
618         ,p_hook_type   => 'AI');
619       --
620   end;
621   --
622   hr_utility.set_location(' Leaving:'||l_proc, 10);
623 End post_insert;
624 --
625 -- ----------------------------------------------------------------------------
626 -- |-------------------------------< ins_lck >--------------------------------|
627 -- ----------------------------------------------------------------------------
628 -- {Start Of Comments}
629 --
630 -- Description:
631 --   The ins_lck process has one main function to perform. When inserting
632 --   a datetracked row, we must validate the DT mode.
633 --
634 -- Prerequisites:
635 --   This procedure can only be called for the datetrack mode of INSERT.
636 --
637 -- In Parameters:
638 --
639 -- Post Success:
640 --   On successful completion of the ins_lck process the parental
641 --   datetracked rows will be locked providing the p_enforce_foreign_locking
642 --   argument value is TRUE.
643 --   If the p_enforce_foreign_locking argument value is FALSE then the
644 --   parential rows are not locked.
645 --
646 -- Post Failure:
647 --   The Lck process can fail for:
648 --   1) When attempting to lock the row the row could already be locked by
649 --      another user. This will raise the HR_Api.Object_Locked exception.
650 --   2) When attempting to the lock the parent which doesn't exist.
651 --      For the entity to be locked the parent must exist!
652 --
653 -- Developer Implementation Notes:
654 --   None.
655 --
656 -- Access Status:
657 --   Internal Row Handler Use Only.
658 --
659 -- {End Of Comments}
660 -- ----------------------------------------------------------------------------
661 Procedure ins_lck
662   (p_effective_date        in         date
663   ,p_datetrack_mode        in         varchar2
664   ,p_rec                   in         pay_opm_shd.g_rec_type
665   ,p_validation_start_date out nocopy date
666   ,p_validation_end_date   out nocopy date
667   ) is
668 --
669   l_proc		  varchar2(72) := g_package||'ins_lck';
670   l_validation_start_date date;
671   l_validation_end_date	  date;
672 --
673 Begin
674   hr_utility.set_location('Entering:'||l_proc, 5);
675   --
676   -- Validate the datetrack mode mode getting the validation start
677   -- and end dates for the specified datetrack operation.
678   --
679   dt_api.validate_dt_mode
680     (p_effective_date	       => p_effective_date
681     ,p_datetrack_mode          => p_datetrack_mode
682     ,p_base_table_name         => 'pay_org_payment_methods_f'
683     ,p_base_key_column         => 'org_payment_method_id'
684     ,p_base_key_value          => p_rec.org_payment_method_id
685     ,p_enforce_foreign_locking => true
686     ,p_validation_start_date   => l_validation_start_date
687     ,p_validation_end_date     => l_validation_end_date
688     );
689   --
690   -- Set the validation start and end date OUT arguments
691   --
692   p_validation_start_date := l_validation_start_date;
693   p_validation_end_date   := l_validation_end_date;
694   --
695   hr_utility.set_location(' Leaving:'||l_proc, 10);
696 --
697 End ins_lck;
698 --
699 -- ----------------------------------------------------------------------------
700 -- |---------------------------------< ins >----------------------------------|
701 -- ----------------------------------------------------------------------------
702 Procedure ins
703   (p_effective_date in            date
704   ,p_rec            in out nocopy pay_opm_shd.g_rec_type
705   ) is
706 --
707   l_proc                        varchar2(72) := g_package||'ins';
708   l_datetrack_mode              varchar2(30) := hr_api.g_insert;
709   l_validation_start_date       date;
710   l_validation_end_date         date;
711 --
712 Begin
713   hr_utility.set_location('Entering:'||l_proc, 5);
714   --
715   -- Call the lock operation
716   --
717   pay_opm_ins.ins_lck
718     (p_effective_date        => p_effective_date
719     ,p_datetrack_mode        => l_datetrack_mode
720     ,p_rec                   => p_rec
721     ,p_validation_start_date => l_validation_start_date
722     ,p_validation_end_date   => l_validation_end_date
723     );
724   --
725   -- Call the supporting insert validate operations
726   --
727   pay_opm_bus.insert_validate
728     (p_rec                   => p_rec
729     ,p_effective_date        => p_effective_date
730     ,p_datetrack_mode        => l_datetrack_mode
731     ,p_validation_start_date => l_validation_start_date
732     ,p_validation_end_date   => l_validation_end_date
733     );
734   --
735   -- Call the supporting pre-insert operation
736   --
737   pay_opm_ins.pre_insert
738     (p_rec                   => p_rec
739     ,p_effective_date        => p_effective_date
740     ,p_datetrack_mode        => l_datetrack_mode
741     ,p_validation_start_date => l_validation_start_date
742     ,p_validation_end_date   => l_validation_end_date
743     );
744   --
745   -- Insert the row
746   --
747   pay_opm_ins.insert_dml
748     (p_rec                   => p_rec
749     ,p_effective_date        => p_effective_date
750     ,p_datetrack_mode        => l_datetrack_mode
751     ,p_validation_start_date => l_validation_start_date
752     ,p_validation_end_date   => l_validation_end_date
753     );
754   --
755   -- Call the supporting post-insert operation
756   --
757   pay_opm_ins.post_insert
758     (p_rec                   => p_rec
759     ,p_effective_date        => p_effective_date
760     ,p_datetrack_mode        => l_datetrack_mode
761     ,p_validation_start_date => l_validation_start_date
762     ,p_validation_end_date   => l_validation_end_date
763     );
764   --
765   hr_utility.set_location('Leaving:'||l_proc,10);
766 end ins;
767 --
768 -- ----------------------------------------------------------------------------
769 -- |---------------------------------< ins >----------------------------------|
770 -- ----------------------------------------------------------------------------
771 Procedure ins
772   (p_effective_date                 in     date
773   ,p_business_group_id              in     number
774   ,p_external_account_id            in     number
775   ,p_currency_code                  in     varchar2
776   ,p_payment_type_id                in     number
777   ,p_org_payment_method_name        in     varchar2
778   ,p_defined_balance_id             in     number   default null
779   ,p_comments                       in     varchar2 default null
780   ,p_attribute_category             in     varchar2 default null
781   ,p_attribute1                     in     varchar2 default null
782   ,p_attribute2                     in     varchar2 default null
783   ,p_attribute3                     in     varchar2 default null
784   ,p_attribute4                     in     varchar2 default null
785   ,p_attribute5                     in     varchar2 default null
786   ,p_attribute6                     in     varchar2 default null
787   ,p_attribute7                     in     varchar2 default null
788   ,p_attribute8                     in     varchar2 default null
789   ,p_attribute9                     in     varchar2 default null
790   ,p_attribute10                    in     varchar2 default null
791   ,p_attribute11                    in     varchar2 default null
792   ,p_attribute12                    in     varchar2 default null
793   ,p_attribute13                    in     varchar2 default null
794   ,p_attribute14                    in     varchar2 default null
795   ,p_attribute15                    in     varchar2 default null
796   ,p_attribute16                    in     varchar2 default null
797   ,p_attribute17                    in     varchar2 default null
798   ,p_attribute18                    in     varchar2 default null
799   ,p_attribute19                    in     varchar2 default null
800   ,p_attribute20                    in     varchar2 default null
801   ,p_pmeth_information_category     in     varchar2 default null
802   ,p_pmeth_information1             in     varchar2 default null
803   ,p_pmeth_information2             in     varchar2 default null
804   ,p_pmeth_information3             in     varchar2 default null
805   ,p_pmeth_information4             in     varchar2 default null
806   ,p_pmeth_information5             in     varchar2 default null
807   ,p_pmeth_information6             in     varchar2 default null
808   ,p_pmeth_information7             in     varchar2 default null
809   ,p_pmeth_information8             in     varchar2 default null
810   ,p_pmeth_information9             in     varchar2 default null
811   ,p_pmeth_information10            in     varchar2 default null
812   ,p_pmeth_information11            in     varchar2 default null
813   ,p_pmeth_information12            in     varchar2 default null
814   ,p_pmeth_information13            in     varchar2 default null
815   ,p_pmeth_information14            in     varchar2 default null
816   ,p_pmeth_information15            in     varchar2 default null
817   ,p_pmeth_information16            in     varchar2 default null
818   ,p_pmeth_information17            in     varchar2 default null
819   ,p_pmeth_information18            in     varchar2 default null
820   ,p_pmeth_information19            in     varchar2 default null
821   ,p_pmeth_information20            in     varchar2 default null
822   ,p_transfer_to_gl_flag            in     varchar2 default null
823   ,p_cost_payment                   in     varchar2 default null
824   ,p_cost_cleared_payment           in     varchar2 default null
825   ,p_cost_cleared_void_payment      in     varchar2 default null
826   ,p_exclude_manual_payment         in     varchar2 default null
827   ,p_org_payment_method_id             out nocopy number
828   ,p_object_version_number             out nocopy number
829   ,p_effective_start_date              out nocopy date
830   ,p_effective_end_date                out nocopy date
831   ,p_comment_id                        out nocopy number
832   ) is
833 --
834   l_rec         pay_opm_shd.g_rec_type;
835   l_proc        varchar2(72) := g_package||'ins';
836 --
837 Begin
838   hr_utility.set_location('Entering:'||l_proc, 5);
839   --
840   -- Call conversion function to turn arguments into the
841   -- p_rec structure.
842   --
843   l_rec :=
844   pay_opm_shd.convert_args
845     (null
846     ,null
847     ,null
848     ,p_business_group_id
849     ,p_external_account_id
850     ,p_currency_code
851     ,p_payment_type_id
852     ,p_defined_balance_id
853     ,p_org_payment_method_name
854     ,null
855     ,p_comments
856     ,p_attribute_category
857     ,p_attribute1
858     ,p_attribute2
859     ,p_attribute3
860     ,p_attribute4
861     ,p_attribute5
862     ,p_attribute6
863     ,p_attribute7
864     ,p_attribute8
865     ,p_attribute9
866     ,p_attribute10
867     ,p_attribute11
868     ,p_attribute12
869     ,p_attribute13
870     ,p_attribute14
871     ,p_attribute15
872     ,p_attribute16
873     ,p_attribute17
874     ,p_attribute18
875     ,p_attribute19
876     ,p_attribute20
877     ,p_pmeth_information_category
878     ,p_pmeth_information1
879     ,p_pmeth_information2
880     ,p_pmeth_information3
881     ,p_pmeth_information4
882     ,p_pmeth_information5
883     ,p_pmeth_information6
884     ,p_pmeth_information7
885     ,p_pmeth_information8
886     ,p_pmeth_information9
887     ,p_pmeth_information10
888     ,p_pmeth_information11
889     ,p_pmeth_information12
890     ,p_pmeth_information13
891     ,p_pmeth_information14
892     ,p_pmeth_information15
893     ,p_pmeth_information16
894     ,p_pmeth_information17
895     ,p_pmeth_information18
896     ,p_pmeth_information19
897     ,p_pmeth_information20
898     ,null
899     ,p_transfer_to_gl_flag
900     ,p_cost_payment
901     ,p_cost_cleared_payment
902     ,p_cost_cleared_void_payment
903     ,p_exclude_manual_payment
904     );
905   --
906   -- Having converted the arguments into the pay_opm_rec
907   -- plsql record structure we call the corresponding record
908   -- business process.
909   --
910   pay_opm_ins.ins
911     (p_effective_date
912     ,l_rec
913     );
914   --
915   -- Set the OUT arguments.
916   --
917   p_org_payment_method_id            := l_rec.org_payment_method_id;
918   p_effective_start_date             := l_rec.effective_start_date;
919   p_effective_end_date               := l_rec.effective_end_date;
920   p_object_version_number            := l_rec.object_version_number;
921   p_comment_id                       := l_rec.comment_id;
922   --
923   hr_utility.set_location(' Leaving:'||l_proc, 10);
924 End ins;
925 --
926 end pay_opm_ins;