[Home] [Help]
PACKAGE BODY: APPS.PSP_ERA_INS
Source
1 Package Body psp_era_ins as
2 /* $Header: PSPEARHB.pls 120.2 2006/03/26 01:08 dpaudel noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' psp_era_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_effort_report_approval_id_i number default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19 (p_effort_report_approval_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 psp_era_ins.g_effort_report_approval_id_i := p_effort_report_approval_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 psp_era_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 --
86 --
87 -- Insert the row into: psp_eff_report_approvals
88 --
89 insert into psp_eff_report_approvals
90 (effort_report_approval_id
91 ,effort_report_detail_id
92 ,wf_role_name
93 ,wf_orig_system_id
94 ,wf_orig_system
95 ,approver_order_num
96 ,approval_status
97 ,response_date
98 ,actual_cost_share
99 ,overwritten_effort_percent
100 ,wf_item_key
101 ,comments
102 ,pera_information_category
103 ,pera_information1
104 ,pera_information2
105 ,pera_information3
106 ,pera_information4
107 ,pera_information5
108 ,pera_information6
109 ,pera_information7
110 ,pera_information8
111 ,pera_information9
112 ,pera_information10
113 ,pera_information11
114 ,pera_information12
115 ,pera_information13
116 ,pera_information14
117 ,pera_information15
118 ,pera_information16
119 ,pera_information17
120 ,pera_information18
121 ,pera_information19
122 ,pera_information20
123 ,wf_role_display_name
124 ,object_version_number
125 ,notification_id
126 ,eff_information_category
127 ,eff_information1
128 ,eff_information2
129 ,eff_information3
130 ,eff_information4
131 ,eff_information5
132 ,eff_information6
133 ,eff_information7
134 ,eff_information8
135 ,eff_information9
136 ,eff_information10
137 ,eff_information11
138 ,eff_information12
139 ,eff_information13
140 ,eff_information14
141 ,eff_information15
142 )
143 Values
144 (p_rec.effort_report_approval_id
145 ,p_rec.effort_report_detail_id
146 ,p_rec.wf_role_name
147 ,p_rec.wf_orig_system_id
148 ,p_rec.wf_orig_system
149 ,p_rec.approver_order_num
150 ,p_rec.approval_status
151 ,p_rec.response_date
152 ,p_rec.actual_cost_share
153 ,p_rec.overwritten_effort_percent
154 ,p_rec.wf_item_key
155 ,p_rec.comments
156 ,p_rec.pera_information_category
157 ,p_rec.pera_information1
158 ,p_rec.pera_information2
159 ,p_rec.pera_information3
160 ,p_rec.pera_information4
161 ,p_rec.pera_information5
162 ,p_rec.pera_information6
163 ,p_rec.pera_information7
164 ,p_rec.pera_information8
165 ,p_rec.pera_information9
166 ,p_rec.pera_information10
167 ,p_rec.pera_information11
168 ,p_rec.pera_information12
169 ,p_rec.pera_information13
170 ,p_rec.pera_information14
171 ,p_rec.pera_information15
172 ,p_rec.pera_information16
173 ,p_rec.pera_information17
174 ,p_rec.pera_information18
175 ,p_rec.pera_information19
176 ,p_rec.pera_information20
177 ,p_rec.wf_role_display_name
178 ,p_rec.object_version_number
179 ,p_rec.notification_id
180 ,p_rec.eff_information_category
181 ,p_rec.eff_information1
182 ,p_rec.eff_information2
183 ,p_rec.eff_information3
184 ,p_rec.eff_information4
185 ,p_rec.eff_information5
186 ,p_rec.eff_information6
187 ,p_rec.eff_information7
188 ,p_rec.eff_information8
189 ,p_rec.eff_information9
190 ,p_rec.eff_information10
191 ,p_rec.eff_information11
192 ,p_rec.eff_information12
193 ,p_rec.eff_information13
194 ,p_rec.eff_information14
195 ,p_rec.eff_information15
196 );
197 --
198 --
199 --
200 hr_utility.set_location(' Leaving:'||l_proc, 10);
201 Exception
202 When hr_api.check_integrity_violated Then
203 -- A check constraint has been violated
204 --
205 psp_era_shd.constraint_error
206 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
207 When hr_api.parent_integrity_violated Then
208 -- Parent integrity has been violated
209 --
210 psp_era_shd.constraint_error
211 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
212 When hr_api.unique_integrity_violated Then
213 -- Unique integrity has been violated
214 --
215 psp_era_shd.constraint_error
216 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
217 When Others Then
218 --
219 Raise;
220 End insert_dml;
221 --
222 -- ----------------------------------------------------------------------------
223 -- |------------------------------< pre_insert >------------------------------|
224 -- ----------------------------------------------------------------------------
225 -- {Start Of Comments}
226 --
227 -- Description:
228 -- This private procedure contains any processing which is required before
229 -- the insert dml. Presently, if the entity has a corresponding primary
230 -- key which is maintained by an associating sequence, the primary key for
231 -- the entity will be populated with the next sequence value in
232 -- preparation for the insert dml.
233 --
234 -- Prerequisites:
235 -- This is an internal procedure which is called from the ins procedure.
236 --
237 -- In Parameters:
238 -- A Pl/Sql record structure.
239 --
240 -- Post Success:
241 -- Processing continues.
242 --
243 -- Post Failure:
244 -- If an error has occurred, an error message and exception will be raised
245 -- but not handled.
246 --
247 -- Developer Implementation Notes:
248 -- Any pre-processing required before the insert dml is issued should be
249 -- coded within this procedure. As stated above, a good example is the
250 -- generation of a primary key number via a corresponding sequence.
251 -- It is important to note that any 3rd party maintenance should be reviewed
252 -- before placing in this procedure.
253 --
254 -- Access Status:
255 -- Internal Row Handler Use Only.
256 --
257 -- {End Of Comments}
258 -- ----------------------------------------------------------------------------
259 Procedure pre_insert
260 (p_rec in out nocopy psp_era_shd.g_rec_type
261 ) is
262 --
263 Cursor C_Sel1 is select psp_eff_report_approvals_s.nextval from sys.dual;
264 --
265 Cursor C_Sel2 is
266 Select null
267 from psp_eff_report_approvals
268 where effort_report_approval_id =
269 psp_era_ins.g_effort_report_approval_id_i;
270 --
271 l_proc varchar2(72) := g_package||'pre_insert';
272 l_exists varchar2(1);
273 --
274 Begin
275 hr_utility.set_location('Entering:'||l_proc, 5);
276 --
277 If (psp_era_ins.g_effort_report_approval_id_i is not null) Then
278 --
279 -- Verify registered primary key values not already in use
280 --
281 Open C_Sel2;
282 Fetch C_Sel2 into l_exists;
283 If C_Sel2%found Then
284 Close C_Sel2;
285 --
286 -- The primary key values are already in use.
287 --
288 fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
289 fnd_message.set_token('TABLE_NAME','psp_eff_report_approvals');
290 fnd_message.raise_error;
291 End If;
292 Close C_Sel2;
293 --
294 -- Use registered key values and clear globals
295 --
296 p_rec.effort_report_approval_id :=
297 psp_era_ins.g_effort_report_approval_id_i;
298 psp_era_ins.g_effort_report_approval_id_i := null;
299 Else
300 --
301 -- No registerd key values, so select the next sequence number
302 --
303 --
304 -- Select the next sequence number
305 --
306 Open C_Sel1;
307 Fetch C_Sel1 Into p_rec.effort_report_approval_id;
308 Close C_Sel1;
309 End If;
310 --
311 hr_utility.set_location(' Leaving:'||l_proc, 10);
312 End pre_insert;
313 --
314 -- ----------------------------------------------------------------------------
315 -- |-----------------------------< post_insert >------------------------------|
316 -- ----------------------------------------------------------------------------
317 -- {Start Of Comments}
318 --
319 -- Description:
320 -- This private procedure contains any processing which is required after
321 -- the insert dml.
322 --
323 -- Prerequisites:
324 -- This is an internal procedure which is called from the ins procedure.
325 --
326 -- In Parameters:
327 -- A Pl/Sql record structre.
328 --
329 -- Post Success:
330 -- Processing continues.
331 --
332 -- Post Failure:
333 -- If an error has occurred, an error message and exception will be raised
334 -- but not handled.
335 --
336 -- Developer Implementation Notes:
337 -- Any post-processing required after the insert dml is issued should be
338 -- coded within this procedure. It is important to note that any 3rd party
339 -- maintenance should be reviewed before placing in this procedure.
340 --
341 -- Access Status:
342 -- Internal Row Handler Use Only.
343 --
344 -- {End Of Comments}
345 -- ----------------------------------------------------------------------------
346 Procedure post_insert
347 (p_rec in psp_era_shd.g_rec_type
348 ) is
349 --
350 l_proc varchar2(72) := g_package||'post_insert';
351 --
352 Begin
353 hr_utility.set_location('Entering:'||l_proc, 5);
354 begin
355 --
356 psp_era_rki.after_insert
357 (p_effort_report_approval_id
358 => p_rec.effort_report_approval_id
359 ,p_effort_report_detail_id
360 => p_rec.effort_report_detail_id
361 ,p_wf_role_name
362 => p_rec.wf_role_name
363 ,p_wf_orig_system_id
364 => p_rec.wf_orig_system_id
365 ,p_wf_orig_system
366 => p_rec.wf_orig_system
367 ,p_approver_order_num
368 => p_rec.approver_order_num
369 ,p_approval_status
370 => p_rec.approval_status
371 ,p_response_date
372 => p_rec.response_date
373 ,p_actual_cost_share
374 => p_rec.actual_cost_share
375 ,p_overwritten_effort_percent
376 => p_rec.overwritten_effort_percent
377 ,p_wf_item_key
378 => p_rec.wf_item_key
379 ,p_comments
380 => p_rec.comments
381 ,p_pera_information_category
382 => p_rec.pera_information_category
383 ,p_pera_information1
384 => p_rec.pera_information1
385 ,p_pera_information2
386 => p_rec.pera_information2
387 ,p_pera_information3
388 => p_rec.pera_information3
389 ,p_pera_information4
390 => p_rec.pera_information4
391 ,p_pera_information5
392 => p_rec.pera_information5
393 ,p_pera_information6
394 => p_rec.pera_information6
395 ,p_pera_information7
396 => p_rec.pera_information7
397 ,p_pera_information8
398 => p_rec.pera_information8
399 ,p_pera_information9
400 => p_rec.pera_information9
401 ,p_pera_information10
402 => p_rec.pera_information10
403 ,p_pera_information11
404 => p_rec.pera_information11
405 ,p_pera_information12
406 => p_rec.pera_information12
407 ,p_pera_information13
408 => p_rec.pera_information13
409 ,p_pera_information14
410 => p_rec.pera_information14
411 ,p_pera_information15
412 => p_rec.pera_information15
413 ,p_pera_information16
414 => p_rec.pera_information16
415 ,p_pera_information17
416 => p_rec.pera_information17
417 ,p_pera_information18
418 => p_rec.pera_information18
419 ,p_pera_information19
420 => p_rec.pera_information19
421 ,p_pera_information20
422 => p_rec.pera_information20
423 ,p_wf_role_display_name
424 => p_rec.wf_role_display_name
425 ,p_object_version_number
426 => p_rec.object_version_number
427 ,p_notification_id
428 => p_rec.notification_id
429 ,p_eff_information_category
430 => p_rec.eff_information_category
431 ,p_eff_information1
432 => p_rec.eff_information1
433 ,p_eff_information2
434 => p_rec.eff_information2
435 ,p_eff_information3
436 => p_rec.eff_information3
437 ,p_eff_information4
438 => p_rec.eff_information4
439 ,p_eff_information5
440 => p_rec.eff_information5
441 ,p_eff_information6
442 => p_rec.eff_information6
443 ,p_eff_information7
444 => p_rec.eff_information7
445 ,p_eff_information8
446 => p_rec.eff_information8
447 ,p_eff_information9
448 => p_rec.eff_information9
449 ,p_eff_information10
450 => p_rec.eff_information10
451 ,p_eff_information11
452 => p_rec.eff_information11
453 ,p_eff_information12
454 => p_rec.eff_information12
455 ,p_eff_information13
456 => p_rec.eff_information13
457 ,p_eff_information14
458 => p_rec.eff_information14
459 ,p_eff_information15
460 => p_rec.eff_information15
461 );
462 --
463 exception
464 --
465 when hr_api.cannot_find_prog_unit then
466 --
467 hr_api.cannot_find_prog_unit_error
468 (p_module_name => 'PSP_EFF_REPORT_APPROVALS'
469 ,p_hook_type => 'AI');
470 --
471 end;
472 --
473 hr_utility.set_location(' Leaving:'||l_proc, 10);
474 End post_insert;
475 --
476 -- ----------------------------------------------------------------------------
477 -- |---------------------------------< ins >----------------------------------|
478 -- ----------------------------------------------------------------------------
479 Procedure ins
480 (p_rec in out nocopy psp_era_shd.g_rec_type
481 ) is
482 --
483 l_proc varchar2(72) := g_package||'ins';
484 --
485 Begin
486 hr_utility.set_location('Entering:'||l_proc, 5);
487 --
488 -- Call the supporting insert validate operations
489 --
490 psp_era_bus.insert_validate
491 (p_rec
492 );
493 --
494 -- Call to raise any errors on multi-message list
495 hr_multi_message.end_validation_set;
496 --
497 -- Call the supporting pre-insert operation
498 --
499 psp_era_ins.pre_insert(p_rec);
500 --
501 -- Insert the row
502 --
503 psp_era_ins.insert_dml(p_rec);
504 --
505 -- Call the supporting post-insert operation
506 --
507 psp_era_ins.post_insert
508 (p_rec
509 );
510 --
511 -- Call to raise any errors on multi-message list
512 hr_multi_message.end_validation_set;
513 --
514 hr_utility.set_location('Leaving:'||l_proc, 20);
515 end ins;
516 --
517 -- ----------------------------------------------------------------------------
518 -- |---------------------------------< ins >----------------------------------|
519 -- ----------------------------------------------------------------------------
520 Procedure ins
521 (p_effort_report_detail_id in number default null
522 ,p_wf_role_name in varchar2 default null
523 ,p_wf_orig_system_id in number default null
524 ,p_wf_orig_system in varchar2 default null
525 ,p_approver_order_num in number default null
526 ,p_approval_status in varchar2 default null
527 ,p_response_date in date default null
528 ,p_actual_cost_share in number default null
529 ,p_overwritten_effort_percent in number default null
530 ,p_wf_item_key in varchar2 default null
531 ,p_comments in varchar2 default null
532 ,p_pera_information_category in varchar2 default null
533 ,p_pera_information1 in varchar2 default null
534 ,p_pera_information2 in varchar2 default null
535 ,p_pera_information3 in varchar2 default null
536 ,p_pera_information4 in varchar2 default null
537 ,p_pera_information5 in varchar2 default null
538 ,p_pera_information6 in varchar2 default null
539 ,p_pera_information7 in varchar2 default null
540 ,p_pera_information8 in varchar2 default null
541 ,p_pera_information9 in varchar2 default null
542 ,p_pera_information10 in varchar2 default null
543 ,p_pera_information11 in varchar2 default null
544 ,p_pera_information12 in varchar2 default null
545 ,p_pera_information13 in varchar2 default null
546 ,p_pera_information14 in varchar2 default null
547 ,p_pera_information15 in varchar2 default null
548 ,p_pera_information16 in varchar2 default null
549 ,p_pera_information17 in varchar2 default null
550 ,p_pera_information18 in varchar2 default null
551 ,p_pera_information19 in varchar2 default null
552 ,p_pera_information20 in varchar2 default null
553 ,p_wf_role_display_name in varchar2 default null
554 ,p_notification_id in number default null
555 ,p_eff_information_category in varchar2 default null
556 ,p_eff_information1 in varchar2 default null
557 ,p_eff_information2 in varchar2 default null
558 ,p_eff_information3 in varchar2 default null
559 ,p_eff_information4 in varchar2 default null
560 ,p_eff_information5 in varchar2 default null
561 ,p_eff_information6 in varchar2 default null
562 ,p_eff_information7 in varchar2 default null
563 ,p_eff_information8 in varchar2 default null
564 ,p_eff_information9 in varchar2 default null
565 ,p_eff_information10 in varchar2 default null
566 ,p_eff_information11 in varchar2 default null
567 ,p_eff_information12 in varchar2 default null
568 ,p_eff_information13 in varchar2 default null
569 ,p_eff_information14 in varchar2 default null
570 ,p_eff_information15 in varchar2 default null
571 ,p_effort_report_approval_id out nocopy number
572 ,p_object_version_number out nocopy number
573 ) is
574 --
575 l_rec psp_era_shd.g_rec_type;
576 l_proc varchar2(72) := g_package||'ins';
577 --
578 Begin
579 hr_utility.set_location('Entering:'||l_proc, 5);
580 --
581 -- Call conversion function to turn arguments into the
582 -- p_rec structure.
583 --
584 l_rec :=
585 psp_era_shd.convert_args
586 (null
587 ,p_effort_report_detail_id
588 ,p_wf_role_name
589 ,p_wf_orig_system_id
590 ,p_wf_orig_system
591 ,p_approver_order_num
592 ,p_approval_status
593 ,p_response_date
594 ,p_actual_cost_share
595 ,p_overwritten_effort_percent
596 ,p_wf_item_key
597 ,p_comments
598 ,p_pera_information_category
599 ,p_pera_information1
600 ,p_pera_information2
601 ,p_pera_information3
602 ,p_pera_information4
603 ,p_pera_information5
604 ,p_pera_information6
605 ,p_pera_information7
606 ,p_pera_information8
607 ,p_pera_information9
608 ,p_pera_information10
609 ,p_pera_information11
610 ,p_pera_information12
611 ,p_pera_information13
612 ,p_pera_information14
613 ,p_pera_information15
614 ,p_pera_information16
615 ,p_pera_information17
616 ,p_pera_information18
617 ,p_pera_information19
618 ,p_pera_information20
619 ,p_wf_role_display_name
620 ,null
621 ,p_notification_id
622 ,p_eff_information_category
623 ,p_eff_information1
624 ,p_eff_information2
625 ,p_eff_information3
626 ,p_eff_information4
627 ,p_eff_information5
628 ,p_eff_information6
629 ,p_eff_information7
630 ,p_eff_information8
631 ,p_eff_information9
632 ,p_eff_information10
633 ,p_eff_information11
634 ,p_eff_information12
635 ,p_eff_information13
636 ,p_eff_information14
637 ,p_eff_information15
638 );
639 --
640 -- Having converted the arguments into the psp_era_rec
641 -- plsql record structure we call the corresponding record business process.
642 --
643 psp_era_ins.ins
644 (l_rec
645 );
646 --
647 -- As the primary key argument(s)
648 -- are specified as an OUT's we must set these values.
649 --
650 p_effort_report_approval_id := l_rec.effort_report_approval_id;
651 p_object_version_number := l_rec.object_version_number;
652 --
653 hr_utility.set_location(' Leaving:'||l_proc, 10);
654 End ins;
655 --
656 end psp_era_ins;