[Home] [Help]
PACKAGE BODY: APPS.BEN_PRT_SHD
Source
1 Package Body ben_prt_shd as
2 /* $Header: beprtrhi.pkb 120.0.12010000.3 2008/08/25 13:51:57 ppentapa ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_prt_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_POE_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_poe_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 poe_rt_id,
66 effective_start_date,
67 effective_end_date,
68 mn_poe_num,
69 mx_poe_num,
70 no_mn_poe_flag,
71 no_mx_poe_flag,
72 rndg_cd,
73 rndg_rl,
74 poe_nnmntry_uom,
75 vrbl_rt_prfl_id,
76 business_group_id,
77 prt_attribute_category,
78 prt_attribute1,
79 prt_attribute2,
80 prt_attribute3,
81 prt_attribute4,
82 prt_attribute5,
83 prt_attribute6,
84 prt_attribute7,
85 prt_attribute8,
86 prt_attribute9,
87 prt_attribute10,
88 prt_attribute11,
89 prt_attribute12,
90 prt_attribute13,
91 prt_attribute14,
92 prt_attribute15,
93 prt_attribute16,
94 prt_attribute17,
95 prt_attribute18,
96 prt_attribute19,
97 prt_attribute20,
98 prt_attribute21,
99 prt_attribute22,
100 prt_attribute23,
101 prt_attribute24,
102 prt_attribute25,
103 prt_attribute26,
104 prt_attribute27,
105 prt_attribute28,
106 prt_attribute29,
107 prt_attribute30,
108 object_version_number,
109 cbr_dsblty_apls_flag
110 from ben_poe_rt_f
111 where poe_rt_id = p_poe_rt_id
112 and p_effective_date
113 between effective_start_date and effective_end_date;
114 --
115 l_proc varchar2(72) := g_package||'api_updating';
116 l_fct_ret boolean;
117 --
118 Begin
119 hr_utility.set_location('Entering:'||l_proc, 5);
120 --
121 If (p_effective_date is null or
122 p_poe_rt_id is null or
123 p_object_version_number is null) Then
124 --
125 -- One of the primary key arguments is null therefore we must
126 -- set the returning function value to false
127 --
128 l_fct_ret := false;
129 Else
130 If (p_poe_rt_id = g_old_rec.poe_rt_id and
131 p_object_version_number = g_old_rec.object_version_number) Then
132 hr_utility.set_location(l_proc, 10);
133 --
134 -- The g_old_rec is current therefore we must
135 -- set the returning function to true
136 --
137 l_fct_ret := true;
138 Else
139 --
140 -- Select the current row
141 --
142 Open C_Sel1;
143 Fetch C_Sel1 Into g_old_rec;
144 If C_Sel1%notfound Then
145 Close C_Sel1;
146 --
147 -- The primary key is invalid therefore we must error
148 --
149 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
150 fnd_message.raise_error;
151 End If;
152 Close C_Sel1;
153 If (p_object_version_number <> g_old_rec.object_version_number) Then
154 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
155 fnd_message.raise_error;
156 End If;
157 hr_utility.set_location(l_proc, 15);
158 l_fct_ret := true;
159 End If;
160 End If;
161 hr_utility.set_location(' Leaving:'||l_proc, 20);
162 Return (l_fct_ret);
163 --
164 End api_updating;
165 --
166 -- ----------------------------------------------------------------------------
167 -- |--------------------------< find_dt_del_modes >---------------------------|
168 -- ----------------------------------------------------------------------------
169 Procedure find_dt_del_modes
170 (p_effective_date in date,
171 p_base_key_value in number,
172 p_zap out nocopy boolean,
173 p_delete out nocopy boolean,
174 p_future_change out nocopy boolean,
175 p_delete_next_change out nocopy boolean) is
176 --
177 l_proc varchar2(72) := g_package||'find_dt_del_modes';
178 --
179 l_parent_key_value1 number;
180 --
181 Cursor C_Sel1 Is
182 select t.vrbl_rt_prfl_id
183 from ben_poe_rt_f t
184 where t.poe_rt_id = p_base_key_value
185 and p_effective_date
186 between t.effective_start_date and t.effective_end_date;
187 --
188 Begin
189 hr_utility.set_location('Entering:'||l_proc, 5);
190 Open C_Sel1;
191 Fetch C_Sel1 Into l_parent_key_value1;
192 If C_Sel1%notfound then
193 Close C_Sel1;
194 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
195 fnd_message.set_token('PROCEDURE', l_proc);
196 fnd_message.set_token('STEP','10');
197 fnd_message.raise_error;
198 End If;
199 Close C_Sel1;
200 --
201 -- Call the corresponding datetrack api
202 --
203 dt_api.find_dt_del_modes
204 (p_effective_date => p_effective_date,
205 p_base_table_name => 'ben_poe_rt_f',
206 p_base_key_column => 'poe_rt_id',
207 p_base_key_value => p_base_key_value,
208 p_parent_table_name1 => 'ben_vrbl_rt_prfl_f',
209 p_parent_key_column1 => 'vrbl_rt_prfl_id',
210 p_parent_key_value1 => l_parent_key_value1,
211 p_zap => p_zap,
212 p_delete => p_delete,
213 p_future_change => p_future_change,
214 p_delete_next_change => p_delete_next_change);
215 --
216 hr_utility.set_location(' Leaving:'||l_proc, 10);
217 End find_dt_del_modes;
218 --
219 -- ----------------------------------------------------------------------------
220 -- |--------------------------< find_dt_upd_modes >---------------------------|
221 -- ----------------------------------------------------------------------------
222 Procedure find_dt_upd_modes
223 (p_effective_date in date,
224 p_base_key_value in number,
225 p_correction out nocopy boolean,
226 p_update out nocopy boolean,
227 p_update_override out nocopy boolean,
228 p_update_change_insert out nocopy boolean) is
229 --
230 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
231 --
232 Begin
233 hr_utility.set_location('Entering:'||l_proc, 5);
234 --
235 -- Call the corresponding datetrack api
236 --
237 dt_api.find_dt_upd_modes
238 (p_effective_date => p_effective_date,
239 p_base_table_name => 'ben_poe_rt_f',
240 p_base_key_column => 'poe_rt_id',
241 p_base_key_value => p_base_key_value,
242 p_correction => p_correction,
243 p_update => p_update,
244 p_update_override => p_update_override,
245 p_update_change_insert => p_update_change_insert);
246 --
247 hr_utility.set_location(' Leaving:'||l_proc, 10);
248 End find_dt_upd_modes;
249 --
250 -- ----------------------------------------------------------------------------
251 -- |------------------------< upd_effective_end_date >------------------------|
252 -- ----------------------------------------------------------------------------
253 Procedure upd_effective_end_date
254 (p_effective_date in date,
255 p_base_key_value in number,
256 p_new_effective_end_date in date,
257 p_validation_start_date in date,
258 p_validation_end_date in date,
259 p_object_version_number out nocopy number) is
260 --
261 l_proc varchar2(72) := g_package||'upd_effective_end_date';
262 l_object_version_number number;
263 --
264 Begin
265 hr_utility.set_location('Entering:'||l_proc, 5);
266 --
267 -- Because we are updating a row we must get the next object
268 -- version number.
269 --
270 l_object_version_number :=
271 dt_api.get_object_version_number
272 (p_base_table_name => 'ben_poe_rt_f',
273 p_base_key_column => 'poe_rt_id',
274 p_base_key_value => p_base_key_value);
275 --
276 hr_utility.set_location(l_proc, 10);
277 g_api_dml := true; -- Set the api dml status
278 --
279 -- Update the specified datetrack row setting the effective
280 -- end date to the specified new effective end date.
281 --
282 update ben_poe_rt_f t
283 set t.effective_end_date = p_new_effective_end_date,
284 t.object_version_number = l_object_version_number
285 where t.poe_rt_id = p_base_key_value
286 and p_effective_date
287 between t.effective_start_date and t.effective_end_date;
288 --
289 g_api_dml := false; -- Unset the api dml status
290 p_object_version_number := l_object_version_number;
291 hr_utility.set_location(' Leaving:'||l_proc, 15);
292 --
293 Exception
294 When Others Then
295 g_api_dml := false; -- Unset the api dml status
296 Raise;
297 End upd_effective_end_date;
298 --
299 -- ----------------------------------------------------------------------------
300 -- |---------------------------------< lck >----------------------------------|
301 -- ----------------------------------------------------------------------------
302 Procedure lck
303 (p_effective_date in date,
304 p_datetrack_mode in varchar2,
305 p_poe_rt_id in number,
306 p_object_version_number in number,
307 p_validation_start_date out nocopy date,
308 p_validation_end_date out nocopy date) is
309 --
310 l_proc varchar2(72) := g_package||'lck';
311 l_validation_start_date date;
312 l_validation_end_date date;
313 l_object_invalid exception;
314 l_argument varchar2(30);
315 --
316 -- Cursor C_Sel1 selects the current locked row as of session date
317 -- ensuring that the object version numbers match.
318 --
319 Cursor C_Sel1 is
320 select
321 poe_rt_id,
322 effective_start_date,
323 effective_end_date,
324 mn_poe_num,
325 mx_poe_num,
326 no_mn_poe_flag,
327 no_mx_poe_flag,
328 rndg_cd,
329 rndg_rl,
330 poe_nnmntry_uom,
331 vrbl_rt_prfl_id,
332 business_group_id,
333 prt_attribute_category,
334 prt_attribute1,
335 prt_attribute2,
336 prt_attribute3,
337 prt_attribute4,
338 prt_attribute5,
339 prt_attribute6,
340 prt_attribute7,
341 prt_attribute8,
342 prt_attribute9,
343 prt_attribute10,
344 prt_attribute11,
345 prt_attribute12,
346 prt_attribute13,
347 prt_attribute14,
348 prt_attribute15,
349 prt_attribute16,
350 prt_attribute17,
351 prt_attribute18,
352 prt_attribute19,
353 prt_attribute20,
354 prt_attribute21,
355 prt_attribute22,
356 prt_attribute23,
357 prt_attribute24,
358 prt_attribute25,
359 prt_attribute26,
360 prt_attribute27,
361 prt_attribute28,
362 prt_attribute29,
363 prt_attribute30,
364 object_version_number,
365 cbr_dsblty_apls_flag
366 from ben_poe_rt_f
367 where poe_rt_id = p_poe_rt_id
368 and p_effective_date
369 between effective_start_date and effective_end_date
370 for update nowait;
371 --
372 --
373 --
374 Begin
375 hr_utility.set_location('Entering:'||l_proc, 5);
376 --
377 -- Ensure that all the mandatory arguments are not null
378 --
379 hr_api.mandatory_arg_error(p_api_name => l_proc,
380 p_argument => 'effective_date',
381 p_argument_value => p_effective_date);
382 --
383 hr_api.mandatory_arg_error(p_api_name => l_proc,
384 p_argument => 'datetrack_mode',
385 p_argument_value => p_datetrack_mode);
386 --
387 hr_api.mandatory_arg_error(p_api_name => l_proc,
388 p_argument => 'poe_rt_id',
389 p_argument_value => p_poe_rt_id);
390 --
391 hr_api.mandatory_arg_error(p_api_name => l_proc,
392 p_argument => 'object_version_number',
393 p_argument_value => p_object_version_number);
394 --
395 -- Check to ensure the datetrack mode is not INSERT.
396 --
397 If (p_datetrack_mode <> 'INSERT') then
398 --
399 -- We must select and lock the current row.
400 --
401 Open C_Sel1;
402 Fetch C_Sel1 Into g_old_rec;
403 If C_Sel1%notfound then
404 Close C_Sel1;
405 --
406 -- The primary key is invalid therefore we must error
407 --
408 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
409 fnd_message.raise_error;
410 End If;
411 Close C_Sel1;
412 If (p_object_version_number <> g_old_rec.object_version_number) Then
413 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
414 fnd_message.raise_error;
415 End If;
416 hr_utility.set_location(l_proc, 15);
417 --
418 --
419 -- Validate the datetrack mode mode getting the validation start
420 -- and end dates for the specified datetrack operation.
421 --
422 dt_api.validate_dt_mode
423 (p_effective_date => p_effective_date,
424 p_datetrack_mode => p_datetrack_mode,
425 p_base_table_name => 'ben_poe_rt_f',
426 p_base_key_column => 'poe_rt_id',
427 p_base_key_value => p_poe_rt_id,
428 p_parent_table_name1 => 'ben_vrbl_rt_prfl_f',
429 p_parent_key_column1 => 'vrbl_rt_prfl_id',
430 p_parent_key_value1 => g_old_rec.vrbl_rt_prfl_id,
431 p_enforce_foreign_locking => false , --true,
432 p_validation_start_date => l_validation_start_date,
433 p_validation_end_date => l_validation_end_date);
434 Else
435 --
436 -- We are doing a datetrack 'INSERT' which is illegal within this
437 -- procedure therefore we must error (note: to lck on insert the
438 -- private procedure ins_lck should be called).
439 --
440 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
441 fnd_message.set_token('PROCEDURE', l_proc);
442 fnd_message.set_token('STEP','20');
443 fnd_message.raise_error;
444 End If;
445 --
446 -- Set the validation start and end date OUT arguments
447 --
448 p_validation_start_date := l_validation_start_date;
449 p_validation_end_date := l_validation_end_date;
450 --
451 hr_utility.set_location(' Leaving:'||l_proc, 30);
452 --
453 -- We need to trap the ORA LOCK exception
454 --
455 Exception
456 When HR_Api.Object_Locked then
457 --
458 -- The object is locked therefore we need to supply a meaningful
459 -- error message.
460 --
461 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
462 fnd_message.set_token('TABLE_NAME', 'ben_poe_rt_f');
463 fnd_message.raise_error;
464 When l_object_invalid then
465 --
466 -- The object doesn't exist or is invalid
467 --
468 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
469 fnd_message.set_token('TABLE_NAME', 'ben_poe_rt_f');
470 fnd_message.raise_error;
471 End lck;
472 --
473 -- ----------------------------------------------------------------------------
474 -- |-----------------------------< convert_args >-----------------------------|
475 -- ----------------------------------------------------------------------------
476 Function convert_args
477 (
478 p_poe_rt_id in number,
479 p_effective_start_date in date,
480 p_effective_end_date in date,
481 p_mn_poe_num in number,
482 p_mx_poe_num in number,
483 p_no_mn_poe_flag in varchar2,
484 p_no_mx_poe_flag in varchar2,
485 p_rndg_cd in varchar2,
486 p_rndg_rl in number,
487 p_poe_nnmntry_uom in varchar2,
488 p_vrbl_rt_prfl_id in number,
489 p_business_group_id in number,
490 p_prt_attribute_category in varchar2,
491 p_prt_attribute1 in varchar2,
492 p_prt_attribute2 in varchar2,
493 p_prt_attribute3 in varchar2,
494 p_prt_attribute4 in varchar2,
495 p_prt_attribute5 in varchar2,
496 p_prt_attribute6 in varchar2,
497 p_prt_attribute7 in varchar2,
498 p_prt_attribute8 in varchar2,
499 p_prt_attribute9 in varchar2,
500 p_prt_attribute10 in varchar2,
501 p_prt_attribute11 in varchar2,
502 p_prt_attribute12 in varchar2,
503 p_prt_attribute13 in varchar2,
504 p_prt_attribute14 in varchar2,
505 p_prt_attribute15 in varchar2,
506 p_prt_attribute16 in varchar2,
507 p_prt_attribute17 in varchar2,
508 p_prt_attribute18 in varchar2,
509 p_prt_attribute19 in varchar2,
510 p_prt_attribute20 in varchar2,
511 p_prt_attribute21 in varchar2,
512 p_prt_attribute22 in varchar2,
513 p_prt_attribute23 in varchar2,
514 p_prt_attribute24 in varchar2,
515 p_prt_attribute25 in varchar2,
516 p_prt_attribute26 in varchar2,
517 p_prt_attribute27 in varchar2,
518 p_prt_attribute28 in varchar2,
519 p_prt_attribute29 in varchar2,
520 p_prt_attribute30 in varchar2,
521 p_object_version_number in number,
522 p_cbr_dsblty_apls_flag in varchar2
523 )
524 Return g_rec_type is
525 --
526 l_rec g_rec_type;
527 l_proc varchar2(72) := g_package||'convert_args';
528 --
529 Begin
530 --
531 hr_utility.set_location('Entering:'||l_proc, 5);
532 --
533 -- Convert arguments into local l_rec structure.
534 --
535 l_rec.poe_rt_id := p_poe_rt_id;
536 l_rec.effective_start_date := p_effective_start_date;
537 l_rec.effective_end_date := p_effective_end_date;
538 l_rec.mn_poe_num := p_mn_poe_num;
539 l_rec.mx_poe_num := p_mx_poe_num;
540 l_rec.no_mn_poe_flag := p_no_mn_poe_flag;
541 l_rec.no_mx_poe_flag := p_no_mx_poe_flag;
542 l_rec.rndg_cd := p_rndg_cd;
543 l_rec.rndg_rl := p_rndg_rl;
544 l_rec.poe_nnmntry_uom := p_poe_nnmntry_uom;
545 l_rec.vrbl_rt_prfl_id := p_vrbl_rt_prfl_id;
546 l_rec.business_group_id := p_business_group_id;
547 l_rec.prt_attribute_category := p_prt_attribute_category;
548 l_rec.prt_attribute1 := p_prt_attribute1;
549 l_rec.prt_attribute2 := p_prt_attribute2;
550 l_rec.prt_attribute3 := p_prt_attribute3;
551 l_rec.prt_attribute4 := p_prt_attribute4;
552 l_rec.prt_attribute5 := p_prt_attribute5;
553 l_rec.prt_attribute6 := p_prt_attribute6;
554 l_rec.prt_attribute7 := p_prt_attribute7;
555 l_rec.prt_attribute8 := p_prt_attribute8;
556 l_rec.prt_attribute9 := p_prt_attribute9;
557 l_rec.prt_attribute10 := p_prt_attribute10;
558 l_rec.prt_attribute11 := p_prt_attribute11;
559 l_rec.prt_attribute12 := p_prt_attribute12;
560 l_rec.prt_attribute13 := p_prt_attribute13;
561 l_rec.prt_attribute14 := p_prt_attribute14;
562 l_rec.prt_attribute15 := p_prt_attribute15;
563 l_rec.prt_attribute16 := p_prt_attribute16;
564 l_rec.prt_attribute17 := p_prt_attribute17;
565 l_rec.prt_attribute18 := p_prt_attribute18;
566 l_rec.prt_attribute19 := p_prt_attribute19;
567 l_rec.prt_attribute20 := p_prt_attribute20;
568 l_rec.prt_attribute21 := p_prt_attribute21;
569 l_rec.prt_attribute22 := p_prt_attribute22;
570 l_rec.prt_attribute23 := p_prt_attribute23;
571 l_rec.prt_attribute24 := p_prt_attribute24;
572 l_rec.prt_attribute25 := p_prt_attribute25;
573 l_rec.prt_attribute26 := p_prt_attribute26;
574 l_rec.prt_attribute27 := p_prt_attribute27;
575 l_rec.prt_attribute28 := p_prt_attribute28;
576 l_rec.prt_attribute29 := p_prt_attribute29;
577 l_rec.prt_attribute30 := p_prt_attribute30;
578 l_rec.object_version_number := p_object_version_number;
579 l_rec.cbr_dsblty_apls_flag := p_cbr_dsblty_apls_flag;
580 --
581 -- Return the plsql record structure.
582 --
583 hr_utility.set_location(' Leaving:'||l_proc, 10);
584 Return(l_rec);
585 --
586 End convert_args;
587 --
588 end ben_prt_shd;