[Home] [Help]
PACKAGE BODY: APPS.PER_PMA_INS
Source
1 Package Body per_pma_ins as
2 /* $Header: pepmarhi.pkb 120.4.12010000.2 2008/08/06 09:29:11 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_pma_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_appraisal_period_id_i number default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19 (p_appraisal_period_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_pma_ins.g_appraisal_period_id_i := p_appraisal_period_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_pma_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_appraisal_periods
88 --
89 insert into per_appraisal_periods
90 (appraisal_period_id
91 ,object_version_number
92 ,plan_id
93 ,appraisal_template_id
94 ,start_date
95 ,end_date
96 ,task_start_date
97 ,task_end_date
98 ,initiator_code
99 ,appraisal_system_type
100 ,appraisal_type
101 ,appraisal_assmt_status
102 ,auto_conc_process
103 ,days_before_task_st_dt
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 ,attribute21
126 ,attribute22
127 ,attribute23
128 ,attribute24
129 ,attribute25
130 ,attribute26
131 ,attribute27
132 ,attribute28
133 ,attribute29
134 ,attribute30
135 )
136 Values
137 (p_rec.appraisal_period_id
138 ,p_rec.object_version_number
139 ,p_rec.plan_id
140 ,p_rec.appraisal_template_id
141 ,p_rec.start_date
142 ,p_rec.end_date
143 ,p_rec.task_start_date
144 ,p_rec.task_end_date
145 ,p_rec.initiator_code
146 ,p_rec.appraisal_system_type
147 ,p_rec.appraisal_type
148 ,p_rec.appraisal_assmt_status
149 ,p_rec.auto_conc_process
150 ,p_rec.days_before_task_st_dt
151 ,p_rec.attribute_category
152 ,p_rec.attribute1
153 ,p_rec.attribute2
154 ,p_rec.attribute3
155 ,p_rec.attribute4
156 ,p_rec.attribute5
157 ,p_rec.attribute6
158 ,p_rec.attribute7
159 ,p_rec.attribute8
160 ,p_rec.attribute9
161 ,p_rec.attribute10
162 ,p_rec.attribute11
163 ,p_rec.attribute12
164 ,p_rec.attribute13
165 ,p_rec.attribute14
166 ,p_rec.attribute15
167 ,p_rec.attribute16
168 ,p_rec.attribute17
169 ,p_rec.attribute18
170 ,p_rec.attribute19
171 ,p_rec.attribute20
172 ,p_rec.attribute21
173 ,p_rec.attribute22
174 ,p_rec.attribute23
175 ,p_rec.attribute24
176 ,p_rec.attribute25
177 ,p_rec.attribute26
178 ,p_rec.attribute27
179 ,p_rec.attribute28
180 ,p_rec.attribute29
181 ,p_rec.attribute30
182 );
183 --
184 --
185 --
186 hr_utility.set_location(' Leaving:'||l_proc, 10);
187 Exception
188 When hr_api.check_integrity_violated Then
189 -- A check constraint has been violated
190 --
191 per_pma_shd.constraint_error
192 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
193 When hr_api.parent_integrity_violated Then
194 -- Parent integrity has been violated
195 --
196 per_pma_shd.constraint_error
197 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
198 When hr_api.unique_integrity_violated Then
199 -- Unique integrity has been violated
200 --
201 per_pma_shd.constraint_error
202 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
203 When Others Then
204 --
205 Raise;
206 End insert_dml;
207 --
208 -- ----------------------------------------------------------------------------
209 -- |------------------------------< pre_insert >------------------------------|
210 -- ----------------------------------------------------------------------------
211 -- {Start Of Comments}
212 --
213 -- Description:
214 -- This private procedure contains any processing which is required before
215 -- the insert dml. Presently, if the entity has a corresponding primary
216 -- key which is maintained by an associating sequence, the primary key for
217 -- the entity will be populated with the next sequence value in
218 -- preparation for the insert dml.
219 --
220 -- Prerequisites:
221 -- This is an internal procedure which is called from the ins procedure.
222 --
223 -- In Parameters:
224 -- A Pl/Sql record structure.
225 --
226 -- Post Success:
227 -- Processing continues.
228 --
229 -- Post Failure:
230 -- If an error has occurred, an error message and exception will be raised
231 -- but not handled.
232 --
233 -- Developer Implementation Notes:
234 -- Any pre-processing required before the insert dml is issued should be
235 -- coded within this procedure. As stated above, a good example is the
236 -- generation of a primary key number via a corresponding sequence.
237 -- It is important to note that any 3rd party maintenance should be reviewed
238 -- before placing in this procedure.
239 --
240 -- Access Status:
241 -- Internal Row Handler Use Only.
242 --
243 -- {End Of Comments}
244 -- ----------------------------------------------------------------------------
245 Procedure pre_insert
246 (p_rec in out nocopy per_pma_shd.g_rec_type
247 ) is
248 --
249 Cursor C_Sel1 is select per_appraisal_periods_s.nextval from sys.dual;
250 --
251 Cursor C_Sel2 is
252 Select null
253 from per_appraisal_periods
254 where appraisal_period_id =
255 per_pma_ins.g_appraisal_period_id_i;
256 --
257 l_proc varchar2(72) := g_package||'pre_insert';
258 l_exists varchar2(1);
259 --
260 Begin
261 hr_utility.set_location('Entering:'||l_proc, 5);
262 --
263 If (per_pma_ins.g_appraisal_period_id_i is not null) Then
264 --
265 -- Verify registered primary key values not already in use
266 --
267 Open C_Sel2;
268 Fetch C_Sel2 into l_exists;
269 If C_Sel2%found Then
270 Close C_Sel2;
271 --
272 -- The primary key values are already in use.
273 --
274 fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
275 fnd_message.set_token('TABLE_NAME','per_appraisal_periods');
276 fnd_message.raise_error;
277 End If;
278 Close C_Sel2;
279 --
280 -- Use registered key values and clear globals
281 --
282 p_rec.appraisal_period_id :=
283 per_pma_ins.g_appraisal_period_id_i;
284 per_pma_ins.g_appraisal_period_id_i := null;
285 Else
286 --
287 -- No registerd key values, so select the next sequence number
288 --
289 --
290 -- Select the next sequence number
291 --
292 Open C_Sel1;
293 Fetch C_Sel1 Into p_rec.appraisal_period_id;
294 Close C_Sel1;
295 End If;
296 --
297 hr_utility.set_location(' Leaving:'||l_proc, 10);
298 End pre_insert;
299 --
300 -- ----------------------------------------------------------------------------
301 -- |-----------------------------< post_insert >------------------------------|
302 -- ----------------------------------------------------------------------------
303 -- {Start Of Comments}
304 --
305 -- Description:
306 -- This private procedure contains any processing which is required after
307 -- the insert dml.
308 --
309 -- Prerequisites:
310 -- This is an internal procedure which is called from the ins procedure.
311 --
312 -- In Parameters:
313 -- A Pl/Sql record structre.
314 --
315 -- Post Success:
316 -- Processing continues.
317 --
318 -- Post Failure:
319 -- If an error has occurred, an error message and exception will be raised
320 -- but not handled.
321 --
322 -- Developer Implementation Notes:
323 -- Any post-processing required after the insert dml is issued should be
324 -- coded within this procedure. It is important to note that any 3rd party
325 -- maintenance should be reviewed before placing in this procedure.
326 --
327 -- Access Status:
328 -- Internal Row Handler Use Only.
329 --
330 -- {End Of Comments}
331 -- ----------------------------------------------------------------------------
332 Procedure post_insert
333 (p_effective_date in date
334 ,p_rec in per_pma_shd.g_rec_type
335 ) is
336 --
337 l_proc varchar2(72) := g_package||'post_insert';
338 --
339 Begin
340 hr_utility.set_location('Entering:'||l_proc, 5);
341 begin
342 --
343 per_pma_rki.after_insert
344 (p_effective_date
345 => p_effective_date
346 ,p_appraisal_period_id
347 => p_rec.appraisal_period_id
348 ,p_object_version_number
349 => p_rec.object_version_number
350 ,p_plan_id
351 => p_rec.plan_id
352 ,p_appraisal_template_id
353 => p_rec.appraisal_template_id
354 ,p_start_date
355 => p_rec.start_date
356 ,p_end_date
357 => p_rec.end_date
358 ,p_task_start_date
359 => p_rec.task_start_date
360 ,p_task_end_date
361 => p_rec.task_end_date
362 ,p_initiator_code
363 => p_rec.initiator_code
364 ,p_appraisal_system_type
365 => p_rec.appraisal_system_type
366 ,p_appraisal_type
367 => p_rec.appraisal_type
368 ,p_appraisal_assmt_status
369 => p_rec.appraisal_assmt_status
370 ,p_auto_conc_process
371 => p_rec.auto_conc_process
372 ,p_days_before_task_st_dt
373 => p_rec.days_before_task_st_dt
374 ,p_attribute_category
375 => p_rec.attribute_category
376 ,p_attribute1
377 => p_rec.attribute1
378 ,p_attribute2
379 => p_rec.attribute2
380 ,p_attribute3
381 => p_rec.attribute3
385 => p_rec.attribute5
382 ,p_attribute4
383 => p_rec.attribute4
384 ,p_attribute5
386 ,p_attribute6
387 => p_rec.attribute6
388 ,p_attribute7
389 => p_rec.attribute7
390 ,p_attribute8
391 => p_rec.attribute8
392 ,p_attribute9
393 => p_rec.attribute9
394 ,p_attribute10
395 => p_rec.attribute10
396 ,p_attribute11
397 => p_rec.attribute11
398 ,p_attribute12
399 => p_rec.attribute12
400 ,p_attribute13
401 => p_rec.attribute13
402 ,p_attribute14
403 => p_rec.attribute14
404 ,p_attribute15
405 => p_rec.attribute15
406 ,p_attribute16
407 => p_rec.attribute16
408 ,p_attribute17
409 => p_rec.attribute17
410 ,p_attribute18
411 => p_rec.attribute18
412 ,p_attribute19
413 => p_rec.attribute19
414 ,p_attribute20
415 => p_rec.attribute20
416 ,p_attribute21
417 => p_rec.attribute21
418 ,p_attribute22
419 => p_rec.attribute22
420 ,p_attribute23
421 => p_rec.attribute23
422 ,p_attribute24
423 => p_rec.attribute24
424 ,p_attribute25
425 => p_rec.attribute25
426 ,p_attribute26
427 => p_rec.attribute26
428 ,p_attribute27
429 => p_rec.attribute27
430 ,p_attribute28
431 => p_rec.attribute28
432 ,p_attribute29
433 => p_rec.attribute29
434 ,p_attribute30
435 => p_rec.attribute30
436 );
437 --
438 exception
439 --
440 when hr_api.cannot_find_prog_unit then
441 --
442 hr_api.cannot_find_prog_unit_error
443 (p_module_name => 'PER_APPRAISAL_PERIODS'
444 ,p_hook_type => 'AI');
445 --
446 end;
447 --
448 hr_utility.set_location(' Leaving:'||l_proc, 10);
449 End post_insert;
450 --
451 -- ----------------------------------------------------------------------------
452 -- |---------------------------------< ins >----------------------------------|
453 -- ----------------------------------------------------------------------------
454 Procedure ins
455 (p_effective_date in date
456 ,p_rec in out nocopy per_pma_shd.g_rec_type
457 ) is
458 --
459 l_proc varchar2(72) := g_package||'ins';
460 --
461 Begin
462 hr_utility.set_location('Entering:'||l_proc, 5);
463 --
464 -- Call the supporting insert validate operations
465 --
466 per_pma_bus.insert_validate
467 (p_effective_date
468 ,p_rec
469 );
470 --
471 -- Call to raise any errors on multi-message list
472 hr_multi_message.end_validation_set;
473 --
474 -- Call the supporting pre-insert operation
475 --
476 per_pma_ins.pre_insert(p_rec);
477 --
478 -- Insert the row
479 --
480 per_pma_ins.insert_dml(p_rec);
481 --
482 -- Call the supporting post-insert operation
483 --
484 per_pma_ins.post_insert
485 (p_effective_date
486 ,p_rec
487 );
488 --
489 -- Call to raise any errors on multi-message list
490 hr_multi_message.end_validation_set;
491 --
492 hr_utility.set_location('Leaving:'||l_proc, 20);
493 end ins;
494 --
495 -- ----------------------------------------------------------------------------
496 -- |---------------------------------< ins >----------------------------------|
497 -- ----------------------------------------------------------------------------
498 Procedure ins
499 (p_effective_date in date
500 ,p_plan_id in number
501 ,p_appraisal_template_id in number
502 ,p_start_date in date
503 ,p_end_date in date
504 ,p_task_start_date in date
505 ,p_task_end_date in date
506 ,p_initiator_code in varchar2
507 ,p_appraisal_system_type in varchar2
508 ,p_appraisal_type in varchar2
509 ,p_appraisal_assmt_status in varchar2
510 ,p_auto_conc_process in varchar2
511 ,p_days_before_task_st_dt in number
512 ,p_attribute_category in varchar2 default null
513 ,p_attribute1 in varchar2 default null
514 ,p_attribute2 in varchar2 default null
515 ,p_attribute3 in varchar2 default null
516 ,p_attribute4 in varchar2 default null
517 ,p_attribute5 in varchar2 default null
518 ,p_attribute6 in varchar2 default null
519 ,p_attribute7 in varchar2 default null
520 ,p_attribute8 in varchar2 default null
521 ,p_attribute9 in varchar2 default null
522 ,p_attribute10 in varchar2 default null
523 ,p_attribute11 in varchar2 default null
527 ,p_attribute15 in varchar2 default null
524 ,p_attribute12 in varchar2 default null
525 ,p_attribute13 in varchar2 default null
526 ,p_attribute14 in varchar2 default null
528 ,p_attribute16 in varchar2 default null
529 ,p_attribute17 in varchar2 default null
530 ,p_attribute18 in varchar2 default null
531 ,p_attribute19 in varchar2 default null
532 ,p_attribute20 in varchar2 default null
533 ,p_attribute21 in varchar2 default null
534 ,p_attribute22 in varchar2 default null
535 ,p_attribute23 in varchar2 default null
536 ,p_attribute24 in varchar2 default null
537 ,p_attribute25 in varchar2 default null
538 ,p_attribute26 in varchar2 default null
539 ,p_attribute27 in varchar2 default null
540 ,p_attribute28 in varchar2 default null
541 ,p_attribute29 in varchar2 default null
542 ,p_attribute30 in varchar2 default null
543 ,p_appraisal_period_id out nocopy number
544 ,p_object_version_number out nocopy number
545 ) is
546 --
547 l_rec per_pma_shd.g_rec_type;
548 l_proc varchar2(72) := g_package||'ins';
549 --
550 Begin
551 hr_utility.set_location('Entering:'||l_proc, 5);
552 --
553 -- Call conversion function to turn arguments into the
554 -- p_rec structure.
555 --
556 l_rec :=
557 per_pma_shd.convert_args
558 (null
559 ,null
560 ,p_plan_id
561 ,p_appraisal_template_id
562 ,p_start_date
563 ,p_end_date
564 ,p_task_start_date
565 ,p_task_end_date
566 ,p_initiator_code
567 ,p_appraisal_system_type
568 ,p_appraisal_type
569 ,p_appraisal_assmt_status
570 ,p_auto_conc_process
571 ,p_days_before_task_st_dt
572 ,p_attribute_category
573 ,p_attribute1
574 ,p_attribute2
575 ,p_attribute3
576 ,p_attribute4
577 ,p_attribute5
578 ,p_attribute6
579 ,p_attribute7
580 ,p_attribute8
581 ,p_attribute9
582 ,p_attribute10
583 ,p_attribute11
584 ,p_attribute12
585 ,p_attribute13
586 ,p_attribute14
587 ,p_attribute15
588 ,p_attribute16
589 ,p_attribute17
590 ,p_attribute18
594 ,p_attribute22
591 ,p_attribute19
592 ,p_attribute20
593 ,p_attribute21
595 ,p_attribute23
596 ,p_attribute24
597 ,p_attribute25
598 ,p_attribute26
599 ,p_attribute27
600 ,p_attribute28
601 ,p_attribute29
602 ,p_attribute30
603 );
604 --
605 -- Having converted the arguments into the per_pma_rec
606 -- plsql record structure we call the corresponding record business process.
607 --
608 per_pma_ins.ins
609 (p_effective_date
610 ,l_rec
611 );
612 --
613 -- As the primary key argument(s)
614 -- are specified as an OUT's we must set these values.
615 --
616 p_appraisal_period_id := l_rec.appraisal_period_id;
617 p_object_version_number := l_rec.object_version_number;
618 --
619 hr_utility.set_location(' Leaving:'||l_proc, 10);
620 End ins;
621 --
622 end per_pma_ins;