[Home] [Help]
PACKAGE BODY: APPS.BEN_PRP_SHD
Source
1 Package Body ben_prp_shd as
2 /* $Header: beprprhi.pkb 120.0.12010000.2 2008/08/05 15:21:44 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_prp_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_PL_REGY_PRP_F_FK1') 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 ElsIf (p_constraint_name = 'BEN_PL_REGY_PRP_F_PK') Then
42 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
43 fnd_message.set_token('PROCEDURE', l_proc);
44 fnd_message.set_token('STEP','10');
45 fnd_message.raise_error;
46 Else
47 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
48 fnd_message.set_token('PROCEDURE', l_proc);
49 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
50 fnd_message.raise_error;
51 End If;
52 --
53 hr_utility.set_location(' Leaving:'||l_proc, 10);
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60 (p_effective_date in date,
61 p_pl_regy_prps_id in number,
62 p_object_version_number in number
63 ) Return Boolean Is
64 --
65 --
66 -- Cursor selects the 'current' row from the HR Schema
67 --
68 Cursor C_Sel1 is
69 select
70 pl_regy_prps_id,
71 effective_start_date,
72 effective_end_date,
73 pl_regy_prps_cd,
74 pl_regy_bod_id,
75 business_group_id,
76 prp_attribute_category,
77 prp_attribute1,
78 prp_attribute2,
79 prp_attribute3,
80 prp_attribute4,
81 prp_attribute5,
82 prp_attribute6,
83 prp_attribute7,
84 prp_attribute8,
85 prp_attribute9,
86 prp_attribute10,
87 prp_attribute11,
88 prp_attribute12,
89 prp_attribute13,
90 prp_attribute14,
91 prp_attribute15,
92 prp_attribute16,
93 prp_attribute17,
94 prp_attribute18,
95 prp_attribute19,
96 prp_attribute20,
97 prp_attribute21,
98 prp_attribute22,
99 prp_attribute23,
100 prp_attribute24,
101 prp_attribute25,
102 prp_attribute26,
103 prp_attribute27,
104 prp_attribute28,
105 prp_attribute29,
106 prp_attribute30,
107 object_version_number
108 from ben_pl_regy_prp_f
109 where pl_regy_prps_id = p_pl_regy_prps_id
110 and p_effective_date
111 between effective_start_date and effective_end_date;
112 --
113 l_proc varchar2(72) := g_package||'api_updating';
114 l_fct_ret boolean;
115 --
116 Begin
117 hr_utility.set_location('Entering:'||l_proc, 5);
118 --
119 If (p_effective_date is null or
120 p_pl_regy_prps_id is null or
121 p_object_version_number is null) Then
122 --
123 -- One of the primary key arguments is null therefore we must
124 -- set the returning function value to false
125 --
126 l_fct_ret := false;
127 Else
128 If (p_pl_regy_prps_id = g_old_rec.pl_regy_prps_id and
129 p_object_version_number = g_old_rec.object_version_number) Then
130 hr_utility.set_location(l_proc, 10);
131 --
132 -- The g_old_rec is current therefore we must
133 -- set the returning function to true
134 --
135 l_fct_ret := true;
136 Else
137 --
138 -- Select the current row
139 --
140 Open C_Sel1;
141 Fetch C_Sel1 Into g_old_rec;
142 If C_Sel1%notfound Then
143 Close C_Sel1;
144 --
145 -- The primary key is invalid therefore we must error
146 --
147 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
148 fnd_message.raise_error;
149 End If;
150 Close C_Sel1;
151 If (p_object_version_number <> g_old_rec.object_version_number) Then
152 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
153 fnd_message.raise_error;
154 End If;
155 hr_utility.set_location(l_proc, 15);
156 l_fct_ret := true;
157 End If;
158 End If;
159 hr_utility.set_location(' Leaving:'||l_proc, 20);
160 Return (l_fct_ret);
161 --
162 End api_updating;
163 --
164 -- ----------------------------------------------------------------------------
165 -- |--------------------------< find_dt_del_modes >---------------------------|
166 -- ----------------------------------------------------------------------------
167 Procedure find_dt_del_modes
168 (p_effective_date in date,
169 p_base_key_value in number,
170 p_zap out nocopy boolean,
171 p_delete out nocopy boolean,
172 p_future_change out nocopy boolean,
173 p_delete_next_change out nocopy boolean) is
174 --
175 l_proc varchar2(72) := g_package||'find_dt_del_modes';
176 --
177 l_parent_key_value1 number;
178 --
179 Cursor C_Sel1 Is
180 select t.pl_regy_bod_id
181 from ben_pl_regy_prp_f t
182 where t.pl_regy_prps_id = p_base_key_value
183 and p_effective_date
184 between t.effective_start_date and t.effective_end_date;
185 --
186 Begin
187 hr_utility.set_location('Entering:'||l_proc, 5);
188 Open C_Sel1;
189 Fetch C_Sel1 Into l_parent_key_value1;
190 If C_Sel1%notfound then
191 Close C_Sel1;
192 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
193 fnd_message.set_token('PROCEDURE', l_proc);
194 fnd_message.set_token('STEP','10');
195 fnd_message.raise_error;
196 End If;
197 Close C_Sel1;
198 --
199 -- Call the corresponding datetrack api
200 --
201 dt_api.find_dt_del_modes
202 (p_effective_date => p_effective_date,
203 p_base_table_name => 'ben_pl_regy_prp_f',
204 p_base_key_column => 'pl_regy_prps_id',
205 p_base_key_value => p_base_key_value,
206 p_parent_table_name1 => 'ben_pl_regy_bod_f',
207 p_parent_key_column1 => 'pl_regy_bod_id',
208 p_parent_key_value1 => l_parent_key_value1,
209 p_zap => p_zap,
210 p_delete => p_delete,
211 p_future_change => p_future_change,
212 p_delete_next_change => p_delete_next_change);
213 --
214 hr_utility.set_location(' Leaving:'||l_proc, 10);
215 End find_dt_del_modes;
216 --
217 -- ----------------------------------------------------------------------------
218 -- |--------------------------< find_dt_upd_modes >---------------------------|
219 -- ----------------------------------------------------------------------------
220 Procedure find_dt_upd_modes
221 (p_effective_date in date,
222 p_base_key_value in number,
223 p_correction out nocopy boolean,
224 p_update out nocopy boolean,
225 p_update_override out nocopy boolean,
226 p_update_change_insert out nocopy boolean) is
227 --
228 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
229 --
230 Begin
231 hr_utility.set_location('Entering:'||l_proc, 5);
232 --
233 -- Call the corresponding datetrack api
234 --
235 dt_api.find_dt_upd_modes
236 (p_effective_date => p_effective_date,
237 p_base_table_name => 'ben_pl_regy_prp_f',
238 p_base_key_column => 'pl_regy_prps_id',
239 p_base_key_value => p_base_key_value,
240 p_correction => p_correction,
241 p_update => p_update,
242 p_update_override => p_update_override,
243 p_update_change_insert => p_update_change_insert);
244 --
245 hr_utility.set_location(' Leaving:'||l_proc, 10);
246 End find_dt_upd_modes;
247 --
248 -- ----------------------------------------------------------------------------
249 -- |------------------------< upd_effective_end_date >------------------------|
250 -- ----------------------------------------------------------------------------
251 Procedure upd_effective_end_date
252 (p_effective_date in date,
253 p_base_key_value in number,
254 p_new_effective_end_date in date,
255 p_validation_start_date in date,
256 p_validation_end_date in date,
257 p_object_version_number out nocopy number) is
258 --
259 l_proc varchar2(72) := g_package||'upd_effective_end_date';
260 l_object_version_number number;
261 --
262 Begin
263 hr_utility.set_location('Entering:'||l_proc, 5);
264 --
265 -- Because we are updating a row we must get the next object
266 -- version number.
267 --
268 l_object_version_number :=
269 dt_api.get_object_version_number
270 (p_base_table_name => 'ben_pl_regy_prp_f',
271 p_base_key_column => 'pl_regy_prps_id',
272 p_base_key_value => p_base_key_value);
273 --
274 hr_utility.set_location(l_proc, 10);
275 g_api_dml := true; -- Set the api dml status
276 --
277 -- Update the specified datetrack row setting the effective
278 -- end date to the specified new effective end date.
279 --
280 update ben_pl_regy_prp_f t
281 set t.effective_end_date = p_new_effective_end_date,
282 t.object_version_number = l_object_version_number
283 where t.pl_regy_prps_id = p_base_key_value
284 and p_effective_date
285 between t.effective_start_date and t.effective_end_date;
286 --
287 g_api_dml := false; -- Unset the api dml status
288 p_object_version_number := l_object_version_number;
289 hr_utility.set_location(' Leaving:'||l_proc, 15);
290 --
291 Exception
292 When Others Then
293 g_api_dml := false; -- Unset the api dml status
294 Raise;
295 End upd_effective_end_date;
296 --
297 -- ----------------------------------------------------------------------------
298 -- |---------------------------------< lck >----------------------------------|
299 -- ----------------------------------------------------------------------------
300 Procedure lck
301 (p_effective_date in date,
302 p_datetrack_mode in varchar2,
303 p_pl_regy_prps_id in number,
304 p_object_version_number in number,
305 p_validation_start_date out nocopy date,
306 p_validation_end_date out nocopy date) is
307 --
308 l_proc varchar2(72) := g_package||'lck';
309 l_validation_start_date date;
310 l_validation_end_date date;
311 l_object_invalid exception;
312 l_argument varchar2(30);
313 --
314 -- Cursor C_Sel1 selects the current locked row as of session date
315 -- ensuring that the object version numbers match.
316 --
317 Cursor C_Sel1 is
318 select
319 pl_regy_prps_id,
320 effective_start_date,
321 effective_end_date,
322 pl_regy_prps_cd,
323 pl_regy_bod_id,
324 business_group_id,
325 prp_attribute_category,
326 prp_attribute1,
327 prp_attribute2,
328 prp_attribute3,
329 prp_attribute4,
330 prp_attribute5,
331 prp_attribute6,
332 prp_attribute7,
333 prp_attribute8,
334 prp_attribute9,
335 prp_attribute10,
336 prp_attribute11,
337 prp_attribute12,
338 prp_attribute13,
339 prp_attribute14,
340 prp_attribute15,
341 prp_attribute16,
342 prp_attribute17,
343 prp_attribute18,
344 prp_attribute19,
345 prp_attribute20,
346 prp_attribute21,
347 prp_attribute22,
348 prp_attribute23,
349 prp_attribute24,
350 prp_attribute25,
351 prp_attribute26,
352 prp_attribute27,
353 prp_attribute28,
354 prp_attribute29,
355 prp_attribute30,
356 object_version_number
357 from ben_pl_regy_prp_f
358 where pl_regy_prps_id = p_pl_regy_prps_id
359 and p_effective_date
360 between effective_start_date and effective_end_date
361 for update nowait;
362 --
363 --
364 --
365 Begin
366 hr_utility.set_location('Entering:'||l_proc, 5);
367 --
368 -- Ensure that all the mandatory arguments are not null
369 --
370 hr_api.mandatory_arg_error(p_api_name => l_proc,
371 p_argument => 'effective_date',
372 p_argument_value => p_effective_date);
373 --
374 hr_api.mandatory_arg_error(p_api_name => l_proc,
375 p_argument => 'datetrack_mode',
376 p_argument_value => p_datetrack_mode);
377 --
378 hr_api.mandatory_arg_error(p_api_name => l_proc,
379 p_argument => 'pl_regy_prps_id',
380 p_argument_value => p_pl_regy_prps_id);
381 --
382 hr_api.mandatory_arg_error(p_api_name => l_proc,
383 p_argument => 'object_version_number',
384 p_argument_value => p_object_version_number);
385 --
386 -- Check to ensure the datetrack mode is not INSERT.
387 --
388 If (p_datetrack_mode <> 'INSERT') then
389 --
390 -- We must select and lock the current row.
391 --
392 Open C_Sel1;
393 Fetch C_Sel1 Into g_old_rec;
394 If C_Sel1%notfound then
395 Close C_Sel1;
396 --
397 -- The primary key is invalid therefore we must error
398 --
399 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
400 fnd_message.raise_error;
401 End If;
402 Close C_Sel1;
406 End If;
403 If (p_object_version_number <> g_old_rec.object_version_number) Then
404 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
405 fnd_message.raise_error;
407 hr_utility.set_location(l_proc, 15);
408 --
409 --
410 -- Validate the datetrack mode mode getting the validation start
411 -- and end dates for the specified datetrack operation.
412 --
413 dt_api.validate_dt_mode
414 (p_effective_date => p_effective_date,
415 p_datetrack_mode => p_datetrack_mode,
416 p_base_table_name => 'ben_pl_regy_prp_f',
417 p_base_key_column => 'pl_regy_prps_id',
418 p_base_key_value => p_pl_regy_prps_id,
419 p_parent_table_name1 => 'ben_pl_regy_bod_f',
420 p_parent_key_column1 => 'pl_regy_bod_id',
421 p_parent_key_value1 => g_old_rec.pl_regy_bod_id,
422 p_enforce_foreign_locking => false , --true,
423 p_validation_start_date => l_validation_start_date,
424 p_validation_end_date => l_validation_end_date);
425 Else
426 --
427 -- We are doing a datetrack 'INSERT' which is illegal within this
428 -- procedure therefore we must error (note: to lck on insert the
429 -- private procedure ins_lck should be called).
430 --
431 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
432 fnd_message.set_token('PROCEDURE', l_proc);
433 fnd_message.set_token('STEP','20');
434 fnd_message.raise_error;
435 End If;
436 --
437 -- Set the validation start and end date OUT arguments
438 --
439 p_validation_start_date := l_validation_start_date;
440 p_validation_end_date := l_validation_end_date;
441 --
442 hr_utility.set_location(' Leaving:'||l_proc, 30);
443 --
444 -- We need to trap the ORA LOCK exception
445 --
446 Exception
447 When HR_Api.Object_Locked then
448 --
449 -- The object is locked therefore we need to supply a meaningful
450 -- error message.
451 --
452 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
453 fnd_message.set_token('TABLE_NAME', 'ben_pl_regy_prp_f');
454 fnd_message.raise_error;
455 When l_object_invalid then
456 --
457 -- The object doesn't exist or is invalid
458 --
459 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
460 fnd_message.set_token('TABLE_NAME', 'ben_pl_regy_prp_f');
461 fnd_message.raise_error;
462 End lck;
463 --
464 -- ----------------------------------------------------------------------------
465 -- |-----------------------------< convert_args >-----------------------------|
466 -- ----------------------------------------------------------------------------
467 Function convert_args
468 (
469 p_pl_regy_prps_id in number,
470 p_effective_start_date in date,
471 p_effective_end_date in date,
472 p_pl_regy_prps_cd in varchar2,
473 p_pl_regy_bod_id in number,
474 p_business_group_id in number,
475 p_prp_attribute_category in varchar2,
476 p_prp_attribute1 in varchar2,
477 p_prp_attribute2 in varchar2,
478 p_prp_attribute3 in varchar2,
479 p_prp_attribute4 in varchar2,
480 p_prp_attribute5 in varchar2,
481 p_prp_attribute6 in varchar2,
482 p_prp_attribute7 in varchar2,
483 p_prp_attribute8 in varchar2,
484 p_prp_attribute9 in varchar2,
485 p_prp_attribute10 in varchar2,
486 p_prp_attribute11 in varchar2,
487 p_prp_attribute12 in varchar2,
488 p_prp_attribute13 in varchar2,
489 p_prp_attribute14 in varchar2,
490 p_prp_attribute15 in varchar2,
491 p_prp_attribute16 in varchar2,
492 p_prp_attribute17 in varchar2,
493 p_prp_attribute18 in varchar2,
494 p_prp_attribute19 in varchar2,
495 p_prp_attribute20 in varchar2,
496 p_prp_attribute21 in varchar2,
497 p_prp_attribute22 in varchar2,
498 p_prp_attribute23 in varchar2,
499 p_prp_attribute24 in varchar2,
500 p_prp_attribute25 in varchar2,
501 p_prp_attribute26 in varchar2,
502 p_prp_attribute27 in varchar2,
503 p_prp_attribute28 in varchar2,
504 p_prp_attribute29 in varchar2,
505 p_prp_attribute30 in varchar2,
506 p_object_version_number in number
507 )
508 Return g_rec_type is
509 --
510 l_rec g_rec_type;
511 l_proc varchar2(72) := g_package||'convert_args';
512 --
513 Begin
514 --
515 hr_utility.set_location('Entering:'||l_proc, 5);
516 --
517 -- Convert arguments into local l_rec structure.
518 --
519 l_rec.pl_regy_prps_id := p_pl_regy_prps_id;
520 l_rec.effective_start_date := p_effective_start_date;
521 l_rec.effective_end_date := p_effective_end_date;
522 l_rec.pl_regy_prps_cd := p_pl_regy_prps_cd;
523 l_rec.pl_regy_bod_id := p_pl_regy_bod_id;
524 l_rec.business_group_id := p_business_group_id;
525 l_rec.prp_attribute_category := p_prp_attribute_category;
529 l_rec.prp_attribute4 := p_prp_attribute4;
526 l_rec.prp_attribute1 := p_prp_attribute1;
527 l_rec.prp_attribute2 := p_prp_attribute2;
528 l_rec.prp_attribute3 := p_prp_attribute3;
530 l_rec.prp_attribute5 := p_prp_attribute5;
531 l_rec.prp_attribute6 := p_prp_attribute6;
532 l_rec.prp_attribute7 := p_prp_attribute7;
533 l_rec.prp_attribute8 := p_prp_attribute8;
534 l_rec.prp_attribute9 := p_prp_attribute9;
535 l_rec.prp_attribute10 := p_prp_attribute10;
536 l_rec.prp_attribute11 := p_prp_attribute11;
537 l_rec.prp_attribute12 := p_prp_attribute12;
538 l_rec.prp_attribute13 := p_prp_attribute13;
539 l_rec.prp_attribute14 := p_prp_attribute14;
540 l_rec.prp_attribute15 := p_prp_attribute15;
541 l_rec.prp_attribute16 := p_prp_attribute16;
542 l_rec.prp_attribute17 := p_prp_attribute17;
543 l_rec.prp_attribute18 := p_prp_attribute18;
544 l_rec.prp_attribute19 := p_prp_attribute19;
545 l_rec.prp_attribute20 := p_prp_attribute20;
546 l_rec.prp_attribute21 := p_prp_attribute21;
547 l_rec.prp_attribute22 := p_prp_attribute22;
548 l_rec.prp_attribute23 := p_prp_attribute23;
549 l_rec.prp_attribute24 := p_prp_attribute24;
550 l_rec.prp_attribute25 := p_prp_attribute25;
551 l_rec.prp_attribute26 := p_prp_attribute26;
552 l_rec.prp_attribute27 := p_prp_attribute27;
553 l_rec.prp_attribute28 := p_prp_attribute28;
554 l_rec.prp_attribute29 := p_prp_attribute29;
555 l_rec.prp_attribute30 := p_prp_attribute30;
556 l_rec.object_version_number := p_object_version_number;
557 --
558 -- Return the plsql record structure.
559 --
560 hr_utility.set_location(' Leaving:'||l_proc, 10);
561 Return(l_rec);
562 --
563 End convert_args;
564 --
565 end ben_prp_shd;