DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PML_INS

Source


1 Package Body per_pml_ins as
2 /* $Header: pepmlrhi.pkb 120.5.12010000.2 2008/11/24 14:49:19 rsykam ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_pml_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_objective_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_objective_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   per_pml_ins.g_objective_id_i := p_objective_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_pml_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: per_objectives_library
88   --
89   insert into per_objectives_library
90       (objective_id
91       ,object_version_number
92       ,objective_name
93       ,valid_from
94       ,valid_to
95       ,target_date
96       ,next_review_date
97       ,group_code
98       ,priority_code
99       ,appraise_flag
100       ,weighting_percent
101       ,measurement_style_code
102       ,measure_name
103       ,target_value
104       ,uom_code
105       ,measure_type_code
106       ,measure_comments
107       ,eligibility_type_code
108       ,details
109       ,success_criteria
110       ,comments
111       ,attribute_category
112       ,attribute1
113       ,attribute2
114       ,attribute3
115       ,attribute4
116       ,attribute5
117       ,attribute6
118       ,attribute7
119       ,attribute8
120       ,attribute9
121       ,attribute10
122       ,attribute11
123       ,attribute12
124       ,attribute13
125       ,attribute14
126       ,attribute15
127       ,attribute16
128       ,attribute17
129       ,attribute18
130       ,attribute19
131       ,attribute20
132       ,attribute21
133       ,attribute22
134       ,attribute23
135       ,attribute24
136       ,attribute25
137       ,attribute26
138       ,attribute27
139       ,attribute28
140       ,attribute29
141       ,attribute30
142       )
143   Values
144     (p_rec.objective_id
145     ,p_rec.object_version_number
146     ,p_rec.objective_name
147     ,p_rec.valid_from
148     ,p_rec.valid_to
149     ,p_rec.target_date
150     ,p_rec.next_review_date
151     ,p_rec.group_code
152     ,p_rec.priority_code
153     ,p_rec.appraise_flag
154     ,p_rec.weighting_percent
155     ,p_rec.measurement_style_code
156     ,p_rec.measure_name
157     ,p_rec.target_value
158     ,p_rec.uom_code
159     ,p_rec.measure_type_code
160     ,p_rec.measure_comments
161     ,p_rec.eligibility_type_code
162     ,p_rec.details
163     ,p_rec.success_criteria
164     ,p_rec.comments
165     ,p_rec.attribute_category
166     ,p_rec.attribute1
167     ,p_rec.attribute2
168     ,p_rec.attribute3
169     ,p_rec.attribute4
170     ,p_rec.attribute5
171     ,p_rec.attribute6
172     ,p_rec.attribute7
173     ,p_rec.attribute8
174     ,p_rec.attribute9
175     ,p_rec.attribute10
176     ,p_rec.attribute11
177     ,p_rec.attribute12
178     ,p_rec.attribute13
179     ,p_rec.attribute14
180     ,p_rec.attribute15
181     ,p_rec.attribute16
182     ,p_rec.attribute17
183     ,p_rec.attribute18
184     ,p_rec.attribute19
185     ,p_rec.attribute20
186     ,p_rec.attribute21
187     ,p_rec.attribute22
188     ,p_rec.attribute23
189     ,p_rec.attribute24
190     ,p_rec.attribute25
191     ,p_rec.attribute26
192     ,p_rec.attribute27
193     ,p_rec.attribute28
194     ,p_rec.attribute29
195     ,p_rec.attribute30
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     per_pml_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     per_pml_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     per_pml_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 per_pml_shd.g_rec_type
261   ) is
262 --
263   Cursor C_Sel1 is select per_objectives_library_s.nextval from sys.dual;
264 --
265   Cursor C_Sel2 is
266     Select null
267       from per_objectives_library
268      where objective_id =
269              per_pml_ins.g_objective_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 (per_pml_ins.g_objective_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','per_objectives_library');
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.objective_id :=
297       per_pml_ins.g_objective_id_i;
298     per_pml_ins.g_objective_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.objective_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_effective_date               in date
348   ,p_rec                          in per_pml_shd.g_rec_type
349   ,p_duplicate_name_warning       in boolean
350   ,p_weighting_over_100_warning   in boolean
351   ,p_weighting_appraisal_warning  in boolean
352   ) is
353 --
354   l_proc  varchar2(72) := g_package||'post_insert';
355 --
356 Begin
357   hr_utility.set_location('Entering:'||l_proc, 5);
358   begin
359     --
360     per_pml_rki.after_insert
361       (p_effective_date              => p_effective_date
362       ,p_objective_id
363       => p_rec.objective_id
364       ,p_object_version_number
365       => p_rec.object_version_number
366       ,p_objective_name
367       => p_rec.objective_name
368       ,p_valid_from
369       => p_rec.valid_from
370       ,p_valid_to
371       => p_rec.valid_to
372       ,p_target_date
373       => p_rec.target_date
374       ,p_next_review_date
375       => p_rec.next_review_date
376       ,p_group_code
377       => p_rec.group_code
378       ,p_priority_code
379       => p_rec.priority_code
380       ,p_appraise_flag
381       => p_rec.appraise_flag
382       ,p_weighting_percent
383       => p_rec.weighting_percent
384       ,p_measurement_style_code
385       => p_rec.measurement_style_code
386       ,p_measure_name
387       => p_rec.measure_name
388       ,p_target_value
389       => p_rec.target_value
390       ,p_uom_code
391       => p_rec.uom_code
392       ,p_measure_type_code
393       => p_rec.measure_type_code
394       ,p_measure_comments
395       => p_rec.measure_comments
396       ,p_eligibility_type_code
397       => p_rec.eligibility_type_code
398       ,p_details
399       => p_rec.details
400       ,p_success_criteria
404       ,p_attribute_category
401       => p_rec.success_criteria
402       ,p_comments
403       => p_rec.comments
405       => p_rec.attribute_category
406       ,p_attribute1
407       => p_rec.attribute1
408       ,p_attribute2
409       => p_rec.attribute2
410       ,p_attribute3
411       => p_rec.attribute3
412       ,p_attribute4
413       => p_rec.attribute4
414       ,p_attribute5
415       => p_rec.attribute5
416       ,p_attribute6
417       => p_rec.attribute6
418       ,p_attribute7
419       => p_rec.attribute7
420       ,p_attribute8
421       => p_rec.attribute8
422       ,p_attribute9
423       => p_rec.attribute9
424       ,p_attribute10
425       => p_rec.attribute10
426       ,p_attribute11
427       => p_rec.attribute11
428       ,p_attribute12
429       => p_rec.attribute12
430       ,p_attribute13
431       => p_rec.attribute13
432       ,p_attribute14
433       => p_rec.attribute14
434       ,p_attribute15
435       => p_rec.attribute15
436       ,p_attribute16
437       => p_rec.attribute16
438       ,p_attribute17
439       => p_rec.attribute17
440       ,p_attribute18
441       => p_rec.attribute18
442       ,p_attribute19
443       => p_rec.attribute19
444       ,p_attribute20
445       => p_rec.attribute20
446       ,p_attribute21
447       => p_rec.attribute21
448       ,p_attribute22
449       => p_rec.attribute22
450       ,p_attribute23
451       => p_rec.attribute23
452       ,p_attribute24
453       => p_rec.attribute24
454       ,p_attribute25
455       => p_rec.attribute25
456       ,p_attribute26
457       => p_rec.attribute26
458       ,p_attribute27
459       => p_rec.attribute27
460       ,p_attribute28
461       => p_rec.attribute28
462       ,p_attribute29
463       => p_rec.attribute29
464       ,p_attribute30
465       => p_rec.attribute30
466       ,p_duplicate_name_warning
467       => p_duplicate_name_warning
468       ,p_weighting_over_100_warning
469       => p_weighting_over_100_warning
470       ,p_weighting_appraisal_warning
471       => p_weighting_appraisal_warning
472       );
473     --
474   exception
475     --
476     when hr_api.cannot_find_prog_unit then
477       --
478       hr_api.cannot_find_prog_unit_error
479         (p_module_name => 'PER_OBJECTIVES_LIBRARY'
480         ,p_hook_type   => 'AI');
481       --
482   end;
483   --
484   hr_utility.set_location(' Leaving:'||l_proc, 10);
485 End post_insert;
486 --
487 -- ----------------------------------------------------------------------------
488 -- |---------------------------------< ins >----------------------------------|
489 -- ----------------------------------------------------------------------------
490 Procedure ins
491   (p_effective_date               in     date
492   ,p_rec                          in out nocopy per_pml_shd.g_rec_type
493   ,p_duplicate_name_warning          out nocopy boolean
494   ,p_weighting_over_100_warning      out nocopy boolean
495   ,p_weighting_appraisal_warning     out nocopy boolean
496   ) is
497 --
498   l_proc  varchar2(72) := g_package||'ins';
499 
500 --
501 Begin
502 
503   hr_utility.set_location('Entering:'||l_proc, 5);
504   --
505   -- Call the supporting insert validate operations
506   --
507   per_pml_bus.insert_validate
508      (p_effective_date
509      ,p_rec
510      ,p_duplicate_name_warning
511      ,p_weighting_over_100_warning
512      ,p_weighting_appraisal_warning
513      );
514   --
515   -- Call to raise any errors on multi-message list
516   hr_multi_message.end_validation_set;
517   --
518   -- Call the supporting pre-insert operation
519   --
520   per_pml_ins.pre_insert(p_rec);
521   --
522   -- Insert the row
523   --
524   per_pml_ins.insert_dml(p_rec);
525   --
526   -- Call the supporting post-insert operation
527   --
528   per_pml_ins.post_insert
529      (p_effective_date              => p_effective_date
530      ,p_rec                         => p_rec
531      ,p_duplicate_name_warning      => p_duplicate_name_warning
532      ,p_weighting_over_100_warning  => p_weighting_over_100_warning
533      ,p_weighting_appraisal_warning => p_weighting_appraisal_warning
534      );
535   --
536   -- Call to raise any errors on multi-message list
537   hr_multi_message.end_validation_set;
538   --
539   hr_utility.set_location('Leaving:'||l_proc, 20);
540 end ins;
541 --
542 -- ----------------------------------------------------------------------------
543 -- |---------------------------------< ins >----------------------------------|
544 -- ----------------------------------------------------------------------------
545 Procedure ins
546   (p_effective_date               in     date
547   ,p_objective_name                 in     varchar2
548   ,p_measurement_style_code         in     varchar2
549   ,p_eligibility_type_code          in     varchar2
550   ,p_valid_from                     in     date     default null
554   ,p_group_code                     in     varchar2 default null
551   ,p_valid_to                       in     date     default null
552   ,p_target_date                    in     date     default null
553   ,p_next_review_date               in     date     default null
555   ,p_priority_code                  in     varchar2 default null
556   ,p_appraise_flag                  in     varchar2 default null
557   ,p_weighting_percent              in     number   default null
558   ,p_measure_name                   in     varchar2 default null
559   ,p_target_value                   in     number   default null
560   ,p_uom_code                       in     varchar2 default null
561   ,p_measure_type_code              in     varchar2 default null
562   ,p_measure_comments               in     varchar2 default null
563   ,p_details                        in     varchar2 default null
564   ,p_success_criteria               in     varchar2 default null
565   ,p_comments                       in     varchar2 default null
566   ,p_attribute_category             in     varchar2 default null
567   ,p_attribute1                     in     varchar2 default null
568   ,p_attribute2                     in     varchar2 default null
569   ,p_attribute3                     in     varchar2 default null
570   ,p_attribute4                     in     varchar2 default null
571   ,p_attribute5                     in     varchar2 default null
572   ,p_attribute6                     in     varchar2 default null
573   ,p_attribute7                     in     varchar2 default null
574   ,p_attribute8                     in     varchar2 default null
575   ,p_attribute9                     in     varchar2 default null
576   ,p_attribute10                    in     varchar2 default null
577   ,p_attribute11                    in     varchar2 default null
578   ,p_attribute12                    in     varchar2 default null
579   ,p_attribute13                    in     varchar2 default null
580   ,p_attribute14                    in     varchar2 default null
581   ,p_attribute15                    in     varchar2 default null
582   ,p_attribute16                    in     varchar2 default null
583   ,p_attribute17                    in     varchar2 default null
584   ,p_attribute18                    in     varchar2 default null
585   ,p_attribute19                    in     varchar2 default null
586   ,p_attribute20                    in     varchar2 default null
587   ,p_attribute21                    in     varchar2 default null
588   ,p_attribute22                    in     varchar2 default null
589   ,p_attribute23                    in     varchar2 default null
590   ,p_attribute24                    in     varchar2 default null
591   ,p_attribute25                    in     varchar2 default null
592   ,p_attribute26                    in     varchar2 default null
593   ,p_attribute27                    in     varchar2 default null
594   ,p_attribute28                    in     varchar2 default null
595   ,p_attribute29                    in     varchar2 default null
596   ,p_attribute30                    in     varchar2 default null
597   ,p_objective_id                      out nocopy number
598   ,p_object_version_number             out nocopy number
599   ,p_duplicate_name_warning            out nocopy   boolean
600   ,p_weighting_over_100_warning        out nocopy   boolean
601   ,p_weighting_appraisal_warning       out nocopy   boolean
602   ) is
603 --
604   l_rec   			 per_pml_shd.g_rec_type;
605   l_proc  			 varchar2(72) := g_package||'ins';
606   l_objective_name_warning       boolean;
607   l_duplicate_name_warning       boolean;
608   l_weighting_over_100_warning   boolean;
609   l_weighting_appraisal_warning  boolean;
610 
611 --
612 Begin
613   hr_utility.set_location('Entering:'||l_proc, 5);
614   --
615   -- Call conversion function to turn arguments into the
616   -- p_rec structure.
617   --
618   l_rec :=
619   per_pml_shd.convert_args
620     (null
621     ,null
622     ,p_objective_name
623     ,p_valid_from
624     ,p_valid_to
625     ,p_target_date
626     ,p_next_review_date
627     ,p_group_code
628     ,p_priority_code
629     ,p_appraise_flag
630     ,p_weighting_percent
631     ,p_measurement_style_code
632     ,p_measure_name
633     ,p_target_value
634     ,p_uom_code
635     ,p_measure_type_code
636     ,p_measure_comments
637     ,p_eligibility_type_code
638     ,p_details
639     ,p_success_criteria
640     ,p_comments
641     ,p_attribute_category
642     ,p_attribute1
643     ,p_attribute2
644     ,p_attribute3
645     ,p_attribute4
646     ,p_attribute5
647     ,p_attribute6
648     ,p_attribute7
649     ,p_attribute8
650     ,p_attribute9
651     ,p_attribute10
652     ,p_attribute11
653     ,p_attribute12
654     ,p_attribute13
655     ,p_attribute14
656     ,p_attribute15
657     ,p_attribute16
658     ,p_attribute17
659     ,p_attribute18
660     ,p_attribute19
661     ,p_attribute20
662     ,p_attribute21
663     ,p_attribute22
664     ,p_attribute23
665     ,p_attribute24
666     ,p_attribute25
667     ,p_attribute26
668     ,p_attribute27
669     ,p_attribute28
670     ,p_attribute29
671     ,p_attribute30
672     );
673   --
674   -- Having converted the arguments into the per_pml_rec
675   -- plsql record structure we call the corresponding record business process.
676   --
677   per_pml_ins.ins
678      (p_effective_date
679      ,l_rec
680      ,l_duplicate_name_warning
681      ,l_weighting_over_100_warning
682      ,l_weighting_appraisal_warning
683      );
684   --
685   -- As the primary key argument(s)
686   -- are specified as an OUT's we must set these values.
687   --
688   p_objective_id 		:= l_rec.objective_id;
689   p_object_version_number 	:= l_rec.object_version_number;
690   p_duplicate_name_warning      := l_duplicate_name_warning;
691   p_weighting_over_100_warning  := l_weighting_over_100_warning;
692   p_weighting_appraisal_warning := l_weighting_appraisal_warning;
693 
694   --
695   hr_utility.set_location(' Leaving:'||l_proc, 10);
696 End ins;
697 --
698 end per_pml_ins;