[Home] [Help]
PACKAGE BODY: APPS.BEN_ECP_SHD
Source
1 Package Body ben_ecp_shd as
2 /* $Header: beecprhi.pkb 120.1 2006/02/27 02:11:18 rtagarra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_ecp_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_CMBN_A_S_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_ELIG_CMBN_A_S_FK2') 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_CMBN_A_S_PK') 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_cmbn_age_los_prte_id in number,
67 p_object_version_number in number
68 ) Return Boolean Is
69 --
70 --
71 -- Cursor selects the 'current' row from the HR Schema
72 --
73 Cursor C_Sel1 is
74 select
75 elig_cmbn_age_los_prte_id,
76 effective_start_date,
77 effective_end_date,
78 business_group_id,
79 cmbn_age_los_fctr_id,
80 eligy_prfl_id,
81 excld_flag,
82 ordr_num,
83 mndtry_flag,
84 ecp_attribute_category,
85 ecp_attribute1,
86 ecp_attribute2,
87 ecp_attribute3,
88 ecp_attribute4,
89 ecp_attribute5,
90 ecp_attribute6,
91 ecp_attribute7,
92 ecp_attribute8,
93 ecp_attribute9,
94 ecp_attribute10,
95 ecp_attribute11,
96 ecp_attribute12,
97 ecp_attribute13,
98 ecp_attribute14,
99 ecp_attribute15,
100 ecp_attribute16,
101 ecp_attribute17,
102 ecp_attribute18,
103 ecp_attribute19,
104 ecp_attribute20,
105 ecp_attribute21,
106 ecp_attribute22,
107 ecp_attribute23,
108 ecp_attribute24,
109 ecp_attribute25,
110 ecp_attribute26,
111 ecp_attribute27,
112 ecp_attribute28,
113 ecp_attribute29,
114 ecp_attribute30,
115 object_version_number,
116 criteria_score,
117 criteria_weight
118 from ben_elig_cmbn_age_los_prte_f
119 where elig_cmbn_age_los_prte_id = p_elig_cmbn_age_los_prte_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_cmbn_age_los_prte_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_cmbn_age_los_prte_id = g_old_rec.elig_cmbn_age_los_prte_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 --
189 Cursor C_Sel1 Is
190 select t.eligy_prfl_id
191 from ben_elig_cmbn_age_los_prte_f t
192 where t.elig_cmbn_age_los_prte_id = p_base_key_value
193 and p_effective_date
194 between t.effective_start_date and t.effective_end_date;
195 --
196 Begin
197 hr_utility.set_location('Entering:'||l_proc, 5);
198 Open C_Sel1;
199 Fetch C_Sel1 Into l_parent_key_value1;
200 If C_Sel1%notfound then
201 Close C_Sel1;
202 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
203 fnd_message.set_token('PROCEDURE', l_proc);
204 fnd_message.set_token('STEP','10');
205 fnd_message.raise_error;
206 End If;
207 Close C_Sel1;
208 --
209 -- Call the corresponding datetrack api
210 --
211 dt_api.find_dt_del_modes
212 (p_effective_date => p_effective_date,
213 p_base_table_name => 'ben_elig_cmbn_age_los_prte_f',
214 p_base_key_column => 'elig_cmbn_age_los_prte_id',
215 p_base_key_value => p_base_key_value,
216 p_parent_table_name1 => 'ben_eligy_prfl_f',
217 p_parent_key_column1 => 'eligy_prfl_id',
218 p_parent_key_value1 => l_parent_key_value1,
219 p_zap => p_zap,
220 p_delete => p_delete,
221 p_future_change => p_future_change,
222 p_delete_next_change => p_delete_next_change);
223 --
224 hr_utility.set_location(' Leaving:'||l_proc, 10);
225 End find_dt_del_modes;
226 --
227 -- ----------------------------------------------------------------------------
228 -- |--------------------------< find_dt_upd_modes >---------------------------|
229 -- ----------------------------------------------------------------------------
230 Procedure find_dt_upd_modes
231 (p_effective_date in date,
232 p_base_key_value in number,
233 p_correction out nocopy boolean,
234 p_update out nocopy boolean,
235 p_update_override out nocopy boolean,
236 p_update_change_insert out nocopy boolean) is
237 --
238 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
239 --
240 Begin
241 hr_utility.set_location('Entering:'||l_proc, 5);
242 --
243 -- Call the corresponding datetrack api
244 --
245 dt_api.find_dt_upd_modes
246 (p_effective_date => p_effective_date,
247 p_base_table_name => 'ben_elig_cmbn_age_los_prte_f',
248 p_base_key_column => 'elig_cmbn_age_los_prte_id',
249 p_base_key_value => p_base_key_value,
250 p_correction => p_correction,
251 p_update => p_update,
252 p_update_override => p_update_override,
253 p_update_change_insert => p_update_change_insert);
254 --
255 hr_utility.set_location(' Leaving:'||l_proc, 10);
256 End find_dt_upd_modes;
257 --
258 -- ----------------------------------------------------------------------------
259 -- |------------------------< upd_effective_end_date >------------------------|
260 -- ----------------------------------------------------------------------------
261 Procedure upd_effective_end_date
262 (p_effective_date in date,
263 p_base_key_value in number,
264 p_new_effective_end_date in date,
265 p_validation_start_date in date,
266 p_validation_end_date in date,
267 p_object_version_number out nocopy number) is
268 --
269 l_proc varchar2(72) := g_package||'upd_effective_end_date';
270 l_object_version_number number;
271 --
272 Begin
273 hr_utility.set_location('Entering:'||l_proc, 5);
274 --
275 -- Because we are updating a row we must get the next object
276 -- version number.
277 --
278 l_object_version_number :=
279 dt_api.get_object_version_number
280 (p_base_table_name => 'ben_elig_cmbn_age_los_prte_f',
281 p_base_key_column => 'elig_cmbn_age_los_prte_id',
282 p_base_key_value => p_base_key_value);
283 --
284 hr_utility.set_location(l_proc, 10);
285 g_api_dml := true; -- Set the api dml status
286 --
287 -- Update the specified datetrack row setting the effective
288 -- end date to the specified new effective end date.
289 --
290 update ben_elig_cmbn_age_los_prte_f t
291 set t.effective_end_date = p_new_effective_end_date,
292 t.object_version_number = l_object_version_number
293 where t.elig_cmbn_age_los_prte_id = p_base_key_value
294 and p_effective_date
295 between t.effective_start_date and t.effective_end_date;
296 --
297 g_api_dml := false; -- Unset the api dml status
298 p_object_version_number := l_object_version_number;
299 hr_utility.set_location(' Leaving:'||l_proc, 15);
300 --
301 Exception
302 When Others Then
303 g_api_dml := false; -- Unset the api dml status
304 Raise;
305 End upd_effective_end_date;
306 --
307 -- ----------------------------------------------------------------------------
308 -- |---------------------------------< lck >----------------------------------|
309 -- ----------------------------------------------------------------------------
310 Procedure lck
311 (p_effective_date in date,
312 p_datetrack_mode in varchar2,
313 p_elig_cmbn_age_los_prte_id in number,
314 p_object_version_number in number,
315 p_validation_start_date out nocopy date,
316 p_validation_end_date out nocopy date) is
317 --
318 l_proc varchar2(72) := g_package||'lck';
319 l_validation_start_date date;
320 l_validation_end_date date;
321 l_object_invalid exception;
322 l_argument varchar2(30);
323 --
324 -- Cursor C_Sel1 selects the current locked row as of session date
325 -- ensuring that the object version numbers match.
326 --
327 Cursor C_Sel1 is
328 select
329 elig_cmbn_age_los_prte_id,
330 effective_start_date,
331 effective_end_date,
332 business_group_id,
333 cmbn_age_los_fctr_id,
334 eligy_prfl_id,
335 excld_flag,
336 ordr_num,
337 mndtry_flag,
338 ecp_attribute_category,
339 ecp_attribute1,
340 ecp_attribute2,
341 ecp_attribute3,
342 ecp_attribute4,
343 ecp_attribute5,
344 ecp_attribute6,
345 ecp_attribute7,
346 ecp_attribute8,
347 ecp_attribute9,
351 ecp_attribute13,
348 ecp_attribute10,
349 ecp_attribute11,
350 ecp_attribute12,
352 ecp_attribute14,
353 ecp_attribute15,
354 ecp_attribute16,
355 ecp_attribute17,
356 ecp_attribute18,
357 ecp_attribute19,
358 ecp_attribute20,
359 ecp_attribute21,
360 ecp_attribute22,
361 ecp_attribute23,
362 ecp_attribute24,
363 ecp_attribute25,
364 ecp_attribute26,
365 ecp_attribute27,
366 ecp_attribute28,
367 ecp_attribute29,
368 ecp_attribute30,
369 object_version_number ,
370 criteria_score,
371 criteria_weight
372 from ben_elig_cmbn_age_los_prte_f
373 where elig_cmbn_age_los_prte_id = p_elig_cmbn_age_los_prte_id
374 and p_effective_date
375 between effective_start_date and effective_end_date
376 for update nowait;
377 --
378 --
379 --
380 Begin
381 hr_utility.set_location('Entering:'||l_proc, 5);
382 --
383 -- Ensure that all the mandatory arguments are not null
384 --
385 hr_api.mandatory_arg_error(p_api_name => l_proc,
386 p_argument => 'effective_date',
387 p_argument_value => p_effective_date);
388 --
389 hr_api.mandatory_arg_error(p_api_name => l_proc,
390 p_argument => 'datetrack_mode',
391 p_argument_value => p_datetrack_mode);
392 --
393 hr_api.mandatory_arg_error(p_api_name => l_proc,
394 p_argument => 'elig_cmbn_age_los_prte_id',
395 p_argument_value => p_elig_cmbn_age_los_prte_id);
396 --
397 hr_api.mandatory_arg_error(p_api_name => l_proc,
398 p_argument => 'object_version_number',
399 p_argument_value => p_object_version_number);
400 --
401 -- Check to ensure the datetrack mode is not INSERT.
402 --
403 If (p_datetrack_mode <> 'INSERT') then
404 --
405 -- We must select and lock the current row.
406 --
407 Open C_Sel1;
408 Fetch C_Sel1 Into g_old_rec;
409 If C_Sel1%notfound then
410 Close C_Sel1;
411 --
412 -- The primary key is invalid therefore we must error
413 --
414 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
415 fnd_message.raise_error;
416 End If;
417 Close C_Sel1;
418 If (p_object_version_number <> g_old_rec.object_version_number) Then
419 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
420 fnd_message.raise_error;
421 End If;
422 hr_utility.set_location(l_proc, 15);
423 --
424 --
425 -- Validate the datetrack mode mode getting the validation start
426 -- and end dates for the specified datetrack operation.
427 --
428 dt_api.validate_dt_mode
429 (p_effective_date => p_effective_date,
430 p_datetrack_mode => p_datetrack_mode,
431 p_base_table_name => 'ben_elig_cmbn_age_los_prte_f',
432 p_base_key_column => 'elig_cmbn_age_los_prte_id',
433 p_base_key_value => p_elig_cmbn_age_los_prte_id,
434 p_parent_table_name1 => 'ben_eligy_prfl_f',
435 p_parent_key_column1 => 'eligy_prfl_id',
436 p_parent_key_value1 => g_old_rec.eligy_prfl_id,
437 p_enforce_foreign_locking => true,
438 p_validation_start_date => l_validation_start_date,
439 p_validation_end_date => l_validation_end_date);
440 Else
441 --
442 -- We are doing a datetrack 'INSERT' which is illegal within this
443 -- procedure therefore we must error (note: to lck on insert the
444 -- private procedure ins_lck should be called).
445 --
446 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
447 fnd_message.set_token('PROCEDURE', l_proc);
448 fnd_message.set_token('STEP','20');
449 fnd_message.raise_error;
450 End If;
451 --
452 -- Set the validation start and end date OUT arguments
453 --
454 p_validation_start_date := l_validation_start_date;
455 p_validation_end_date := l_validation_end_date;
456 --
457 hr_utility.set_location(' Leaving:'||l_proc, 30);
458 --
459 -- We need to trap the ORA LOCK exception
460 --
461 Exception
462 When HR_Api.Object_Locked then
463 --
464 -- The object is locked therefore we need to supply a meaningful
465 -- error message.
466 --
467 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
468 fnd_message.set_token('TABLE_NAME', 'ben_elig_cmbn_age_los_prte_f');
469 fnd_message.raise_error;
470 When l_object_invalid then
471 --
472 -- The object doesn't exist or is invalid
473 --
474 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
475 fnd_message.set_token('TABLE_NAME', 'ben_elig_cmbn_age_los_prte_f');
476 fnd_message.raise_error;
477 End lck;
478 --
479 -- ----------------------------------------------------------------------------
480 -- |-----------------------------< convert_args >-----------------------------|
481 -- ----------------------------------------------------------------------------
482 Function convert_args
483 (
484 p_elig_cmbn_age_los_prte_id in number,
488 p_cmbn_age_los_fctr_id in number,
485 p_effective_start_date in date,
486 p_effective_end_date in date,
487 p_business_group_id in number,
489 p_eligy_prfl_id in number,
490 p_excld_flag in varchar2,
491 p_ordr_num in number,
492 p_mndtry_flag in varchar2,
493 p_ecp_attribute_category in varchar2,
494 p_ecp_attribute1 in varchar2,
495 p_ecp_attribute2 in varchar2,
496 p_ecp_attribute3 in varchar2,
497 p_ecp_attribute4 in varchar2,
498 p_ecp_attribute5 in varchar2,
499 p_ecp_attribute6 in varchar2,
500 p_ecp_attribute7 in varchar2,
501 p_ecp_attribute8 in varchar2,
502 p_ecp_attribute9 in varchar2,
503 p_ecp_attribute10 in varchar2,
504 p_ecp_attribute11 in varchar2,
505 p_ecp_attribute12 in varchar2,
506 p_ecp_attribute13 in varchar2,
507 p_ecp_attribute14 in varchar2,
508 p_ecp_attribute15 in varchar2,
509 p_ecp_attribute16 in varchar2,
510 p_ecp_attribute17 in varchar2,
511 p_ecp_attribute18 in varchar2,
512 p_ecp_attribute19 in varchar2,
513 p_ecp_attribute20 in varchar2,
514 p_ecp_attribute21 in varchar2,
515 p_ecp_attribute22 in varchar2,
516 p_ecp_attribute23 in varchar2,
517 p_ecp_attribute24 in varchar2,
518 p_ecp_attribute25 in varchar2,
519 p_ecp_attribute26 in varchar2,
520 p_ecp_attribute27 in varchar2,
521 p_ecp_attribute28 in varchar2,
522 p_ecp_attribute29 in varchar2,
523 p_ecp_attribute30 in varchar2,
524 p_object_version_number in number ,
525 p_criteria_score in number ,
526 p_criteria_weight in number
527 )
528 Return g_rec_type is
529 --
530 l_rec g_rec_type;
531 l_proc varchar2(72) := g_package||'convert_args';
532 --
533 Begin
534 --
535 hr_utility.set_location('Entering:'||l_proc, 5);
536 --
537 -- Convert arguments into local l_rec structure.
538 --
539 l_rec.elig_cmbn_age_los_prte_id := p_elig_cmbn_age_los_prte_id;
540 l_rec.effective_start_date := p_effective_start_date;
541 l_rec.effective_end_date := p_effective_end_date;
542 l_rec.business_group_id := p_business_group_id;
543 l_rec.cmbn_age_los_fctr_id := p_cmbn_age_los_fctr_id;
544 l_rec.eligy_prfl_id := p_eligy_prfl_id;
545 l_rec.excld_flag := p_excld_flag;
546 l_rec.ordr_num := p_ordr_num;
547 l_rec.mndtry_flag := p_mndtry_flag;
548 l_rec.ecp_attribute_category := p_ecp_attribute_category;
549 l_rec.ecp_attribute1 := p_ecp_attribute1;
550 l_rec.ecp_attribute2 := p_ecp_attribute2;
551 l_rec.ecp_attribute3 := p_ecp_attribute3;
552 l_rec.ecp_attribute4 := p_ecp_attribute4;
553 l_rec.ecp_attribute5 := p_ecp_attribute5;
554 l_rec.ecp_attribute6 := p_ecp_attribute6;
555 l_rec.ecp_attribute7 := p_ecp_attribute7;
556 l_rec.ecp_attribute8 := p_ecp_attribute8;
557 l_rec.ecp_attribute9 := p_ecp_attribute9;
558 l_rec.ecp_attribute10 := p_ecp_attribute10;
559 l_rec.ecp_attribute11 := p_ecp_attribute11;
560 l_rec.ecp_attribute12 := p_ecp_attribute12;
561 l_rec.ecp_attribute13 := p_ecp_attribute13;
562 l_rec.ecp_attribute14 := p_ecp_attribute14;
563 l_rec.ecp_attribute15 := p_ecp_attribute15;
564 l_rec.ecp_attribute16 := p_ecp_attribute16;
565 l_rec.ecp_attribute17 := p_ecp_attribute17;
566 l_rec.ecp_attribute18 := p_ecp_attribute18;
567 l_rec.ecp_attribute19 := p_ecp_attribute19;
568 l_rec.ecp_attribute20 := p_ecp_attribute20;
569 l_rec.ecp_attribute21 := p_ecp_attribute21;
570 l_rec.ecp_attribute22 := p_ecp_attribute22;
571 l_rec.ecp_attribute23 := p_ecp_attribute23;
572 l_rec.ecp_attribute24 := p_ecp_attribute24;
573 l_rec.ecp_attribute25 := p_ecp_attribute25;
574 l_rec.ecp_attribute26 := p_ecp_attribute26;
575 l_rec.ecp_attribute27 := p_ecp_attribute27;
576 l_rec.ecp_attribute28 := p_ecp_attribute28;
577 l_rec.ecp_attribute29 := p_ecp_attribute29;
578 l_rec.ecp_attribute30 := p_ecp_attribute30;
579 l_rec.object_version_number := p_object_version_number;
580 l_rec.criteria_score := p_criteria_score;
581 l_rec.criteria_weight := p_criteria_weight;
582 --
583 -- Return the plsql record structure.
584 --
585 hr_utility.set_location(' Leaving:'||l_proc, 10);
586 Return(l_rec);
587 --
588 End convert_args;
589 --
590 end ben_ecp_shd;