DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_AAT_INS

Source


1 Package Body pqp_aat_ins as
2 /* $Header: pqaatrhi.pkb 120.2.12010000.3 2009/07/01 10:58:37 dchindar ship $ */
3 --
4 -- ---------------------------------------------------------------------------+
5 -- |                     Private Global Definitions                           |
6 -- ---------------------------------------------------------------------------+
7 --
8 g_package  varchar2(33) := '  pqp_aat_ins.';  -- Global package name
9 --
10 -- ---------------------------------------------------------------------------+
11 -- |----------------------------< dt_insert_dml >-----------------------------|
12 -- ---------------------------------------------------------------------------+
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml insert logic for datetrack. The
17 --   functions of this procedure are as follows:
18 --   1) Get the object_version_number.
19 --   2) To set the effective start and end dates to the corresponding
20 --      validation start and end dates. Also, the object version number
21 --      record attribute is set.
22 --   3) To set and unset the g_api_dml status as required (as we are about to
23 --      perform dml).
24 --   4) To insert the row into the schema with the derived effective start
25 --      and end dates and the object version number.
26 --   5) To trap any constraint violations that may have occurred.
27 --   6) To raise any other errors.
28 --
29 -- Prerequisites:
30 --   This is an internal private procedure which must be called from the
31 --   insert_dml and pre_update (logic permitting) procedure and must have
32 --   all mandatory arguments set.
33 --
34 -- In Parameters:
35 --   A Pl/Sql record structure.
36 --
37 -- Post Success:
38 --   The specified row will be inserted into the schema.
39 --
40 -- Post Failure:
41 --   On the insert dml failure it is important to note that we always reset the
42 --   g_api_dml status to false.
43 --   If a check or unique integrity constraint violation is raised the
44 --   constraint_error procedure will be called.
45 --   If any other error is reported, the error will be raised after the
46 --   g_api_dml status is reset.
47 --
48 -- Developer Implementation Notes:
49 --   This is an internal datetrack maintenance procedure which should
50 --   not be modified in anyway.
51 --
52 -- Access Status:
53 --   Internal Row Handler Use Only.
54 --
55 -- {End Of Comments}
56 -- ---------------------------------------------------------------------------+
57 Procedure dt_insert_dml
58   (p_rec                     in out nocopy pqp_aat_shd.g_rec_type
59   ,p_effective_date          in date
60   ,p_datetrack_mode          in varchar2
61   ,p_validation_start_date   in date
62   ,p_validation_end_date     in date
63   ) is
64 -- Cursor to select 'old' created AOL who column values
65 --
66   Cursor C_Sel1 Is
67     select t.created_by,
68            t.creation_date
69     from   pqp_assignment_attributes_f t
70     where  t.assignment_attribute_id       = p_rec.assignment_attribute_id
71     and    t.effective_start_date =
72              pqp_aat_shd.g_old_rec.effective_start_date
73     and    t.effective_end_date   = (p_validation_start_date - 1);
74 --
75   l_proc                varchar2(72) := g_package||'dt_insert_dml';
76   l_created_by          pqp_assignment_attributes_f.created_by%TYPE;
77   l_creation_date       pqp_assignment_attributes_f.creation_date%TYPE;
78   l_last_update_date    pqp_assignment_attributes_f.last_update_date%TYPE;
79   l_last_updated_by     pqp_assignment_attributes_f.last_updated_by%TYPE;
80   l_last_update_login   pqp_assignment_attributes_f.last_update_login%TYPE;
81 --
82 Begin
83   hr_utility.set_location('Entering:'||l_proc, 5);
84   --
85   -- Get the object version number for the insert
86   --
87   p_rec.object_version_number :=
88     dt_api.get_object_version_number
89       (p_base_table_name => 'pqp_assignment_attributes_f'
90       ,p_base_key_column => 'assignment_attribute_id'
91       ,p_base_key_value  => p_rec.assignment_attribute_id
92       );
93   --
94   -- Set the effective start and end dates to the corresponding
95   -- validation start and end dates
96   --
97   p_rec.effective_start_date := p_validation_start_date;
98   p_rec.effective_end_date   := p_validation_end_date;
99   --
100   -- If the datetrack_mode is not INSERT then we must populate the WHO
101   -- columns with the 'old' creation values and 'new' updated values.
102   --
103   If (p_datetrack_mode <> hr_api.g_insert) then
104     hr_utility.set_location(l_proc, 10);
105     --
106     -- Select the 'old' created values
107     --
108     Open C_Sel1;
109     Fetch C_Sel1 Into l_created_by, l_creation_date;
110     If C_Sel1%notfound Then
111       --
112       -- The previous 'old' created row has not been found. We need
113       -- to error as an internal datetrack problem exists.
114       --
115       Close C_Sel1;
116       fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
117       fnd_message.set_token('PROCEDURE', l_proc);
118       fnd_message.set_token('STEP','10');
119       fnd_message.raise_error;
120     End If;
121     Close C_Sel1;
122     --
123     -- Set the AOL updated WHO values
124     --
125     l_last_update_date   := sysdate;
126     l_last_updated_by    := fnd_global.user_id;
127     l_last_update_login  := fnd_global.login_id;
128   End If;
129   --
130   pqp_aat_shd.g_api_dml := true;  -- Set the api dml status
131   --
132   -- Insert the row into: pqp_assignment_attributes_f
133   --
134   insert into pqp_assignment_attributes_f
135       (assignment_attribute_id
136       ,effective_start_date
137       ,effective_end_date
138       ,business_group_id
139       ,assignment_id
140       ,contract_type
141       ,work_pattern
142       ,start_day
143       ,object_version_number
144       ,primary_company_car
145       ,primary_car_fuel_benefit
146       ,primary_class_1a
147       ,primary_capital_contribution
148       ,primary_private_contribution
149       ,secondary_company_car
150       ,secondary_car_fuel_benefit
151       ,secondary_class_1a
152       ,secondary_capital_contribution
153       ,secondary_private_contribution
154       ,company_car_calc_method
155       ,company_car_rates_table_id
156       ,company_car_secondary_table_id
157       ,private_car
158       ,private_car_calc_method
159       ,private_car_rates_table_id
160       ,private_car_essential_table_id
161       ,tp_is_teacher
162       ,tp_headteacher_grp_code --added for head Teacher seconded location for salary scale calculation
163       ,tp_safeguarded_grade
164       ,tp_safeguarded_grade_id
165       ,tp_safeguarded_rate_type
166       ,tp_safeguarded_rate_id
167       ,tp_safeguarded_spinal_point_id
168       ,tp_elected_pension
169       ,tp_fast_track
170       ,aat_attribute_category
171       ,aat_attribute1
172       ,aat_attribute2
173       ,aat_attribute3
174       ,aat_attribute4
175       ,aat_attribute5
176       ,aat_attribute6
177       ,aat_attribute7
178       ,aat_attribute8
179       ,aat_attribute9
180       ,aat_attribute10
181       ,aat_attribute11
182       ,aat_attribute12
183       ,aat_attribute13
184       ,aat_attribute14
185       ,aat_attribute15
186       ,aat_attribute16
187       ,aat_attribute17
188       ,aat_attribute18
189       ,aat_attribute19
190       ,aat_attribute20
191       ,aat_information_category
192       ,aat_information1
193       ,aat_information2
194       ,aat_information3
195       ,aat_information4
196       ,aat_information5
197       ,aat_information6
198       ,aat_information7
199       ,aat_information8
200       ,aat_information9
201       ,aat_information10
202       ,aat_information11
203       ,aat_information12
204       ,aat_information13
205       ,aat_information14
206       ,aat_information15
207       ,aat_information16
208       ,aat_information17
209       ,aat_information18
210       ,aat_information19
211       ,aat_information20
212 	,lgps_process_flag
213 	,lgps_exclusion_type
214 	,lgps_pensionable_pay
215 	,lgps_trans_arrang_flag
216 	,lgps_membership_number
217       ,created_by
218       ,creation_date
219       ,last_update_date
220       ,last_updated_by
221       ,last_update_login
222       )
223   Values
224     (p_rec.assignment_attribute_id
225     ,p_rec.effective_start_date
226     ,p_rec.effective_end_date
227     ,p_rec.business_group_id
228     ,p_rec.assignment_id
229     ,p_rec.contract_type
230     ,p_rec.work_pattern
231     ,p_rec.start_day
232     ,p_rec.object_version_number
233     ,p_rec.primary_company_car
234     ,p_rec.primary_car_fuel_benefit
235     ,p_rec.primary_class_1a
236     ,p_rec.primary_capital_contribution
237     ,p_rec.primary_private_contribution
238     ,p_rec.secondary_company_car
239     ,p_rec.secondary_car_fuel_benefit
240     ,p_rec.secondary_class_1a
241     ,p_rec.secondary_capital_contribution
242     ,p_rec.secondary_private_contribution
243     ,p_rec.company_car_calc_method
244     ,p_rec.company_car_rates_table_id
245     ,p_rec.company_car_secondary_table_id
246     ,p_rec.private_car
247     ,p_rec.private_car_calc_method
248     ,p_rec.private_car_rates_table_id
249     ,p_rec.private_car_essential_table_id
250     ,p_rec.tp_is_teacher
251     ,p_rec.tp_headteacher_grp_code --added for head Teacher seconded location for salary scale calculation
252     ,p_rec.tp_safeguarded_grade
253     ,p_rec.tp_safeguarded_grade_id
254     ,p_rec.tp_safeguarded_rate_type
255     ,p_rec.tp_safeguarded_rate_id
256     ,p_rec.tp_safeguarded_spinal_point_id
257     ,p_rec.tp_elected_pension
258     ,p_rec.tp_fast_track
259     ,p_rec.aat_attribute_category
260     ,p_rec.aat_attribute1
261     ,p_rec.aat_attribute2
262     ,p_rec.aat_attribute3
263     ,p_rec.aat_attribute4
264     ,p_rec.aat_attribute5
265     ,p_rec.aat_attribute6
266     ,p_rec.aat_attribute7
267     ,p_rec.aat_attribute8
268     ,p_rec.aat_attribute9
269     ,p_rec.aat_attribute10
270     ,p_rec.aat_attribute11
271     ,p_rec.aat_attribute12
272     ,p_rec.aat_attribute13
273     ,p_rec.aat_attribute14
274     ,p_rec.aat_attribute15
275     ,p_rec.aat_attribute16
276     ,p_rec.aat_attribute17
277     ,p_rec.aat_attribute18
278     ,p_rec.aat_attribute19
279     ,p_rec.aat_attribute20
280     ,p_rec.aat_information_category
281     ,p_rec.aat_information1
282     ,p_rec.aat_information2
283     ,p_rec.aat_information3
284     ,p_rec.aat_information4
285     ,p_rec.aat_information5
286     ,p_rec.aat_information6
287     ,p_rec.aat_information7
288     ,p_rec.aat_information8
289     ,p_rec.aat_information9
290     ,p_rec.aat_information10
291     ,p_rec.aat_information11
292     ,p_rec.aat_information12
293     ,p_rec.aat_information13
294     ,p_rec.aat_information14
295     ,p_rec.aat_information15
296     ,p_rec.aat_information16
297     ,p_rec.aat_information17
298     ,p_rec.aat_information18
299     ,p_rec.aat_information19
300     ,p_rec.aat_information20
301     ,p_rec.lgps_process_flag
302     ,p_rec.lgps_exclusion_type
303     ,p_rec.lgps_pensionable_pay
304     ,p_rec.lgps_trans_arrang_flag
305     ,p_rec.lgps_membership_number
306     ,l_created_by
307     ,l_creation_date
308     ,l_last_update_date
309     ,l_last_updated_by
310     ,l_last_update_login
311     );
312   --
316 Exception
313   pqp_aat_shd.g_api_dml := false;   -- Unset the api dml status
314   hr_utility.set_location(' Leaving:'||l_proc, 15);
315 --
317   When hr_api.check_integrity_violated Then
318     -- A check constraint has been violated
319     pqp_aat_shd.g_api_dml := false;   -- Unset the api dml status
320     pqp_aat_shd.constraint_error
321       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
322   When hr_api.unique_integrity_violated Then
323     -- Unique integrity has been violated
324     pqp_aat_shd.g_api_dml := false;   -- Unset the api dml status
325     pqp_aat_shd.constraint_error
326       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
327   When Others Then
328     pqp_aat_shd.g_api_dml := false;   -- Unset the api dml status
329     Raise;
330 End dt_insert_dml;
331 --
332 -- ---------------------------------------------------------------------------+
333 -- |------------------------------< insert_dml >------------------------------|
334 -- ---------------------------------------------------------------------------+
335 Procedure insert_dml
336   (p_rec                   in out nocopy pqp_aat_shd.g_rec_type
337   ,p_effective_date        in date
338   ,p_datetrack_mode        in varchar2
339   ,p_validation_start_date in date
340   ,p_validation_end_date   in date
341   ) is
342 --
343   l_proc        varchar2(72) := g_package||'insert_dml';
344 --
345 Begin
346   hr_utility.set_location('Entering:'||l_proc, 5);
347   --
348   pqp_aat_ins.dt_insert_dml
349     (p_rec                   => p_rec
350     ,p_effective_date        => p_effective_date
351     ,p_datetrack_mode        => p_datetrack_mode
352     ,p_validation_start_date => p_validation_start_date
353     ,p_validation_end_date   => p_validation_end_date
354     );
355   --
356   hr_utility.set_location(' Leaving:'||l_proc, 10);
357 End insert_dml;
358 --
359 -- ---------------------------------------------------------------------------+
360 -- |------------------------------< pre_insert >------------------------------|
361 -- ---------------------------------------------------------------------------+
362 -- {Start Of Comments}
363 --
364 -- Description:
365 --   This private procedure contains any processing which is required before
366 --   the insert dml. Presently, if the entity has a corresponding primary
367 --   key which is maintained by an associating sequence, the primary key for
368 --   the entity will be populated with the next sequence value in
369 --   preparation for the insert dml.
370 --   Also, if comments are defined for this entity, the comments insert
371 --   logic will also be called, generating a comment_id if required.
372 --
373 -- Prerequisites:
374 --   This is an internal procedure which is called from the ins procedure.
375 --
376 -- In Parameters:
377 --   A Pl/Sql record structure.
378 --
379 -- Post Success:
380 --   Processing continues.
381 --
382 -- Post Failure:
383 --   If an error has occurred, an error message and exception will be raised
384 --   but not handled.
385 --
386 -- Developer Implementation Notes:
387 --   Any pre-processing required before the insert dml is issued should be
388 --   coded within this procedure. As stated above, a good example is the
389 --   generation of a primary key number via a corresponding sequence.
390 --   It is important to note that any 3rd party maintenance should be reviewed
391 --   before placing in this procedure.
392 --
393 -- Access Status:
394 --   Internal Row Handler Use Only.
395 --
396 -- {End Of Comments}
397 -- ---------------------------------------------------------------------------+
398 Procedure pre_insert
399   (p_rec                   in out nocopy pqp_aat_shd.g_rec_type
400   ,p_effective_date        in date
401   ,p_datetrack_mode        in varchar2
402   ,p_validation_start_date in date
403   ,p_validation_end_date   in date
404   ) is
405 --
406   l_proc        varchar2(72) := g_package||'pre_insert';
407 --
408   Cursor C_Sel1 is select pqp_assignment_attributes_s.nextval from sys.dual;
409 --
410 Begin
411   hr_utility.set_location('Entering:'||l_proc, 5);
412   --
413   --
414   -- Select the next sequence number
415   --
416   Open C_Sel1;
417   Fetch C_Sel1 Into p_rec.assignment_attribute_id;
418   Close C_Sel1;
419   --
420   --
421   hr_utility.set_location(' Leaving:'||l_proc, 10);
422 End pre_insert;
423 --
424 -- ---------------------------------------------------------------------------+
425 -- |----------------------------< post_insert >-------------------------------|
426 -- ---------------------------------------------------------------------------+
427 -- {Start Of Comments}
428 --
429 -- Description:
430 --   This private procedure contains any processing which is required after the
431 --   insert dml.
432 --
433 -- Prerequisites:
434 --   This is an internal procedure which is called from the ins procedure.
435 --
436 -- In Parameters:
437 --   A Pl/Sql record structure.
438 --
439 -- Post Success:
440 --   Processing continues.
441 --
442 -- Post Failure:
443 --   If an error has occurred, an error message and exception will be raised
444 --   but not handled.
445 --
446 -- Developer Implementation Notes:
447 --   Any post-processing required after the insert dml is issued should be
448 --   coded within this procedure. It is important to note that any 3rd party
449 --   maintenance should be reviewed before placing in this procedure.
450 --
451 -- Access Status:
452 --   Internal Row Handler Use Only.
453 --
454 -- {End Of Comments}
458   ,p_effective_date        in date
455 -- ---------------------------------------------------------------------------+
456 Procedure post_insert
457   (p_rec                   in pqp_aat_shd.g_rec_type
459   ,p_datetrack_mode        in varchar2
460   ,p_validation_start_date in date
461   ,p_validation_end_date   in date
462   ) is
463 --
464   l_proc        varchar2(72) := g_package||'post_insert';
465 --
466 Begin
467   hr_utility.set_location('Entering:'||l_proc, 5);
468   begin
469     --
470     pqp_aat_rki.after_insert
471       (p_effective_date
472       => p_effective_date
473       ,p_validation_start_date
474       => p_validation_start_date
475       ,p_validation_end_date
476       => p_validation_end_date
477       ,p_assignment_attribute_id
478       => p_rec.assignment_attribute_id
479       ,p_effective_start_date
480       => p_rec.effective_start_date
481       ,p_effective_end_date
482       => p_rec.effective_end_date
483       ,p_business_group_id
484       => p_rec.business_group_id
485       ,p_assignment_id
486       => p_rec.assignment_id
487       ,p_contract_type
488       => p_rec.contract_type
489       ,p_work_pattern
490       => p_rec.work_pattern
491       ,p_start_day
492       => p_rec.start_day
493       ,p_object_version_number
494       => p_rec.object_version_number
495       ,p_primary_company_car
496       => p_rec.primary_company_car
497       ,p_primary_car_fuel_benefit
498       => p_rec.primary_car_fuel_benefit
499       ,p_primary_class_1a
500       => p_rec.primary_class_1a
501       ,p_primary_capital_contribution
502       => p_rec.primary_capital_contribution
503       ,p_primary_private_contribution
504       => p_rec.primary_private_contribution
505       ,p_secondary_company_car
506       => p_rec.secondary_company_car
507       ,p_secondary_car_fuel_benefit
508       => p_rec.secondary_car_fuel_benefit
509       ,p_secondary_class_1a
510       => p_rec.secondary_class_1a
511       ,p_secondary_capital_contributi
512       => p_rec.secondary_capital_contribution
513       ,p_secondary_private_contributi
514       => p_rec.secondary_private_contribution
515       ,p_company_car_calc_method
516       => p_rec.company_car_calc_method
517       ,p_company_car_rates_table_id
518       => p_rec.company_car_rates_table_id
519       ,p_company_car_secondary_table
520       => p_rec.company_car_secondary_table_id
521       ,p_private_car
522       => p_rec.private_car
523       ,p_private_car_calc_method
524       => p_rec.private_car_calc_method
525       ,p_private_car_rates_table_id
526       => p_rec.private_car_rates_table_id
527       ,p_private_car_essential_table
528       => p_rec.private_car_essential_table_id
529       ,p_tp_is_teacher
530       => p_rec.tp_is_teacher
531        ,p_tp_headteacher_grp_code  --added for head Teacher seconded location for salary scale calculation
532       => p_rec.tp_headteacher_grp_code
533       ,p_tp_safeguarded_grade
534       => p_rec.tp_safeguarded_grade
535       ,p_tp_safeguarded_grade_id
536       => p_rec.tp_safeguarded_grade_id
537       ,p_tp_safeguarded_rate_type
538       => p_rec.tp_safeguarded_rate_type
539       ,p_tp_safeguarded_rate_id
540       => p_rec.tp_safeguarded_rate_id
541       ,p_tp_spinal_point_id
542       => p_rec.tp_safeguarded_spinal_point_id
543       ,p_tp_elected_pension
544       => p_rec.tp_elected_pension
545       ,p_tp_fast_track
546       => p_rec.tp_fast_track
547       ,p_aat_attribute_category
548       => p_rec.aat_attribute_category
549       ,p_aat_attribute1
550       => p_rec.aat_attribute1
551       ,p_aat_attribute2
552       => p_rec.aat_attribute2
553       ,p_aat_attribute3
554       => p_rec.aat_attribute3
555       ,p_aat_attribute4
556       => p_rec.aat_attribute4
557       ,p_aat_attribute5
558       => p_rec.aat_attribute5
559       ,p_aat_attribute6
560       => p_rec.aat_attribute6
561       ,p_aat_attribute7
562       => p_rec.aat_attribute7
563       ,p_aat_attribute8
564       => p_rec.aat_attribute8
565       ,p_aat_attribute9
566       => p_rec.aat_attribute9
567       ,p_aat_attribute10
568       => p_rec.aat_attribute10
569       ,p_aat_attribute11
570       => p_rec.aat_attribute11
571       ,p_aat_attribute12
572       => p_rec.aat_attribute12
573       ,p_aat_attribute13
574       => p_rec.aat_attribute13
575       ,p_aat_attribute14
576       => p_rec.aat_attribute14
577       ,p_aat_attribute15
578       => p_rec.aat_attribute15
579       ,p_aat_attribute16
580       => p_rec.aat_attribute16
581       ,p_aat_attribute17
582       => p_rec.aat_attribute17
583       ,p_aat_attribute18
584       => p_rec.aat_attribute18
585       ,p_aat_attribute19
586       => p_rec.aat_attribute19
587       ,p_aat_attribute20
588       => p_rec.aat_attribute20
589       ,p_aat_information_category
590       => p_rec.aat_information_category
591       ,p_aat_information1
592       => p_rec.aat_information1
593       ,p_aat_information2
594       => p_rec.aat_information2
595       ,p_aat_information3
596       => p_rec.aat_information3
597       ,p_aat_information4
598       => p_rec.aat_information4
599       ,p_aat_information5
600       => p_rec.aat_information5
601       ,p_aat_information6
602       => p_rec.aat_information6
603       ,p_aat_information7
604       => p_rec.aat_information7
605       ,p_aat_information8
606       => p_rec.aat_information8
607       ,p_aat_information9
611       ,p_aat_information11
608       => p_rec.aat_information9
609       ,p_aat_information10
610       => p_rec.aat_information10
612       => p_rec.aat_information11
613       ,p_aat_information12
614       => p_rec.aat_information12
615       ,p_aat_information13
616       => p_rec.aat_information13
617       ,p_aat_information14
618       => p_rec.aat_information14
619       ,p_aat_information15
620       => p_rec.aat_information15
621       ,p_aat_information16
622       => p_rec.aat_information16
623       ,p_aat_information17
624       => p_rec.aat_information17
625       ,p_aat_information18
626       => p_rec.aat_information18
627       ,p_aat_information19
628       => p_rec.aat_information19
629       ,p_aat_information20
630       => p_rec.aat_information20
631 	,p_lgps_process_flag
632       => p_rec.lgps_process_flag
633       ,p_lgps_exclusion_type
634       => p_rec.lgps_exclusion_type
635       ,p_lgps_pensionable_pay
636       => p_rec.lgps_pensionable_pay
637       ,p_lgps_trans_arrang_flag
638       => p_rec.lgps_trans_arrang_flag
639       ,p_lgps_membership_number
640       => p_rec.lgps_membership_number
641       );
642     --
643   exception
644     --
645     when hr_api.cannot_find_prog_unit then
646       --
647       hr_api.cannot_find_prog_unit_error
648         (p_module_name => 'PQP_ASSIGNMENT_ATTRIBUTES_F'
649         ,p_hook_type   => 'AI');
650       --
651   end;
652   --
653   hr_utility.set_location(' Leaving:'||l_proc, 10);
654 End post_insert;
655 --
656 -- ---------------------------------------------------------------------------+
657 -- |-------------------------------< ins_lck >--------------------------------|
658 -- ---------------------------------------------------------------------------+
659 -- {Start Of Comments}
660 --
661 -- Description:
662 --   The ins_lck process has one main function to perform. When inserting
663 --   a datetracked row, we must validate the DT mode.
664 --
665 -- Prerequisites:
666 --   This procedure can only be called for the datetrack mode of INSERT.
667 --
668 -- In Parameters:
669 --
670 -- Post Success:
671 --   On successful completion of the ins_lck process the parental
672 --   datetracked rows will be locked providing the p_enforce_foreign_locking
673 --   argument value is TRUE.
674 --   If the p_enforce_foreign_locking argument value is FALSE then the
675 --   parential rows are not locked.
676 --
677 -- Post Failure:
678 --   The Lck process can fail for:
679 --   1) When attempting to lock the row the row could already be locked by
680 --      another user. This will raise the HR_Api.Object_Locked exception.
681 --   2) When attempting to the lock the parent which doesn't exist.
682 --      For the entity to be locked the parent must exist!
683 --
684 -- Developer Implementation Notes:
685 --   None.
686 --
687 -- Access Status:
688 --   Internal Row Handler Use Only.
689 --
690 -- {End Of Comments}
691 -- ---------------------------------------------------------------------------+
692 Procedure ins_lck
693   (p_effective_date        in date
694   ,p_datetrack_mode        in varchar2
695   ,p_rec                   in pqp_aat_shd.g_rec_type
696   ,p_validation_start_date out nocopy date
697   ,p_validation_end_date   out nocopy date
698   ) is
699 --
700   l_proc                  varchar2(72) := g_package||'ins_lck';
701   l_validation_start_date date;
702   l_validation_end_date   date;
703 --
704 Begin
705   hr_utility.set_location('Entering:'||l_proc, 5);
706   --
707   -- Validate the datetrack mode mode getting the validation start
708   -- and end dates for the specified datetrack operation.
709   --
710   dt_api.validate_dt_mode
711     (p_effective_date          => p_effective_date
712     ,p_datetrack_mode          => p_datetrack_mode
713     ,p_base_table_name         => 'pqp_assignment_attributes_f'
714     ,p_base_key_column         => 'assignment_attribute_id'
715     ,p_base_key_value          => p_rec.assignment_attribute_id
716     ,p_enforce_foreign_locking => true
717     ,p_validation_start_date   => l_validation_start_date
718     ,p_validation_end_date     => l_validation_end_date
719     );
720   --
721   -- Set the validation start and end date OUT arguments
722   --
723   p_validation_start_date := l_validation_start_date;
724   p_validation_end_date   := l_validation_end_date;
725   --
726   hr_utility.set_location(' Leaving:'||l_proc, 10);
727 --
728 End ins_lck;
729 --
730 -- ---------------------------------------------------------------------------+
731 -- |---------------------------------< ins >----------------------------------|
732 -- ---------------------------------------------------------------------------+
733 Procedure ins
734   (p_effective_date in     date
735   ,p_rec            in out nocopy pqp_aat_shd.g_rec_type
736   ) is
737 --
738   l_proc                        varchar2(72) := g_package||'ins';
739   l_datetrack_mode              varchar2(30) := hr_api.g_insert;
740   l_validation_start_date       date;
741   l_validation_end_date         date;
742 --
743 Begin
744   hr_utility.set_location('Entering:'||l_proc, 5);
745   --
746   -- Call the lock operation
747   --
748   pqp_aat_ins.ins_lck
749     (p_effective_date        => p_effective_date
750     ,p_datetrack_mode        => l_datetrack_mode
751     ,p_rec                   => p_rec
752     ,p_validation_start_date => l_validation_start_date
753     ,p_validation_end_date   => l_validation_end_date
754     );
755   --
759     (p_rec                   => p_rec
756   -- Call the supporting insert validate operations
757   --
758   pqp_aat_bus.insert_validate
760     ,p_effective_date        => p_effective_date
761     ,p_datetrack_mode        => l_datetrack_mode
762     ,p_validation_start_date => l_validation_start_date
763     ,p_validation_end_date   => l_validation_end_date
764     );
765   --
766   -- Call the supporting pre-insert operation
767   --
768   pqp_aat_ins.pre_insert
769     (p_rec                   => p_rec
770     ,p_effective_date        => p_effective_date
771     ,p_datetrack_mode        => l_datetrack_mode
772     ,p_validation_start_date => l_validation_start_date
773     ,p_validation_end_date   => l_validation_end_date
774     );
775   --
776   -- Insert the row
777   --
778   pqp_aat_ins.insert_dml
779     (p_rec                   => p_rec
780     ,p_effective_date        => p_effective_date
781     ,p_datetrack_mode        => l_datetrack_mode
782     ,p_validation_start_date => l_validation_start_date
783     ,p_validation_end_date   => l_validation_end_date
784     );
785   --
786   -- Call the supporting post-insert operation
787   --
788   pqp_aat_ins.post_insert
789     (p_rec                   => p_rec
790     ,p_effective_date        => p_effective_date
791     ,p_datetrack_mode        => l_datetrack_mode
792     ,p_validation_start_date => l_validation_start_date
793     ,p_validation_end_date   => l_validation_end_date
794     );
795   --
796   hr_utility.set_location('Leaving:'||l_proc,10);
797 end ins;
798 --
799 -- ---------------------------------------------------------------------------+
800 -- |---------------------------------< ins >----------------------------------|
801 -- ---------------------------------------------------------------------------+
802 Procedure ins
803   (p_effective_date                 in     date
804   ,p_business_group_id              in     number
805   ,p_assignment_id                  in     number
806   ,p_contract_type                  in     varchar2 default null
807   ,p_work_pattern                   in     varchar2 default null
808   ,p_start_day                      in     varchar2 default null
809   ,p_primary_company_car            in     number   default null
810   ,p_primary_car_fuel_benefit       in     varchar2 default null
811   ,p_primary_class_1a               in     varchar2 default null
812   ,p_primary_capital_contribution   in     number   default null
813   ,p_primary_private_contribution   in     number   default null
814   ,p_secondary_company_car          in     number   default null
815   ,p_secondary_car_fuel_benefit     in     varchar2 default null
816   ,p_secondary_class_1a             in     varchar2 default null
817   ,p_secondary_capital_contributi   in     number   default null
818   ,p_secondary_private_contributi   in     number   default null
819   ,p_company_car_calc_method        in     varchar2 default null
820   ,p_company_car_rates_table_id     in     number   default null
821   ,p_company_car_secondary_table    in     number   default null
822   ,p_private_car                    in     number   default null
823   ,p_private_car_calc_method        in     varchar2 default null
824   ,p_private_car_rates_table_id     in     number   default null
825   ,p_private_car_essential_table    in     number   default null
826   ,p_tp_is_teacher                  in     varchar2 default null
827   ,p_tp_headteacher_grp_code	    in     number   default null --added for head Teacher seconded location for salary scale calculation
828   ,p_tp_safeguarded_grade           in     varchar2 default null
829   ,p_tp_safeguarded_grade_id        in     number   default null
830   ,p_tp_safeguarded_rate_type       in     varchar2 default null
831   ,p_tp_safeguarded_rate_id         in     number   default null
832   ,p_tp_spinal_point_id             in     number   default null
833   ,p_tp_elected_pension             in     varchar2 default null
834   ,p_tp_fast_track                  in     varchar2 default null
835   ,p_aat_attribute_category         in     varchar2 default null
836   ,p_aat_attribute1                 in     varchar2 default null
837   ,p_aat_attribute2                 in     varchar2 default null
838   ,p_aat_attribute3                 in     varchar2 default null
839   ,p_aat_attribute4                 in     varchar2 default null
840   ,p_aat_attribute5                 in     varchar2 default null
841   ,p_aat_attribute6                 in     varchar2 default null
842   ,p_aat_attribute7                 in     varchar2 default null
843   ,p_aat_attribute8                 in     varchar2 default null
844   ,p_aat_attribute9                 in     varchar2 default null
845   ,p_aat_attribute10                in     varchar2 default null
846   ,p_aat_attribute11                in     varchar2 default null
847   ,p_aat_attribute12                in     varchar2 default null
848   ,p_aat_attribute13                in     varchar2 default null
849   ,p_aat_attribute14                in     varchar2 default null
850   ,p_aat_attribute15                in     varchar2 default null
851   ,p_aat_attribute16                in     varchar2 default null
852   ,p_aat_attribute17                in     varchar2 default null
853   ,p_aat_attribute18                in     varchar2 default null
854   ,p_aat_attribute19                in     varchar2 default null
855   ,p_aat_attribute20                in     varchar2 default null
856   ,p_aat_information_category       in     varchar2 default null
857   ,p_aat_information1               in     varchar2 default null
858   ,p_aat_information2               in     varchar2 default null
859   ,p_aat_information3               in     varchar2 default null
860   ,p_aat_information4               in     varchar2 default null
861   ,p_aat_information5               in     varchar2 default null
862   ,p_aat_information6               in     varchar2 default null
863   ,p_aat_information7               in     varchar2 default null
864   ,p_aat_information8               in     varchar2 default null
865   ,p_aat_information9               in     varchar2 default null
866   ,p_aat_information10              in     varchar2 default null
867   ,p_aat_information11              in     varchar2 default null
868   ,p_aat_information12              in     varchar2 default null
869   ,p_aat_information13              in     varchar2 default null
870   ,p_aat_information14              in     varchar2 default null
871   ,p_aat_information15              in     varchar2 default null
872   ,p_aat_information16              in     varchar2 default null
873   ,p_aat_information17              in     varchar2 default null
874   ,p_aat_information18              in     varchar2 default null
875   ,p_aat_information19              in     varchar2 default null
876   ,p_aat_information20              in     varchar2 default null
877   ,p_lgps_process_flag              in     varchar2 default null
878   ,p_lgps_exclusion_type            in     varchar2 default null
879   ,p_lgps_pensionable_pay           in     varchar2 default null
880   ,p_lgps_trans_arrang_flag         in     varchar2 default null
881   ,p_lgps_membership_number         in     varchar2 default null
882   ,p_assignment_attribute_id           out nocopy number
883   ,p_object_version_number             out nocopy number
884   ,p_effective_start_date              out nocopy date
885   ,p_effective_end_date                out nocopy date
886   ) is
887 --
888   l_rec         pqp_aat_shd.g_rec_type;
889   l_proc        varchar2(72) := g_package||'ins';
890 --
891 Begin
892   hr_utility.set_location('Entering:'||l_proc, 5);
893   --
894   -- Call conversion function to turn arguments into the
895   -- p_rec structure.
896   --
897   l_rec :=
898   pqp_aat_shd.convert_args
899     (null
900     ,null
901     ,null
902     ,p_business_group_id
903     ,p_assignment_id
904     ,p_contract_type
905     ,p_work_pattern
906     ,p_start_day
907     ,null
908     ,p_primary_company_car
909     ,p_primary_car_fuel_benefit
910     ,p_primary_class_1a
911     ,p_primary_capital_contribution
912     ,p_primary_private_contribution
913     ,p_secondary_company_car
914     ,p_secondary_car_fuel_benefit
915     ,p_secondary_class_1a
916     ,p_secondary_capital_contributi
917     ,p_secondary_private_contributi
918     ,p_company_car_calc_method
919     ,p_company_car_rates_table_id
920     ,p_company_car_secondary_table
921     ,p_private_car
922     ,p_private_car_calc_method
923     ,p_private_car_rates_table_id
924     ,p_private_car_essential_table
925     ,p_tp_is_teacher
926     ,p_tp_headteacher_grp_code  --added for head Teacher seconded location for salary scale calculation
927     ,p_tp_safeguarded_grade
928     ,p_tp_safeguarded_grade_id
929     ,p_tp_safeguarded_rate_type
930     ,p_tp_safeguarded_rate_id
931     ,p_tp_spinal_point_id
932     ,p_tp_elected_pension
933     ,p_tp_fast_track
934     ,p_aat_attribute_category
935     ,p_aat_attribute1
936     ,p_aat_attribute2
937     ,p_aat_attribute3
938     ,p_aat_attribute4
939     ,p_aat_attribute5
940     ,p_aat_attribute6
941     ,p_aat_attribute7
942     ,p_aat_attribute8
943     ,p_aat_attribute9
944     ,p_aat_attribute10
945     ,p_aat_attribute11
946     ,p_aat_attribute12
947     ,p_aat_attribute13
948     ,p_aat_attribute14
949     ,p_aat_attribute15
950     ,p_aat_attribute16
951     ,p_aat_attribute17
952     ,p_aat_attribute18
953     ,p_aat_attribute19
954     ,p_aat_attribute20
955     ,p_aat_information_category
956     ,p_aat_information1
957     ,p_aat_information2
958     ,p_aat_information3
959     ,p_aat_information4
960     ,p_aat_information5
961     ,p_aat_information6
962     ,p_aat_information7
963     ,p_aat_information8
964     ,p_aat_information9
965     ,p_aat_information10
966     ,p_aat_information11
967     ,p_aat_information12
968     ,p_aat_information13
969     ,p_aat_information14
970     ,p_aat_information15
971     ,p_aat_information16
972     ,p_aat_information17
973     ,p_aat_information18
974     ,p_aat_information19
975     ,p_aat_information20
976     ,p_lgps_process_flag
977     ,p_lgps_exclusion_type
978     ,p_lgps_pensionable_pay
979     ,p_lgps_trans_arrang_flag
980     ,p_lgps_membership_number
981     );
982   --
983   -- Having converted the arguments into the pqp_aat_rec
984   -- plsql record structure we call the corresponding record
985   -- business process.
986   --
987   pqp_aat_ins.ins
988     (p_effective_date
989     ,l_rec
990     );
991   --
992   -- Set the OUT arguments.
993   --
994   p_assignment_attribute_id          := l_rec.assignment_attribute_id;
995   p_effective_start_date             := l_rec.effective_start_date;
996   p_effective_end_date               := l_rec.effective_end_date;
997   p_object_version_number            := l_rec.object_version_number;
998   --
999   --
1000   hr_utility.set_location(' Leaving:'||l_proc, 10);
1001 End ins;
1002 --
1003 end pqp_aat_ins;