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