1 Package Body per_spp_upd as
2 /* $Header: pespprhi.pkb 120.6 2010/01/12 06:37:43 skura ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_spp_upd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_update_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the execution of dml from the datetrack mode
17 -- of CORRECTION only. It is important to note that the object version
18 -- number is only increment by 1 because the datetrack correction is
19 -- soley for one datetracked row.
20 -- This procedure controls the actual dml update logic. The functions of this
21 -- procedure are as follows:
22 -- 1) Get the next object_version_number.
23 -- 2) To set and unset the g_api_dml status as required (as we are about to
24 -- perform dml).
25 -- 3) To update the specified row in the schema using the primary key in
26 -- the predicates.
27 -- 4) To trap any constraint violations that may have occurred.
28 -- 5) To raise any other errors.
29 --
30 -- Prerequisites:
31 -- This is an internal private procedure which must be called from the
32 -- update_dml procedure.
33 --
34 -- In Parameters:
35 -- A Pl/Sql record structure.
36 --
37 -- Post Success:
38 -- The specified row will be updated in the schema.
39 --
40 -- Post Failure:
41 -- On the update dml failure it is important to note that we always reset the
42 -- g_api_dml status to false.
43 -- If a check or unique integrity constraint violation is raised the
44 -- constraint_error procedure will be called.
45 -- If any other error is reported, the error will be raised after the
46 -- g_api_dml status is reset.
47 --
48 -- Developer Implementation Notes:
49 -- The update 'set' arguments list should be modified if any of your
50 -- attributes are not updateable.
51 --
52 -- Access Status:
53 -- Internal Row Handler Use Only.
54 --
55 -- {End Of Comments}
56 -- ----------------------------------------------------------------------------
57 Procedure dt_update_dml
58 (p_rec in out nocopy per_spp_shd.g_rec_type
59 ,p_effective_date in date
60 ,p_datetrack_mode in varchar2
61 ,p_validation_start_date in date
62 ,p_validation_end_date in date
63 ) is
64 --
65 l_proc varchar2(72) := g_package||'dt_update_dml';
66 --
67 Begin
68 hr_utility.set_location('Entering:'||l_proc, 5);
69 --
70 If (p_datetrack_mode = hr_api.g_correction) then
71 hr_utility.set_location(l_proc, 10);
72 --
73 -- Because we are updating a row we must get the next object
74 -- version number.
75 --
76 p_rec.object_version_number :=
77 dt_api.get_object_version_number
78 (p_base_table_name => 'per_spinal_point_placements_f'
79 ,p_base_key_column => 'placement_id'
80 ,p_base_key_value => p_rec.placement_id
81 );
82 --
83 hr_utility.set_location('Entering:'||l_proc, 10);
84 hr_utility.set_location('Reason '|| p_rec.reason, 10);
85 hr_utility.set_location('Placement ID '||p_rec.placement_id, 10);
86 hr_utility.set_location('Step ID '||p_rec.step_id, 10);
87 hr_utility.set_location('OVN '||p_rec.object_version_number, 10);
88 hr_utility.set_location('Start Date '||p_validation_start_date, 10);
89 hr_utility.set_location('End Date '||p_validation_end_date, 10);
90 hr_utility.set_location('Increment Number'||p_rec.increment_number, 20);
91 per_spp_shd.g_api_dml := true; -- Set the api dml status
92 --
93 -- Update the per_spinal_point_placements_f Row
94 --
95 update per_spinal_point_placements_f
96 set
97 placement_id = p_rec.placement_id
98 ,business_group_id = p_rec.business_group_id
99 ,assignment_id = p_rec.assignment_id
100 ,step_id = p_rec.step_id
101 ,auto_increment_flag = p_rec.auto_increment_flag
102 ,parent_spine_id = p_rec.parent_spine_id
103 ,reason = p_rec.reason
104 ,request_id = p_rec.request_id
105 ,program_application_id = p_rec.program_application_id
106 ,program_id = p_rec.program_id
107 ,program_update_date = p_rec.program_update_date
108 ,increment_number = p_rec.increment_number
109 ,object_version_number = p_rec.object_version_number
110 ,information1 = p_rec.information1
111 ,information2 = p_rec.information2
112 ,information3 = p_rec.information3
113 ,information4 = p_rec.information4
114 ,information5 = p_rec.information5
115 ,information6 = p_rec.information6
116 ,information7 = p_rec.information7
117 ,information8 = p_rec.information8
118 ,information9 = p_rec.information9
119 ,information10 = p_rec.information10
120 ,information11 = p_rec.information11
121 ,information12 = p_rec.information12
122 ,information13 = p_rec.information13
123 ,information14 = p_rec.information14
124 ,information15 = p_rec.information15
125 ,information16 = p_rec.information16
126 ,information17 = p_rec.information17
127 ,information18 = p_rec.information18
128 ,information19 = p_rec.information19
129 ,information20 = p_rec.information20
130 ,information21 = p_rec.information21
131 ,information22 = p_rec.information22
132 ,information23 = p_rec.information23
133 ,information24 = p_rec.information24
134 ,information25 = p_rec.information25
135 ,information26 = p_rec.information26
136 ,information27 = p_rec.information27
137 ,information28 = p_rec.information28
138 ,information29 = p_rec.information29
139 ,information30 = p_rec.information30
140 ,information_category = p_rec.information_category
141 where placement_id = p_rec.placement_id
142 and effective_start_date = p_validation_start_date
143 and effective_end_date = p_validation_end_date;
144 --
145 per_spp_shd.g_api_dml := false; -- Unset the api dml status
146 hr_utility.set_location('Entering:'||l_proc, 15);
147 --
148 -- Set the effective start and end dates
149 --
150 p_rec.effective_start_date := p_validation_start_date;
151 p_rec.effective_end_date := p_validation_end_date;
152 End If;
153 --
154 hr_utility.set_location(' Leaving:'||l_proc, 20);
155 Exception
156 When hr_api.check_integrity_violated Then
157 -- A check constraint has been violated
158 per_spp_shd.g_api_dml := false; -- Unset the api dml status
159 per_spp_shd.constraint_error
160 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
161 When hr_api.unique_integrity_violated Then
162 -- Unique integrity has been violated
163 per_spp_shd.g_api_dml := false; -- Unset the api dml status
164 per_spp_shd.constraint_error
165 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
166 When Others Then
167 per_spp_shd.g_api_dml := false; -- Unset the api dml status
168 Raise;
169 End dt_update_dml;
170 --
171 -- ----------------------------------------------------------------------------
172 -- |------------------------------< update_dml >------------------------------|
173 -- ----------------------------------------------------------------------------
174 -- {Start Of Comments}
175 --
176 -- Description:
177 -- This procedure calls the dt_update_dml control logic which handles
178 -- the actual datetrack dml.
179 --
180 -- Prerequisites:
181 -- This is an internal private procedure which must be called from the upd
182 -- procedure.
183 --
184 -- In Parameters:
185 -- A Pl/Sql record structre.
186 --
187 -- Post Success:
188 -- Processing contines.
189 --
190 -- Post Failure:
191 -- No specific error handling is required within this procedure.
192 --
193 -- Developer Implementation Notes:
194 -- The update 'set' arguments list should be modified if any of your
195 -- attributes are not updateable.
196 --
197 -- Access Status:
198 -- Internal Row Handler Use Only.
199 --
200 -- {End Of Comments}
201 -- ----------------------------------------------------------------------------
202 Procedure update_dml
203 (p_rec in out nocopy per_spp_shd.g_rec_type
204 ,p_effective_date in date
205 ,p_datetrack_mode in varchar2
206 ,p_validation_start_date in date
207 ,p_validation_end_date in date
208 ) is
209 --
210 l_proc varchar2(72) := g_package||'update_dml';
211 --
212 Begin
213 hr_utility.set_location('Entering:'||l_proc, 5);
214 --
215 per_spp_upd.dt_update_dml
216 (p_rec => p_rec
217 ,p_effective_date => p_effective_date
218 ,p_datetrack_mode => p_datetrack_mode
219 ,p_validation_start_date => p_validation_start_date
220 ,p_validation_end_date => p_validation_end_date
221 );
222 --
223 hr_utility.set_location(' Leaving:'||l_proc, 10);
224 End update_dml;
225 --
226 -- ----------------------------------------------------------------------------
227 -- |----------------------------< dt_pre_update >-----------------------------|
228 -- ----------------------------------------------------------------------------
229 -- {Start Of Comments}
230 --
231 -- Description:
232 -- The dt_pre_update procedure controls the execution
233 -- of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
234 -- and UPDATE_CHANGE_INSERT only. The execution required is as
235 -- follows:
236 --
237 -- 1) Providing the datetrack update mode is not 'CORRECTION'
238 -- then set the effective end date of the current row (this
239 -- will be the validation_start_date - 1).
240 -- 2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
241 -- corresponding delete_dml process to delete any future rows
242 -- where the effective_start_date is greater than or equal to
243 -- the validation_start_date.
244 -- 3) Call the insert_dml process to insert the new updated row
245 -- details.
246 --
247 -- Prerequisites:
248 -- This is an internal procedure which is called from the
249 -- pre_update procedure.
250 --
251 -- In Parameters:
252 --
253 -- Post Success:
254 -- Processing continues.
255 --
256 -- Post Failure:
257 -- If an error has occurred, an error message and exception will be raised
258 -- but not handled.
259 --
260 -- Developer Implementation Notes:
261 -- This is an internal procedure which is required by Datetrack. Don't
262 -- remove or modify.
263 --
264 -- Access Status:
265 -- Internal Row Handler Use Only.
266 --
267 -- {End Of Comments}
268 -- ----------------------------------------------------------------------------
269 Procedure dt_pre_update
270 (p_rec in out nocopy per_spp_shd.g_rec_type
271 ,p_effective_date in date
272 ,p_datetrack_mode in varchar2
273 ,p_validation_start_date in date
274 ,p_validation_end_date in date
275 ) is
276 --
277 l_proc varchar2(72) := g_package||'dt_pre_update';
278 l_dummy_version_number number;
279 --
280 Begin
281 hr_utility.set_location('Entering:'||l_proc, 5);
282 If (p_datetrack_mode <> hr_api.g_correction) then
283 --
284 -- Update the current effective end date
285 --
286 per_spp_shd.upd_effective_end_date
287 (p_effective_date => p_effective_date
288 ,p_base_key_value => p_rec.placement_id
289 ,p_new_effective_end_date => (p_validation_start_date - 1)
290 ,p_validation_start_date => p_validation_start_date
291 ,p_validation_end_date => p_validation_end_date
292 ,p_object_version_number => l_dummy_version_number
293 );
294 --
295 If (p_datetrack_mode = hr_api.g_update_override) then
296 --
297 -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
298 -- delete any future rows
299 --
300 per_spp_del.delete_dml
301 (p_rec => p_rec
302 ,p_effective_date => p_effective_date
303 ,p_datetrack_mode => p_datetrack_mode
304 ,p_validation_start_date => p_validation_start_date
305 ,p_validation_end_date => p_validation_end_date
306 );
307 End If;
308 --
309 -- We must now insert the updated row
310 --
311 per_spp_ins.insert_dml
312 (p_rec => p_rec
313 ,p_effective_date => p_effective_date
314 ,p_datetrack_mode => p_datetrack_mode
315 ,p_validation_start_date => p_validation_start_date
316 ,p_validation_end_date => p_validation_end_date
317 );
318 End If;
319 hr_utility.set_location(' Leaving:'||l_proc, 20);
320 End dt_pre_update;
321 --
322 -- ----------------------------------------------------------------------------
323 -- |------------------------------< pre_update >------------------------------|
324 -- ----------------------------------------------------------------------------
325 -- {Start Of Comments}
326 --
327 -- Description:
328 -- This private procedure contains any processing which is required before
329 -- the update dml.
330 --
331 -- Prerequisites:
332 -- This is an internal procedure which is called from the upd procedure.
333 --
334 -- In Parameters:
335 -- A Pl/Sql record structure.
336 --
337 -- Post Success:
338 -- Processing continues.
339 --
340 -- Post Failure:
341 -- If an error has occurred, an error message and exception will be raised
342 -- but not handled.
343 --
344 -- Developer Implementation Notes:
345 -- Any pre-processing required before the update dml is issued should be
346 -- coded within this procedure. It is important to note that any 3rd party
347 -- maintenance should be reviewed before placing in this procedure. The call
348 -- to the dt_update_dml procedure should NOT be removed.
349 --
350 -- Access Status:
351 -- Internal Row Handler Use Only.
352 --
353 -- {End Of Comments}
354 -- ----------------------------------------------------------------------------
355 Procedure pre_update
356 (p_rec in out nocopy per_spp_shd.g_rec_type
357 ,p_effective_date in date
358 ,p_datetrack_mode in varchar2
359 ,p_validation_start_date in date
360 ,p_validation_end_date in date
361 ) is
362 --
363 l_proc varchar2(72) := g_package||'pre_update';
364 --
365 Begin
366 hr_utility.set_location('Entering:'||l_proc, 5);
367 --
368 --
369 --
370 dt_pre_update
371 (p_rec => p_rec
372 ,p_effective_date => p_effective_date
373 ,p_datetrack_mode => p_datetrack_mode
374 ,p_validation_start_date => p_validation_start_date
375 ,p_validation_end_date => p_validation_end_date
376 );
377 --
378 hr_utility.set_location(' Leaving:'||l_proc, 10);
379 End pre_update;
380 --
381 -- ----------------------------------------------------------------------------
382 -- |----------------------------< post_update >-------------------------------|
383 -- ----------------------------------------------------------------------------
384 -- {Start Of Comments}
385 --
386 -- Description:
387 -- This private procedure contains any processing which is required after the
388 -- update dml.
389 --
390 -- Prerequisites:
391 -- This is an internal procedure which is called from the upd procedure.
392 --
393 -- In Parameters:
394 -- A Pl/Sql record structure.
395 --
396 -- Post Success:
397 -- Processing continues.
398 --
399 -- Post Failure:
400 -- If an error has occurred, an error message and exception will be raised
401 -- but not handled.
402 --
403 -- Developer Implementation Notes:
404 -- Any post-processing required after the update dml is issued should be
405 -- coded within this procedure. It is important to note that any 3rd party
406 -- maintenance should be reviewed before placing in this procedure.
407 --
408 -- Access Status:
409 -- Internal Row Handler Use Only.
410 --
411 -- {End Of Comments}
412 -- ----------------------------------------------------------------------------
413 Procedure post_update
414 (p_rec in per_spp_shd.g_rec_type
415 ,p_effective_date in date
416 ,p_datetrack_mode in varchar2
417 ,p_validation_start_date in date
418 ,p_validation_end_date in date
419 ) is
420 --
421 l_proc varchar2(72) := g_package||'post_update';
422 -- code changes start for bug 7457065
423 l_step_end_date per_spinal_point_steps_f.effective_end_date%type; -- added for 7457065
424 l_next_placement_st_date per_spinal_point_steps_f.effective_start_date%type; -- added for 7457065
425
426 cursor c_step_end_date is
427 select max(effective_end_date)
428 from per_spinal_point_steps_f
429 where step_id = p_rec.step_id;
430
431 cursor c_next_placement_st_date is
432 select min(effective_start_date)
433 from per_spinal_point_placements_f
434 where assignment_id = p_rec.assignment_id
435 and effective_start_date > p_rec.effective_start_date;
436 -- code changes end for bug 7457065
437
438 Begin
439 hr_utility.set_location('Entering:'||l_proc, 5);
440
441 -- Code Changes start for Bug 7457065
442 open c_step_end_date;
443 fetch c_step_end_date into l_step_end_date;
444 close c_step_end_date;
445 hr_utility.set_location(l_proc, 6);
446 if l_step_end_date < p_rec.effective_end_date then
447 open c_next_placement_st_date;
448 fetch c_next_placement_st_date into l_next_placement_st_date;
449 close c_next_placement_st_date;
450 hr_utility.set_location(l_proc, 7);
451 if l_next_placement_st_date is not null then
452 hr_utility.set_location(l_proc, 8);
453 if l_next_placement_st_date > l_step_end_date + 1 then
454 fnd_message.set_name('PER', 'HR_50439_SP_GAP_ERROR');
455 fnd_message.set_token('END_DATE',l_step_end_date);
456 fnd_message.raise_error;
457 end if;
458 hr_utility.set_location(l_proc, 9);
459 else
460 hr_utility.set_location(l_proc, 10);
461 update per_spinal_point_placements_f
462 set effective_end_date = l_step_end_date
463 where placement_id = p_rec.placement_id
464 and effective_start_date = p_rec.effective_start_date;
465 hr_utility.set_location(l_proc, 11);
466 end if;
467 hr_utility.set_location(l_proc, 12);
468 end if;
469
470 hr_utility.set_location(l_proc, 13);
471 -- Code Changes end for Bug 7457065
472 begin
473 --
474 per_spp_rku.after_update
475 (p_effective_date
476 => p_effective_date
477 ,p_datetrack_mode
478 => p_datetrack_mode
479 ,p_validation_start_date
480 => p_validation_start_date
481 ,p_validation_end_date
482 => p_validation_end_date
483 ,p_placement_id
484 => p_rec.placement_id
485 ,p_effective_start_date
486 => p_rec.effective_start_date
487 ,p_effective_end_date
488 => p_rec.effective_end_date
489 ,p_business_group_id
490 => p_rec.business_group_id
491 ,p_assignment_id
492 => p_rec.assignment_id
493 ,p_step_id
494 => p_rec.step_id
495 ,p_auto_increment_flag
496 => p_rec.auto_increment_flag
497 ,p_parent_spine_id
498 => p_rec.parent_spine_id
499 ,p_reason
500 => p_rec.reason
501 ,p_request_id
502 => p_rec.request_id
503 ,p_program_application_id
504 => p_rec.program_application_id
505 ,p_program_id
506 => p_rec.program_id
507 ,p_program_update_date
508 => p_rec.program_update_date
509 ,p_increment_number
510 => p_rec.increment_number
511 ,p_information1 => p_rec.information1
512 ,p_information2 => p_rec.information2
513 ,p_information3 => p_rec.information3
514 ,p_information4 => p_rec.information4
515 ,p_information5 => p_rec.information5
516 ,p_information6 => p_rec.information6
517 ,p_information7 => p_rec.information7
518 ,p_information8 => p_rec.information8
519 ,p_information9 => p_rec.information9
520 ,p_information10 => p_rec.information10
521 ,p_information11 => p_rec.information11
522 ,p_information12 => p_rec.information12
523 ,p_information13 => p_rec.information13
524 ,p_information14 => p_rec.information14
525 ,p_information15 => p_rec.information15
526 ,p_information16 => p_rec.information16
527 ,p_information17 => p_rec.information17
528 ,p_information18 => p_rec.information18
529 ,p_information19 => p_rec.information19
530 ,p_information20 => p_rec.information20
531 ,p_information21 => p_rec.information21
532 ,p_information22 => p_rec.information22
533 ,p_information23 => p_rec.information23
534 ,p_information24 => p_rec.information24
535 ,p_information25 => p_rec.information25
536 ,p_information26 => p_rec.information26
537 ,p_information27 => p_rec.information27
538 ,p_information28 => p_rec.information28
539 ,p_information29 => p_rec.information29
540 ,p_information30 => p_rec.information30
541 ,p_information_category => p_rec.information_category
542 ,p_object_version_number
543 => p_rec.object_version_number
544 ,p_effective_start_date_o
545 => per_spp_shd.g_old_rec.effective_start_date
546 ,p_effective_end_date_o
547 => per_spp_shd.g_old_rec.effective_end_date
548 ,p_business_group_id_o
549 => per_spp_shd.g_old_rec.business_group_id
550 ,p_assignment_id_o
551 => per_spp_shd.g_old_rec.assignment_id
552 ,p_step_id_o
553 => per_spp_shd.g_old_rec.step_id
554 ,p_auto_increment_flag_o
555 => per_spp_shd.g_old_rec.auto_increment_flag
556 ,p_parent_spine_id_o
557 => per_spp_shd.g_old_rec.parent_spine_id
558 ,p_reason_o
559 => per_spp_shd.g_old_rec.reason
560 ,p_request_id_o
561 => per_spp_shd.g_old_rec.request_id
562 ,p_program_application_id_o
563 => per_spp_shd.g_old_rec.program_application_id
564 ,p_program_id_o
565 => per_spp_shd.g_old_rec.program_id
566 ,p_program_update_date_o
567 => per_spp_shd.g_old_rec.program_update_date
568 ,p_increment_number_o
569 => per_spp_shd.g_old_rec.increment_number
570 ,p_information1_o => per_spp_shd.g_old_rec.information1
571 ,p_information2_o => per_spp_shd.g_old_rec.information2
572 ,p_information3_o => per_spp_shd.g_old_rec.information3
573 ,p_information4_o => per_spp_shd.g_old_rec.information4
574 ,p_information5_o => per_spp_shd.g_old_rec.information5
575 ,p_information6_o => per_spp_shd.g_old_rec.information6
576 ,p_information7_o => per_spp_shd.g_old_rec.information7
577 ,p_information8_o => per_spp_shd.g_old_rec.information8
578 ,p_information9_o => per_spp_shd.g_old_rec.information9
579 ,p_information10_o => per_spp_shd.g_old_rec.information10
580 ,p_information11_o => per_spp_shd.g_old_rec.information11
581 ,p_information12_o => per_spp_shd.g_old_rec.information12
582 ,p_information13_o => per_spp_shd.g_old_rec.information13
583 ,p_information14_o => per_spp_shd.g_old_rec.information14
584 ,p_information15_o => per_spp_shd.g_old_rec.information15
585 ,p_information16_o => per_spp_shd.g_old_rec.information16
586 ,p_information17_o => per_spp_shd.g_old_rec.information17
587 ,p_information18_o => per_spp_shd.g_old_rec.information18
588 ,p_information19_o => per_spp_shd.g_old_rec.information19
589 ,p_information20_o => per_spp_shd.g_old_rec.information20
590 ,p_information21_o => per_spp_shd.g_old_rec.information21
591 ,p_information22_o => per_spp_shd.g_old_rec.information22
592 ,p_information23_o => per_spp_shd.g_old_rec.information23
593 ,p_information24_o => per_spp_shd.g_old_rec.information24
594 ,p_information25_o => per_spp_shd.g_old_rec.information25
595 ,p_information26_o => per_spp_shd.g_old_rec.information26
596 ,p_information27_o => per_spp_shd.g_old_rec.information27
597 ,p_information28_o => per_spp_shd.g_old_rec.information28
598 ,p_information29_o => per_spp_shd.g_old_rec.information29
599 ,p_information30_o => per_spp_shd.g_old_rec.information30
600 ,p_information_category_o => per_spp_shd.g_old_rec.information_category
601 ,p_object_version_number_o
602 => per_spp_shd.g_old_rec.object_version_number
603 );
604 --
605 exception
606 --
607 when hr_api.cannot_find_prog_unit then
608 --
609 hr_api.cannot_find_prog_unit_error
610 (p_module_name => 'PER_SPINAL_POINT_PLACEMENTS_F'
611 ,p_hook_type => 'AU');
612 --
613 end;
614 --
615 hr_utility.set_location(' Leaving:'||l_proc, 10);
616 End post_update;
617 --
618 -- ----------------------------------------------------------------------------
619 -- |-----------------------------< convert_defs >-----------------------------|
620 -- ----------------------------------------------------------------------------
621 -- {Start Of Comments}
622 --
623 -- Description:
624 -- The Convert_Defs procedure has one very important function:
625 -- It must return the record structure for the row with all system defaulted
626 -- values converted into its corresponding parameter value for update. When
627 -- we attempt to update a row through the Upd process , certain
628 -- parameters can be defaulted which enables flexibility in the calling of
629 -- the upd process (e.g. only attributes which need to be updated need to be
630 -- specified). For the upd process to determine which attributes
631 -- have NOT been specified we need to check if the parameter has a reserved
632 -- system default value. Therefore, for all parameters which have a
633 -- corresponding reserved system default mechanism specified we need to
634 -- check if a system default is being used. If a system default is being
635 -- used then we convert the defaulted value into its corresponding attribute
636 -- value held in the g_old_rec data structure.
637 --
638 -- Prerequisites:
639 -- This private function can only be called from the upd process.
640 --
641 -- In Parameters:
642 -- A Pl/Sql record structure.
643 --
644 -- Post Success:
645 -- The record structure will be returned with all system defaulted parameter
646 -- values converted into its current row attribute value.
647 --
648 -- Post Failure:
649 -- No direct error handling is required within this function. Any possible
650 -- errors within this procedure will be a PL/SQL value error due to
651 -- conversion of datatypes or data lengths.
652 --
653 -- Developer Implementation Notes:
654 -- None.
655 --
656 -- Access Status:
657 -- Internal Row Handler Use Only.
658 --
659 -- {End Of Comments}
660 -- ----------------------------------------------------------------------------
661 Procedure convert_defs
662 (p_rec in out nocopy per_spp_shd.g_rec_type
663 ) is
664 --
665 Begin
666 --
667 -- We must now examine each argument value in the
668 -- p_rec plsql record structure
669 -- to see if a system default is being used. If a system default
670 -- is being used then we must set to the 'current' argument value.
671 --
672 If (p_rec.business_group_id = hr_api.g_number) then
673 p_rec.business_group_id :=
674 per_spp_shd.g_old_rec.business_group_id;
675 End If;
676 If (p_rec.assignment_id = hr_api.g_number) then
677 p_rec.assignment_id :=
678 per_spp_shd.g_old_rec.assignment_id;
679 End If;
680 If (p_rec.step_id = hr_api.g_number) then
681 p_rec.step_id :=
682 per_spp_shd.g_old_rec.step_id;
683 End If;
684 If (p_rec.auto_increment_flag = hr_api.g_varchar2) then
685 p_rec.auto_increment_flag :=
686 per_spp_shd.g_old_rec.auto_increment_flag;
687 End If;
688 If (p_rec.parent_spine_id = hr_api.g_number) then
689 p_rec.parent_spine_id :=
690 per_spp_shd.g_old_rec.parent_spine_id;
691 End If;
692 If (p_rec.reason = hr_api.g_varchar2) then
693 p_rec.reason :=
694 per_spp_shd.g_old_rec.reason;
695 End If;
696 If (p_rec.request_id = hr_api.g_number) then
697 p_rec.request_id :=
698 per_spp_shd.g_old_rec.request_id;
699 End If;
700 If (p_rec.program_application_id = hr_api.g_number) then
701 p_rec.program_application_id :=
702 per_spp_shd.g_old_rec.program_application_id;
703 End If;
704 If (p_rec.program_id = hr_api.g_number) then
705 p_rec.program_id :=
706 per_spp_shd.g_old_rec.program_id;
707 End If;
708 If (p_rec.program_update_date = hr_api.g_date) then
709 p_rec.program_update_date :=
710 per_spp_shd.g_old_rec.program_update_date;
711 End If;
712 If (p_rec.increment_number = hr_api.g_number) then
713 p_rec.increment_number :=
714 per_spp_shd.g_old_rec.increment_number;
715 End If;
716 If (p_rec.information1 = hr_api.g_varchar2) then
717 p_rec.information1 := per_spp_shd.g_old_rec.information1;
718 End If;
719 If (p_rec.information2 = hr_api.g_varchar2) then
720 p_rec.information2 := per_spp_shd.g_old_rec.information2;
721 End If;
722 If (p_rec.information3 = hr_api.g_varchar2) then
723 p_rec.information3 := per_spp_shd.g_old_rec.information3;
724 End If;
725 If (p_rec.information3 = hr_api.g_varchar2) then
726 p_rec.information3 := per_spp_shd.g_old_rec.information3;
727 End If;
728 If (p_rec.information4 = hr_api.g_varchar2) then
729 p_rec.information4 := per_spp_shd.g_old_rec.information4;
730 End If;
731 If (p_rec.information5 = hr_api.g_varchar2) then
732 p_rec.information5 := per_spp_shd.g_old_rec.information5;
733 End If;
734 If (p_rec.information6 = hr_api.g_varchar2) then
735 p_rec.information6 := per_spp_shd.g_old_rec.information6;
736 End If;
737 If (p_rec.information7 = hr_api.g_varchar2) then
738 p_rec.information7 := per_spp_shd.g_old_rec.information7;
739 End If;
740 If (p_rec.information8 = hr_api.g_varchar2) then
741 p_rec.information8 := per_spp_shd.g_old_rec.information8;
742 End If;
743 If (p_rec.information9 = hr_api.g_varchar2) then
744 p_rec.information9 := per_spp_shd.g_old_rec.information9;
745 End If;
746 If (p_rec.information10 = hr_api.g_varchar2) then
747 p_rec.information10 := per_spp_shd.g_old_rec.information10;
748 End If;
749 If (p_rec.information11 = hr_api.g_varchar2) then
750 p_rec.information11 := per_spp_shd.g_old_rec.information11;
751 End If;
752 If (p_rec.information12 = hr_api.g_varchar2) then
753 p_rec.information12 := per_spp_shd.g_old_rec.information12;
754 End If;
755 If (p_rec.information13 = hr_api.g_varchar2) then
756 p_rec.information13 := per_spp_shd.g_old_rec.information13;
757 End If;
758 If (p_rec.information14 = hr_api.g_varchar2) then
759 p_rec.information14 := per_spp_shd.g_old_rec.information14;
760 End If;
761 If (p_rec.information15 = hr_api.g_varchar2) then
762 p_rec.information15 := per_spp_shd.g_old_rec.information15;
763 End If;
764 If (p_rec.information16 = hr_api.g_varchar2) then
765 p_rec.information16 := per_spp_shd.g_old_rec.information16;
766 End If;
767 If (p_rec.information17 = hr_api.g_varchar2) then
768 p_rec.information17 := per_spp_shd.g_old_rec.information17;
769 End If;
770 If (p_rec.information18 = hr_api.g_varchar2) then
771 p_rec.information18 := per_spp_shd.g_old_rec.information18;
772 End If;
773 If (p_rec.information19 = hr_api.g_varchar2) then
774 p_rec.information19 := per_spp_shd.g_old_rec.information19;
775 End If;
776 If (p_rec.information20 = hr_api.g_varchar2) then
777 p_rec.information20 := per_spp_shd.g_old_rec.information20;
778 End If;
779 If (p_rec.information21 = hr_api.g_varchar2) then
780 p_rec.information21 := per_spp_shd.g_old_rec.information21;
781 End If;
782 If (p_rec.information22 = hr_api.g_varchar2) then
783 p_rec.information22 := per_spp_shd.g_old_rec.information22;
784 End If;
785 If (p_rec.information23 = hr_api.g_varchar2) then
786 p_rec.information23 := per_spp_shd.g_old_rec.information23;
787 End If;
788 If (p_rec.information24 = hr_api.g_varchar2) then
789 p_rec.information24 := per_spp_shd.g_old_rec.information24;
790 End If;
791 If (p_rec.information25 = hr_api.g_varchar2) then
792 p_rec.information25 := per_spp_shd.g_old_rec.information25;
793 End If;
794 If (p_rec.information26 = hr_api.g_varchar2) then
795 p_rec.information26 := per_spp_shd.g_old_rec.information26;
796 End If;
797 If (p_rec.information27 = hr_api.g_varchar2) then
798 p_rec.information27 := per_spp_shd.g_old_rec.information27;
799 End If;
800 If (p_rec.information28 = hr_api.g_varchar2) then
801 p_rec.information28 := per_spp_shd.g_old_rec.information28;
802 End If;
803 If (p_rec.information29 = hr_api.g_varchar2) then
804 p_rec.information29 := per_spp_shd.g_old_rec.information29;
805 End If;
806 If (p_rec.information30 = hr_api.g_varchar2) then
807 p_rec.information30 := per_spp_shd.g_old_rec.information30;
808 End If;
809 If (p_rec.information_category = hr_api.g_varchar2) then
810 p_rec.information_category := per_spp_shd.g_old_rec.information_category;
811 End If;
812 --
813 End convert_defs;
814 --
815 -- ----------------------------------------------------------------------------
816 -- |---------------------------------< upd >----------------------------------|
817 -- ----------------------------------------------------------------------------
818 Procedure upd
819 (p_effective_date in date
820 ,p_datetrack_mode in out nocopy varchar2
821 ,p_rec in out nocopy per_spp_shd.g_rec_type
822 ) is
823 --
824 l_proc varchar2(72) := g_package||'upd';
825 l_validation_start_date date;
826 l_validation_end_date date;
827 l_datetrack_mode varchar2(30);
828 --
829 Begin
830 hr_utility.set_location('Entering:'||l_proc, 5);
831 --
832 --
833 -- Ensure that the DateTrack update mode is valid
834 --
835 dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
836 --
837 -- We must lock the row which we need to update.
838 --
839 per_spp_shd.lck
840 (p_effective_date => p_effective_date
841 ,p_datetrack_mode => p_datetrack_mode
842 ,p_placement_id => p_rec.placement_id
843 ,p_object_version_number => p_rec.object_version_number
844 ,p_validation_start_date => l_validation_start_date
845 ,p_validation_end_date => l_validation_end_date
846 );
847 --
848 -- 1. During an update system defaults are used to determine if
849 -- arguments have been defaulted or not. We must therefore
850 -- derive the full record structure values to be updated.
851 --
852 -- 2. Call the supporting update validate operations.
853 --
854 per_spp_upd.convert_defs(p_rec);
855 --
856 per_spp_bus.update_validate
857 (p_rec => p_rec
858 ,p_effective_date => p_effective_date
859 ,p_datetrack_mode => p_datetrack_mode
860 ,p_validation_start_date => l_validation_start_date
861 ,p_validation_end_date => l_validation_end_date
862 );
863 --
864 -- Call the supporting pre-update operation
865 --
866 pre_update
867 (p_rec => p_rec
868 ,p_effective_date => p_effective_date
869 ,p_datetrack_mode => p_datetrack_mode
870 ,p_validation_start_date => l_validation_start_date
871 ,p_validation_end_date => l_validation_end_date
872 );
873 --
874 -- Update the row.
875 --
876 update_dml
877 (p_rec => p_rec
878 ,p_effective_date => p_effective_date
879 ,p_datetrack_mode => p_datetrack_mode
880 ,p_validation_start_date => l_validation_start_date
881 ,p_validation_end_date => l_validation_end_date
882 );
883 --
884 -- Call the supporting post-update operation
885 --
886
887 post_update
888 (p_rec => p_rec
889 ,p_effective_date => p_effective_date
890 ,p_datetrack_mode => p_datetrack_mode
891 ,p_validation_start_date => l_validation_start_date
892 ,p_validation_end_date => l_validation_end_date
893 );
894
895 End upd;
896 --
897 -- ----------------------------------------------------------------------------
898 -- |------------------------------< upd >-------------------------------------|
899 -- ----------------------------------------------------------------------------
900 Procedure upd
901 (p_effective_date in date
902 ,p_datetrack_mode in out nocopy varchar2
903 ,p_placement_id in number
904 ,p_object_version_number in out nocopy number
905 ,p_business_group_id in number
906 ,p_assignment_id in number
907 ,p_step_id in number
908 ,p_auto_increment_flag in varchar2
909 -- ,p_parent_spine_id in number
910 ,p_reason in varchar2
911 ,p_request_id in number
912 ,p_program_application_id in number
913 ,p_program_id in number
914 ,p_program_update_date in date
915 ,p_increment_number in number
916 ,p_information1 in varchar2
917 ,p_information2 in varchar2
918 ,p_information3 in varchar2
919 ,p_information4 in varchar2
920 ,p_information5 in varchar2
921 ,p_information6 in varchar2
922 ,p_information7 in varchar2
923 ,p_information8 in varchar2
924 ,p_information9 in varchar2
925 ,p_information10 in varchar2
926 ,p_information11 in varchar2
927 ,p_information12 in varchar2
928 ,p_information13 in varchar2
929 ,p_information14 in varchar2
930 ,p_information15 in varchar2
931 ,p_information16 in varchar2
932 ,p_information17 in varchar2
933 ,p_information18 in varchar2
934 ,p_information19 in varchar2
935 ,p_information20 in varchar2
936 ,p_information21 in varchar2
937 ,p_information22 in varchar2
938 ,p_information23 in varchar2
939 ,p_information24 in varchar2
940 ,p_information25 in varchar2
941 ,p_information26 in varchar2
942 ,p_information27 in varchar2
943 ,p_information28 in varchar2
944 ,p_information29 in varchar2
945 ,p_information30 in varchar2
946 ,p_information_category in varchar2
947 ,p_effective_start_date in out nocopy date
948 ,p_effective_end_date in out nocopy date
949 ) is
950 --
951 l_rec per_spp_shd.g_rec_type;
952 l_proc varchar2(72) := g_package||'upd';
953 l_parent_spine_id per_spinal_point_placements_f.parent_spine_id%TYPE;
954 --
955 Begin
956 hr_utility.set_location('Entering:'||l_proc, 5);
957 hr_utility.set_location('assignment_id :'||p_assignment_id,5);
958 hr_utility.set_location('effective_date :'||p_effective_date,5);
959 --
960 -- Get the parent_spine_id
961 --
962 select distinct parent_spine_id
963 into l_parent_spine_id
964 from per_grade_spines_f pgs,
965 per_all_assignments_f paa
966 where paa.grade_id = pgs.grade_id
967 and paa.assignment_id = p_assignment_id
968 and p_effective_date between paa.effective_start_date
969 and paa.effective_end_date
970 and p_effective_date between pgs.effective_start_date
971 and pgs.effective_end_date;
972 --
973 hr_utility.set_location('Entering:'||l_proc, 6);
974 --
975 -- Call conversion function to turn arguments into the
976 -- l_rec structure.
977 --
978 l_rec :=
979 per_spp_shd.convert_args
980 (p_placement_id
981 ,p_effective_start_date
982 ,p_effective_end_date
983 ,p_business_group_id
984 ,p_assignment_id
985 ,p_step_id
986 ,p_auto_increment_flag
987 ,l_parent_spine_id
988 ,p_reason
989 ,p_request_id
990 ,p_program_application_id
991 ,p_program_id
992 ,p_program_update_date
993 ,p_increment_number
994 ,p_information1
995 ,p_information2
996 ,p_information3
997 ,p_information4
998 ,p_information5
999 ,p_information6
1000 ,p_information7
1001 ,p_information8
1002 ,p_information9
1003 ,p_information10
1004 ,p_information11
1005 ,p_information12
1006 ,p_information13
1007 ,p_information14
1008 ,p_information15
1009 ,p_information16
1010 ,p_information17
1011 ,p_information18
1012 ,p_information19
1013 ,p_information20
1014 ,p_information21
1015 ,p_information22
1016 ,p_information23
1017 ,p_information24
1018 ,p_information25
1019 ,p_information26
1020 ,p_information27
1021 ,p_information28
1022 ,p_information29
1023 ,p_information30
1024 ,p_information_category
1025 ,p_object_version_number
1026 );
1027 hr_utility.set_location('Entering:'||l_proc, 7);
1028 /*
1029 select effective_start_date,effective_end_date
1030 into l_rec.effective_start_date, l_rec.effective_end_date
1031 from per_spinal_point_placements_f
1032 where placement_id = p_placement_id
1033 and p_effective_date between effective_start_date
1034 and effective_end_date;
1035 */
1036 hr_utility.set_location('Entering:'||l_proc, 8);
1037 --
1038 -- Having converted the arguments into the
1039 -- plsql record structure we call the corresponding record
1040 -- business process.
1041 --
1042 per_spp_upd.upd
1043 (p_effective_date
1044 ,p_datetrack_mode
1045 ,l_rec
1046 );
1047 --
1048 -- Set the out parameters
1049 --
1050 p_object_version_number := l_rec.object_version_number;
1051 p_effective_start_date := l_rec.effective_start_date;
1052 p_effective_end_date := l_rec.effective_end_date;
1053 --
1054 --
1055 hr_utility.set_location(' Leaving:'||l_proc, 10);
1056
1057 /* added this exception for bug 6346478 which will fix 6024292.
1058 The fix for 6024292 has been reverted as it is raising bug 6346478*/
1059
1060 exception
1061 when no_data_found then
1062 hr_utility.set_message(800, 'HR_289829_NO_SPP_REC_FOR_EDATE');
1063 hr_utility.raise_error;
1064 End upd;
1065 --
1066 end per_spp_upd;