[Home] [Help]
PACKAGE BODY: APPS.BEN_ECQ_SHD
Source
1 Package Body ben_ecq_shd as
2 /* $Header: beecqrhi.pkb 120.1 2006/02/27 02:30:07 rtagarra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_ecq_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_ELIG_CBR_QUALD_BNF_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 ElsIf (p_constraint_name = 'BEN_ELIG_CBR_QUALD_BNF_F_DT2') 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 ElsIf (p_constraint_name = 'BEN_ELIG_CBR_QUALD_BNF_F_DT3') Then
47 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
48 fnd_message.set_token('PROCEDURE', l_proc);
49 fnd_message.set_token('STEP','15');
50 fnd_message.raise_error;
51 Else
52 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
53 fnd_message.set_token('PROCEDURE', l_proc);
54 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
55 fnd_message.raise_error;
56 End If;
57 --
58 hr_utility.set_location(' Leaving:'||l_proc, 10);
59 End constraint_error;
60 --
61 -- ----------------------------------------------------------------------------
62 -- |-----------------------------< api_updating >-----------------------------|
63 -- ----------------------------------------------------------------------------
64 Function api_updating
65 (p_effective_date in date,
66 p_elig_cbr_quald_bnf_id in number,
67 p_object_version_number in number
68 ) Return Boolean Is
69 --
70 --
74 select
71 -- Cursor selects the 'current' row from the HR Schema
72 --
73 Cursor C_Sel1 is
75 elig_cbr_quald_bnf_id,
76 effective_start_date,
77 effective_end_date,
78 quald_bnf_flag,
79 ordr_num,
80 eligy_prfl_id,
81 pgm_id,
82 ptip_id,
83 business_group_id,
84 ecq_attribute_category,
85 ecq_attribute1,
86 ecq_attribute2,
87 ecq_attribute3,
88 ecq_attribute4,
89 ecq_attribute5,
90 ecq_attribute6,
91 ecq_attribute7,
92 ecq_attribute8,
93 ecq_attribute9,
94 ecq_attribute10,
95 ecq_attribute11,
96 ecq_attribute12,
97 ecq_attribute13,
98 ecq_attribute14,
99 ecq_attribute15,
100 ecq_attribute16,
101 ecq_attribute17,
102 ecq_attribute18,
103 ecq_attribute19,
104 ecq_attribute20,
105 ecq_attribute21,
106 ecq_attribute22,
107 ecq_attribute23,
108 ecq_attribute24,
109 ecq_attribute25,
110 ecq_attribute26,
111 ecq_attribute27,
112 ecq_attribute28,
113 ecq_attribute29,
114 ecq_attribute30,
115 object_version_number,
116 criteria_score,
117 criteria_weight
118 from ben_elig_cbr_quald_bnf_f
119 where elig_cbr_quald_bnf_id = p_elig_cbr_quald_bnf_id
120 and p_effective_date
121 between effective_start_date and effective_end_date;
122 --
123 l_proc varchar2(72) := g_package||'api_updating';
124 l_fct_ret boolean;
125 --
126 Begin
127 hr_utility.set_location('Entering:'||l_proc, 5);
128 --
129 If (p_effective_date is null or
130 p_elig_cbr_quald_bnf_id is null or
131 p_object_version_number is null) Then
132 --
133 -- One of the primary key arguments is null therefore we must
134 -- set the returning function value to false
135 --
136 l_fct_ret := false;
137 Else
138 If (p_elig_cbr_quald_bnf_id = g_old_rec.elig_cbr_quald_bnf_id and
139 p_object_version_number = g_old_rec.object_version_number) Then
140 hr_utility.set_location(l_proc, 10);
141 --
142 -- The g_old_rec is current therefore we must
143 -- set the returning function to true
144 --
145 l_fct_ret := true;
146 Else
147 --
148 -- Select the current row
149 --
150 Open C_Sel1;
151 Fetch C_Sel1 Into g_old_rec;
152 If C_Sel1%notfound Then
153 Close C_Sel1;
154 --
155 -- The primary key is invalid therefore we must error
156 --
157 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
158 fnd_message.raise_error;
159 End If;
160 Close C_Sel1;
161 If (p_object_version_number <> g_old_rec.object_version_number) Then
162 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
163 fnd_message.raise_error;
164 End If;
165 hr_utility.set_location(l_proc, 15);
166 l_fct_ret := true;
167 End If;
168 End If;
169 hr_utility.set_location(' Leaving:'||l_proc, 20);
170 Return (l_fct_ret);
171 --
172 End api_updating;
173 --
174 -- ----------------------------------------------------------------------------
175 -- |--------------------------< find_dt_del_modes >---------------------------|
176 -- ----------------------------------------------------------------------------
177 Procedure find_dt_del_modes
178 (p_effective_date in date,
179 p_base_key_value in number,
180 p_zap out nocopy boolean,
181 p_delete out nocopy boolean,
182 p_future_change out nocopy boolean,
183 p_delete_next_change out nocopy boolean) is
184 --
185 l_proc varchar2(72) := g_package||'find_dt_del_modes';
186 --
187 l_parent_key_value1 number;
188 l_parent_key_value2 number;
189 l_parent_key_value3 number;
190 --
191 Cursor C_Sel1 Is
192 select t.eligy_prfl_id,
193 t.pgm_id,
194 t.ptip_id
195 from ben_elig_cbr_quald_bnf_f t
196 where t.elig_cbr_quald_bnf_id = p_base_key_value
197 and p_effective_date
198 between t.effective_start_date and t.effective_end_date;
199 --
200 Begin
201 hr_utility.set_location('Entering:'||l_proc, 5);
202 Open C_Sel1;
203 Fetch C_Sel1 Into l_parent_key_value1,
204 l_parent_key_value2,
205 l_parent_key_value3;
206 If C_Sel1%notfound then
207 Close C_Sel1;
208 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
209 fnd_message.set_token('PROCEDURE', l_proc);
210 fnd_message.set_token('STEP','10');
211 fnd_message.raise_error;
212 End If;
213 Close C_Sel1;
214 --
215 -- Call the corresponding datetrack api
216 --
217 dt_api.find_dt_del_modes
218 (p_effective_date => p_effective_date,
219 p_base_table_name => 'ben_elig_cbr_quald_bnf_f',
220 p_base_key_column => 'elig_cbr_quald_bnf_id',
221 p_base_key_value => p_base_key_value,
222 p_parent_table_name1 => 'ben_eligy_prfl_f',
223 p_parent_key_column1 => 'eligy_prfl_id',
224 p_parent_key_value1 => l_parent_key_value1,
225 p_parent_table_name2 => 'ben_pgm_f',
226 p_parent_key_column2 => 'pgm_id',
227 p_parent_key_value2 => l_parent_key_value2,
228 p_parent_table_name3 => 'ben_ptip_f',
229 p_parent_key_column3 => 'ptip_id',
230 p_parent_key_value3 => l_parent_key_value3,
231 p_zap => p_zap,
232 p_delete => p_delete,
233 p_future_change => p_future_change,
234 p_delete_next_change => p_delete_next_change);
235 --
236 hr_utility.set_location(' Leaving:'||l_proc, 10);
240 -- |--------------------------< find_dt_upd_modes >---------------------------|
237 End find_dt_del_modes;
238 --
239 -- ----------------------------------------------------------------------------
241 -- ----------------------------------------------------------------------------
242 Procedure find_dt_upd_modes
243 (p_effective_date in date,
244 p_base_key_value in number,
245 p_correction out nocopy boolean,
246 p_update out nocopy boolean,
247 p_update_override out nocopy boolean,
248 p_update_change_insert out nocopy boolean) is
249 --
250 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
251 --
252 Begin
253 hr_utility.set_location('Entering:'||l_proc, 5);
254 --
255 -- Call the corresponding datetrack api
256 --
257 dt_api.find_dt_upd_modes
258 (p_effective_date => p_effective_date,
259 p_base_table_name => 'ben_elig_cbr_quald_bnf_f',
260 p_base_key_column => 'elig_cbr_quald_bnf_id',
261 p_base_key_value => p_base_key_value,
262 p_correction => p_correction,
263 p_update => p_update,
264 p_update_override => p_update_override,
265 p_update_change_insert => p_update_change_insert);
266 --
267 hr_utility.set_location(' Leaving:'||l_proc, 10);
268 End find_dt_upd_modes;
269 --
270 -- ----------------------------------------------------------------------------
271 -- |------------------------< upd_effective_end_date >------------------------|
272 -- ----------------------------------------------------------------------------
273 Procedure upd_effective_end_date
274 (p_effective_date in date,
275 p_base_key_value in number,
276 p_new_effective_end_date in date,
277 p_validation_start_date in date,
278 p_validation_end_date in date,
279 p_object_version_number out nocopy number) is
280 --
281 l_proc varchar2(72) := g_package||'upd_effective_end_date';
282 l_object_version_number number;
283 --
284 Begin
285 hr_utility.set_location('Entering:'||l_proc, 5);
286 --
287 -- Because we are updating a row we must get the next object
288 -- version number.
289 --
290 l_object_version_number :=
291 dt_api.get_object_version_number
292 (p_base_table_name => 'ben_elig_cbr_quald_bnf_f',
293 p_base_key_column => 'elig_cbr_quald_bnf_id',
294 p_base_key_value => p_base_key_value);
295 --
296 hr_utility.set_location(l_proc, 10);
297 g_api_dml := true; -- Set the api dml status
298 --
299 -- Update the specified datetrack row setting the effective
300 -- end date to the specified new effective end date.
301 --
302 update ben_elig_cbr_quald_bnf_f t
303 set t.effective_end_date = p_new_effective_end_date,
304 t.object_version_number = l_object_version_number
305 where t.elig_cbr_quald_bnf_id = p_base_key_value
306 and p_effective_date
307 between t.effective_start_date and t.effective_end_date;
308 --
309 g_api_dml := false; -- Unset the api dml status
310 p_object_version_number := l_object_version_number;
311 hr_utility.set_location(' Leaving:'||l_proc, 15);
312 --
313 Exception
314 When Others Then
315 g_api_dml := false; -- Unset the api dml status
316 Raise;
317 End upd_effective_end_date;
318 --
319 -- ----------------------------------------------------------------------------
320 -- |---------------------------------< lck >----------------------------------|
321 -- ----------------------------------------------------------------------------
322 Procedure lck
323 (p_effective_date in date,
324 p_datetrack_mode in varchar2,
325 p_elig_cbr_quald_bnf_id in number,
326 p_object_version_number in number,
327 p_validation_start_date out nocopy date,
328 p_validation_end_date out nocopy date) is
329 --
330 l_proc varchar2(72) := g_package||'lck';
331 l_validation_start_date date;
332 l_validation_end_date date;
333 l_object_invalid exception;
334 l_argument varchar2(30);
335 --
336 -- Cursor C_Sel1 selects the current locked row as of session date
337 -- ensuring that the object version numbers match.
338 --
339 Cursor C_Sel1 is
340 select
341 elig_cbr_quald_bnf_id,
342 effective_start_date,
343 effective_end_date,
344 quald_bnf_flag,
345 ordr_num,
346 eligy_prfl_id,
347 pgm_id,
348 ptip_id,
349 business_group_id,
350 ecq_attribute_category,
351 ecq_attribute1,
352 ecq_attribute2,
353 ecq_attribute3,
354 ecq_attribute4,
355 ecq_attribute5,
356 ecq_attribute6,
357 ecq_attribute7,
358 ecq_attribute8,
359 ecq_attribute9,
360 ecq_attribute10,
361 ecq_attribute11,
362 ecq_attribute12,
363 ecq_attribute13,
364 ecq_attribute14,
365 ecq_attribute15,
366 ecq_attribute16,
367 ecq_attribute17,
368 ecq_attribute18,
369 ecq_attribute19,
370 ecq_attribute20,
371 ecq_attribute21,
372 ecq_attribute22,
373 ecq_attribute23,
374 ecq_attribute24,
375 ecq_attribute25,
376 ecq_attribute26,
377 ecq_attribute27,
378 ecq_attribute28,
379 ecq_attribute29,
380 ecq_attribute30,
381 object_version_number,
382 criteria_score,
383 criteria_weight
384
385 from ben_elig_cbr_quald_bnf_f
386 where elig_cbr_quald_bnf_id = p_elig_cbr_quald_bnf_id
387 and p_effective_date
388 between effective_start_date and effective_end_date
389 for update nowait;
390 --
391 --
392 --
393 Begin
394 hr_utility.set_location('Entering:'||l_proc, 5);
395 --
396 -- Ensure that all the mandatory arguments are not null
397 --
401 --
398 hr_api.mandatory_arg_error(p_api_name => l_proc,
399 p_argument => 'effective_date',
400 p_argument_value => p_effective_date);
402 hr_api.mandatory_arg_error(p_api_name => l_proc,
403 p_argument => 'datetrack_mode',
404 p_argument_value => p_datetrack_mode);
405 --
406 hr_api.mandatory_arg_error(p_api_name => l_proc,
407 p_argument => 'elig_cbr_quald_bnf_id',
408 p_argument_value => p_elig_cbr_quald_bnf_id);
409 --
410 hr_api.mandatory_arg_error(p_api_name => l_proc,
411 p_argument => 'object_version_number',
412 p_argument_value => p_object_version_number);
413 --
414 -- Check to ensure the datetrack mode is not INSERT.
415 --
416 If (p_datetrack_mode <> 'INSERT') then
417 --
418 -- We must select and lock the current row.
419 --
420 Open C_Sel1;
421 Fetch C_Sel1 Into g_old_rec;
422 If C_Sel1%notfound then
423 Close C_Sel1;
424 --
425 -- The primary key is invalid therefore we must error
426 --
427 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
428 fnd_message.raise_error;
429 End If;
430 Close C_Sel1;
431 If (p_object_version_number <> g_old_rec.object_version_number) Then
432 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
433 fnd_message.raise_error;
434 End If;
435 hr_utility.set_location(l_proc, 15);
436 --
437 --
438 -- Validate the datetrack mode mode getting the validation start
439 -- and end dates for the specified datetrack operation.
440 --
441 dt_api.validate_dt_mode
442 (p_effective_date => p_effective_date,
443 p_datetrack_mode => p_datetrack_mode,
444 p_base_table_name => 'ben_elig_cbr_quald_bnf_f',
445 p_base_key_column => 'elig_cbr_quald_bnf_id',
446 p_base_key_value => p_elig_cbr_quald_bnf_id,
447 p_parent_table_name1 => 'ben_eligy_prfl_f',
448 p_parent_key_column1 => 'eligy_prfl_id',
449 p_parent_key_value1 => g_old_rec.eligy_prfl_id,
450 p_parent_table_name2 => 'ben_pgm_f',
451 p_parent_key_column2 => 'pgm_id',
452 p_parent_key_value2 => g_old_rec.pgm_id,
453 p_parent_table_name3 => 'ben_ptip_f',
454 p_parent_key_column3 => 'ptip_id',
455 p_parent_key_value3 => g_old_rec.ptip_id,
456 p_enforce_foreign_locking => true,
457 p_validation_start_date => l_validation_start_date,
458 p_validation_end_date => l_validation_end_date);
459 Else
460 --
461 -- We are doing a datetrack 'INSERT' which is illegal within this
462 -- procedure therefore we must error (note: to lck on insert the
463 -- private procedure ins_lck should be called).
464 --
465 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
466 fnd_message.set_token('PROCEDURE', l_proc);
467 fnd_message.set_token('STEP','20');
468 fnd_message.raise_error;
469 End If;
470 --
471 -- Set the validation start and end date OUT arguments
472 --
473 p_validation_start_date := l_validation_start_date;
474 p_validation_end_date := l_validation_end_date;
475 --
476 hr_utility.set_location(' Leaving:'||l_proc, 30);
477 --
478 -- We need to trap the ORA LOCK exception
479 --
480 Exception
481 When HR_Api.Object_Locked then
482 --
483 -- The object is locked therefore we need to supply a meaningful
484 -- error message.
485 --
486 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
487 fnd_message.set_token('TABLE_NAME', 'ben_elig_cbr_quald_bnf_f');
488 fnd_message.raise_error;
489 When l_object_invalid then
490 --
491 -- The object doesn't exist or is invalid
492 --
493 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
494 fnd_message.set_token('TABLE_NAME', 'ben_elig_cbr_quald_bnf_f');
495 fnd_message.raise_error;
496 End lck;
497 --
498 -- ----------------------------------------------------------------------------
499 -- |-----------------------------< convert_args >-----------------------------|
500 -- ----------------------------------------------------------------------------
501 Function convert_args
502 (
503 p_elig_cbr_quald_bnf_id in number,
504 p_effective_start_date in date,
505 p_effective_end_date in date,
506 p_quald_bnf_flag in varchar2,
507 p_ordr_num in number,
508 p_eligy_prfl_id in number,
509 p_pgm_id in number,
510 p_ptip_id in number,
511 p_business_group_id in number,
512 p_ecq_attribute_category in varchar2,
513 p_ecq_attribute1 in varchar2,
514 p_ecq_attribute2 in varchar2,
515 p_ecq_attribute3 in varchar2,
516 p_ecq_attribute4 in varchar2,
517 p_ecq_attribute5 in varchar2,
518 p_ecq_attribute6 in varchar2,
519 p_ecq_attribute7 in varchar2,
520 p_ecq_attribute8 in varchar2,
521 p_ecq_attribute9 in varchar2,
522 p_ecq_attribute10 in varchar2,
523 p_ecq_attribute11 in varchar2,
524 p_ecq_attribute12 in varchar2,
525 p_ecq_attribute13 in varchar2,
526 p_ecq_attribute14 in varchar2,
527 p_ecq_attribute15 in varchar2,
528 p_ecq_attribute16 in varchar2,
529 p_ecq_attribute17 in varchar2,
533 p_ecq_attribute21 in varchar2,
530 p_ecq_attribute18 in varchar2,
531 p_ecq_attribute19 in varchar2,
532 p_ecq_attribute20 in varchar2,
534 p_ecq_attribute22 in varchar2,
535 p_ecq_attribute23 in varchar2,
536 p_ecq_attribute24 in varchar2,
537 p_ecq_attribute25 in varchar2,
538 p_ecq_attribute26 in varchar2,
539 p_ecq_attribute27 in varchar2,
540 p_ecq_attribute28 in varchar2,
541 p_ecq_attribute29 in varchar2,
542 p_ecq_attribute30 in varchar2,
543 p_object_version_number in number,
544 p_criteria_score in number,
545 p_criteria_weight in number
546
547 )
548 Return g_rec_type is
549 --
550 l_rec g_rec_type;
551 l_proc varchar2(72) := g_package||'convert_args';
552 --
553 Begin
554 --
555 hr_utility.set_location('Entering:'||l_proc, 5);
556 --
557 -- Convert arguments into local l_rec structure.
558 --
559 l_rec.elig_cbr_quald_bnf_id := p_elig_cbr_quald_bnf_id;
560 l_rec.effective_start_date := p_effective_start_date;
561 l_rec.effective_end_date := p_effective_end_date;
562 l_rec.quald_bnf_flag := p_quald_bnf_flag;
563 l_rec.ordr_num := p_ordr_num;
564 l_rec.eligy_prfl_id := p_eligy_prfl_id;
565 l_rec.pgm_id := p_pgm_id;
566 l_rec.ptip_id := p_ptip_id;
567 l_rec.business_group_id := p_business_group_id;
568 l_rec.ecq_attribute_category := p_ecq_attribute_category;
569 l_rec.ecq_attribute1 := p_ecq_attribute1;
570 l_rec.ecq_attribute2 := p_ecq_attribute2;
571 l_rec.ecq_attribute3 := p_ecq_attribute3;
572 l_rec.ecq_attribute4 := p_ecq_attribute4;
573 l_rec.ecq_attribute5 := p_ecq_attribute5;
574 l_rec.ecq_attribute6 := p_ecq_attribute6;
575 l_rec.ecq_attribute7 := p_ecq_attribute7;
576 l_rec.ecq_attribute8 := p_ecq_attribute8;
577 l_rec.ecq_attribute9 := p_ecq_attribute9;
578 l_rec.ecq_attribute10 := p_ecq_attribute10;
579 l_rec.ecq_attribute11 := p_ecq_attribute11;
580 l_rec.ecq_attribute12 := p_ecq_attribute12;
581 l_rec.ecq_attribute13 := p_ecq_attribute13;
582 l_rec.ecq_attribute14 := p_ecq_attribute14;
583 l_rec.ecq_attribute15 := p_ecq_attribute15;
584 l_rec.ecq_attribute16 := p_ecq_attribute16;
585 l_rec.ecq_attribute17 := p_ecq_attribute17;
586 l_rec.ecq_attribute18 := p_ecq_attribute18;
587 l_rec.ecq_attribute19 := p_ecq_attribute19;
588 l_rec.ecq_attribute20 := p_ecq_attribute20;
589 l_rec.ecq_attribute21 := p_ecq_attribute21;
590 l_rec.ecq_attribute22 := p_ecq_attribute22;
591 l_rec.ecq_attribute23 := p_ecq_attribute23;
592 l_rec.ecq_attribute24 := p_ecq_attribute24;
593 l_rec.ecq_attribute25 := p_ecq_attribute25;
594 l_rec.ecq_attribute26 := p_ecq_attribute26;
595 l_rec.ecq_attribute27 := p_ecq_attribute27;
596 l_rec.ecq_attribute28 := p_ecq_attribute28;
597 l_rec.ecq_attribute29 := p_ecq_attribute29;
598 l_rec.ecq_attribute30 := p_ecq_attribute30;
599 l_rec.object_version_number := p_object_version_number;
600 l_rec.criteria_score :=p_criteria_score;
601 l_rec.criteria_weight :=p_criteria_weight;
602
603
604 --
605 -- Return the plsql record structure.
606 --
607 hr_utility.set_location(' Leaving:'||l_proc, 10);
608 Return(l_rec);
609 --
610 End convert_args;
611 --
612 end ben_ecq_shd;