DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_ETP_INS_ND

Source


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