DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_ETP_INS

Source


1 Package Body pay_etp_ins as
2 /* $Header: pyetprhi.pkb 120.6.12010000.6 2009/07/30 11:56:55 npannamp ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_etp_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_element_type_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_element_type_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_etp_ins.g_element_type_id_i := p_element_type_id;
27   --
28   hr_utility.set_location(' Leaving:'||l_proc, 20);
29 End set_base_key_value;
30 --
31 --
32 -- ----------------------------------------------------------------------------
33 -- |----------------------------< dt_insert_dml >-----------------------------|
34 -- ----------------------------------------------------------------------------
35 -- {Start Of Comments}
36 --
37 -- Description:
38 --   This procedure controls the actual dml insert logic for datetrack. The
39 --   functions of this procedure are as follows:
40 --   1) Get the object_version_number.
41 --   2) To set the effective start and end dates to the corresponding
42 --      validation start and end dates. Also, the object version number
43 --      record attribute is set.
44 --   3) To set and unset the g_api_dml status as required (as we are about to
45 --      perform dml).
46 --   4) To insert the row into the schema with the derived effective start
47 --      and end dates and the object version number.
48 --   5) To trap any constraint violations that may have occurred.
49 --   6) To raise any other errors.
50 --
51 -- Prerequisites:
52 --   This is an internal private procedure which must be called from the
53 --   insert_dml and pre_update (logic permitting) procedure and must have
54 --   all mandatory arguments set.
55 --
56 -- In Parameters:
57 --   A Pl/Sql record structure.
58 --
59 -- Post Success:
60 --   The specified row will be inserted into the schema.
61 --
62 -- Post Failure:
63 --   On the insert dml failure it is important to note that we always reset the
64 --   g_api_dml status to false.
65 --   If a check or unique integrity constraint violation is raised the
66 --   constraint_error procedure will be called.
67 --   If any other error is reported, the error will be raised after the
68 --   g_api_dml status is reset.
69 --
70 -- Developer Implementation Notes:
71 --   This is an internal datetrack maintenance procedure which should
72 --   not be modified in anyway.
73 --
74 -- Access Status:
75 --   Internal Row Handler Use Only.
76 --
77 -- {End Of Comments}
78 -- ----------------------------------------------------------------------------
79 Procedure dt_insert_dml
80   (p_rec                     in out nocopy pay_etp_shd.g_rec_type
81   ,p_effective_date          in date
82   ,p_datetrack_mode          in varchar2
83   ,p_validation_start_date   in date
84   ,p_validation_end_date     in date
85   ) is
86 -- Cursor to select 'old' created AOL who column values
87 --
88   Cursor C_Sel1 Is
89     select t.created_by,
90            t.creation_date
91     from   pay_element_types_f t
92     where  t.element_type_id       = p_rec.element_type_id
93     and    t.effective_start_date =
94              pay_etp_shd.g_old_rec.effective_start_date
95     and    t.effective_end_date   = (p_validation_start_date - 1);
96 --
97   l_proc                varchar2(72) := g_package||'dt_insert_dml';
98   l_created_by          pay_element_types_f.created_by%TYPE;
99   l_creation_date       pay_element_types_f.creation_date%TYPE;
100   l_last_update_date    pay_element_types_f.last_update_date%TYPE;
101   l_last_updated_by     pay_element_types_f.last_updated_by%TYPE;
102   l_last_update_login   pay_element_types_f.last_update_login%TYPE;
103 --
104 Begin
105   hr_utility.set_location('Entering:'||l_proc, 5);
106   --
107   -- Get the object version number for the insert
108   --
109   p_rec.object_version_number :=
110     dt_api.get_object_version_number
111       (p_base_table_name => 'pay_element_types_f'
112       ,p_base_key_column => 'element_type_id'
113       ,p_base_key_value  => p_rec.element_type_id
114       );
115   --
116   -- Set the effective start and end dates to the corresponding
117   -- validation start and end dates
118   --
119   p_rec.effective_start_date := p_validation_start_date;
120   p_rec.effective_end_date   := p_validation_end_date;
121   --
122   -- If the datetrack_mode is not INSERT then we must populate the WHO
123   -- columns with the 'old' creation values and 'new' updated values.
124   --
125   If (p_datetrack_mode <> hr_api.g_insert) then
126     hr_utility.set_location(l_proc, 10);
127     --
128     -- Select the 'old' created values
129     --
130     Open C_Sel1;
131     Fetch C_Sel1 Into l_created_by, l_creation_date;
132     If C_Sel1%notfound Then
133       --
134       -- The previous 'old' created row has not been found. We need
135       -- to error as an internal datetrack problem exists.
136       --
137       Close C_Sel1;
138       fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
139       fnd_message.set_token('PROCEDURE', l_proc);
140       fnd_message.set_token('STEP','10');
141       fnd_message.raise_error;
142     End If;
143     Close C_Sel1;
144     --
145     -- Set the AOL updated WHO values
146     --
147     l_last_update_date   := sysdate;
148     l_last_updated_by    := fnd_global.user_id;
149     l_last_update_login  := fnd_global.login_id;
150   End If;
151   --
152   pay_etp_shd.g_api_dml := true;  -- Set the api dml status
153   --
154   -- Insert the row into: pay_element_types_f
155   --
156   insert into pay_element_types_f
157       (element_type_id
158       ,effective_start_date
159       ,effective_end_date
160       ,business_group_id
161       ,legislation_code
162       ,formula_id
163       ,input_currency_code
164       ,output_currency_code
165       ,classification_id
166       ,benefit_classification_id
167       ,additional_entry_allowed_flag
168       ,adjustment_only_flag
169       ,closed_for_entry_flag
170       ,element_name
171       ,indirect_only_flag
172       ,multiple_entries_allowed_flag
173       ,multiply_value_flag
174       ,post_termination_rule
175       ,process_in_run_flag
176       ,processing_priority
177       ,processing_type
178       ,standard_link_flag
179       ,comment_id
180       ,description
181       ,legislation_subgroup
182       ,qualifying_age
183       ,qualifying_length_of_service
184       ,qualifying_units
185       ,reporting_name
186       ,attribute_category
187       ,attribute1
188       ,attribute2
189       ,attribute3
190       ,attribute4
191       ,attribute5
192       ,attribute6
193       ,attribute7
194       ,attribute8
195       ,attribute9
196       ,attribute10
197       ,attribute11
198       ,attribute12
199       ,attribute13
200       ,attribute14
201       ,attribute15
202       ,attribute16
203       ,attribute17
204       ,attribute18
205       ,attribute19
206       ,attribute20
207       ,element_information_category
208       ,element_information1
209       ,element_information2
210       ,element_information3
211       ,element_information4
212       ,element_information5
213       ,element_information6
214       ,element_information7
215       ,element_information8
216       ,element_information9
217       ,element_information10
218       ,element_information11
219       ,element_information12
220       ,element_information13
221       ,element_information14
222       ,element_information15
223       ,element_information16
224       ,element_information17
225       ,element_information18
226       ,element_information19
227       ,element_information20
228       ,third_party_pay_only_flag
229       ,object_version_number
230       ,iterative_flag
231       ,iterative_formula_id
232       ,iterative_priority
233       ,creator_type
234       ,retro_summ_ele_id
235       ,grossup_flag
236       ,process_mode
237       ,advance_indicator
238       ,advance_payable
239       ,advance_deduction
240       ,process_advance_entry
241       ,proration_group_id
242       ,proration_formula_id
243       ,recalc_event_group_id
244       ,once_each_period_flag
245       ,time_definition_type
246       ,time_definition_id
247       ,advance_element_type_id
248       ,deduction_element_type_id
249       ,created_by
250       ,creation_date
251       ,last_update_date
252       ,last_updated_by
253       ,last_update_login
254       )
255   Values
256     (p_rec.element_type_id
257     ,p_rec.effective_start_date
258     ,p_rec.effective_end_date
259     ,p_rec.business_group_id
260     ,p_rec.legislation_code
261     ,p_rec.formula_id
262     ,p_rec.input_currency_code
263     ,p_rec.output_currency_code
264     ,p_rec.classification_id
265     ,p_rec.benefit_classification_id
266     ,p_rec.additional_entry_allowed_flag
267     ,p_rec.adjustment_only_flag
268     ,p_rec.closed_for_entry_flag
269     ,p_rec.element_name
270     ,p_rec.indirect_only_flag
271     ,p_rec.multiple_entries_allowed_flag
272     ,p_rec.multiply_value_flag
273     ,p_rec.post_termination_rule
274     ,p_rec.process_in_run_flag
275     ,p_rec.processing_priority
276     ,p_rec.processing_type
277     ,p_rec.standard_link_flag
278     ,p_rec.comment_id
279     ,p_rec.description
280     ,p_rec.legislation_subgroup
281     ,p_rec.qualifying_age
282     ,p_rec.qualifying_length_of_service
283     ,p_rec.qualifying_units
284     ,p_rec.reporting_name
285     ,p_rec.attribute_category
286     ,p_rec.attribute1
287     ,p_rec.attribute2
288     ,p_rec.attribute3
289     ,p_rec.attribute4
290     ,p_rec.attribute5
291     ,p_rec.attribute6
292     ,p_rec.attribute7
293     ,p_rec.attribute8
294     ,p_rec.attribute9
295     ,p_rec.attribute10
296     ,p_rec.attribute11
297     ,p_rec.attribute12
298     ,p_rec.attribute13
299     ,p_rec.attribute14
300     ,p_rec.attribute15
301     ,p_rec.attribute16
302     ,p_rec.attribute17
303     ,p_rec.attribute18
304     ,p_rec.attribute19
305     ,p_rec.attribute20
306     ,p_rec.element_information_category
307     ,p_rec.element_information1
308     ,p_rec.element_information2
309     ,p_rec.element_information3
310     ,p_rec.element_information4
311     ,p_rec.element_information5
312     ,p_rec.element_information6
313     ,p_rec.element_information7
314     ,p_rec.element_information8
315     ,p_rec.element_information9
316     ,p_rec.element_information10
317     ,p_rec.element_information11
318     ,p_rec.element_information12
319     ,p_rec.element_information13
320     ,p_rec.element_information14
321     ,p_rec.element_information15
322     ,p_rec.element_information16
323     ,p_rec.element_information17
324     ,p_rec.element_information18
325     ,p_rec.element_information19
326     ,p_rec.element_information20
327     ,p_rec.third_party_pay_only_flag
328     ,p_rec.object_version_number
329     ,p_rec.iterative_flag
330     ,p_rec.iterative_formula_id
331     ,p_rec.iterative_priority
332     ,p_rec.creator_type
333     ,p_rec.retro_summ_ele_id
334     ,p_rec.grossup_flag
335     ,p_rec.process_mode
336     ,p_rec.advance_indicator
337     ,p_rec.advance_payable
338     ,p_rec.advance_deduction
339     ,p_rec.process_advance_entry
340     ,p_rec.proration_group_id
341     ,p_rec.proration_formula_id
342     ,p_rec.recalc_event_group_id
343     ,p_rec.once_each_period_flag
344     ,p_rec.time_definition_type
345     ,p_rec.time_definition_id
346     ,p_rec.advance_element_type_id
347     ,p_rec.deduction_element_type_id
348     ,l_created_by
349     ,l_creation_date
350     ,l_last_update_date
351     ,l_last_updated_by
352     ,l_last_update_login
353     );
354   --
355   pay_etp_shd.g_api_dml := false;   -- Unset the api dml status
356   hr_utility.set_location(' Leaving:'||l_proc, 15);
357 --
358 Exception
359   When hr_api.check_integrity_violated Then
360     -- A check constraint has been violated
361     pay_etp_shd.g_api_dml := false;   -- Unset the api dml status
362     pay_etp_shd.constraint_error
363       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
364   When hr_api.unique_integrity_violated Then
365     -- Unique integrity has been violated
366     pay_etp_shd.g_api_dml := false;   -- Unset the api dml status
367     pay_etp_shd.constraint_error
368       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
369   When Others Then
370     pay_etp_shd.g_api_dml := false;   -- Unset the api dml status
371     Raise;
372 End dt_insert_dml;
373 --
374 -- ----------------------------------------------------------------------------
375 -- |-----------------------< create_app_ownerships >--------------------------|
376 -- ----------------------------------------------------------------------------
377 --
378 -- Description:
379 --   This procedure inserts a row into the HR_APPLICATION_OWNERSHIPS table
380 --   when the row handler is called in the appropriate mode.
381 --
382 -- ----------------------------------------------------------------------------
383 PROCEDURE create_app_ownerships(p_pk_column  IN varchar2
384                                ,p_pk_value   IN varchar2) IS
385 --
386 CURSOR csr_definition IS
387   SELECT product_short_name
388     FROM hr_owner_definitions
389    WHERE session_id = hr_startup_data_api_support.g_session_id;
390 --
391 BEGIN
392   --
393   IF (hr_startup_data_api_support.return_startup_mode IN
394                                ('STARTUP','GENERIC')) THEN
395      --
396      FOR c1 IN csr_definition LOOP
397        --
398        INSERT INTO hr_application_ownerships
399          (key_name
400          ,key_value
401          ,product_name
402          )
403        VALUES
404          (p_pk_column
405          ,fnd_number.number_to_canonical(p_pk_value)
406          ,c1.product_short_name
407          );
408      END LOOP;
409   END IF;
410 END create_app_ownerships;
411 --
412 -- ----------------------------------------------------------------------------
413 -- |-----------------------< create_app_ownerships >--------------------------|
414 -- ----------------------------------------------------------------------------
415 PROCEDURE create_app_ownerships(p_pk_column IN varchar2
416                                ,p_pk_value  IN number) IS
417 --
418 BEGIN
419   create_app_ownerships(p_pk_column, to_char(p_pk_value));
420 END create_app_ownerships;
421 --
422 -- ----------------------------------------------------------------------------
423 -- |------------------------------< insert_dml >------------------------------|
424 -- ----------------------------------------------------------------------------
425 Procedure insert_dml
426   (p_rec                   in out nocopy pay_etp_shd.g_rec_type
427   ,p_effective_date        in date
428   ,p_datetrack_mode        in varchar2
429   ,p_validation_start_date in date
430   ,p_validation_end_date   in date
431   ) is
432 --
433   l_proc        varchar2(72) := g_package||'insert_dml';
434 --
435 Begin
436   hr_utility.set_location('Entering:'||l_proc, 5);
437   --
438   pay_etp_ins.dt_insert_dml
439     (p_rec                   => p_rec
440     ,p_effective_date        => p_effective_date
441     ,p_datetrack_mode        => p_datetrack_mode
442     ,p_validation_start_date => p_validation_start_date
443     ,p_validation_end_date   => p_validation_end_date
444     );
445   --
446   hr_utility.set_location(' Leaving:'||l_proc, 10);
447 End insert_dml;
448 --
449 -- ----------------------------------------------------------------------------
450 -- |------------------------------< pre_insert >------------------------------|
451 -- ----------------------------------------------------------------------------
452 -- {Start Of Comments}
453 --
454 -- Description:
455 --   This private procedure contains any processing which is required before
456 --   the insert dml. Presently, if the entity has a corresponding primary
457 --   key which is maintained by an associating sequence, the primary key for
458 --   the entity will be populated with the next sequence value in
459 --   preparation for the insert dml.
460 --   Also, if comments are defined for this entity, the comments insert
461 --   logic will also be called, generating a comment_id if required.
462 --
463 -- Prerequisites:
464 --   This is an internal procedure which is called from the ins procedure.
465 --
466 -- In Parameters:
467 --   A Pl/Sql record structure.
468 --
469 -- Post Success:
470 --   Processing continues.
471 --
472 -- Post Failure:
473 --   If an error has occurred, an error message and exception will be raised
474 --   but not handled.
475 --
476 -- Developer Implementation Notes:
477 --   Any pre-processing required before the insert dml is issued should be
478 --   coded within this procedure. As stated above, a good example is the
479 --   generation of a primary key number via a corresponding sequence.
480 --   It is important to note that any 3rd party maintenance should be reviewed
481 --   before placing in this procedure.
482 --
483 -- Access Status:
484 --   Internal Row Handler Use Only.
485 --
486 -- {End Of Comments}
487 -- ----------------------------------------------------------------------------
488 Procedure pre_insert
489   (p_rec                   in out nocopy pay_etp_shd.g_rec_type
490   ,p_effective_date        in date
491   ,p_datetrack_mode        in varchar2
492   ,p_validation_start_date in date
493   ,p_validation_end_date   in date
494   ) is
495 --
496   Cursor C_Sel1 is select pay_element_types_s.nextval from sys.dual;
497 --
498  Cursor C_Sel2 is
499     Select null
500       from pay_element_types_f
501      where element_type_id =
502              pay_etp_ins.g_element_type_id_i;
503 --
504   l_proc        varchar2(72) := g_package||'pre_insert';
505   l_exists      varchar2(1);
506 --
507 Begin
508   hr_utility.set_location('Entering:'||l_proc, 5);
509   --
510     If (pay_etp_ins.g_element_type_id_i is not null) Then
511     --
512     -- Verify registered primary key values not already in use
513     --
514     Open C_Sel2;
515     Fetch C_Sel2 into l_exists;
516     If C_Sel2%found Then
517        Close C_Sel2;
518        --
519        -- The primary key values are already in use.
520        --
521        fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
522        fnd_message.set_token('TABLE_NAME','pay_element_types_f');
523        fnd_message.raise_error;
524     End If;
525     Close C_Sel2;
526     --
527     -- Use registered key values and clear globals
528     --
529     p_rec.element_type_id :=
530       pay_etp_ins.g_element_type_id_i;
531     pay_etp_ins.g_element_type_id_i := null;
532   Else
533     --
534     -- No registerd key values, so select the next sequence number
535     --
536     --
537     -- Select the next sequence number
538     --
539     Open C_Sel1;
540     Fetch C_Sel1 Into p_rec.element_type_id;
541     Close C_Sel1;
542   End If;
543   --
544   --
545   -- Insert the comment text if comments exist
546   --
547   If (p_rec.comments is not null) then
548     hr_comm_api.ins
549       (p_comment_id        => p_rec.comment_id
550       ,p_source_table_name => 'PAY_ELEMENT_TYPES_F'
551       ,p_comment_text      => p_rec.comments
552       );
553   End If;
554   hr_utility.set_location(' Leaving:'||l_proc, 10);
555 End pre_insert;
556 --
557 -- ----------------------------------------------------------------------------
558 -- |----------------------------< post_insert >-------------------------------|
559 -- ----------------------------------------------------------------------------
560 -- {Start Of Comments}
561 --
562 -- Description:
563 --   This private procedure contains any processing which is required after
564 --   the insert dml.
565 --
566 -- Prerequisites:
567 --   This is an internal procedure which is called from the ins procedure.
568 --
569 -- In Parameters:
570 --   A Pl/Sql record structure.
571 --
572 -- Post Success:
573 --   Processing continues.
574 --
575 -- Post Failure:
576 --   If an error has occurred, an error message and exception will be raised
577 --   but not handled.
578 --
579 -- Developer Implementation Notes:
580 --   Any post-processing required after the insert dml is issued should be
581 --   coded within this procedure. It is important to note that any 3rd party
582 --   maintenance should be reviewed before placing in this procedure.
583 --
584 -- Access Status:
585 --   Internal Row Handler Use Only.
586 --
587 -- {End Of Comments}
588 -- ----------------------------------------------------------------------------
589 Procedure post_insert
590   (p_rec                   in pay_etp_shd.g_rec_type
591   ,p_effective_date        in date
592   ,p_datetrack_mode        in varchar2
593   ,p_validation_start_date in date
594   ,p_validation_end_date   in date
595   ) is
596 --
597   l_proc        varchar2(72) := g_package||'post_insert';
598 --
599 Begin
600   hr_utility.set_location('Entering:'||l_proc, 5);
601   begin
602       --
603     -- insert ownerships if applicable
604     create_app_ownerships
605       ('ELEMENT_TYPE_ID', p_rec.element_type_id
606       );
607     --
608     --
609     pay_etp_rki.after_insert
610       (p_effective_date
611       => p_effective_date
612       ,p_validation_start_date
613       => p_validation_start_date
614       ,p_validation_end_date
615       => p_validation_end_date
616       ,p_element_type_id
617       => p_rec.element_type_id
618       ,p_effective_start_date
619       => p_rec.effective_start_date
620       ,p_effective_end_date
621       => p_rec.effective_end_date
622       ,p_business_group_id
623       => p_rec.business_group_id
624       ,p_legislation_code
625       => p_rec.legislation_code
626       ,p_formula_id
627       => p_rec.formula_id
628       ,p_input_currency_code
629       => p_rec.input_currency_code
630       ,p_output_currency_code
631       => p_rec.output_currency_code
632       ,p_classification_id
633       => p_rec.classification_id
634       ,p_benefit_classification_id
635       => p_rec.benefit_classification_id
636       ,p_additional_entry_allowed_fla
637       => p_rec.additional_entry_allowed_flag
638       ,p_adjustment_only_flag
639       => p_rec.adjustment_only_flag
640       ,p_closed_for_entry_flag
641       => p_rec.closed_for_entry_flag
642       ,p_element_name
643       => p_rec.element_name
644       ,p_indirect_only_flag
645       => p_rec.indirect_only_flag
646       ,p_multiple_entries_allowed_fla
647       => p_rec.multiple_entries_allowed_flag
648       ,p_multiply_value_flag
649       => p_rec.multiply_value_flag
650       ,p_post_termination_rule
651       => p_rec.post_termination_rule
652       ,p_process_in_run_flag
653       => p_rec.process_in_run_flag
654       ,p_processing_priority
655       => p_rec.processing_priority
656       ,p_processing_type
657       => p_rec.processing_type
658       ,p_standard_link_flag
659       => p_rec.standard_link_flag
660       ,p_comment_id
661       => p_rec.comment_id
662       ,p_comments
663       => p_rec.comments
664       ,p_description
665       => p_rec.description
666       ,p_legislation_subgroup
667       => p_rec.legislation_subgroup
668       ,p_qualifying_age
669       => p_rec.qualifying_age
670       ,p_qualifying_length_of_service
671       => p_rec.qualifying_length_of_service
672       ,p_qualifying_units
673       => p_rec.qualifying_units
674       ,p_reporting_name
675       => p_rec.reporting_name
676       ,p_attribute_category
677       => p_rec.attribute_category
678       ,p_attribute1
679       => p_rec.attribute1
680       ,p_attribute2
681       => p_rec.attribute2
682       ,p_attribute3
683       => p_rec.attribute3
684       ,p_attribute4
685       => p_rec.attribute4
686       ,p_attribute5
687       => p_rec.attribute5
688       ,p_attribute6
689       => p_rec.attribute6
690       ,p_attribute7
691       => p_rec.attribute7
692       ,p_attribute8
693       => p_rec.attribute8
694       ,p_attribute9
695       => p_rec.attribute9
696       ,p_attribute10
697       => p_rec.attribute10
698       ,p_attribute11
699       => p_rec.attribute11
700       ,p_attribute12
701       => p_rec.attribute12
702       ,p_attribute13
703       => p_rec.attribute13
704       ,p_attribute14
705       => p_rec.attribute14
706       ,p_attribute15
707       => p_rec.attribute15
708       ,p_attribute16
709       => p_rec.attribute16
710       ,p_attribute17
711       => p_rec.attribute17
712       ,p_attribute18
713       => p_rec.attribute18
714       ,p_attribute19
715       => p_rec.attribute19
716       ,p_attribute20
717       => p_rec.attribute20
718       ,p_element_information_category
719       => p_rec.element_information_category
720       ,p_element_information1
721       => p_rec.element_information1
722       ,p_element_information2
723       => p_rec.element_information2
724       ,p_element_information3
725       => p_rec.element_information3
726       ,p_element_information4
727       => p_rec.element_information4
728       ,p_element_information5
729       => p_rec.element_information5
730       ,p_element_information6
731       => p_rec.element_information6
732       ,p_element_information7
733       => p_rec.element_information7
734       ,p_element_information8
735       => p_rec.element_information8
736       ,p_element_information9
737       => p_rec.element_information9
738       ,p_element_information10
739       => p_rec.element_information10
740       ,p_element_information11
741       => p_rec.element_information11
742       ,p_element_information12
743       => p_rec.element_information12
744       ,p_element_information13
745       => p_rec.element_information13
746       ,p_element_information14
747       => p_rec.element_information14
748       ,p_element_information15
749       => p_rec.element_information15
750       ,p_element_information16
751       => p_rec.element_information16
752       ,p_element_information17
753       => p_rec.element_information17
754       ,p_element_information18
755       => p_rec.element_information18
756       ,p_element_information19
757       => p_rec.element_information19
758       ,p_element_information20
759       => p_rec.element_information20
760       ,p_third_party_pay_only_flag
761       => p_rec.third_party_pay_only_flag
762       ,p_object_version_number
763       => p_rec.object_version_number
764       ,p_iterative_flag
765       => p_rec.iterative_flag
766       ,p_iterative_formula_id
767       => p_rec.iterative_formula_id
768       ,p_iterative_priority
769       => p_rec.iterative_priority
770       ,p_creator_type
771       => p_rec.creator_type
772       ,p_retro_summ_ele_id
773       => p_rec.retro_summ_ele_id
774       ,p_grossup_flag
775       => p_rec.grossup_flag
776       ,p_process_mode
777       => p_rec.process_mode
778       ,p_advance_indicator
779       => p_rec.advance_indicator
780       ,p_advance_payable
781       => p_rec.advance_payable
782       ,p_advance_deduction
783       => p_rec.advance_deduction
784       ,p_process_advance_entry
785       => p_rec.process_advance_entry
786       ,p_proration_group_id
787       => p_rec.proration_group_id
788       ,p_proration_formula_id
789       => p_rec.proration_formula_id
790       ,p_recalc_event_group_id
791       => p_rec.recalc_event_group_id
792       ,p_once_each_period_flag
793       => p_rec.once_each_period_flag
794       ,p_time_definition_type
795       => p_rec.time_definition_type
796       ,p_time_definition_id
797       => p_rec.time_definition_id
798       ,p_advance_element_type_id
799       => p_rec.advance_element_type_id
800       ,p_deduction_element_type_id
801       => p_rec.deduction_element_type_id
802       );
803     --
804   exception
805     --
806     when hr_api.cannot_find_prog_unit then
807       --
808       hr_api.cannot_find_prog_unit_error
809         (p_module_name => 'PAY_ELEMENT_TYPES_F'
810         ,p_hook_type   => 'AI');
811       --
812   end;
813   --
814   hr_utility.set_location(' Leaving:'||l_proc, 10);
815 End post_insert;
816 --
817 -- ----------------------------------------------------------------------------
818 -- |-------------------------------< ins_lck >--------------------------------|
819 -- ----------------------------------------------------------------------------
820 -- {Start Of Comments}
821 --
822 -- Description:
823 --   The ins_lck process has one main function to perform. When inserting
824 --   a datetracked row, we must validate the DT mode.
825 --
826 -- Prerequisites:
827 --   This procedure can only be called for the datetrack mode of INSERT.
828 --
829 -- In Parameters:
830 --
831 -- Post Success:
832 --   On successful completion of the ins_lck process the parental
833 --   datetracked rows will be locked providing the p_enforce_foreign_locking
834 --   argument value is TRUE.
835 --   If the p_enforce_foreign_locking argument value is FALSE then the
836 --   parential rows are not locked.
837 --
838 -- Post Failure:
839 --   The Lck process can fail for:
840 --   1) When attempting to lock the row the row could already be locked by
841 --      another user. This will raise the HR_Api.Object_Locked exception.
842 --   2) When attempting to the lock the parent which doesn't exist.
843 --      For the entity to be locked the parent must exist!
844 --
845 -- Developer Implementation Notes:
846 --   None.
847 --
848 -- Access Status:
849 --   Internal Row Handler Use Only.
850 --
851 -- {End Of Comments}
852 -- ----------------------------------------------------------------------------
853 Procedure ins_lck
854   (p_effective_date        in date
855   ,p_datetrack_mode        in varchar2
856   ,p_rec                   in pay_etp_shd.g_rec_type
857   ,p_validation_start_date out nocopy date
858   ,p_validation_end_date   out nocopy date
859   ) is
860 --
861   l_proc                  varchar2(72) := g_package||'ins_lck';
862   l_validation_start_date date;
863   l_validation_end_date   date;
864 --
865 Begin
866   hr_utility.set_location('Entering:'||l_proc, 5);
867   --
868   -- Validate the datetrack mode mode getting the validation start
869   -- and end dates for the specified datetrack operation.
870   --
871   dt_api.validate_dt_mode
872     (p_effective_date          => p_effective_date
873     ,p_datetrack_mode          => p_datetrack_mode
874     ,p_base_table_name         => 'pay_element_types_f'
875     ,p_base_key_column         => 'element_type_id'
876     ,p_base_key_value          => p_rec.element_type_id
877     ,p_enforce_foreign_locking => true
878     ,p_validation_start_date   => l_validation_start_date
879     ,p_validation_end_date     => l_validation_end_date
880     );
881   --
882   -- Set the validation start and end date OUT arguments
883   --
884   p_validation_start_date := l_validation_start_date;
885   p_validation_end_date   := l_validation_end_date;
886   --
887   hr_utility.set_location(' Leaving:'||l_proc, 10);
888   --
889 End ins_lck;
890 --
891 -- ----------------------------------------------------------------------------
892 -- |---------------------------------< ins >----------------------------------|
893 -- ----------------------------------------------------------------------------
894 Procedure ins
895   (p_effective_date 			 in     date
896   ,p_rec            			 in out nocopy pay_etp_shd.g_rec_type
897   ,p_processing_priority_warning            out nocopy boolean
898   ) is
899 --
900   l_proc                        varchar2(72) := g_package||'ins';
901   l_datetrack_mode              varchar2(30) := hr_api.g_insert;
902   l_validation_start_date       date;
903   l_validation_end_date         date;
904   l_processing_priority_warning boolean;
905 --
906 Begin
907   hr_utility.set_location('Entering:'||l_proc, 5);
908   --
909   -- Call the lock operation
910   --
911   pay_etp_ins.ins_lck
912     (p_effective_date        => p_effective_date
913     ,p_datetrack_mode        => l_datetrack_mode
914     ,p_rec                   => p_rec
915     ,p_validation_start_date => l_validation_start_date
916     ,p_validation_end_date   => l_validation_end_date
917     );
918   --
919   -- Call the supporting insert validate operations
920   --
921   pay_etp_bus.insert_validate
922     (p_rec                   => p_rec
923     ,p_effective_date        => p_effective_date
924     ,p_datetrack_mode        => l_datetrack_mode
925     ,p_validation_start_date => l_validation_start_date
926     ,p_validation_end_date   => l_validation_end_date
927     ,p_processing_priority_warning => l_processing_priority_warning
928     );
929   --
930   p_processing_priority_warning := l_processing_priority_warning;
931   --
932   -- Call to raise any errors on multi-message list
933   hr_multi_message.end_validation_set;
934   --
935   -- Call the supporting pre-insert operation
936   --
937   pay_etp_ins.pre_insert
938     (p_rec                   => p_rec
939     ,p_effective_date        => p_effective_date
940     ,p_datetrack_mode        => l_datetrack_mode
941     ,p_validation_start_date => l_validation_start_date
942     ,p_validation_end_date   => l_validation_end_date
943     );
944   --
945   -- Insert the row
946   --
947   pay_etp_ins.insert_dml
948     (p_rec                   => p_rec
949     ,p_effective_date        => p_effective_date
950     ,p_datetrack_mode        => l_datetrack_mode
951     ,p_validation_start_date => l_validation_start_date
952     ,p_validation_end_date   => l_validation_end_date
953     );
954   --
955   -- Call the supporting post-insert operation
956   --
957   pay_etp_ins.post_insert
958     (p_rec                   => p_rec
959     ,p_effective_date        => p_effective_date
960     ,p_datetrack_mode        => l_datetrack_mode
961     ,p_validation_start_date => l_validation_start_date
962     ,p_validation_end_date   => l_validation_end_date
963     );
964   --
965   -- Call to raise any errors on multi-message list
966   hr_multi_message.end_validation_set;
967   --
968   hr_utility.set_location('Leaving:'||l_proc,10);
969 end ins;
970 --
971 -- ----------------------------------------------------------------------------
972 -- |---------------------------------< ins >----------------------------------|
973 -- ----------------------------------------------------------------------------
974 Procedure ins
975   (p_effective_date                 in     date
976   ,p_classification_id              in     number
977   ,p_additional_entry_allowed_fla   in     varchar2
978   ,p_adjustment_only_flag           in     varchar2
979   ,p_closed_for_entry_flag          in     varchar2
980   ,p_element_name                   in     varchar2
981   ,p_indirect_only_flag             in     varchar2
982   ,p_multiple_entries_allowed_fla   in     varchar2
983   ,p_multiply_value_flag            in     varchar2
984   ,p_post_termination_rule          in     varchar2
985   ,p_process_in_run_flag            in     varchar2
986   ,p_processing_priority            in     number
987   ,p_processing_type                in     varchar2
988   ,p_standard_link_flag             in     varchar2
989   ,p_business_group_id              in     number   default null
990   ,p_legislation_code               in     varchar2 default null
991   ,p_formula_id                     in     number   default null
992   ,p_input_currency_code            in     varchar2 default null
993   ,p_output_currency_code           in     varchar2 default null
994   ,p_benefit_classification_id      in     number   default null
995   ,p_comments                       in     varchar2 default null
996   ,p_description                    in     varchar2 default null
997   ,p_legislation_subgroup           in     varchar2 default null
998   ,p_qualifying_age                 in     number   default null
999   ,p_qualifying_length_of_service   in     number   default null
1000   ,p_qualifying_units               in     varchar2 default null
1001   ,p_reporting_name                 in     varchar2 default null
1002   ,p_attribute_category             in     varchar2 default null
1003   ,p_attribute1                     in     varchar2 default null
1004   ,p_attribute2                     in     varchar2 default null
1005   ,p_attribute3                     in     varchar2 default null
1006   ,p_attribute4                     in     varchar2 default null
1007   ,p_attribute5                     in     varchar2 default null
1008   ,p_attribute6                     in     varchar2 default null
1009   ,p_attribute7                     in     varchar2 default null
1010   ,p_attribute8                     in     varchar2 default null
1011   ,p_attribute9                     in     varchar2 default null
1012   ,p_attribute10                    in     varchar2 default null
1013   ,p_attribute11                    in     varchar2 default null
1014   ,p_attribute12                    in     varchar2 default null
1015   ,p_attribute13                    in     varchar2 default null
1016   ,p_attribute14                    in     varchar2 default null
1017   ,p_attribute15                    in     varchar2 default null
1018   ,p_attribute16                    in     varchar2 default null
1019   ,p_attribute17                    in     varchar2 default null
1020   ,p_attribute18                    in     varchar2 default null
1021   ,p_attribute19                    in     varchar2 default null
1022   ,p_attribute20                    in     varchar2 default null
1023   ,p_element_information_category   in     varchar2 default null
1024   ,p_element_information1           in     varchar2 default null
1025   ,p_element_information2           in     varchar2 default null
1026   ,p_element_information3           in     varchar2 default null
1027   ,p_element_information4           in     varchar2 default null
1028   ,p_element_information5           in     varchar2 default null
1029   ,p_element_information6           in     varchar2 default null
1033   ,p_element_information10          in     varchar2 default null
1030   ,p_element_information7           in     varchar2 default null
1031   ,p_element_information8           in     varchar2 default null
1032   ,p_element_information9           in     varchar2 default null
1034   ,p_element_information11          in     varchar2 default null
1035   ,p_element_information12          in     varchar2 default null
1036   ,p_element_information13          in     varchar2 default null
1037   ,p_element_information14          in     varchar2 default null
1038   ,p_element_information15          in     varchar2 default null
1039   ,p_element_information16          in     varchar2 default null
1040   ,p_element_information17          in     varchar2 default null
1041   ,p_element_information18          in     varchar2 default null
1042   ,p_element_information19          in     varchar2 default null
1043   ,p_element_information20          in     varchar2 default null
1044   ,p_third_party_pay_only_flag      in     varchar2 default null
1045   ,p_iterative_flag                 in     varchar2 default null
1046   ,p_iterative_formula_id           in     number   default null
1047   ,p_iterative_priority             in     number   default null
1048   ,p_creator_type                   in     varchar2 default null
1049   ,p_retro_summ_ele_id              in     number   default null
1050   ,p_grossup_flag                   in     varchar2 default null
1051   ,p_process_mode                   in     varchar2 default null
1052   ,p_advance_indicator              in     varchar2 default null
1053   ,p_advance_payable                in     varchar2 default null
1054   ,p_advance_deduction              in     varchar2 default null
1055   ,p_process_advance_entry          in     varchar2 default null
1056   ,p_proration_group_id             in     number   default null
1057   ,p_proration_formula_id           in     number   default null
1058   ,p_recalc_event_group_id          in     number   default null
1059   ,p_once_each_period_flag          in     varchar2 default 'N'
1060   ,p_time_definition_type           in     varchar2 default null
1061   ,p_time_definition_id             in     number   default null
1062   ,p_advance_element_type_id	    in     number default null
1063   ,p_deduction_element_type_id	    in     number default null
1064   ,p_element_type_id                   out nocopy number
1065   ,p_object_version_number             out nocopy number
1066   ,p_effective_start_date              out nocopy date
1067   ,p_effective_end_date                out nocopy date
1068   ,p_comment_id                        out nocopy number
1069   ,p_processing_priority_warning       out nocopy boolean
1070   ) is
1071 --
1072   l_rec         				pay_etp_shd.g_rec_type;
1073   l_proc        				varchar2(72) := g_package||'ins';
1074   l_processing_priority_warning boolean;
1075 --
1076 Begin
1077   hr_utility.set_location('Entering:'||l_proc, 5);
1078   --
1079   -- Call conversion function to turn arguments into the
1080   -- p_rec structure.
1081   --
1082   l_rec :=
1083   pay_etp_shd.convert_args
1084     (null
1085     ,null
1086     ,null
1087     ,p_business_group_id
1088     ,p_legislation_code
1089     ,p_formula_id
1090     ,p_input_currency_code
1091     ,p_output_currency_code
1092     ,p_classification_id
1093     ,p_benefit_classification_id
1094     ,p_additional_entry_allowed_fla
1095     ,p_adjustment_only_flag
1096     ,p_closed_for_entry_flag
1097     ,p_element_name
1098     ,p_indirect_only_flag
1099     ,p_multiple_entries_allowed_fla
1100     ,p_multiply_value_flag
1101     ,p_post_termination_rule
1102     ,p_process_in_run_flag
1103     ,p_processing_priority
1104     ,p_processing_type
1105     ,p_standard_link_flag
1106     ,null
1107     ,p_comments
1108     ,p_description
1109     ,p_legislation_subgroup
1110     ,p_qualifying_age
1111     ,p_qualifying_length_of_service
1112     ,p_qualifying_units
1113     ,p_reporting_name
1114     ,p_attribute_category
1115     ,p_attribute1
1116     ,p_attribute2
1117     ,p_attribute3
1118     ,p_attribute4
1119     ,p_attribute5
1120     ,p_attribute6
1121     ,p_attribute7
1122     ,p_attribute8
1123     ,p_attribute9
1124     ,p_attribute10
1125     ,p_attribute11
1126     ,p_attribute12
1127     ,p_attribute13
1128     ,p_attribute14
1129     ,p_attribute15
1130     ,p_attribute16
1131     ,p_attribute17
1132     ,p_attribute18
1133     ,p_attribute19
1134     ,p_attribute20
1135     ,p_element_information_category
1136     ,p_element_information1
1137     ,p_element_information2
1138     ,p_element_information3
1139     ,p_element_information4
1140     ,p_element_information5
1141     ,p_element_information6
1142     ,p_element_information7
1143     ,p_element_information8
1144     ,p_element_information9
1145     ,p_element_information10
1146     ,p_element_information11
1147     ,p_element_information12
1148     ,p_element_information13
1149     ,p_element_information14
1150     ,p_element_information15
1151     ,p_element_information16
1152     ,p_element_information17
1153     ,p_element_information18
1154     ,p_element_information19
1155     ,p_element_information20
1156     ,p_third_party_pay_only_flag
1157     ,null
1158     ,p_iterative_flag
1159     ,p_iterative_formula_id
1160     ,p_iterative_priority
1161     ,p_creator_type
1162     ,p_retro_summ_ele_id
1163     ,p_grossup_flag
1164     ,p_process_mode
1165     ,p_advance_indicator
1166     ,p_advance_payable
1167     ,p_advance_deduction
1168     ,p_process_advance_entry
1169     ,p_proration_group_id
1170     ,p_proration_formula_id
1171     ,p_recalc_event_group_id
1172     ,p_once_each_period_flag
1173     ,p_time_definition_type
1174     ,p_time_definition_id
1175     ,p_advance_element_type_id
1176     ,p_deduction_element_type_id
1177     );
1178   --
1179   -- Having converted the arguments into the pay_etp_rec
1180   -- plsql record structure we call the corresponding record
1181   -- business process.
1182   --
1183   pay_etp_ins.ins
1184     (p_effective_date
1185     ,l_rec
1186     ,l_processing_priority_warning
1187     );
1188   --
1189   -- Set the OUT arguments.
1190   --
1191   p_element_type_id                  := l_rec.element_type_id;
1192   p_effective_start_date             := l_rec.effective_start_date;
1193   p_effective_end_date               := l_rec.effective_end_date;
1194   p_object_version_number            := l_rec.object_version_number;
1195   p_comment_id                       := l_rec.comment_id;
1196   p_processing_priority_warning	     := l_processing_priority_warning;
1197   --
1198   hr_utility.set_location(' Leaving:'||l_proc, 10);
1199 End ins;
1200 --
1201 end pay_etp_ins;