[Home] [Help]
PACKAGE BODY: APPS.BEN_PRR_SHD
Source
1 Package Body ben_prr_shd as
2 /* $Header: beprrrhi.pkb 120.3 2008/02/05 09:40:09 rtagarra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_prr_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 l_proc varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18 hr_utility.set_location('Entering:'||l_proc, 5);
19 --
20 Return (nvl(g_api_dml, false));
21 --
22 hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31 l_proc varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34 hr_utility.set_location('Entering:'||l_proc, 5);
35 --
36 If (p_constraint_name = 'BEN_PERF_RTNG_RT_F_PK') Then
37 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38 fnd_message.set_token('PROCEDURE', l_proc);
39 fnd_message.set_token('STEP','5');
40 fnd_message.raise_error;
41 Else
42 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
43 fnd_message.set_token('PROCEDURE', l_proc);
44 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
45 fnd_message.raise_error;
46 End If;
47 --
48 hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55 (p_effective_date in date,
56 p_perf_rtng_rt_id in number,
57 p_object_version_number in number
58 ) Return Boolean Is
59 --
60 --
61 -- Cursor selects the 'current' row from the HR Schema
62 --
63 Cursor C_Sel1 is
64 select
65 perf_rtng_rt_id,
69 vrbl_rt_prfl_id,
66 effective_start_date,
67 effective_end_date,
68 business_group_id,
70 ordr_num,
71 excld_flag,
72 event_type,
73 perf_rtng_cd,
74 prr_attribute_category,
75 prr_attribute1,
76 prr_attribute2,
77 prr_attribute3,
78 prr_attribute4,
79 prr_attribute5,
80 prr_attribute6,
81 prr_attribute7,
82 prr_attribute8,
83 prr_attribute9,
84 prr_attribute10,
85 prr_attribute11,
86 prr_attribute12,
87 prr_attribute13,
88 prr_attribute14,
89 prr_attribute15,
90 prr_attribute16,
91 prr_attribute17,
92 prr_attribute18,
93 prr_attribute19,
94 prr_attribute20,
95 prr_attribute21,
96 prr_attribute22,
97 prr_attribute23,
98 prr_attribute24,
99 prr_attribute25,
100 prr_attribute26,
101 prr_attribute27,
102 prr_attribute28,
103 prr_attribute29,
104 prr_attribute30,
105 object_version_number
106 from ben_perf_rtng_rt_f
107 where perf_rtng_rt_id = p_perf_rtng_rt_id
108 and p_effective_date
109 between effective_start_date and effective_end_date;
110 --
111 l_proc varchar2(72) := g_package||'api_updating';
112 l_fct_ret boolean;
113 --
114 Begin
115 hr_utility.set_location('Entering:'||l_proc, 5);
116 --
117 If (p_effective_date is null or
118 p_perf_rtng_rt_id is null or
119 p_object_version_number is null) Then
120 --
121 -- One of the primary key arguments is null therefore we must
122 -- set the returning function value to false
123 --
124 l_fct_ret := false;
125 Else
126 If (p_perf_rtng_rt_id = g_old_rec.perf_rtng_rt_id and
127 p_object_version_number = g_old_rec.object_version_number) Then
128 hr_utility.set_location(l_proc, 10);
129 --
130 -- The g_old_rec is current therefore we must
131 -- set the returning function to true
132 --
133 l_fct_ret := true;
134 Else
135 --
136 -- Select the current row
137 --
138 Open C_Sel1;
139 Fetch C_Sel1 Into g_old_rec;
140 If C_Sel1%notfound Then
141 Close C_Sel1;
142 --
143 -- The primary key is invalid therefore we must error
144 --
145 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
146 fnd_message.raise_error;
147 End If;
148 Close C_Sel1;
149 If (p_object_version_number <> g_old_rec.object_version_number) Then
150 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
151 fnd_message.raise_error;
152 End If;
153 hr_utility.set_location(l_proc, 15);
154 l_fct_ret := true;
155 End If;
156 End If;
157 hr_utility.set_location(' Leaving:'||l_proc, 20);
158 Return (l_fct_ret);
159 --
160 End api_updating;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |--------------------------< find_dt_del_modes >---------------------------|
164 -- ----------------------------------------------------------------------------
165 Procedure find_dt_del_modes
166 (p_effective_date in date,
167 p_base_key_value in number,
168 p_zap out nocopy boolean,
169 p_delete out nocopy boolean,
170 p_future_change out nocopy boolean,
171 p_delete_next_change out nocopy boolean) is
172 --
173 l_proc varchar2(72) := g_package||'find_dt_del_modes';
174 --
175 l_parent_key_value1 number;
176 --
177 Cursor C_Sel1 Is
178 select t.vrbl_rt_prfl_id
179 from ben_perf_rtng_rt_f t
180 where t.perf_rtng_rt_id = p_base_key_value
181 and p_effective_date
182 between t.effective_start_date and t.effective_end_date;
183 --
184 Begin
185 hr_utility.set_location('Entering:'||l_proc, 5);
186 Open C_Sel1;
187 Fetch C_Sel1 Into l_parent_key_value1;
188 If C_Sel1%notfound then
189 Close C_Sel1;
190 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
191 fnd_message.set_token('PROCEDURE', l_proc);
192 fnd_message.set_token('STEP','10');
193 fnd_message.raise_error;
194 End If;
195 Close C_Sel1;
196 --
197 -- Call the corresponding datetrack api
198 --
199 dt_api.find_dt_del_modes
200 (p_effective_date => p_effective_date,
201 p_base_table_name => 'ben_perf_rtng_rt_f',
202 p_base_key_column => 'perf_rtng_rt_id',
203 p_base_key_value => p_base_key_value,
204 p_parent_table_name1 => 'ben_vrbl_rt_prfl_f',
205 p_parent_key_column1 => 'vrbl_rt_prfl_id',
206 p_parent_key_value1 => l_parent_key_value1,
207 p_zap => p_zap,
208 p_delete => p_delete,
209 p_future_change => p_future_change,
210 p_delete_next_change => p_delete_next_change);
211 --
212 hr_utility.set_location(' Leaving:'||l_proc, 10);
213 End find_dt_del_modes;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |--------------------------< find_dt_upd_modes >---------------------------|
217 -- ----------------------------------------------------------------------------
218 Procedure find_dt_upd_modes
219 (p_effective_date in date,
220 p_base_key_value in number,
221 p_correction out nocopy boolean,
222 p_update out nocopy boolean,
223 p_update_override out nocopy boolean,
224 p_update_change_insert out nocopy boolean) is
225 --
226 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
227 --
228 Begin
232 --
229 hr_utility.set_location('Entering:'||l_proc, 5);
230 --
231 -- Call the corresponding datetrack api
233 dt_api.find_dt_upd_modes
234 (p_effective_date => p_effective_date,
235 p_base_table_name => 'ben_perf_rtng_rt_f',
236 p_base_key_column => 'perf_rtng_rt_id',
237 p_base_key_value => p_base_key_value,
238 p_correction => p_correction,
239 p_update => p_update,
240 p_update_override => p_update_override,
241 p_update_change_insert => p_update_change_insert);
242 --
243 hr_utility.set_location(' Leaving:'||l_proc, 10);
244 End find_dt_upd_modes;
245 --
246 -- ----------------------------------------------------------------------------
247 -- |------------------------< upd_effective_end_date >------------------------|
248 -- ----------------------------------------------------------------------------
249 Procedure upd_effective_end_date
250 (p_effective_date in date,
251 p_base_key_value in number,
252 p_new_effective_end_date in date,
253 p_validation_start_date in date,
254 p_validation_end_date in date,
255 p_object_version_number out nocopy number) is
256 --
257 l_proc varchar2(72) := g_package||'upd_effective_end_date';
258 l_object_version_number number;
259 --
260 Begin
261 hr_utility.set_location('Entering:'||l_proc, 5);
262 --
263 -- Because we are updating a row we must get the next object
264 -- version number.
265 --
266 l_object_version_number :=
267 dt_api.get_object_version_number
268 (p_base_table_name => 'ben_perf_rtng_rt_f',
269 p_base_key_column => 'perf_rtng_rt_id',
270 p_base_key_value => p_base_key_value);
271 --
272 hr_utility.set_location(l_proc, 10);
273 g_api_dml := true; -- Set the api dml status
274 --
275 -- Update the specified datetrack row setting the effective
276 -- end date to the specified new effective end date.
277 --
278 update ben_perf_rtng_rt_f t
279 set t.effective_end_date = p_new_effective_end_date,
280 t.object_version_number = l_object_version_number
281 where t.perf_rtng_rt_id = p_base_key_value
282 and p_effective_date
283 between t.effective_start_date and t.effective_end_date;
284 --
285 g_api_dml := false; -- Unset the api dml status
286 p_object_version_number := l_object_version_number;
287 hr_utility.set_location(' Leaving:'||l_proc, 15);
288 --
289 Exception
290 When Others Then
291 g_api_dml := false; -- Unset the api dml status
292 Raise;
293 End upd_effective_end_date;
294 --
295 -- ----------------------------------------------------------------------------
296 -- |---------------------------------< lck >----------------------------------|
297 -- ----------------------------------------------------------------------------
298 Procedure lck
299 (p_effective_date in date,
300 p_datetrack_mode in varchar2,
301 p_perf_rtng_rt_id in number,
302 p_object_version_number in number,
303 p_validation_start_date out nocopy date,
304 p_validation_end_date out nocopy date) is
305 --
306 l_proc varchar2(72) := g_package||'lck';
307 l_validation_start_date date;
308 l_validation_end_date date;
309 l_object_invalid exception;
310 l_argument varchar2(30);
311 --
312 -- Cursor C_Sel1 selects the current locked row as of session date
313 -- ensuring that the object version numbers match.
314 --
315 Cursor C_Sel1 is
316 select
317 perf_rtng_rt_id,
318 effective_start_date,
319 effective_end_date,
320 business_group_id,
321 vrbl_rt_prfl_id,
322 ordr_num,
323 excld_flag,
324 event_type,
325 perf_rtng_cd,
326 prr_attribute_category,
327 prr_attribute1,
328 prr_attribute2,
329 prr_attribute3,
330 prr_attribute4,
331 prr_attribute5,
332 prr_attribute6,
333 prr_attribute7,
334 prr_attribute8,
335 prr_attribute9,
336 prr_attribute10,
337 prr_attribute11,
338 prr_attribute12,
339 prr_attribute13,
340 prr_attribute14,
341 prr_attribute15,
342 prr_attribute16,
343 prr_attribute17,
344 prr_attribute18,
345 prr_attribute19,
346 prr_attribute20,
347 prr_attribute21,
348 prr_attribute22,
349 prr_attribute23,
350 prr_attribute24,
351 prr_attribute25,
352 prr_attribute26,
353 prr_attribute27,
354 prr_attribute28,
355 prr_attribute29,
356 prr_attribute30,
357 object_version_number
358 from ben_perf_rtng_rt_f
359 where perf_rtng_rt_id = p_perf_rtng_rt_id
360 and p_effective_date
361 between effective_start_date and effective_end_date
362 for update nowait;
363 --
364 --
365 --
366 Begin
367 hr_utility.set_location('Entering:'||l_proc, 5);
368 --
369 -- Ensure that all the mandatory arguments are not null
370 --
371 hr_api.mandatory_arg_error(p_api_name => l_proc,
372 p_argument => 'effective_date',
373 p_argument_value => p_effective_date);
374 --
375 hr_api.mandatory_arg_error(p_api_name => l_proc,
376 p_argument => 'datetrack_mode',
377 p_argument_value => p_datetrack_mode);
378 --
379 hr_api.mandatory_arg_error(p_api_name => l_proc,
380 p_argument => 'perf_rtng_rt_id',
384 p_argument => 'object_version_number',
381 p_argument_value => p_perf_rtng_rt_id);
382 --
383 hr_api.mandatory_arg_error(p_api_name => l_proc,
385 p_argument_value => p_object_version_number);
386 --
387 -- Check to ensure the datetrack mode is not INSERT.
388 --
389 If (p_datetrack_mode <> 'INSERT') then
390 --
391 -- We must select and lock the current row.
392 --
393 Open C_Sel1;
394 Fetch C_Sel1 Into g_old_rec;
395 If C_Sel1%notfound then
396 Close C_Sel1;
397 --
398 -- The primary key is invalid therefore we must error
399 --
400 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
401 fnd_message.raise_error;
402 End If;
403 Close C_Sel1;
404 If (p_object_version_number <> g_old_rec.object_version_number) Then
405 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
406 fnd_message.raise_error;
407 End If;
408 hr_utility.set_location(l_proc, 15);
409 --
410 --
411 -- Validate the datetrack mode mode getting the validation start
412 -- and end dates for the specified datetrack operation.
413 --
414 dt_api.validate_dt_mode
415 (p_effective_date => p_effective_date,
416 p_datetrack_mode => p_datetrack_mode,
417 p_base_table_name => 'ben_perf_rtng_rt_f',
418 p_base_key_column => 'perf_rtng_rt_id',
419 p_base_key_value => p_perf_rtng_rt_id,
420 p_parent_table_name1 => 'ben_vrbl_rt_prfl_f',
421 p_parent_key_column1 => 'vrbl_rt_prfl_id',
422 p_parent_key_value1 => g_old_rec.vrbl_rt_prfl_id,
423 p_enforce_foreign_locking => false , --true,
424 p_validation_start_date => l_validation_start_date,
425 p_validation_end_date => l_validation_end_date);
426 Else
427 --
428 -- We are doing a datetrack 'INSERT' which is illegal within this
429 -- procedure therefore we must error (note: to lck on insert the
430 -- private procedure ins_lck should be called).
431 --
432 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
433 fnd_message.set_token('PROCEDURE', l_proc);
434 fnd_message.set_token('STEP','20');
435 fnd_message.raise_error;
436 End If;
437 --
438 -- Set the validation start and end date OUT arguments
439 --
440 p_validation_start_date := l_validation_start_date;
441 p_validation_end_date := l_validation_end_date;
442 --
443 hr_utility.set_location(' Leaving:'||l_proc, 30);
444 --
445 -- We need to trap the ORA LOCK exception
446 --
447 Exception
448 When HR_Api.Object_Locked then
449 --
450 -- The object is locked therefore we need to supply a meaningful
451 -- error message.
452 --
453 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
454 fnd_message.set_token('TABLE_NAME', 'BEN_PERF_RTNG_RT_F');
455 fnd_message.raise_error;
456 When l_object_invalid then
457 --
458 -- The object doesn't exist or is invalid
459 --
460 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
461 fnd_message.set_token('TABLE_NAME', 'BEN_PERF_RTNG_RT_F');
462 fnd_message.raise_error;
463 End lck;
464 --
465 -- ----------------------------------------------------------------------------
466 -- |-----------------------------< convert_args >-----------------------------|
467 -- ----------------------------------------------------------------------------
468 Function convert_args
469 (
470 p_perf_rtng_rt_id in number,
471 p_effective_start_date in date,
472 p_effective_end_date in date,
473 p_business_group_id in number,
474 p_vrbl_rt_prfl_id in number,
475 p_ordr_num in number,
476 p_excld_flag in varchar2,
477 p_event_type in varchar2,
478 p_perf_rtng_cd in varchar2,
479 p_prr_attribute_category in varchar2,
480 p_prr_attribute1 in varchar2,
481 p_prr_attribute2 in varchar2,
482 p_prr_attribute3 in varchar2,
483 p_prr_attribute4 in varchar2,
484 p_prr_attribute5 in varchar2,
485 p_prr_attribute6 in varchar2,
486 p_prr_attribute7 in varchar2,
487 p_prr_attribute8 in varchar2,
488 p_prr_attribute9 in varchar2,
489 p_prr_attribute10 in varchar2,
490 p_prr_attribute11 in varchar2,
491 p_prr_attribute12 in varchar2,
492 p_prr_attribute13 in varchar2,
493 p_prr_attribute14 in varchar2,
494 p_prr_attribute15 in varchar2,
495 p_prr_attribute16 in varchar2,
496 p_prr_attribute17 in varchar2,
497 p_prr_attribute18 in varchar2,
498 p_prr_attribute19 in varchar2,
499 p_prr_attribute20 in varchar2,
500 p_prr_attribute21 in varchar2,
501 p_prr_attribute22 in varchar2,
502 p_prr_attribute23 in varchar2,
503 p_prr_attribute24 in varchar2,
504 p_prr_attribute25 in varchar2,
505 p_prr_attribute26 in varchar2,
506 p_prr_attribute27 in varchar2,
507 p_prr_attribute28 in varchar2,
508 p_prr_attribute29 in varchar2,
509 p_prr_attribute30 in varchar2,
510 p_object_version_number in number
511 )
515 l_proc varchar2(72) := g_package||'convert_args';
512 Return g_rec_type is
513 --
514 l_rec g_rec_type;
516 --
517 Begin
518 --
519 hr_utility.set_location('Entering:'||l_proc, 5);
520 --
521 -- Convert arguments into local l_rec structure.
522 --
523 l_rec.perf_rtng_rt_id := p_perf_rtng_rt_id;
524 l_rec.effective_start_date := p_effective_start_date;
525 l_rec.effective_end_date := p_effective_end_date;
526 l_rec.business_group_id := p_business_group_id;
527 l_rec.vrbl_rt_prfl_id := p_vrbl_rt_prfl_id;
528 l_rec.ordr_num := p_ordr_num;
529 l_rec.excld_flag := p_excld_flag;
530 l_rec.event_type := p_event_type;
531 l_rec.perf_rtng_cd := p_perf_rtng_cd;
532 l_rec.prr_attribute_category := p_prr_attribute_category;
533 l_rec.prr_attribute1 := p_prr_attribute1;
534 l_rec.prr_attribute2 := p_prr_attribute2;
535 l_rec.prr_attribute3 := p_prr_attribute3;
536 l_rec.prr_attribute4 := p_prr_attribute4;
537 l_rec.prr_attribute5 := p_prr_attribute5;
538 l_rec.prr_attribute6 := p_prr_attribute6;
539 l_rec.prr_attribute7 := p_prr_attribute7;
540 l_rec.prr_attribute8 := p_prr_attribute8;
541 l_rec.prr_attribute9 := p_prr_attribute9;
542 l_rec.prr_attribute10 := p_prr_attribute10;
543 l_rec.prr_attribute11 := p_prr_attribute11;
544 l_rec.prr_attribute12 := p_prr_attribute12;
545 l_rec.prr_attribute13 := p_prr_attribute13;
546 l_rec.prr_attribute14 := p_prr_attribute14;
547 l_rec.prr_attribute15 := p_prr_attribute15;
548 l_rec.prr_attribute16 := p_prr_attribute16;
549 l_rec.prr_attribute17 := p_prr_attribute17;
550 l_rec.prr_attribute18 := p_prr_attribute18;
551 l_rec.prr_attribute19 := p_prr_attribute19;
552 l_rec.prr_attribute20 := p_prr_attribute20;
553 l_rec.prr_attribute21 := p_prr_attribute21;
554 l_rec.prr_attribute22 := p_prr_attribute22;
555 l_rec.prr_attribute23 := p_prr_attribute23;
556 l_rec.prr_attribute24 := p_prr_attribute24;
557 l_rec.prr_attribute25 := p_prr_attribute25;
558 l_rec.prr_attribute26 := p_prr_attribute26;
559 l_rec.prr_attribute27 := p_prr_attribute27;
560 l_rec.prr_attribute28 := p_prr_attribute28;
561 l_rec.prr_attribute29 := p_prr_attribute29;
562 l_rec.prr_attribute30 := p_prr_attribute30;
563 l_rec.object_version_number := p_object_version_number;
564 --
565 -- Return the plsql record structure.
566 --
567 hr_utility.set_location(' Leaving:'||l_proc, 10);
568 Return(l_rec);
569 --
570 End convert_args;
571 --
572 end ben_prr_shd;