[Home] [Help]
PACKAGE BODY: APPS.BEN_ESP_SHD
Source
1 Package Body ben_esp_shd as
2 /* $Header: beesprhi.pkb 120.0 2005/05/28 02:57:34 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_esp_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_SP_CLNG_PRG_PRTE_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_ELIG_SP_CLNG_PRG_PRTE_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_elig_sp_clng_prg_prte_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 elig_sp_clng_prg_prte_id,
71 effective_start_date,
72 effective_end_date,
73 excld_flag,
74 ordr_num,
75 special_ceiling_step_id,
76 eligy_prfl_id,
77 business_group_id,
81 esp_attribute3,
78 esp_attribute_category,
79 esp_attribute1,
80 esp_attribute2,
82 esp_attribute4,
83 esp_attribute5,
84 esp_attribute6,
85 esp_attribute7,
86 esp_attribute8,
87 esp_attribute9,
88 esp_attribute10,
89 esp_attribute11,
90 esp_attribute12,
91 esp_attribute13,
92 esp_attribute14,
93 esp_attribute15,
94 esp_attribute16,
95 esp_attribute17,
96 esp_attribute18,
97 esp_attribute19,
98 esp_attribute20,
99 esp_attribute21,
100 esp_attribute22,
101 esp_attribute23,
102 esp_attribute24,
103 esp_attribute25,
104 esp_attribute26,
105 esp_attribute27,
106 esp_attribute28,
107 esp_attribute29,
108 esp_attribute30,
109 object_version_number,
110 criteria_score,
111 criteria_weight
112 from ben_elig_sp_clng_prg_prte_f
113 where elig_sp_clng_prg_prte_id = p_elig_sp_clng_prg_prte_id
114 and p_effective_date
115 between effective_start_date and effective_end_date;
116 --
117 l_proc varchar2(72) := g_package||'api_updating';
118 l_fct_ret boolean;
119 --
120 Begin
121 hr_utility.set_location('Entering:'||l_proc, 5);
122 --
123 If (p_effective_date is null or
124 p_elig_sp_clng_prg_prte_id is null or
125 p_object_version_number is null) Then
126 --
127 -- One of the primary key arguments is null therefore we must
128 -- set the returning function value to false
129 --
130 l_fct_ret := false;
131 Else
132 If (p_elig_sp_clng_prg_prte_id = g_old_rec.elig_sp_clng_prg_prte_id and
133 p_object_version_number = g_old_rec.object_version_number) Then
134 hr_utility.set_location(l_proc, 10);
135 --
136 -- The g_old_rec is current therefore we must
137 -- set the returning function to true
138 --
139 l_fct_ret := true;
140 Else
141 --
142 -- Select the current row
143 --
144 Open C_Sel1;
145 Fetch C_Sel1 Into g_old_rec;
146 If C_Sel1%notfound Then
147 Close C_Sel1;
148 --
149 -- The primary key is invalid therefore we must error
150 --
151 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
152 fnd_message.raise_error;
153 End If;
154 Close C_Sel1;
155 If (p_object_version_number <> g_old_rec.object_version_number) Then
156 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
157 fnd_message.raise_error;
158 End If;
159 hr_utility.set_location(l_proc, 15);
160 l_fct_ret := true;
161 End If;
162 End If;
163 hr_utility.set_location(' Leaving:'||l_proc, 20);
164 Return (l_fct_ret);
165 --
166 End api_updating;
167 --
168 -- ----------------------------------------------------------------------------
169 -- |--------------------------< find_dt_del_modes >---------------------------|
170 -- ----------------------------------------------------------------------------
171 Procedure find_dt_del_modes
172 (p_effective_date in date,
173 p_base_key_value in number,
174 p_zap out nocopy boolean,
175 p_delete out nocopy boolean,
176 p_future_change out nocopy boolean,
177 p_delete_next_change out nocopy boolean) is
178 --
179 l_proc varchar2(72) := g_package||'find_dt_del_modes';
180 --
181 --
182 --
183 --
184 Begin
185 hr_utility.set_location('Entering:'||l_proc, 5);
186 --
187 --
188 -- Call the corresponding datetrack api
189 --
190 dt_api.find_dt_del_modes
191 (p_effective_date => p_effective_date,
192 p_base_table_name => 'BEN_ELIG_SP_CLNG_PRG_PRTE_F',
193 p_base_key_column => 'ELIG_SP_CLNG_PRG_PRTE_ID',
194 p_base_key_value => p_base_key_value,
195 p_zap => p_zap,
196 p_delete => p_delete,
197 p_future_change => p_future_change,
198 p_delete_next_change => p_delete_next_change);
199 --
200 hr_utility.set_location(' Leaving:'||l_proc, 10);
201 End find_dt_del_modes;
202 --
203 -- ----------------------------------------------------------------------------
204 -- |--------------------------< find_dt_upd_modes >---------------------------|
205 -- ----------------------------------------------------------------------------
206 Procedure find_dt_upd_modes
207 (p_effective_date in date,
208 p_base_key_value in number,
209 p_correction out nocopy boolean,
210 p_update out nocopy boolean,
211 p_update_override out nocopy boolean,
212 p_update_change_insert out nocopy boolean) is
213 --
214 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
215 --
216 Begin
217 hr_utility.set_location('Entering:'||l_proc, 5);
218 --
219 -- Call the corresponding datetrack api
220 --
221 dt_api.find_dt_upd_modes
222 (p_effective_date => p_effective_date,
223 p_base_table_name => 'BEN_ELIG_SP_CLNG_PRG_PRTE_F',
224 p_base_key_column => 'ELIG_SP_CLNG_PRG_PRTE_ID',
225 p_base_key_value => p_base_key_value,
226 p_correction => p_correction,
227 p_update => p_update,
228 p_update_override => p_update_override,
229 p_update_change_insert => p_update_change_insert);
230 --
231 hr_utility.set_location(' Leaving:'||l_proc, 10);
232 End find_dt_upd_modes;
233 --
234 -- ----------------------------------------------------------------------------
235 -- |------------------------< upd_effective_end_date >------------------------|
236 -- ----------------------------------------------------------------------------
237 Procedure upd_effective_end_date
238 (p_effective_date in date,
242 p_validation_end_date in date,
239 p_base_key_value in number,
240 p_new_effective_end_date in date,
241 p_validation_start_date in date,
243 p_object_version_number out nocopy number) is
244 --
245 l_proc varchar2(72) := g_package||'upd_effective_end_date';
246 l_object_version_number number;
247 --
248 Begin
249 hr_utility.set_location('Entering:'||l_proc, 5);
250 --
251 -- Because we are updating a row we must get the next object
252 -- version number.
253 --
254 l_object_version_number :=
255 dt_api.get_object_version_number
256 (p_base_table_name => 'BEN_ELIG_SP_CLNG_PRG_PRTE_F',
257 p_base_key_column => 'ELIG_SP_CLNG_PRG_PRTE_ID',
258 p_base_key_value => p_base_key_value);
259 --
260 hr_utility.set_location(l_proc, 10);
261 g_api_dml := true; -- Set the api dml status
262 --
263 -- Update the specified datetrack row setting the effective
264 -- end date to the specified new effective end date.
265 --
266 update ben_elig_sp_clng_prg_prte_f t
267 set t.effective_end_date = p_new_effective_end_date,
268 t.object_version_number = l_object_version_number
269 where t.elig_sp_clng_prg_prte_id = p_base_key_value
270 and p_effective_date
271 between t.effective_start_date and t.effective_end_date;
272 --
273 g_api_dml := false; -- Unset the api dml status
274 p_object_version_number := l_object_version_number;
275 hr_utility.set_location(' Leaving:'||l_proc, 15);
276 --
277 Exception
278 When Others Then
279 g_api_dml := false; -- Unset the api dml status
280 Raise;
281 End upd_effective_end_date;
282 --
283 -- ----------------------------------------------------------------------------
284 -- |---------------------------------< lck >----------------------------------|
285 -- ----------------------------------------------------------------------------
286 Procedure lck
287 (p_effective_date in date,
288 p_datetrack_mode in varchar2,
289 p_elig_sp_clng_prg_prte_id in number,
290 p_object_version_number in number,
291 p_validation_start_date out nocopy date,
292 p_validation_end_date out nocopy date) is
293 --
294 l_proc varchar2(72) := g_package||'lck';
295 l_validation_start_date date;
296 l_validation_end_date date;
297 l_object_invalid exception;
298 l_argument varchar2(30);
299 --
300 -- Cursor C_Sel1 selects the current locked row as of session date
301 -- ensuring that the object version numbers match.
302 --
303 Cursor C_Sel1 is
304 select
305 elig_sp_clng_prg_prte_id,
306 effective_start_date,
307 effective_end_date,
308 excld_flag,
309 ordr_num,
310 special_ceiling_step_id,
311 eligy_prfl_id,
312 business_group_id,
313 esp_attribute_category,
314 esp_attribute1,
315 esp_attribute2,
316 esp_attribute3,
317 esp_attribute4,
318 esp_attribute5,
319 esp_attribute6,
320 esp_attribute7,
321 esp_attribute8,
322 esp_attribute9,
323 esp_attribute10,
324 esp_attribute11,
325 esp_attribute12,
326 esp_attribute13,
327 esp_attribute14,
328 esp_attribute15,
329 esp_attribute16,
330 esp_attribute17,
331 esp_attribute18,
332 esp_attribute19,
333 esp_attribute20,
334 esp_attribute21,
335 esp_attribute22,
336 esp_attribute23,
337 esp_attribute24,
338 esp_attribute25,
339 esp_attribute26,
340 esp_attribute27,
341 esp_attribute28,
342 esp_attribute29,
343 esp_attribute30,
344 object_version_number,
345 criteria_score,
346 criteria_weight
347 from ben_elig_sp_clng_prg_prte_f
348 where elig_sp_clng_prg_prte_id = p_elig_sp_clng_prg_prte_id
349 and p_effective_date
350 between effective_start_date and effective_end_date
351 for update nowait;
352 --
353 --
354 --
355 Begin
356 hr_utility.set_location('Entering:'||l_proc, 5);
357 --
358 -- Ensure that all the mandatory arguments are not null
359 --
360 hr_api.mandatory_arg_error(p_api_name => l_proc,
361 p_argument => 'effective_date',
362 p_argument_value => p_effective_date);
363 --
364 hr_api.mandatory_arg_error(p_api_name => l_proc,
365 p_argument => 'datetrack_mode',
366 p_argument_value => p_datetrack_mode);
367 --
368 hr_api.mandatory_arg_error(p_api_name => l_proc,
369 p_argument => 'ELIG_SP_CLNG_PRG_PRTE_ID',
370 p_argument_value => p_elig_sp_clng_prg_prte_id);
371 --
372 hr_api.mandatory_arg_error(p_api_name => l_proc,
373 p_argument => 'object_version_number',
374 p_argument_value => p_object_version_number);
375 --
376 -- Check to ensure the datetrack mode is not INSERT.
377 --
378 If (p_datetrack_mode <> 'INSERT') then
379 --
380 -- We must select and lock the current row.
381 --
382 Open C_Sel1;
383 Fetch C_Sel1 Into g_old_rec;
384 If C_Sel1%notfound then
385 Close C_Sel1;
386 --
387 -- The primary key is invalid therefore we must error
388 --
389 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
390 fnd_message.raise_error;
391 End If;
392 Close C_Sel1;
396 End If;
393 If (p_object_version_number <> g_old_rec.object_version_number) Then
394 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
395 fnd_message.raise_error;
397 hr_utility.set_location(l_proc, 15);
398 --
399 --
400 -- Validate the datetrack mode mode getting the validation start
401 -- and end dates for the specified datetrack operation.
402 --
403 dt_api.validate_dt_mode
404 (p_effective_date => p_effective_date,
405 p_datetrack_mode => p_datetrack_mode,
406 p_base_table_name => 'BEN_ELIG_SP_CLNG_PRG_PRTE_F',
407 p_base_key_column => 'ELIG_SP_CLNG_PRG_PRTE_ID',
408 p_base_key_value => p_elig_sp_clng_prg_prte_id,
409
410 p_enforce_foreign_locking => true,
411 p_validation_start_date => l_validation_start_date,
412 p_validation_end_date => l_validation_end_date);
413 Else
414 --
415 -- We are doing a datetrack 'INSERT' which is illegal within this
416 -- procedure therefore we must error (note: to lck on insert the
417 -- private procedure ins_lck should be called).
418 --
419 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
420 fnd_message.set_token('PROCEDURE', l_proc);
421 fnd_message.set_token('STEP','20');
422 fnd_message.raise_error;
423 End If;
424 --
425 -- Set the validation start and end date OUT arguments
426 --
427 p_validation_start_date := l_validation_start_date;
428 p_validation_end_date := l_validation_end_date;
429 --
430 hr_utility.set_location(' Leaving:'||l_proc, 30);
431 --
432 -- We need to trap the ORA LOCK exception
433 --
434 Exception
435 When HR_Api.Object_Locked then
436 --
437 -- The object is locked therefore we need to supply a meaningful
438 -- error message.
439 --
440 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
441 fnd_message.set_token('TABLE_NAME', 'ben_elig_sp_clng_prg_prte_f');
442 fnd_message.raise_error;
443 When l_object_invalid then
444 --
445 -- The object doesn't exist or is invalid
446 --
447 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
448 fnd_message.set_token('TABLE_NAME', 'ben_elig_sp_clng_prg_prte_f');
449 fnd_message.raise_error;
450 End lck;
451 --
452 -- ----------------------------------------------------------------------------
453 -- |-----------------------------< convert_args >-----------------------------|
454 -- ----------------------------------------------------------------------------
455 Function convert_args
456 (
457 p_elig_sp_clng_prg_prte_id in number,
458 p_effective_start_date in date,
459 p_effective_end_date in date,
460 p_excld_flag in varchar2,
461 p_ordr_num in number,
462 p_special_ceiling_step_id in number,
463 p_eligy_prfl_id in number,
464 p_business_group_id in number,
465 p_esp_attribute_category in varchar2,
466 p_esp_attribute1 in varchar2,
467 p_esp_attribute2 in varchar2,
468 p_esp_attribute3 in varchar2,
469 p_esp_attribute4 in varchar2,
470 p_esp_attribute5 in varchar2,
471 p_esp_attribute6 in varchar2,
472 p_esp_attribute7 in varchar2,
473 p_esp_attribute8 in varchar2,
474 p_esp_attribute9 in varchar2,
475 p_esp_attribute10 in varchar2,
476 p_esp_attribute11 in varchar2,
477 p_esp_attribute12 in varchar2,
478 p_esp_attribute13 in varchar2,
479 p_esp_attribute14 in varchar2,
480 p_esp_attribute15 in varchar2,
481 p_esp_attribute16 in varchar2,
482 p_esp_attribute17 in varchar2,
483 p_esp_attribute18 in varchar2,
484 p_esp_attribute19 in varchar2,
485 p_esp_attribute20 in varchar2,
486 p_esp_attribute21 in varchar2,
487 p_esp_attribute22 in varchar2,
488 p_esp_attribute23 in varchar2,
489 p_esp_attribute24 in varchar2,
490 p_esp_attribute25 in varchar2,
491 p_esp_attribute26 in varchar2,
492 p_esp_attribute27 in varchar2,
493 p_esp_attribute28 in varchar2,
494 p_esp_attribute29 in varchar2,
495 p_esp_attribute30 in varchar2,
496 p_object_version_number in number ,
497 p_criteria_score in number ,
498 p_criteria_weight in number
499 )
500 Return g_rec_type is
501 --
502 l_rec g_rec_type;
503 l_proc varchar2(72) := g_package||'convert_args';
504 --
505 Begin
506 --
507 hr_utility.set_location('Entering:'||l_proc, 5);
508 --
509 -- Convert arguments into local l_rec structure.
510 --
511 l_rec.elig_sp_clng_prg_prte_id := p_elig_sp_clng_prg_prte_id;
512 l_rec.effective_start_date := p_effective_start_date;
513 l_rec.effective_end_date := p_effective_end_date;
514 l_rec.excld_flag := p_excld_flag;
515 l_rec.ordr_num := p_ordr_num;
516 l_rec.special_ceiling_step_id := p_special_ceiling_step_id;
517 l_rec.eligy_prfl_id := p_eligy_prfl_id;
518 l_rec.business_group_id := p_business_group_id;
519 l_rec.esp_attribute_category := p_esp_attribute_category;
520 l_rec.esp_attribute1 := p_esp_attribute1;
521 l_rec.esp_attribute2 := p_esp_attribute2;
522 l_rec.esp_attribute3 := p_esp_attribute3;
523 l_rec.esp_attribute4 := p_esp_attribute4;
524 l_rec.esp_attribute5 := p_esp_attribute5;
525 l_rec.esp_attribute6 := p_esp_attribute6;
526 l_rec.esp_attribute7 := p_esp_attribute7;
527 l_rec.esp_attribute8 := p_esp_attribute8;
528 l_rec.esp_attribute9 := p_esp_attribute9;
529 l_rec.esp_attribute10 := p_esp_attribute10;
530 l_rec.esp_attribute11 := p_esp_attribute11;
531 l_rec.esp_attribute12 := p_esp_attribute12;
532 l_rec.esp_attribute13 := p_esp_attribute13;
533 l_rec.esp_attribute14 := p_esp_attribute14;
534 l_rec.esp_attribute15 := p_esp_attribute15;
535 l_rec.esp_attribute16 := p_esp_attribute16;
536 l_rec.esp_attribute17 := p_esp_attribute17;
537 l_rec.esp_attribute18 := p_esp_attribute18;
538 l_rec.esp_attribute19 := p_esp_attribute19;
539 l_rec.esp_attribute20 := p_esp_attribute20;
540 l_rec.esp_attribute21 := p_esp_attribute21;
541 l_rec.esp_attribute22 := p_esp_attribute22;
542 l_rec.esp_attribute23 := p_esp_attribute23;
543 l_rec.esp_attribute24 := p_esp_attribute24;
544 l_rec.esp_attribute25 := p_esp_attribute25;
545 l_rec.esp_attribute26 := p_esp_attribute26;
546 l_rec.esp_attribute27 := p_esp_attribute27;
547 l_rec.esp_attribute28 := p_esp_attribute28;
548 l_rec.esp_attribute29 := p_esp_attribute29;
549 l_rec.esp_attribute30 := p_esp_attribute30;
550 l_rec.object_version_number := p_object_version_number;
551 l_rec.criteria_score := p_criteria_score;
552 l_rec.criteria_weight := p_criteria_weight;
553 --
554 -- Return the plsql record structure.
555 --
556 hr_utility.set_location(' Leaving:'||l_proc, 10);
557 Return(l_rec);
558 --
559 End convert_args;
560 --
561 end ben_esp_shd;