[Home] [Help]
PACKAGE BODY: APPS.BEN_EPP_SHD
Source
1 Package Body ben_epp_shd as
2 /* $Header: beepprhi.pkb 120.1 2006/03/01 05:36:51 rtagarra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_epp_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_PRTT_ANTHR_PL_PK') Then
37 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38 hr_utility.set_message_token('PROCEDURE', l_proc);
39 hr_utility.set_message_token('STEP','5');
40 hr_utility.raise_error;
41 Else
42 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
43 hr_utility.set_message_token('PROCEDURE', l_proc);
44 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
45 hr_utility.raise_error;
46 End If;
47 --
48 hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55 (p_effective_date in date,
56 p_elig_prtt_anthr_pl_prte_id in number,
57 p_object_version_number in number
58 ) Return Boolean Is
59 --
60 --
61 -- Cursor selects the 'current' row from the HR Schema
62 --
63 Cursor C_Sel1 is
64 select
65 elig_prtt_anthr_pl_prte_id,
66 effective_start_date,
67 effective_end_date,
68 excld_flag,
69 ordr_num,
70 eligy_prfl_id,
71 pl_id,
72 business_group_id,
73 epp_attribute_category,
74 epp_attribute1,
75 epp_attribute2,
76 epp_attribute3,
77 epp_attribute4,
78 epp_attribute5,
79 epp_attribute6,
80 epp_attribute7,
81 epp_attribute8,
82 epp_attribute9,
83 epp_attribute10,
84 epp_attribute11,
85 epp_attribute12,
86 epp_attribute13,
87 epp_attribute14,
88 epp_attribute15,
89 epp_attribute16,
90 epp_attribute17,
91 epp_attribute18,
92 epp_attribute19,
93 epp_attribute20,
94 epp_attribute21,
95 epp_attribute22,
96 epp_attribute23,
97 epp_attribute24,
98 epp_attribute25,
99 epp_attribute26,
100 epp_attribute27,
101 epp_attribute28,
102 epp_attribute29,
103 epp_attribute30,
104 object_version_number
105 from ben_elig_prtt_anthr_pl_prte_f
106 where elig_prtt_anthr_pl_prte_id = p_elig_prtt_anthr_pl_prte_id
107 and p_effective_date
108 between effective_start_date and effective_end_date;
109 --
110 l_proc varchar2(72) := g_package||'api_updating';
111 l_fct_ret boolean;
112 --
113 Begin
114 hr_utility.set_location('Entering:'||l_proc, 5);
115 --
116 If (p_effective_date is null or
117 p_elig_prtt_anthr_pl_prte_id is null or
118 p_object_version_number is null) Then
119 --
120 -- One of the primary key arguments is null therefore we must
121 -- set the returning function value to false
122 --
123 l_fct_ret := false;
124 Else
125 If (p_elig_prtt_anthr_pl_prte_id = g_old_rec.elig_prtt_anthr_pl_prte_id and
126 p_object_version_number = g_old_rec.object_version_number) Then
127 hr_utility.set_location(l_proc, 10);
128 --
129 -- The g_old_rec is current therefore we must
130 -- set the returning function to true
131 --
132 l_fct_ret := true;
133 Else
134 --
135 -- Select the current row
136 --
137 Open C_Sel1;
138 Fetch C_Sel1 Into g_old_rec;
139 If C_Sel1%notfound Then
140 Close C_Sel1;
141 --
142 -- The primary key is invalid therefore we must error
143 --
144 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
145 hr_utility.raise_error;
146 End If;
147 Close C_Sel1;
148 If (p_object_version_number <> g_old_rec.object_version_number) Then
149 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
150 hr_utility.raise_error;
151 End If;
152 hr_utility.set_location(l_proc, 15);
153 l_fct_ret := true;
154 End If;
155 End If;
156 hr_utility.set_location(' Leaving:'||l_proc, 20);
157 Return (l_fct_ret);
158 --
159 End api_updating;
160 --
161 -- ----------------------------------------------------------------------------
162 -- |--------------------------< find_dt_del_modes >---------------------------|
163 -- ----------------------------------------------------------------------------
164 Procedure find_dt_del_modes
165 (p_effective_date in date,
166 p_base_key_value in number,
167 p_zap out nocopy boolean,
168 p_delete out nocopy boolean,
169 p_future_change out nocopy boolean,
170 p_delete_next_change out nocopy boolean) is
171 --
172 l_proc varchar2(72) := g_package||'find_dt_del_modes';
173 --
174 l_parent_key_value1 number;
175 --
176 Cursor C_Sel1 Is
177 select t.eligy_prfl_id
178 from ben_elig_prtt_anthr_pl_prte_f t
179 where t.elig_prtt_anthr_pl_prte_id = p_base_key_value
180 and p_effective_date
181 between t.effective_start_date and t.effective_end_date;
182 --
183 Begin
184 hr_utility.set_location('Entering:'||l_proc, 5);
185 Open C_Sel1;
186 Fetch C_Sel1 Into l_parent_key_value1;
187 If C_Sel1%notfound then
188 Close C_Sel1;
189 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
190 hr_utility.set_message_token('PROCEDURE', l_proc);
191 hr_utility.set_message_token('STEP','10');
192 hr_utility.raise_error;
193 End If;
194 Close C_Sel1;
195 --
196 -- Call the corresponding datetrack api
197 --
198 dt_api.find_dt_del_modes
199 (p_effective_date => p_effective_date,
200 p_base_table_name => 'ben_elig_prtt_anthr_pl_prte_f',
201 p_base_key_column => 'elig_prtt_anthr_pl_prte_id',
202 p_base_key_value => p_base_key_value,
203 p_parent_table_name1 => 'ben_eligy_prfl_f',
204 p_parent_key_column1 => 'eligy_prfl_id',
205 p_parent_key_value1 => l_parent_key_value1,
206 p_zap => p_zap,
207 p_delete => p_delete,
208 p_future_change => p_future_change,
209 p_delete_next_change => p_delete_next_change);
210 --
211 hr_utility.set_location(' Leaving:'||l_proc, 10);
212 End find_dt_del_modes;
213 --
214 -- ----------------------------------------------------------------------------
215 -- |--------------------------< find_dt_upd_modes >---------------------------|
216 -- ----------------------------------------------------------------------------
217 Procedure find_dt_upd_modes
218 (p_effective_date in date,
219 p_base_key_value in number,
220 p_correction out nocopy boolean,
221 p_update out nocopy boolean,
222 p_update_override out nocopy boolean,
223 p_update_change_insert out nocopy boolean) is
224 --
225 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
226 --
227 Begin
228 hr_utility.set_location('Entering:'||l_proc, 5);
229 --
230 -- Call the corresponding datetrack api
231 --
232 dt_api.find_dt_upd_modes
233 (p_effective_date => p_effective_date,
234 p_base_table_name => 'ben_elig_prtt_anthr_pl_prte_f',
235 p_base_key_column => 'elig_prtt_anthr_pl_prte_id',
236 p_base_key_value => p_base_key_value,
237 p_correction => p_correction,
238 p_update => p_update,
239 p_update_override => p_update_override,
240 p_update_change_insert => p_update_change_insert);
241 --
242 hr_utility.set_location(' Leaving:'||l_proc, 10);
243 End find_dt_upd_modes;
244 --
245 -- ----------------------------------------------------------------------------
246 -- |------------------------< upd_effective_end_date >------------------------|
247 -- ----------------------------------------------------------------------------
248 Procedure upd_effective_end_date
249 (p_effective_date in date,
250 p_base_key_value in number,
251 p_new_effective_end_date in date,
252 p_validation_start_date in date,
253 p_validation_end_date in date,
254 p_object_version_number out nocopy number) is
255 --
256 l_proc varchar2(72) := g_package||'upd_effective_end_date';
257 l_object_version_number number;
258 --
259 Begin
260 hr_utility.set_location('Entering:'||l_proc, 5);
261 --
262 -- Because we are updating a row we must get the next object
263 -- version number.
264 --
265 l_object_version_number :=
266 dt_api.get_object_version_number
267 (p_base_table_name => 'ben_elig_prtt_anthr_pl_prte_f',
268 p_base_key_column => 'elig_prtt_anthr_pl_prte_id',
269 p_base_key_value => p_base_key_value);
270 --
271 hr_utility.set_location(l_proc, 10);
272 g_api_dml := true; -- Set the api dml status
273 --
274 -- Update the specified datetrack row setting the effective
275 -- end date to the specified new effective end date.
276 --
277 update ben_elig_prtt_anthr_pl_prte_f t
278 set t.effective_end_date = p_new_effective_end_date,
279 t.object_version_number = l_object_version_number
280 where t.elig_prtt_anthr_pl_prte_id = p_base_key_value
281 and p_effective_date
282 between t.effective_start_date and t.effective_end_date;
283 --
284 g_api_dml := false; -- Unset the api dml status
285 p_object_version_number := l_object_version_number;
286 hr_utility.set_location(' Leaving:'||l_proc, 15);
287 --
288 Exception
289 When Others Then
290 g_api_dml := false; -- Unset the api dml status
291 Raise;
292 End upd_effective_end_date;
293 --
294 -- ----------------------------------------------------------------------------
295 -- |---------------------------------< lck >----------------------------------|
296 -- ----------------------------------------------------------------------------
297 Procedure lck
298 (p_effective_date in date,
299 p_datetrack_mode in varchar2,
300 p_elig_prtt_anthr_pl_prte_id in number,
301 p_object_version_number in number,
302 p_validation_start_date out nocopy date,
303 p_validation_end_date out nocopy date) is
304 --
305 l_proc varchar2(72) := g_package||'lck';
306 l_validation_start_date date;
307 l_validation_end_date date;
308 l_object_invalid exception;
309 l_argument varchar2(30);
310 --
311 -- Cursor C_Sel1 selects the current locked row as of session date
312 -- ensuring that the object version numbers match.
313 --
314 Cursor C_Sel1 is
315 select
316 elig_prtt_anthr_pl_prte_id,
317 effective_start_date,
318 effective_end_date,
319 excld_flag,
320 ordr_num,
321 eligy_prfl_id,
322 pl_id,
323 business_group_id,
324 epp_attribute_category,
325 epp_attribute1,
326 epp_attribute2,
327 epp_attribute3,
328 epp_attribute4,
329 epp_attribute5,
330 epp_attribute6,
331 epp_attribute7,
332 epp_attribute8,
333 epp_attribute9,
334 epp_attribute10,
335 epp_attribute11,
336 epp_attribute12,
337 epp_attribute13,
338 epp_attribute14,
339 epp_attribute15,
340 epp_attribute16,
341 epp_attribute17,
342 epp_attribute18,
343 epp_attribute19,
344 epp_attribute20,
345 epp_attribute21,
346 epp_attribute22,
347 epp_attribute23,
348 epp_attribute24,
349 epp_attribute25,
350 epp_attribute26,
351 epp_attribute27,
352 epp_attribute28,
353 epp_attribute29,
354 epp_attribute30,
355 object_version_number
356 from ben_elig_prtt_anthr_pl_prte_f
357 where elig_prtt_anthr_pl_prte_id = p_elig_prtt_anthr_pl_prte_id
358 and p_effective_date
359 between effective_start_date and effective_end_date
360 for update nowait;
361 --
362 --
363 --
364 Begin
365 hr_utility.set_location('Entering:'||l_proc, 5);
366 --
367 -- Ensure that all the mandatory arguments are not null
368 --
369 hr_api.mandatory_arg_error(p_api_name => l_proc,
370 p_argument => 'effective_date',
371 p_argument_value => p_effective_date);
372 --
373 hr_api.mandatory_arg_error(p_api_name => l_proc,
374 p_argument => 'datetrack_mode',
375 p_argument_value => p_datetrack_mode);
376 --
377 hr_api.mandatory_arg_error(p_api_name => l_proc,
378 p_argument => 'elig_prtt_anthr_pl_prte_id',
379 p_argument_value => p_elig_prtt_anthr_pl_prte_id);
380 --
381 hr_api.mandatory_arg_error(p_api_name => l_proc,
382 p_argument => 'object_version_number',
383 p_argument_value => p_object_version_number);
384 --
385 -- Check to ensure the datetrack mode is not INSERT.
386 --
387 If (p_datetrack_mode <> 'INSERT') then
388 --
389 -- We must select and lock the current row.
390 --
391 Open C_Sel1;
392 Fetch C_Sel1 Into g_old_rec;
393 If C_Sel1%notfound then
394 Close C_Sel1;
395 --
396 -- The primary key is invalid therefore we must error
397 --
398 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
399 hr_utility.raise_error;
400 End If;
401 Close C_Sel1;
402 If (p_object_version_number <> g_old_rec.object_version_number) Then
403 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
404 hr_utility.raise_error;
405 End If;
406 hr_utility.set_location(l_proc, 15);
407 --
408 --
409 -- Validate the datetrack mode mode getting the validation start
410 -- and end dates for the specified datetrack operation.
411 --
412 dt_api.validate_dt_mode
413 (p_effective_date => p_effective_date,
414 p_datetrack_mode => p_datetrack_mode,
415 p_base_table_name => 'ben_elig_prtt_anthr_pl_prte_f',
416 p_base_key_column => 'elig_prtt_anthr_pl_prte_id',
417 p_base_key_value => p_elig_prtt_anthr_pl_prte_id,
418 p_parent_table_name1 => 'ben_eligy_prfl_f',
419 p_parent_key_column1 => 'eligy_prfl_id',
420 p_parent_key_value1 => g_old_rec.eligy_prfl_id,
421 p_enforce_foreign_locking => true,
422 p_validation_start_date => l_validation_start_date,
423 p_validation_end_date => l_validation_end_date);
424 Else
425 --
426 -- We are doing a datetrack 'INSERT' which is illegal within this
427 -- procedure therefore we must error (note: to lck on insert the
431 hr_utility.set_message_token('PROCEDURE', l_proc);
428 -- private procedure ins_lck should be called).
429 --
430 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
432 hr_utility.set_message_token('STEP','20');
433 hr_utility.raise_error;
434 End If;
435 --
436 -- Set the validation start and end date OUT arguments
437 --
438 p_validation_start_date := l_validation_start_date;
439 p_validation_end_date := l_validation_end_date;
440 --
441 hr_utility.set_location(' Leaving:'||l_proc, 30);
442 --
443 -- We need to trap the ORA LOCK exception
444 --
445 Exception
446 When HR_Api.Object_Locked then
447 --
448 -- The object is locked therefore we need to supply a meaningful
449 -- error message.
450 --
451 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
452 hr_utility.set_message_token('TABLE_NAME', 'ben_elig_prtt_anthr_pl_prte_f');
453 hr_utility.raise_error;
454 When l_object_invalid then
455 --
456 -- The object doesn't exist or is invalid
457 --
458 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
459 hr_utility.set_message_token('TABLE_NAME', 'ben_elig_prtt_anthr_pl_prte_f');
460 hr_utility.raise_error;
461 End lck;
462 --
463 -- ----------------------------------------------------------------------------
464 -- |-----------------------------< convert_args >-----------------------------|
465 -- ----------------------------------------------------------------------------
466 Function convert_args
467 (
468 p_elig_prtt_anthr_pl_prte_id in number,
469 p_effective_start_date in date,
470 p_effective_end_date in date,
471 p_excld_flag in varchar2,
472 p_ordr_num in number,
473 p_eligy_prfl_id in number,
474 p_pl_id in number,
475 p_business_group_id in number,
476 p_epp_attribute_category in varchar2,
477 p_epp_attribute1 in varchar2,
478 p_epp_attribute2 in varchar2,
479 p_epp_attribute3 in varchar2,
480 p_epp_attribute4 in varchar2,
481 p_epp_attribute5 in varchar2,
482 p_epp_attribute6 in varchar2,
483 p_epp_attribute7 in varchar2,
484 p_epp_attribute8 in varchar2,
485 p_epp_attribute9 in varchar2,
486 p_epp_attribute10 in varchar2,
487 p_epp_attribute11 in varchar2,
488 p_epp_attribute12 in varchar2,
489 p_epp_attribute13 in varchar2,
490 p_epp_attribute14 in varchar2,
491 p_epp_attribute15 in varchar2,
492 p_epp_attribute16 in varchar2,
493 p_epp_attribute17 in varchar2,
494 p_epp_attribute18 in varchar2,
495 p_epp_attribute19 in varchar2,
496 p_epp_attribute20 in varchar2,
497 p_epp_attribute21 in varchar2,
498 p_epp_attribute22 in varchar2,
499 p_epp_attribute23 in varchar2,
500 p_epp_attribute24 in varchar2,
501 p_epp_attribute25 in varchar2,
502 p_epp_attribute26 in varchar2,
503 p_epp_attribute27 in varchar2,
504 p_epp_attribute28 in varchar2,
505 p_epp_attribute29 in varchar2,
506 p_epp_attribute30 in varchar2,
507 p_object_version_number in number
508 )
509 Return g_rec_type is
510 --
511 l_rec g_rec_type;
512 l_proc varchar2(72) := g_package||'convert_args';
513 --
514 Begin
515 --
516 hr_utility.set_location('Entering:'||l_proc, 5);
517 --
518 -- Convert arguments into local l_rec structure.
519 --
520 l_rec.elig_prtt_anthr_pl_prte_id := p_elig_prtt_anthr_pl_prte_id;
521 l_rec.effective_start_date := p_effective_start_date;
522 l_rec.effective_end_date := p_effective_end_date;
523 l_rec.excld_flag := p_excld_flag;
524 l_rec.ordr_num := p_ordr_num;
525 l_rec.eligy_prfl_id := p_eligy_prfl_id;
526 l_rec.pl_id := p_pl_id;
527 l_rec.business_group_id := p_business_group_id;
528 l_rec.epp_attribute_category := p_epp_attribute_category;
529 l_rec.epp_attribute1 := p_epp_attribute1;
530 l_rec.epp_attribute2 := p_epp_attribute2;
531 l_rec.epp_attribute3 := p_epp_attribute3;
532 l_rec.epp_attribute4 := p_epp_attribute4;
533 l_rec.epp_attribute5 := p_epp_attribute5;
534 l_rec.epp_attribute6 := p_epp_attribute6;
535 l_rec.epp_attribute7 := p_epp_attribute7;
536 l_rec.epp_attribute8 := p_epp_attribute8;
537 l_rec.epp_attribute9 := p_epp_attribute9;
538 l_rec.epp_attribute10 := p_epp_attribute10;
539 l_rec.epp_attribute11 := p_epp_attribute11;
540 l_rec.epp_attribute12 := p_epp_attribute12;
541 l_rec.epp_attribute13 := p_epp_attribute13;
542 l_rec.epp_attribute14 := p_epp_attribute14;
543 l_rec.epp_attribute15 := p_epp_attribute15;
544 l_rec.epp_attribute16 := p_epp_attribute16;
545 l_rec.epp_attribute17 := p_epp_attribute17;
546 l_rec.epp_attribute18 := p_epp_attribute18;
547 l_rec.epp_attribute19 := p_epp_attribute19;
548 l_rec.epp_attribute20 := p_epp_attribute20;
549 l_rec.epp_attribute21 := p_epp_attribute21;
550 l_rec.epp_attribute22 := p_epp_attribute22;
551 l_rec.epp_attribute23 := p_epp_attribute23;
552 l_rec.epp_attribute24 := p_epp_attribute24;
553 l_rec.epp_attribute25 := p_epp_attribute25;
554 l_rec.epp_attribute26 := p_epp_attribute26;
555 l_rec.epp_attribute27 := p_epp_attribute27;
556 l_rec.epp_attribute28 := p_epp_attribute28;
557 l_rec.epp_attribute29 := p_epp_attribute29;
558 l_rec.epp_attribute30 := p_epp_attribute30;
559 l_rec.object_version_number := p_object_version_number;
560 --
561 -- Return the plsql record structure.
562 --
563 hr_utility.set_location(' Leaving:'||l_proc, 10);
564 Return(l_rec);
565 --
566 End convert_args;
567 --
568 end ben_epp_shd;