[Home] [Help]
PACKAGE BODY: APPS.PER_ABB_INS
Source
1 Package Body per_abb_ins as
2 /* $Header: peabbrhi.pkb 120.3 2006/03/03 06:26 bshukla noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_abb_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_absence_attendance_type_id_i number default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19 (p_absence_attendance_type_id in number) is
20 --
21 l_proc varchar2(72) := g_package||'set_base_key_value';
25 --
22 --
23 Begin
24 hr_utility.set_location('Entering:'||l_proc, 10);
26 per_abb_ins.g_absence_attendance_type_id_i := p_absence_attendance_type_id;
27 --
28 hr_utility.set_location(' Leaving:'||l_proc, 20);
29 End set_base_key_value;
30 --
31 --
32 -- ----------------------------------------------------------------------------
33 -- |------------------------------< insert_dml >------------------------------|
34 -- ----------------------------------------------------------------------------
35 -- {Start Of Comments}
36 --
37 -- Description:
38 -- This procedure controls the actual dml insert logic. The processing of
39 -- this procedure are as follows:
40 -- 1) Initialise the object_version_number to 1 if the object_version_number
41 -- is defined as an attribute for this entity.
42 -- 2) To set and unset the g_api_dml status as required (as we are about to
43 -- perform dml).
44 -- 3) To insert the row into the schema.
45 -- 4) To trap any constraint violations that may have occurred.
46 -- 5) To raise any other errors.
47 --
48 -- Prerequisites:
49 -- This is an internal private procedure which must be called from the ins
50 -- procedure and must have all mandatory attributes set (except the
51 -- object_version_number which is initialised within this procedure).
52 --
53 -- In Parameters:
54 -- A Pl/Sql record structre.
55 --
56 -- Post Success:
57 -- The specified row will be inserted into the schema.
58 --
59 -- Post Failure:
60 -- On the insert dml failure it is important to note that we always reset the
61 -- g_api_dml status to false.
62 -- If a check, unique or parent integrity constraint violation is raised the
63 -- constraint_error procedure will be called.
64 -- If any other error is reported, the error will be raised after the
65 -- g_api_dml status is reset.
66 --
67 -- Developer Implementation Notes:
68 -- None.
69 --
70 -- Access Status:
71 -- Internal Row Handler Use Only.
72 --
73 -- {End Of Comments}
74 -- ----------------------------------------------------------------------------
75 Procedure insert_dml
76 (p_rec in out nocopy per_abb_shd.g_rec_type
77 ) is
78 --
79 l_proc varchar2(72) := g_package||'insert_dml';
80 --
81 Begin
82 hr_utility.set_location('Entering:'||l_proc, 5);
83 p_rec.object_version_number := 1; -- Initialise the object version
84 --
85 per_abb_shd.g_api_dml := true; -- Set the api dml status
86 --
87 -- Insert the row into: per_absence_attendance_types
88 --
89 insert into per_absence_attendance_types
90 (absence_attendance_type_id
91 ,business_group_id
92 ,input_value_id
93 ,date_effective
94 ,name
95 ,absence_category
96 ,comments
97 ,date_end
98 ,hours_or_days
99 ,increasing_or_decreasing_flag
100 ,request_id
101 ,program_application_id
102 ,program_id
103 ,program_update_date
104 ,attribute_category
105 ,attribute1
106 ,attribute2
107 ,attribute3
108 ,attribute4
109 ,attribute5
110 ,attribute6
111 ,attribute7
112 ,attribute8
113 ,attribute9
114 ,attribute10
115 ,attribute11
116 ,attribute12
117 ,attribute13
118 ,attribute14
119 ,attribute15
120 ,attribute16
121 ,attribute17
122 ,attribute18
123 ,attribute19
124 ,attribute20
125 ,object_version_number
126 ,information_category
127 ,information1
128 ,information2
129 ,information3
130 ,information4
131 ,information5
132 ,information6
133 ,information7
134 ,information8
135 ,information9
136 ,information10
137 ,information11
138 ,information12
139 ,information13
140 ,information14
141 ,information15
142 ,information16
143 ,information17
144 ,information18
145 ,information19
146 ,information20
147 ,user_role
148 ,assignment_status_type_id
149 ,advance_pay
150 ,absence_overlap_flag
151 )
152 Values
153 (p_rec.absence_attendance_type_id
154 ,p_rec.business_group_id
155 ,p_rec.input_value_id
156 ,p_rec.date_effective
157 ,p_rec.name
158 ,p_rec.absence_category
159 ,p_rec.comments
160 ,p_rec.date_end
161 ,p_rec.hours_or_days
162 ,p_rec.increasing_or_decreasing_flag
163 ,p_rec.request_id
164 ,p_rec.program_application_id
165 ,p_rec.program_id
166 ,p_rec.program_update_date
167 ,p_rec.attribute_category
168 ,p_rec.attribute1
169 ,p_rec.attribute2
170 ,p_rec.attribute3
171 ,p_rec.attribute4
172 ,p_rec.attribute5
173 ,p_rec.attribute6
174 ,p_rec.attribute7
175 ,p_rec.attribute8
176 ,p_rec.attribute9
177 ,p_rec.attribute10
178 ,p_rec.attribute11
179 ,p_rec.attribute12
180 ,p_rec.attribute13
181 ,p_rec.attribute14
182 ,p_rec.attribute15
183 ,p_rec.attribute16
184 ,p_rec.attribute17
185 ,p_rec.attribute18
186 ,p_rec.attribute19
187 ,p_rec.attribute20
188 ,p_rec.object_version_number
189 ,p_rec.information_category
190 ,p_rec.information1
191 ,p_rec.information2
192 ,p_rec.information3
193 ,p_rec.information4
194 ,p_rec.information5
195 ,p_rec.information6
196 ,p_rec.information7
197 ,p_rec.information8
198 ,p_rec.information9
199 ,p_rec.information10
200 ,p_rec.information11
201 ,p_rec.information12
202 ,p_rec.information13
203 ,p_rec.information14
204 ,p_rec.information15
205 ,p_rec.information16
206 ,p_rec.information17
207 ,p_rec.information18
208 ,p_rec.information19
209 ,p_rec.information20
210 ,p_rec.user_role
211 ,p_rec.assignment_status_type_id
212 ,p_rec.advance_pay
213 ,p_rec.absence_overlap_flag
214 );
215 --
216 per_abb_shd.g_api_dml := false; -- Unset the api dml status
217 --
218 hr_utility.set_location(' Leaving:'||l_proc, 10);
219 Exception
220 When hr_api.check_integrity_violated Then
221 -- A check constraint has been violated
222 per_abb_shd.g_api_dml := false; -- Unset the api dml status
226 -- Parent integrity has been violated
223 per_abb_shd.constraint_error
224 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
225 When hr_api.parent_integrity_violated Then
227 per_abb_shd.g_api_dml := false; -- Unset the api dml status
228 per_abb_shd.constraint_error
229 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
230 When hr_api.unique_integrity_violated Then
231 -- Unique integrity has been violated
232 per_abb_shd.g_api_dml := false; -- Unset the api dml status
233 per_abb_shd.constraint_error
234 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
235 When Others Then
236 per_abb_shd.g_api_dml := false; -- Unset the api dml status
237 Raise;
238 End insert_dml;
239 --
240 -- ----------------------------------------------------------------------------
241 -- |------------------------------< pre_insert >------------------------------|
242 -- ----------------------------------------------------------------------------
243 -- {Start Of Comments}
244 --
245 -- Description:
246 -- This private procedure contains any processing which is required before
247 -- the insert dml. Presently, if the entity has a corresponding primary
248 -- key which is maintained by an associating sequence, the primary key for
249 -- the entity will be populated with the next sequence value in
250 -- preparation for the insert dml.
251 --
252 -- Prerequisites:
253 -- This is an internal procedure which is called from the ins procedure.
254 --
255 -- In Parameters:
256 -- A Pl/Sql record structure.
257 --
258 -- Post Success:
259 -- Processing continues.
260 --
261 -- Post Failure:
262 -- If an error has occurred, an error message and exception will be raised
263 -- but not handled.
264 --
265 -- Developer Implementation Notes:
266 -- Any pre-processing required before the insert dml is issued should be
267 -- coded within this procedure. As stated above, a good example is the
268 -- generation of a primary key number via a corresponding sequence.
269 -- It is important to note that any 3rd party maintenance should be reviewed
270 -- before placing in this procedure.
271 --
272 -- Access Status:
273 -- Internal Row Handler Use Only.
274 --
275 -- {End Of Comments}
276 -- ----------------------------------------------------------------------------
277 Procedure pre_insert
278 (p_rec in out nocopy per_abb_shd.g_rec_type
279 ) is
280 --
281 Cursor C_Sel1 is select per_absence_attendance_types_s.nextval from sys.dual;
282 --
283 Cursor C_Sel2 is
284 Select null
285 from per_absence_attendance_types
286 where absence_attendance_type_id =
287 per_abb_ins.g_absence_attendance_type_id_i;
288 --
289 l_proc varchar2(72) := g_package||'pre_insert';
290 l_exists varchar2(1);
291 --
292 Begin
293 hr_utility.set_location('Entering:'||l_proc, 5);
294 --
295 If (per_abb_ins.g_absence_attendance_type_id_i is not null) Then
296 --
297 -- Verify registered primary key values not already in use
298 --
299 Open C_Sel2;
300 Fetch C_Sel2 into l_exists;
301 If C_Sel2%found Then
302 Close C_Sel2;
303 --
304 -- The primary key values are already in use.
305 --
306 fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
307 fnd_message.set_token('TABLE_NAME','per_absence_attendance_types');
308 fnd_message.raise_error;
309 End If;
310 Close C_Sel2;
311 --
312 -- Use registered key values and clear globals
313 --
314 p_rec.absence_attendance_type_id :=
315 per_abb_ins.g_absence_attendance_type_id_i;
316 per_abb_ins.g_absence_attendance_type_id_i := null;
317 Else
318 --
319 -- No registerd key values, so select the next sequence number
320 --
321 --
322 -- Select the next sequence number
323 --
324 Open C_Sel1;
325 Fetch C_Sel1 Into p_rec.absence_attendance_type_id;
326 Close C_Sel1;
327 End If;
328 --
329 hr_utility.set_location(' Leaving:'||l_proc, 10);
330 End pre_insert;
331 --
332 -- ----------------------------------------------------------------------------
333 -- |-----------------------------< post_insert >------------------------------|
334 -- ----------------------------------------------------------------------------
335 -- {Start Of Comments}
336 --
337 -- Description:
338 -- This private procedure contains any processing which is required after
339 -- the insert dml.
340 --
341 -- Prerequisites:
342 -- This is an internal procedure which is called from the ins procedure.
343 --
344 -- In Parameters:
345 -- A Pl/Sql record structre.
346 --
347 -- Post Success:
348 -- Processing continues.
349 --
350 -- Post Failure:
351 -- If an error has occurred, an error message and exception will be raised
352 -- but not handled.
353 --
354 -- Developer Implementation Notes:
355 -- Any post-processing required after the insert dml is issued should be
356 -- coded within this procedure. It is important to note that any 3rd party
357 -- maintenance should be reviewed before placing in this procedure.
358 --
359 -- Access Status:
360 -- Internal Row Handler Use Only.
361 --
362 -- {End Of Comments}
366 ) is
363 -- ----------------------------------------------------------------------------
364 Procedure post_insert
365 (p_rec in per_abb_shd.g_rec_type
367 --
368 l_proc varchar2(72) := g_package||'post_insert';
369 --
370 Begin
371 hr_utility.set_location('Entering:'||l_proc, 5);
372 begin
373 --
374 per_abb_rki.after_insert
375 (p_absence_attendance_type_id
376 => p_rec.absence_attendance_type_id
377 ,p_business_group_id
378 => p_rec.business_group_id
379 ,p_input_value_id
380 => p_rec.input_value_id
381 ,p_date_effective
382 => p_rec.date_effective
383 ,p_name
384 => p_rec.name
385 ,p_absence_category
386 => p_rec.absence_category
387 ,p_comments
388 => p_rec.comments
389 ,p_date_end
390 => p_rec.date_end
391 ,p_hours_or_days
392 => p_rec.hours_or_days
393 ,p_inc_or_dec_flag
394 => p_rec.increasing_or_decreasing_flag
395 ,p_request_id
396 => p_rec.request_id
397 ,p_program_application_id
398 => p_rec.program_application_id
399 ,p_program_id
400 => p_rec.program_id
401 ,p_program_update_date
402 => p_rec.program_update_date
403 ,p_attribute_category
404 => p_rec.attribute_category
405 ,p_attribute1
406 => p_rec.attribute1
407 ,p_attribute2
408 => p_rec.attribute2
409 ,p_attribute3
410 => p_rec.attribute3
411 ,p_attribute4
412 => p_rec.attribute4
413 ,p_attribute5
414 => p_rec.attribute5
415 ,p_attribute6
416 => p_rec.attribute6
417 ,p_attribute7
418 => p_rec.attribute7
419 ,p_attribute8
420 => p_rec.attribute8
421 ,p_attribute9
422 => p_rec.attribute9
423 ,p_attribute10
424 => p_rec.attribute10
425 ,p_attribute11
426 => p_rec.attribute11
427 ,p_attribute12
428 => p_rec.attribute12
429 ,p_attribute13
430 => p_rec.attribute13
431 ,p_attribute14
432 => p_rec.attribute14
433 ,p_attribute15
434 => p_rec.attribute15
435 ,p_attribute16
436 => p_rec.attribute16
437 ,p_attribute17
438 => p_rec.attribute17
439 ,p_attribute18
440 => p_rec.attribute18
441 ,p_attribute19
442 => p_rec.attribute19
443 ,p_attribute20
444 => p_rec.attribute20
445 ,p_object_version_number
446 => p_rec.object_version_number
447 ,p_information_category
448 => p_rec.information_category
449 ,p_information1
450 => p_rec.information1
451 ,p_information2
452 => p_rec.information2
453 ,p_information3
454 => p_rec.information3
455 ,p_information4
456 => p_rec.information4
457 ,p_information5
458 => p_rec.information5
459 ,p_information6
460 => p_rec.information6
461 ,p_information7
462 => p_rec.information7
463 ,p_information8
464 => p_rec.information8
465 ,p_information9
466 => p_rec.information9
467 ,p_information10
468 => p_rec.information10
469 ,p_information11
470 => p_rec.information11
471 ,p_information12
472 => p_rec.information12
473 ,p_information13
474 => p_rec.information13
475 ,p_information14
476 => p_rec.information14
477 ,p_information15
478 => p_rec.information15
479 ,p_information16
480 => p_rec.information16
481 ,p_information17
482 => p_rec.information17
483 ,p_information18
484 => p_rec.information18
485 ,p_information19
486 => p_rec.information19
487 ,p_information20
488 => p_rec.information20
489 --
490 ,p_user_role
491 => p_rec.user_role
492 ,p_assignment_status_type_id
493 => p_rec.assignment_status_type_id
494 ,p_advance_pay
495 => p_rec.advance_pay
496 ,p_absence_overlap_flag
497 => p_rec.absence_overlap_flag
498 );
499 --
500 exception
501 --
502 when hr_api.cannot_find_prog_unit then
503 --
504 hr_api.cannot_find_prog_unit_error
505 (p_module_name => 'PER_ABSENCE_ATTENDANCE_TYPES'
506 ,p_hook_type => 'AI');
507 --
508 end;
509 --
510 hr_utility.set_location(' Leaving:'||l_proc, 10);
511 End post_insert;
512 --
513 -- ----------------------------------------------------------------------------
514 -- |---------------------------------< ins >----------------------------------|
515 -- ----------------------------------------------------------------------------
516 Procedure ins
517 (p_rec in out nocopy per_abb_shd.g_rec_type
518 ) is
519 --
520 l_proc varchar2(72) := g_package||'ins';
521 --
522 Begin
523 hr_utility.set_location('Entering:'||l_proc, 5);
524 --
525 -- Call the supporting insert validate operations
526 --
527 per_abb_bus.insert_validate
528 (p_rec
529 );
530 --
531 -- Call to raise any errors on multi-message list
532 hr_multi_message.end_validation_set;
533 --
534 -- Call the supporting pre-insert operation
538 -- Insert the row
535 --
536 per_abb_ins.pre_insert(p_rec);
537 --
539 --
540 per_abb_ins.insert_dml(p_rec);
541 --
542 -- Call the supporting post-insert operation
543 --
544 per_abb_ins.post_insert
545 (p_rec
546 );
547 --
548 -- Call to raise any errors on multi-message list
549 hr_multi_message.end_validation_set;
550 --
551 hr_utility.set_location('Leaving:'||l_proc, 20);
552 end ins;
553 --
554 -- ----------------------------------------------------------------------------
555 -- |---------------------------------< ins >----------------------------------|
556 -- ----------------------------------------------------------------------------
557 Procedure ins
558 (p_business_group_id in number
559 ,p_date_effective in date
560 ,p_name in varchar2
561 ,p_input_value_id in number default null
562 ,p_absence_category in varchar2 default null
563 ,p_comments in varchar2 default null
564 ,p_date_end in out nocopy date
565 ,p_hours_or_days in varchar2 default null
566 ,p_inc_or_dec_flag in varchar2 default null
567 ,p_request_id in number default null
568 ,p_program_application_id in number default null
569 ,p_program_id in number default null
570 ,p_program_update_date in date default null
571 ,p_attribute_category in varchar2 default null
572 ,p_attribute1 in varchar2 default null
573 ,p_attribute2 in varchar2 default null
574 ,p_attribute3 in varchar2 default null
575 ,p_attribute4 in varchar2 default null
576 ,p_attribute5 in varchar2 default null
577 ,p_attribute6 in varchar2 default null
578 ,p_attribute7 in varchar2 default null
579 ,p_attribute8 in varchar2 default null
580 ,p_attribute9 in varchar2 default null
581 ,p_attribute10 in varchar2 default null
582 ,p_attribute11 in varchar2 default null
583 ,p_attribute12 in varchar2 default null
584 ,p_attribute13 in varchar2 default null
585 ,p_attribute14 in varchar2 default null
586 ,p_attribute15 in varchar2 default null
587 ,p_attribute16 in varchar2 default null
588 ,p_attribute17 in varchar2 default null
589 ,p_attribute18 in varchar2 default null
590 ,p_attribute19 in varchar2 default null
591 ,p_attribute20 in varchar2 default null
592 ,p_information_category in varchar2 default null
593 ,p_information1 in varchar2 default null
594 ,p_information2 in varchar2 default null
595 ,p_information3 in varchar2 default null
596 ,p_information4 in varchar2 default null
597 ,p_information5 in varchar2 default null
598 ,p_information6 in varchar2 default null
599 ,p_information7 in varchar2 default null
600 ,p_information8 in varchar2 default null
601 ,p_information9 in varchar2 default null
602 ,p_information10 in varchar2 default null
603 ,p_information11 in varchar2 default null
604 ,p_information12 in varchar2 default null
605 ,p_information13 in varchar2 default null
606 ,p_information14 in varchar2 default null
607 ,p_information15 in varchar2 default null
608 ,p_information16 in varchar2 default null
609 ,p_information17 in varchar2 default null
610 ,p_information18 in varchar2 default null
611 ,p_information19 in varchar2 default null
612 ,p_information20 in varchar2 default null
613 ,p_user_role in varchar2 default null
614 ,p_assignment_status_type_id in number default null
615 ,p_advance_pay in varchar2 default null
616 ,p_absence_overlap_flag in varchar2 default null
617 ,p_absence_attendance_type_id out nocopy number
618 ,p_object_version_number out nocopy number
619 ) is
620 --
621 l_rec per_abb_shd.g_rec_type;
622 l_proc varchar2(72) := g_package||'ins';
623 --
624 Begin
625 hr_utility.set_location('Entering:'||l_proc, 5);
626 --
627 -- Call conversion function to turn arguments into the
628 -- p_rec structure.
629 --
630 l_rec :=
631 per_abb_shd.convert_args
632 (null
633 ,p_business_group_id
634 ,p_input_value_id
635 ,p_date_effective
636 ,p_name
637 ,p_absence_category
638 ,p_comments
639 ,p_date_end
640 ,p_hours_or_days
641 ,p_inc_or_dec_flag
642 ,p_request_id
643 ,p_program_application_id
644 ,p_program_id
645 ,p_program_update_date
646 ,p_attribute_category
647 ,p_attribute1
648 ,p_attribute2
649 ,p_attribute3
650 ,p_attribute4
651 ,p_attribute5
652 ,p_attribute6
653 ,p_attribute7
654 ,p_attribute8
655 ,p_attribute9
656 ,p_attribute10
660 ,p_attribute14
657 ,p_attribute11
658 ,p_attribute12
659 ,p_attribute13
661 ,p_attribute15
662 ,p_attribute16
663 ,p_attribute17
664 ,p_attribute18
665 ,p_attribute19
666 ,p_attribute20
667 ,null
668 ,p_information_category
669 ,p_information1
670 ,p_information2
671 ,p_information3
672 ,p_information4
673 ,p_information5
674 ,p_information6
675 ,p_information7
676 ,p_information8
677 ,p_information9
678 ,p_information10
679 ,p_information11
680 ,p_information12
681 ,p_information13
682 ,p_information14
683 ,p_information15
684 ,p_information16
685 ,p_information17
686 ,p_information18
687 ,p_information19
688 ,p_information20
689 --
690 ,p_user_role
691 ,p_assignment_status_type_id
692 ,p_advance_pay
693 ,p_absence_overlap_flag
694 --
695 );
696 --
697 -- Having converted the arguments into the per_abb_rec
698 -- plsql record structure we call the corresponding record business process.
699 --
700 per_abb_ins.ins
701 (l_rec
702 );
703 --
704 -- As the primary key argument(s)
705 -- are specified as an OUT's we must set these values.
706 --
707 p_absence_attendance_type_id := l_rec.absence_attendance_type_id;
708 p_object_version_number := l_rec.object_version_number;
709 p_date_end := l_rec.date_end;
710 --
711 hr_utility.set_location(' Leaving:'||l_proc, 10);
712 End ins;
713 --
714 end per_abb_ins;