DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PGN_INS

Source


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