[Home] [Help]
PACKAGE BODY: APPS.BEN_ESA_SHD
Source
1 Package Body ben_esa_shd as
2 /* $Header: beesarhi.pkb 120.2 2005/07/05 05:08:25 rgajula noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_esa_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 -- ----------------------------------------------------------------------------
29 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
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_SVC_AREA_PRTE_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 = 'EXCLD_FLAG_FLG1') 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_svc_area_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_svc_area_prte_id,
71 effective_start_date,
72 effective_end_date,
73 excld_flag,
74 ordr_num,
75 svc_area_id,
76 eligy_prfl_id,
77 business_group_id,
78 esa_attribute_category,
79 esa_attribute1,
80 esa_attribute2,
81 esa_attribute3,
82 esa_attribute4,
83 esa_attribute5,
84 esa_attribute6,
85 esa_attribute7,
86 esa_attribute8,
87 esa_attribute9,
88 esa_attribute10,
89 esa_attribute11,
90 esa_attribute12,
91 esa_attribute13,
92 esa_attribute14,
93 esa_attribute15,
94 esa_attribute16,
95 esa_attribute17,
96 esa_attribute18,
97 esa_attribute19,
98 esa_attribute20,
99 esa_attribute21,
100 esa_attribute22,
101 esa_attribute23,
102 esa_attribute24,
103 esa_attribute25,
104 esa_attribute26,
105 esa_attribute27,
106 esa_attribute28,
107 esa_attribute29,
108 esa_attribute30,
109 object_version_number,
110 criteria_score,
111 criteria_weight
112 from ben_elig_svc_area_prte_f
113 where elig_svc_area_prte_id = p_elig_svc_area_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_svc_area_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_svc_area_prte_id = g_old_rec.elig_svc_area_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 l_parent_key_value1 number;
182 l_parent_key_value2 number;
183 --
184 Cursor C_Sel1 Is
185 select t.eligy_prfl_id,
186 t.svc_area_id
190 between t.effective_start_date and t.effective_end_date;
187 from ben_elig_svc_area_prte_f t
188 where t.elig_svc_area_prte_id = p_base_key_value
189 and p_effective_date
191 --
192 Begin
193 hr_utility.set_location('Entering:'||l_proc, 5);
194 Open C_Sel1;
195 Fetch C_Sel1 Into l_parent_key_value1,
196 l_parent_key_value2;
197 If C_Sel1%notfound then
198 Close C_Sel1;
199 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
200 fnd_message.set_token('PROCEDURE', l_proc);
201 fnd_message.set_token('STEP','10');
202 fnd_message.raise_error;
203 End If;
204 Close C_Sel1;
205 --
206 -- Call the corresponding datetrack api
207 --
208 dt_api.find_dt_del_modes
209 (p_effective_date => p_effective_date,
210 p_base_table_name => 'ben_elig_svc_area_prte_f',
211 p_base_key_column => 'elig_svc_area_prte_id',
212 p_base_key_value => p_base_key_value,
213 p_parent_table_name1 => 'ben_eligy_prfl_f',
214 p_parent_key_column1 => 'eligy_prfl_id',
215 p_parent_key_value1 => l_parent_key_value1,
216 p_parent_table_name2 => 'ben_svc_area_f',
217 p_parent_key_column2 => 'svc_area_id',
218 p_parent_key_value2 => l_parent_key_value2,
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_svc_area_prte_f',
248 p_base_key_column => 'elig_svc_area_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_svc_area_prte_f',
281 p_base_key_column => 'elig_svc_area_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_svc_area_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_svc_area_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_svc_area_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_svc_area_prte_id,
330 effective_start_date,
331 effective_end_date,
332 excld_flag,
333 ordr_num,
337 esa_attribute_category,
334 svc_area_id,
335 eligy_prfl_id,
336 business_group_id,
338 esa_attribute1,
339 esa_attribute2,
340 esa_attribute3,
341 esa_attribute4,
342 esa_attribute5,
343 esa_attribute6,
344 esa_attribute7,
345 esa_attribute8,
346 esa_attribute9,
347 esa_attribute10,
348 esa_attribute11,
349 esa_attribute12,
350 esa_attribute13,
351 esa_attribute14,
352 esa_attribute15,
353 esa_attribute16,
354 esa_attribute17,
355 esa_attribute18,
356 esa_attribute19,
357 esa_attribute20,
358 esa_attribute21,
359 esa_attribute22,
360 esa_attribute23,
361 esa_attribute24,
362 esa_attribute25,
363 esa_attribute26,
364 esa_attribute27,
365 esa_attribute28,
366 esa_attribute29,
367 esa_attribute30,
368 object_version_number ,
369 criteria_score,
370 criteria_weight
371 from ben_elig_svc_area_prte_f
372 where elig_svc_area_prte_id = p_elig_svc_area_prte_id
373 and p_effective_date
374 between effective_start_date and effective_end_date
375 for update nowait;
376 --
377 --
378 --
379 Begin
380 hr_utility.set_location('Entering:'||l_proc, 5);
381 --
382 -- Ensure that all the mandatory arguments are not null
383 --
384 hr_api.mandatory_arg_error(p_api_name => l_proc,
385 p_argument => 'effective_date',
386 p_argument_value => p_effective_date);
387 --
388 hr_api.mandatory_arg_error(p_api_name => l_proc,
389 p_argument => 'datetrack_mode',
390 p_argument_value => p_datetrack_mode);
391 --
392 hr_api.mandatory_arg_error(p_api_name => l_proc,
393 p_argument => 'elig_svc_area_prte_id',
394 p_argument_value => p_elig_svc_area_prte_id);
395 --
396 hr_api.mandatory_arg_error(p_api_name => l_proc,
397 p_argument => 'object_version_number',
398 p_argument_value => p_object_version_number);
399 --
400 -- Check to ensure the datetrack mode is not INSERT.
401 --
402 If (p_datetrack_mode <> 'INSERT') then
403 --
404 -- We must select and lock the current row.
405 --
406 Open C_Sel1;
407 Fetch C_Sel1 Into g_old_rec;
408 If C_Sel1%notfound then
409 Close C_Sel1;
410 --
411 -- The primary key is invalid therefore we must error
412 --
413 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
414 fnd_message.raise_error;
415 End If;
416 Close C_Sel1;
417 If (p_object_version_number <> g_old_rec.object_version_number) Then
418 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
419 fnd_message.raise_error;
420 End If;
421 hr_utility.set_location(l_proc, 15);
422 --
423 --
424 -- Validate the datetrack mode mode getting the validation start
425 -- and end dates for the specified datetrack operation.
426 --
427 dt_api.validate_dt_mode
428 (p_effective_date => p_effective_date,
429 p_datetrack_mode => p_datetrack_mode,
430 p_base_table_name => 'ben_elig_svc_area_prte_f',
431 p_base_key_column => 'elig_svc_area_prte_id',
432 p_base_key_value => p_elig_svc_area_prte_id,
433 p_parent_table_name1 => 'ben_eligy_prfl_f',
434 p_parent_key_column1 => 'eligy_prfl_id',
435 p_parent_key_value1 => g_old_rec.eligy_prfl_id,
436 p_parent_table_name2 => 'ben_svc_area_f',
437 p_parent_key_column2 => 'svc_area_id',
438 p_parent_key_value2 => g_old_rec.svc_area_id,
439 p_enforce_foreign_locking => true,
440 p_validation_start_date => l_validation_start_date,
441 p_validation_end_date => l_validation_end_date);
442 Else
443 --
444 -- We are doing a datetrack 'INSERT' which is illegal within this
445 -- procedure therefore we must error (note: to lck on insert the
446 -- private procedure ins_lck should be called).
447 --
448 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
449 fnd_message.set_token('PROCEDURE', l_proc);
450 fnd_message.set_token('STEP','20');
451 fnd_message.raise_error;
452 End If;
453 --
454 -- Set the validation start and end date OUT arguments
455 --
456 p_validation_start_date := l_validation_start_date;
457 p_validation_end_date := l_validation_end_date;
458 --
459 hr_utility.set_location(' Leaving:'||l_proc, 30);
460 --
461 -- We need to trap the ORA LOCK exception
462 --
463 Exception
464 When HR_Api.Object_Locked then
465 --
466 -- The object is locked therefore we need to supply a meaningful
467 -- error message.
468 --
469 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
470 fnd_message.set_token('TABLE_NAME', 'ben_elig_svc_area_prte_f');
471 fnd_message.raise_error;
472 When l_object_invalid then
473 --
474 -- The object doesn't exist or is invalid
475 --
476 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
477 fnd_message.set_token('TABLE_NAME', 'ben_elig_svc_area_prte_f');
478 fnd_message.raise_error;
479 End lck;
480 --
481 -- ----------------------------------------------------------------------------
482 -- |-----------------------------< convert_args >-----------------------------|
483 -- ----------------------------------------------------------------------------
484 Function convert_args
485 (
486 p_elig_svc_area_prte_id in number,
487 p_effective_start_date in date,
488 p_effective_end_date in date,
489 p_excld_flag in varchar2,
490 p_ordr_num in number,
491 p_svc_area_id in number,
492 p_eligy_prfl_id in number,
493 p_business_group_id in number,
494 p_esa_attribute_category in varchar2,
495 p_esa_attribute1 in varchar2,
496 p_esa_attribute2 in varchar2,
497 p_esa_attribute3 in varchar2,
498 p_esa_attribute4 in varchar2,
499 p_esa_attribute5 in varchar2,
500 p_esa_attribute6 in varchar2,
501 p_esa_attribute7 in varchar2,
502 p_esa_attribute8 in varchar2,
503 p_esa_attribute9 in varchar2,
504 p_esa_attribute10 in varchar2,
505 p_esa_attribute11 in varchar2,
506 p_esa_attribute12 in varchar2,
507 p_esa_attribute13 in varchar2,
508 p_esa_attribute14 in varchar2,
509 p_esa_attribute15 in varchar2,
510 p_esa_attribute16 in varchar2,
511 p_esa_attribute17 in varchar2,
512 p_esa_attribute18 in varchar2,
513 p_esa_attribute19 in varchar2,
514 p_esa_attribute20 in varchar2,
515 p_esa_attribute21 in varchar2,
516 p_esa_attribute22 in varchar2,
517 p_esa_attribute23 in varchar2,
518 p_esa_attribute24 in varchar2,
519 p_esa_attribute25 in varchar2,
520 p_esa_attribute26 in varchar2,
521 p_esa_attribute27 in varchar2,
522 p_esa_attribute28 in varchar2,
523 p_esa_attribute29 in varchar2,
524 p_esa_attribute30 in varchar2,
525 p_object_version_number in number ,
526 p_criteria_score in number ,
527 p_criteria_weight in number
528 )
529 Return g_rec_type is
530 --
531 l_rec g_rec_type;
532 l_proc varchar2(72) := g_package||'convert_args';
533 --
534 Begin
535 --
536 hr_utility.set_location('Entering:'||l_proc, 5);
537 --
538 -- Convert arguments into local l_rec structure.
539 --
540 l_rec.elig_svc_area_prte_id := p_elig_svc_area_prte_id;
541 l_rec.effective_start_date := p_effective_start_date;
542 l_rec.effective_end_date := p_effective_end_date;
543 l_rec.excld_flag := p_excld_flag;
544 l_rec.ordr_num := p_ordr_num;
545 l_rec.svc_area_id := p_svc_area_id;
546 l_rec.eligy_prfl_id := p_eligy_prfl_id;
547 l_rec.business_group_id := p_business_group_id;
548 l_rec.esa_attribute_category := p_esa_attribute_category;
549 l_rec.esa_attribute1 := p_esa_attribute1;
550 l_rec.esa_attribute2 := p_esa_attribute2;
551 l_rec.esa_attribute3 := p_esa_attribute3;
552 l_rec.esa_attribute4 := p_esa_attribute4;
553 l_rec.esa_attribute5 := p_esa_attribute5;
554 l_rec.esa_attribute6 := p_esa_attribute6;
555 l_rec.esa_attribute7 := p_esa_attribute7;
556 l_rec.esa_attribute8 := p_esa_attribute8;
557 l_rec.esa_attribute9 := p_esa_attribute9;
558 l_rec.esa_attribute10 := p_esa_attribute10;
559 l_rec.esa_attribute11 := p_esa_attribute11;
560 l_rec.esa_attribute12 := p_esa_attribute12;
561 l_rec.esa_attribute13 := p_esa_attribute13;
562 l_rec.esa_attribute14 := p_esa_attribute14;
563 l_rec.esa_attribute15 := p_esa_attribute15;
564 l_rec.esa_attribute16 := p_esa_attribute16;
565 l_rec.esa_attribute17 := p_esa_attribute17;
566 l_rec.esa_attribute18 := p_esa_attribute18;
567 l_rec.esa_attribute19 := p_esa_attribute19;
568 l_rec.esa_attribute20 := p_esa_attribute20;
569 l_rec.esa_attribute21 := p_esa_attribute21;
570 l_rec.esa_attribute22 := p_esa_attribute22;
571 l_rec.esa_attribute23 := p_esa_attribute23;
572 l_rec.esa_attribute24 := p_esa_attribute24;
573 l_rec.esa_attribute25 := p_esa_attribute25;
574 l_rec.esa_attribute26 := p_esa_attribute26;
575 l_rec.esa_attribute27 := p_esa_attribute27;
576 l_rec.esa_attribute28 := p_esa_attribute28;
577 l_rec.esa_attribute29 := p_esa_attribute29;
578 l_rec.esa_attribute30 := p_esa_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_esa_shd;