[Home] [Help]
PACKAGE BODY: APPS.BEN_ESH_SHD
Source
1 Package Body ben_esh_shd as
2 /* $Header: beeshrhi.pkb 120.0 2005/05/28 02:56:41 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_esh_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_SCH_HRS_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_SCH_HRS_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_schedd_hrs_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 --
71 effective_start_date,
68 Cursor C_Sel1 is
69 select
70 elig_schedd_hrs_prte_id,
72 effective_end_date,
73 business_group_id,
74 hrs_num,
75 determination_cd,
76 determination_rl,
77 rounding_cd,
78 rounding_rl,
79 max_hrs_num,
80 schedd_hrs_rl,
81 freq_cd,
82 ordr_num,
83 excld_flag,
84 eligy_prfl_id,
85 esh_attribute_category,
86 esh_attribute1,
87 esh_attribute2,
88 esh_attribute3,
89 esh_attribute4,
90 esh_attribute5,
91 esh_attribute6,
92 esh_attribute7,
93 esh_attribute8,
94 esh_attribute9,
95 esh_attribute10,
96 esh_attribute11,
97 esh_attribute12,
98 esh_attribute13,
99 esh_attribute14,
100 esh_attribute15,
101 esh_attribute16,
102 esh_attribute17,
103 esh_attribute18,
104 esh_attribute19,
105 esh_attribute20,
106 esh_attribute21,
107 esh_attribute22,
108 esh_attribute23,
109 esh_attribute24,
110 esh_attribute25,
111 esh_attribute26,
112 esh_attribute27,
113 esh_attribute28,
114 esh_attribute29,
115 esh_attribute30,
116 object_version_number ,
117 criteria_score,
118 criteria_weight
119 from ben_elig_schedd_hrs_prte_f
120 where elig_schedd_hrs_prte_id = p_elig_schedd_hrs_prte_id
121 and p_effective_date
122 between effective_start_date and effective_end_date;
123 --
124 l_proc varchar2(72) := g_package||'api_updating';
125 l_fct_ret boolean;
126 --
127 Begin
128 hr_utility.set_location('Entering:'||l_proc, 5);
129 --
130 If (p_effective_date is null or
131 p_elig_schedd_hrs_prte_id is null or
132 p_object_version_number is null) Then
133 --
134 -- One of the primary key arguments is null therefore we must
135 -- set the returning function value to false
136 --
137 l_fct_ret := false;
138 Else
139 If (p_elig_schedd_hrs_prte_id = g_old_rec.elig_schedd_hrs_prte_id and
140 p_object_version_number = g_old_rec.object_version_number) Then
141 hr_utility.set_location(l_proc, 10);
142 --
143 -- The g_old_rec is current therefore we must
144 -- set the returning function to true
145 --
146 l_fct_ret := true;
147 Else
148 --
149 -- Select the current row
150 --
151 Open C_Sel1;
152 Fetch C_Sel1 Into g_old_rec;
153 If C_Sel1%notfound Then
154 Close C_Sel1;
155 --
156 -- The primary key is invalid therefore we must error
157 --
158 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
159 fnd_message.raise_error;
160 End If;
161 Close C_Sel1;
162 If (p_object_version_number <> g_old_rec.object_version_number) Then
163 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
164 fnd_message.raise_error;
165 End If;
166 hr_utility.set_location(l_proc, 15);
167 l_fct_ret := true;
168 End If;
169 End If;
170 hr_utility.set_location(' Leaving:'||l_proc, 20);
171 Return (l_fct_ret);
172 --
173 End api_updating;
174 --
175 -- ----------------------------------------------------------------------------
176 -- |--------------------------< find_dt_del_modes >---------------------------|
177 -- ----------------------------------------------------------------------------
178 Procedure find_dt_del_modes
179 (p_effective_date in date,
180 p_base_key_value in number,
181 p_zap out nocopy boolean,
182 p_delete out nocopy boolean,
183 p_future_change out nocopy boolean,
184 p_delete_next_change out nocopy boolean) is
185 --
186 l_proc varchar2(72) := g_package||'find_dt_del_modes';
187 --
188 l_parent_key_value1 number;
189 --
190 Cursor C_Sel1 Is
191 select t.eligy_prfl_id
192 from ben_elig_schedd_hrs_prte_f t
193 where t.elig_schedd_hrs_prte_id = p_base_key_value
194 and p_effective_date
195 between t.effective_start_date and t.effective_end_date;
196 --
197 Begin
198 hr_utility.set_location('Entering:'||l_proc, 5);
199 Open C_Sel1;
200 Fetch C_Sel1 Into l_parent_key_value1;
201 If C_Sel1%notfound then
202 Close C_Sel1;
203 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
204 fnd_message.set_token('PROCEDURE', l_proc);
205 fnd_message.set_token('STEP','10');
206 fnd_message.raise_error;
207 End If;
208 Close C_Sel1;
209 --
210 -- Call the corresponding datetrack api
211 --
212 dt_api.find_dt_del_modes
213 (p_effective_date => p_effective_date,
214 p_base_table_name => 'ben_elig_schedd_hrs_prte_f',
215 p_base_key_column => 'elig_schedd_hrs_prte_id',
216 p_base_key_value => p_base_key_value,
217 p_parent_table_name1 => 'ben_eligy_prfl_f',
218 p_parent_key_column1 => 'eligy_prfl_id',
219 p_parent_key_value1 => l_parent_key_value1,
220 p_zap => p_zap,
221 p_delete => p_delete,
222 p_future_change => p_future_change,
223 p_delete_next_change => p_delete_next_change);
224 --
225 hr_utility.set_location(' Leaving:'||l_proc, 10);
226 End find_dt_del_modes;
227 --
228 -- ----------------------------------------------------------------------------
229 -- |--------------------------< find_dt_upd_modes >---------------------------|
230 -- ----------------------------------------------------------------------------
231 Procedure find_dt_upd_modes
232 (p_effective_date in date,
233 p_base_key_value in number,
237 p_update_change_insert out nocopy boolean) is
234 p_correction out nocopy boolean,
235 p_update out nocopy boolean,
236 p_update_override out nocopy boolean,
238 --
239 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
240 --
241 Begin
242 hr_utility.set_location('Entering:'||l_proc, 5);
243 --
244 -- Call the corresponding datetrack api
245 --
246 dt_api.find_dt_upd_modes
247 (p_effective_date => p_effective_date,
248 p_base_table_name => 'ben_elig_schedd_hrs_prte_f',
249 p_base_key_column => 'elig_schedd_hrs_prte_id',
250 p_base_key_value => p_base_key_value,
251 p_correction => p_correction,
252 p_update => p_update,
253 p_update_override => p_update_override,
254 p_update_change_insert => p_update_change_insert);
255 --
256 hr_utility.set_location(' Leaving:'||l_proc, 10);
257 End find_dt_upd_modes;
258 --
259 -- ----------------------------------------------------------------------------
260 -- |------------------------< upd_effective_end_date >------------------------|
261 -- ----------------------------------------------------------------------------
262 Procedure upd_effective_end_date
263 (p_effective_date in date,
264 p_base_key_value in number,
265 p_new_effective_end_date in date,
266 p_validation_start_date in date,
267 p_validation_end_date in date,
268 p_object_version_number out nocopy number) is
269 --
270 l_proc varchar2(72) := g_package||'upd_effective_end_date';
271 l_object_version_number number;
272 --
273 Begin
274 hr_utility.set_location('Entering:'||l_proc, 5);
275 --
276 -- Because we are updating a row we must get the next object
277 -- version number.
278 --
279 l_object_version_number :=
280 dt_api.get_object_version_number
281 (p_base_table_name => 'ben_elig_schedd_hrs_prte_f',
282 p_base_key_column => 'elig_schedd_hrs_prte_id',
283 p_base_key_value => p_base_key_value);
284 --
285 hr_utility.set_location(l_proc, 10);
286 g_api_dml := true; -- Set the api dml status
287 --
288 -- Update the specified datetrack row setting the effective
289 -- end date to the specified new effective end date.
290 --
291 update ben_elig_schedd_hrs_prte_f t
292 set t.effective_end_date = p_new_effective_end_date,
293 t.object_version_number = l_object_version_number
294 where t.elig_schedd_hrs_prte_id = p_base_key_value
295 and p_effective_date
296 between t.effective_start_date and t.effective_end_date;
297 --
298 g_api_dml := false; -- Unset the api dml status
299 p_object_version_number := l_object_version_number;
300 hr_utility.set_location(' Leaving:'||l_proc, 15);
301 --
302 Exception
303 When Others Then
304 g_api_dml := false; -- Unset the api dml status
305 Raise;
306 End upd_effective_end_date;
307 --
308 -- ----------------------------------------------------------------------------
309 -- |---------------------------------< lck >----------------------------------|
310 -- ----------------------------------------------------------------------------
311 Procedure lck
312 (p_effective_date in date,
313 p_datetrack_mode in varchar2,
314 p_elig_schedd_hrs_prte_id in number,
315 p_object_version_number in number,
316 p_validation_start_date out nocopy date,
317 p_validation_end_date out nocopy date) is
318 --
319 l_proc varchar2(72) := g_package||'lck';
320 l_validation_start_date date;
321 l_validation_end_date date;
322 l_object_invalid exception;
323 l_argument varchar2(30);
324 --
325 -- Cursor C_Sel1 selects the current locked row as of session date
326 -- ensuring that the object version numbers match.
327 --
328 Cursor C_Sel1 is
329 select
330 elig_schedd_hrs_prte_id,
331 effective_start_date,
332 effective_end_date,
333 business_group_id,
334 hrs_num,
335 determination_cd,
336 determination_rl,
337 rounding_cd,
338 rounding_rl,
339 max_hrs_num,
340 schedd_hrs_rl,
341 freq_cd,
342 ordr_num,
343 excld_flag,
344 eligy_prfl_id,
345 esh_attribute_category,
346 esh_attribute1,
347 esh_attribute2,
348 esh_attribute3,
349 esh_attribute4,
350 esh_attribute5,
351 esh_attribute6,
352 esh_attribute7,
353 esh_attribute8,
354 esh_attribute9,
355 esh_attribute10,
356 esh_attribute11,
357 esh_attribute12,
358 esh_attribute13,
359 esh_attribute14,
360 esh_attribute15,
361 esh_attribute16,
362 esh_attribute17,
363 esh_attribute18,
364 esh_attribute19,
365 esh_attribute20,
366 esh_attribute21,
367 esh_attribute22,
368 esh_attribute23,
369 esh_attribute24,
370 esh_attribute25,
371 esh_attribute26,
372 esh_attribute27,
373 esh_attribute28,
374 esh_attribute29,
375 esh_attribute30,
376 object_version_number ,
377 criteria_score,
378 criteria_weight
379 from ben_elig_schedd_hrs_prte_f
380 where elig_schedd_hrs_prte_id = p_elig_schedd_hrs_prte_id
381 and p_effective_date
382 between effective_start_date and effective_end_date
383 for update nowait;
384 --
385 --
386 --
387 Begin
388 hr_utility.set_location('Entering:'||l_proc, 5);
389 --
390 -- Ensure that all the mandatory arguments are not null
391 --
392 hr_api.mandatory_arg_error(p_api_name => l_proc,
396 hr_api.mandatory_arg_error(p_api_name => l_proc,
393 p_argument => 'effective_date',
394 p_argument_value => p_effective_date);
395 --
397 p_argument => 'datetrack_mode',
398 p_argument_value => p_datetrack_mode);
399 --
400 hr_api.mandatory_arg_error(p_api_name => l_proc,
401 p_argument => 'elig_schedd_hrs_prte_id',
402 p_argument_value => p_elig_schedd_hrs_prte_id);
403 --
404 hr_api.mandatory_arg_error(p_api_name => l_proc,
405 p_argument => 'object_version_number',
406 p_argument_value => p_object_version_number);
407 --
408 -- Check to ensure the datetrack mode is not INSERT.
409 --
410 If (p_datetrack_mode <> 'INSERT') then
411 --
412 -- We must select and lock the current row.
413 --
414 Open C_Sel1;
415 Fetch C_Sel1 Into g_old_rec;
416 If C_Sel1%notfound then
417 Close C_Sel1;
418 --
419 -- The primary key is invalid therefore we must error
420 --
421 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
422 fnd_message.raise_error;
423 End If;
424 Close C_Sel1;
425 If (p_object_version_number <> g_old_rec.object_version_number) Then
426 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
427 fnd_message.raise_error;
428 End If;
429 hr_utility.set_location(l_proc, 15);
430 --
431 --
432 -- Validate the datetrack mode mode getting the validation start
433 -- and end dates for the specified datetrack operation.
434 --
435 dt_api.validate_dt_mode
436 (p_effective_date => p_effective_date,
437 p_datetrack_mode => p_datetrack_mode,
438 p_base_table_name => 'ben_elig_schedd_hrs_prte_f',
439 p_base_key_column => 'elig_schedd_hrs_prte_id',
440 p_base_key_value => p_elig_schedd_hrs_prte_id,
441 p_parent_table_name1 => 'ben_eligy_prfl_f',
442 p_parent_key_column1 => 'eligy_prfl_id',
443 p_parent_key_value1 => g_old_rec.eligy_prfl_id,
444 p_enforce_foreign_locking => true,
445 p_validation_start_date => l_validation_start_date,
446 p_validation_end_date => l_validation_end_date);
447 Else
448 --
449 -- We are doing a datetrack 'INSERT' which is illegal within this
450 -- procedure therefore we must error (note: to lck on insert the
451 -- private procedure ins_lck should be called).
452 --
453 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
454 fnd_message.set_token('PROCEDURE', l_proc);
455 fnd_message.set_token('STEP','20');
456 fnd_message.raise_error;
457 End If;
458 --
459 -- Set the validation start and end date OUT arguments
460 --
461 p_validation_start_date := l_validation_start_date;
462 p_validation_end_date := l_validation_end_date;
463 --
464 hr_utility.set_location(' Leaving:'||l_proc, 30);
465 --
466 -- We need to trap the ORA LOCK exception
467 --
468 Exception
469 When HR_Api.Object_Locked then
470 --
471 -- The object is locked therefore we need to supply a meaningful
472 -- error message.
473 --
474 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
475 fnd_message.set_token('TABLE_NAME', 'ben_elig_schedd_hrs_prte_f');
476 fnd_message.raise_error;
477 When l_object_invalid then
478 --
479 -- The object doesn't exist or is invalid
480 --
481 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
482 fnd_message.set_token('TABLE_NAME', 'ben_elig_schedd_hrs_prte_f');
483 fnd_message.raise_error;
484 End lck;
485 --
486 -- ----------------------------------------------------------------------------
487 -- |-----------------------------< convert_args >-----------------------------|
488 -- ----------------------------------------------------------------------------
489 Function convert_args
490 (
491 p_elig_schedd_hrs_prte_id in number,
492 p_effective_start_date in date,
493 p_effective_end_date in date,
494 p_business_group_id in number,
495 p_hrs_num in number,
496 p_determination_cd in varchar2,
497 p_determination_rl in number,
498 p_rounding_cd in varchar2,
499 p_rounding_rl in number,
500 p_max_hrs_num in number,
501 p_schedd_hrs_rl in number,
502 p_freq_cd in varchar2,
503 p_ordr_num in number,
504 p_excld_flag in varchar2,
505 p_eligy_prfl_id in number,
506 p_esh_attribute_category in varchar2,
507 p_esh_attribute1 in varchar2,
508 p_esh_attribute2 in varchar2,
509 p_esh_attribute3 in varchar2,
510 p_esh_attribute4 in varchar2,
511 p_esh_attribute5 in varchar2,
512 p_esh_attribute6 in varchar2,
513 p_esh_attribute7 in varchar2,
514 p_esh_attribute8 in varchar2,
515 p_esh_attribute9 in varchar2,
516 p_esh_attribute10 in varchar2,
517 p_esh_attribute11 in varchar2,
518 p_esh_attribute12 in varchar2,
519 p_esh_attribute13 in varchar2,
520 p_esh_attribute14 in varchar2,
521 p_esh_attribute15 in varchar2,
525 p_esh_attribute19 in varchar2,
522 p_esh_attribute16 in varchar2,
523 p_esh_attribute17 in varchar2,
524 p_esh_attribute18 in varchar2,
526 p_esh_attribute20 in varchar2,
527 p_esh_attribute21 in varchar2,
528 p_esh_attribute22 in varchar2,
529 p_esh_attribute23 in varchar2,
530 p_esh_attribute24 in varchar2,
531 p_esh_attribute25 in varchar2,
532 p_esh_attribute26 in varchar2,
533 p_esh_attribute27 in varchar2,
534 p_esh_attribute28 in varchar2,
535 p_esh_attribute29 in varchar2,
536 p_esh_attribute30 in varchar2,
537 p_object_version_number in number ,
538 p_criteria_score in number ,
539 p_criteria_weight in number
540 )
541 Return g_rec_type is
542 --
543 l_rec g_rec_type;
544 l_proc varchar2(72) := g_package||'convert_args';
545 --
546 Begin
547 --
548 hr_utility.set_location('Entering:'||l_proc, 5);
549 --
550 -- Convert arguments into local l_rec structure.
551 --
552 l_rec.elig_schedd_hrs_prte_id := p_elig_schedd_hrs_prte_id;
553 l_rec.effective_start_date := p_effective_start_date;
554 l_rec.effective_end_date := p_effective_end_date;
555 l_rec.business_group_id := p_business_group_id;
556 l_rec.hrs_num := p_hrs_num;
557 l_rec.determination_cd := p_determination_cd;
558 l_rec.determination_rl := p_determination_rl;
559 l_rec.rounding_cd := p_rounding_cd;
560 l_rec.rounding_rl := p_rounding_rl;
561 l_rec.max_hrs_num := p_max_hrs_num;
562 l_rec.schedd_hrs_rl := p_schedd_hrs_rl;
563 l_rec.freq_cd := p_freq_cd;
564 l_rec.ordr_num := p_ordr_num;
565 l_rec.excld_flag := p_excld_flag;
566 l_rec.eligy_prfl_id := p_eligy_prfl_id;
567 l_rec.esh_attribute_category := p_esh_attribute_category;
568 l_rec.esh_attribute1 := p_esh_attribute1;
569 l_rec.esh_attribute2 := p_esh_attribute2;
570 l_rec.esh_attribute3 := p_esh_attribute3;
571 l_rec.esh_attribute4 := p_esh_attribute4;
572 l_rec.esh_attribute5 := p_esh_attribute5;
573 l_rec.esh_attribute6 := p_esh_attribute6;
574 l_rec.esh_attribute7 := p_esh_attribute7;
575 l_rec.esh_attribute8 := p_esh_attribute8;
576 l_rec.esh_attribute9 := p_esh_attribute9;
577 l_rec.esh_attribute10 := p_esh_attribute10;
578 l_rec.esh_attribute11 := p_esh_attribute11;
579 l_rec.esh_attribute12 := p_esh_attribute12;
580 l_rec.esh_attribute13 := p_esh_attribute13;
581 l_rec.esh_attribute14 := p_esh_attribute14;
582 l_rec.esh_attribute15 := p_esh_attribute15;
583 l_rec.esh_attribute16 := p_esh_attribute16;
584 l_rec.esh_attribute17 := p_esh_attribute17;
585 l_rec.esh_attribute18 := p_esh_attribute18;
586 l_rec.esh_attribute19 := p_esh_attribute19;
587 l_rec.esh_attribute20 := p_esh_attribute20;
588 l_rec.esh_attribute21 := p_esh_attribute21;
589 l_rec.esh_attribute22 := p_esh_attribute22;
590 l_rec.esh_attribute23 := p_esh_attribute23;
591 l_rec.esh_attribute24 := p_esh_attribute24;
592 l_rec.esh_attribute25 := p_esh_attribute25;
593 l_rec.esh_attribute26 := p_esh_attribute26;
594 l_rec.esh_attribute27 := p_esh_attribute27;
595 l_rec.esh_attribute28 := p_esh_attribute28;
596 l_rec.esh_attribute29 := p_esh_attribute29;
597 l_rec.esh_attribute30 := p_esh_attribute30;
598 l_rec.object_version_number := p_object_version_number;
599 l_rec.criteria_score := p_criteria_score;
600 l_rec.criteria_weight := p_criteria_weight;
601 --
602 -- Return the plsql record structure.
603 --
604 hr_utility.set_location(' Leaving:'||l_proc, 10);
605 Return(l_rec);
606 --
607 End convert_args;
608 --
609 end ben_esh_shd;