[Home] [Help]
PACKAGE BODY: APPS.BEN_LAR_SHD
Source
1 Package Body ben_lar_shd as
2 /* $Header: belarrhi.pkb 120.0 2005/05/28 03:14:52 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
10 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_lar_shd.'; -- Global package name
9 --
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_LOA_RSN_RT_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 Else
42 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
43 fnd_message.set_token('PROCEDURE', l_proc);
44 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
45 fnd_message.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_loa_rsn_rt_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 loa_rsn_rt_id,
66 effective_start_date,
67 effective_end_date,
68 business_group_id,
69 ordr_num,
70 excld_flag,
71 vrbl_rt_prfl_id,
72 loa_rsn_cd,
73 lar_attribute_category,
74 lar_attribute1,
75 lar_attribute2,
76 lar_attribute3,
77 lar_attribute4,
78 lar_attribute5,
79 lar_attribute6,
80 lar_attribute7,
81 lar_attribute8,
82 lar_attribute9,
83 lar_attribute10,
84 lar_attribute11,
85 lar_attribute12,
86 lar_attribute13,
87 lar_attribute14,
88 lar_attribute15,
89 lar_attribute16,
90 lar_attribute17,
91 lar_attribute18,
92 lar_attribute19,
93 lar_attribute20,
94 lar_attribute21,
95 lar_attribute22,
96 lar_attribute23,
97 lar_attribute24,
98 lar_attribute25,
99 lar_attribute26,
100 lar_attribute27,
101 lar_attribute28,
102 lar_attribute29,
103 lar_attribute30,
104 absence_attendance_type_id,
105 abs_attendance_reason_id,
106 object_version_number
107 from ben_loa_rsn_rt_f
108 where loa_rsn_rt_id = p_loa_rsn_rt_id
109 and p_effective_date
110 between effective_start_date and effective_end_date;
111 --
112 l_proc varchar2(72) := g_package||'api_updating';
113 l_fct_ret boolean;
114 --
115 Begin
116 hr_utility.set_location('Entering:'||l_proc, 5);
117 --
118 If (p_effective_date is null or
119 p_loa_rsn_rt_id is null or
120 p_object_version_number is null) Then
121 --
122 -- One of the primary key arguments is null therefore we must
123 -- set the returning function value to false
124 --
125 l_fct_ret := false;
126 Else
127 If (p_loa_rsn_rt_id = g_old_rec.loa_rsn_rt_id and
128 p_object_version_number = g_old_rec.object_version_number) Then
129 hr_utility.set_location(l_proc, 10);
130 --
131 -- The g_old_rec is current therefore we must
132 -- set the returning function to true
133 --
134 l_fct_ret := true;
135 Else
136 --
137 -- Select the current row
138 --
139 Open C_Sel1;
140 Fetch C_Sel1 Into g_old_rec;
141 If C_Sel1%notfound Then
142 Close C_Sel1;
143 --
144 -- The primary key is invalid therefore we must error
145 --
146 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
147 fnd_message.raise_error;
148 End If;
149 Close C_Sel1;
150 If (p_object_version_number <> g_old_rec.object_version_number) Then
151 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
152 fnd_message.raise_error;
153 End If;
154 hr_utility.set_location(l_proc, 15);
155 l_fct_ret := true;
156 End If;
157 End If;
158 hr_utility.set_location(' Leaving:'||l_proc, 20);
159 Return (l_fct_ret);
160 --
161 End api_updating;
162 --
163 -- ----------------------------------------------------------------------------
164 -- |--------------------------< find_dt_del_modes >---------------------------|
165 -- ----------------------------------------------------------------------------
166 Procedure find_dt_del_modes
167 (p_effective_date in date,
171 p_future_change out nocopy boolean,
168 p_base_key_value in number,
169 p_zap out nocopy boolean,
170 p_delete out nocopy boolean,
172 p_delete_next_change out nocopy boolean) is
173 --
174 l_proc varchar2(72) := g_package||'find_dt_del_modes';
175 --
176 --
177 l_parent_key_value1 number;
178 --
179 Cursor C_Sel1 Is
180 select t.vrbl_rt_prfl_id
181 from ben_loa_rsn_rt_f t
182 where t.loa_rsn_rt_id = p_base_key_value
183 and p_effective_date
184 between t.effective_start_date and t.effective_end_date;
185 --
186 Begin
187 hr_utility.set_location('Entering:'||l_proc, 5);
188 --
189 Open C_Sel1;
190 Fetch C_Sel1 Into l_parent_key_value1;
191 If C_Sel1%notfound then
192 Close C_Sel1;
193 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
194 fnd_message.set_token('PROCEDURE', l_proc);
195 fnd_message.set_token('STEP','10');
196 fnd_message.raise_error;
197 End If;
198 Close C_Sel1;
199 --
200 -- Call the corresponding datetrack api
201 --
202 dt_api.find_dt_del_modes
203 (p_effective_date => p_effective_date,
204 p_base_table_name => 'ben_loa_rsn_rt_f',
205 p_base_key_column => 'loa_rsn_rt_id',
206 p_base_key_value => p_base_key_value,
207 p_parent_table_name1 => 'ben_vrbl_rt_prfl_f',
208 p_parent_key_column1 => 'vrbl_rt_prfl_id',
209 p_parent_key_value1 => l_parent_key_value1,
210 p_zap => p_zap,
211 p_delete => p_delete,
212 p_future_change => p_future_change,
213 p_delete_next_change => p_delete_next_change);
214 --
215 hr_utility.set_location(' Leaving:'||l_proc, 10);
216 End find_dt_del_modes;
217 --
218 -- ----------------------------------------------------------------------------
219 -- |--------------------------< find_dt_upd_modes >---------------------------|
220 -- ----------------------------------------------------------------------------
221 Procedure find_dt_upd_modes
222 (p_effective_date in date,
223 p_base_key_value in number,
224 p_correction out nocopy boolean,
225 p_update out nocopy boolean,
226 p_update_override out nocopy boolean,
227 p_update_change_insert out nocopy boolean) is
228 --
229 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
230 --
231 Begin
232 hr_utility.set_location('Entering:'||l_proc, 5);
233 --
234 -- Call the corresponding datetrack api
235 --
236 dt_api.find_dt_upd_modes
237 (p_effective_date => p_effective_date,
238 p_base_table_name => 'ben_loa_rsn_rt_f',
239 p_base_key_column => 'loa_rsn_rt_id',
240 p_base_key_value => p_base_key_value,
241 p_correction => p_correction,
242 p_update => p_update,
243 p_update_override => p_update_override,
244 p_update_change_insert => p_update_change_insert);
245 --
246 hr_utility.set_location(' Leaving:'||l_proc, 10);
247 End find_dt_upd_modes;
248 --
249 -- ----------------------------------------------------------------------------
250 -- |------------------------< upd_effective_end_date >------------------------|
251 -- ----------------------------------------------------------------------------
252 Procedure upd_effective_end_date
253 (p_effective_date in date,
254 p_base_key_value in number,
255 p_new_effective_end_date in date,
256 p_validation_start_date in date,
257 p_validation_end_date in date,
258 p_object_version_number out nocopy number) is
259 --
260 l_proc varchar2(72) := g_package||'upd_effective_end_date';
261 l_object_version_number number;
262 --
263 Begin
264 hr_utility.set_location('Entering:'||l_proc, 5);
265 --
266 -- Because we are updating a row we must get the next object
267 -- version number.
268 --
269 l_object_version_number :=
270 dt_api.get_object_version_number
271 (p_base_table_name => 'ben_loa_rsn_rt_f',
272 p_base_key_column => 'loa_rsn_rt_id',
273 p_base_key_value => p_base_key_value);
274 --
275 hr_utility.set_location(l_proc, 10);
276 g_api_dml := true; -- Set the api dml status
277 --
278 -- Update the specified datetrack row setting the effective
279 -- end date to the specified new effective end date.
280 --
281 update ben_loa_rsn_rt_f t
282 set t.effective_end_date = p_new_effective_end_date,
283 t.object_version_number = l_object_version_number
284 where t.loa_rsn_rt_id = p_base_key_value
285 and p_effective_date
286 between t.effective_start_date and t.effective_end_date;
287 --
288 g_api_dml := false; -- Unset the api dml status
289 p_object_version_number := l_object_version_number;
290 hr_utility.set_location(' Leaving:'||l_proc, 15);
291 --
292 Exception
293 When Others Then
294 g_api_dml := false; -- Unset the api dml status
295 Raise;
296 End upd_effective_end_date;
297 --
298 -- ----------------------------------------------------------------------------
299 -- |---------------------------------< lck >----------------------------------|
300 -- ----------------------------------------------------------------------------
301 Procedure lck
302 (p_effective_date in date,
303 p_datetrack_mode in varchar2,
304 p_loa_rsn_rt_id in number,
305 p_object_version_number in number,
306 p_validation_start_date out nocopy date,
307 p_validation_end_date out nocopy date) is
308 --
309 l_proc varchar2(72) := g_package||'lck';
310 l_validation_start_date date;
311 l_validation_end_date date;
312 l_object_invalid exception;
313 l_argument varchar2(30);
314 --
315 -- Cursor C_Sel1 selects the current locked row as of session date
319 select
316 -- ensuring that the object version numbers match.
317 --
318 Cursor C_Sel1 is
320 loa_rsn_rt_id,
321 effective_start_date,
322 effective_end_date,
323 business_group_id,
324 ordr_num,
325 excld_flag,
326 vrbl_rt_prfl_id,
327 loa_rsn_cd,
328 lar_attribute_category,
329 lar_attribute1,
330 lar_attribute2,
331 lar_attribute3,
332 lar_attribute4,
333 lar_attribute5,
334 lar_attribute6,
335 lar_attribute7,
336 lar_attribute8,
337 lar_attribute9,
338 lar_attribute10,
339 lar_attribute11,
340 lar_attribute12,
341 lar_attribute13,
342 lar_attribute14,
343 lar_attribute15,
344 lar_attribute16,
345 lar_attribute17,
346 lar_attribute18,
347 lar_attribute19,
348 lar_attribute20,
349 lar_attribute21,
350 lar_attribute22,
351 lar_attribute23,
352 lar_attribute24,
353 lar_attribute25,
354 lar_attribute26,
355 lar_attribute27,
356 lar_attribute28,
357 lar_attribute29,
358 lar_attribute30,
359 absence_attendance_type_id,
360 abs_attendance_reason_id,
361 object_version_number
362 from ben_loa_rsn_rt_f
363 where loa_rsn_rt_id = p_loa_rsn_rt_id
364 and p_effective_date
365 between effective_start_date and effective_end_date
366 for update nowait;
367 --
368 --
369 --
370 Begin
371 hr_utility.set_location('Entering:'||l_proc, 5);
372 --
373 -- Ensure that all the mandatory arguments are not null
374 --
375 hr_api.mandatory_arg_error(p_api_name => l_proc,
376 p_argument => 'effective_date',
377 p_argument_value => p_effective_date);
378 --
379 hr_api.mandatory_arg_error(p_api_name => l_proc,
380 p_argument => 'datetrack_mode',
381 p_argument_value => p_datetrack_mode);
382 --
383 hr_api.mandatory_arg_error(p_api_name => l_proc,
384 p_argument => 'loa_rsn_rt_id',
385 p_argument_value => p_loa_rsn_rt_id);
386 --
387 hr_api.mandatory_arg_error(p_api_name => l_proc,
388 p_argument => 'object_version_number',
389 p_argument_value => p_object_version_number);
390 --
391 -- Check to ensure the datetrack mode is not INSERT.
392 --
393 If (p_datetrack_mode <> 'INSERT') then
394 --
395 -- We must select and lock the current row.
396 --
397 Open C_Sel1;
398 Fetch C_Sel1 Into g_old_rec;
399 If C_Sel1%notfound then
400 Close C_Sel1;
401 --
402 -- The primary key is invalid therefore we must error
403 --
404 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
405 fnd_message.raise_error;
406 End If;
407 Close C_Sel1;
408 If (p_object_version_number <> g_old_rec.object_version_number) Then
409 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
410 fnd_message.raise_error;
411 End If;
412 hr_utility.set_location(l_proc, 15);
413 --
414 --
415 -- Validate the datetrack mode mode getting the validation start
416 -- and end dates for the specified datetrack operation.
417 --
418 dt_api.validate_dt_mode
419 (p_effective_date => p_effective_date,
420 p_datetrack_mode => p_datetrack_mode,
421 p_base_table_name => 'ben_loa_rsn_rt_f',
422 p_base_key_column => 'loa_rsn_rt_id',
423 p_base_key_value => p_loa_rsn_rt_id,
424 p_parent_table_name1 => 'ben_vrbl_rt_prfl_f',
425 p_parent_key_column1 => 'vrbl_rt_prfl_id',
426 p_parent_key_value1 => g_old_rec.vrbl_rt_prfl_id,
427 p_enforce_foreign_locking => true,
428 p_validation_start_date => l_validation_start_date,
429 p_validation_end_date => l_validation_end_date);
430 Else
431 --
432 -- We are doing a datetrack 'INSERT' which is illegal within this
433 -- procedure therefore we must error (note: to lck on insert the
434 -- private procedure ins_lck should be called).
435 --
436 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
437 fnd_message.set_token('PROCEDURE', l_proc);
438 fnd_message.set_token('STEP','20');
439 fnd_message.raise_error;
440 End If;
441 --
442 -- Set the validation start and end date OUT arguments
443 --
444 p_validation_start_date := l_validation_start_date;
445 p_validation_end_date := l_validation_end_date;
446 --
447 hr_utility.set_location(' Leaving:'||l_proc, 30);
448 --
449 -- We need to trap the ORA LOCK exception
450 --
451 Exception
452 When HR_Api.Object_Locked then
453 --
454 -- The object is locked therefore we need to supply a meaningful
455 -- error message.
456 --
457 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
458 fnd_message.set_token('TABLE_NAME', 'ben_loa_rsn_rt_f');
459 fnd_message.raise_error;
460 When l_object_invalid then
461 --
462 -- The object doesn't exist or is invalid
463 --
464 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
465 fnd_message.set_token('TABLE_NAME', 'ben_loa_rsn_rt_f');
466 fnd_message.raise_error;
467 End lck;
468 --
469 -- ----------------------------------------------------------------------------
470 -- |-----------------------------< convert_args >-----------------------------|
471 -- ----------------------------------------------------------------------------
475 p_effective_start_date in date,
472 Function convert_args
473 (
474 p_loa_rsn_rt_id in number,
476 p_effective_end_date in date,
477 p_business_group_id in number,
478 p_ordr_num in number,
479 p_excld_flag in varchar2,
480 p_vrbl_rt_prfl_id in number,
481 p_loa_rsn_cd in varchar2,
482 p_lar_attribute_category in varchar2,
483 p_lar_attribute1 in varchar2,
484 p_lar_attribute2 in varchar2,
485 p_lar_attribute3 in varchar2,
486 p_lar_attribute4 in varchar2,
487 p_lar_attribute5 in varchar2,
488 p_lar_attribute6 in varchar2,
489 p_lar_attribute7 in varchar2,
490 p_lar_attribute8 in varchar2,
491 p_lar_attribute9 in varchar2,
492 p_lar_attribute10 in varchar2,
493 p_lar_attribute11 in varchar2,
494 p_lar_attribute12 in varchar2,
495 p_lar_attribute13 in varchar2,
496 p_lar_attribute14 in varchar2,
497 p_lar_attribute15 in varchar2,
498 p_lar_attribute16 in varchar2,
499 p_lar_attribute17 in varchar2,
500 p_lar_attribute18 in varchar2,
501 p_lar_attribute19 in varchar2,
502 p_lar_attribute20 in varchar2,
503 p_lar_attribute21 in varchar2,
504 p_lar_attribute22 in varchar2,
505 p_lar_attribute23 in varchar2,
506 p_lar_attribute24 in varchar2,
507 p_lar_attribute25 in varchar2,
508 p_lar_attribute26 in varchar2,
509 p_lar_attribute27 in varchar2,
510 p_lar_attribute28 in varchar2,
511 p_lar_attribute29 in varchar2,
512 p_lar_attribute30 in varchar2,
513 p_absence_attendance_type_id in number,
514 p_abs_attendance_reason_id in number,
515 p_object_version_number in number
516 )
517 Return g_rec_type is
518 --
519 l_rec g_rec_type;
520 l_proc varchar2(72) := g_package||'convert_args';
521 --
522 Begin
523 --
524 hr_utility.set_location('Entering:'||l_proc, 5);
525 --
526 -- Convert arguments into local l_rec structure.
527 --
528 l_rec.loa_rsn_rt_id := p_loa_rsn_rt_id;
529 l_rec.effective_start_date := p_effective_start_date;
530 l_rec.effective_end_date := p_effective_end_date;
531 l_rec.business_group_id := p_business_group_id;
532 l_rec.ordr_num := p_ordr_num;
533 l_rec.excld_flag := p_excld_flag;
534 l_rec.vrbl_rt_prfl_id := p_vrbl_rt_prfl_id;
535 l_rec.loa_rsn_cd := p_loa_rsn_cd;
536 l_rec.lar_attribute_category := p_lar_attribute_category;
537 l_rec.lar_attribute1 := p_lar_attribute1;
538 l_rec.lar_attribute2 := p_lar_attribute2;
539 l_rec.lar_attribute3 := p_lar_attribute3;
540 l_rec.lar_attribute4 := p_lar_attribute4;
541 l_rec.lar_attribute5 := p_lar_attribute5;
542 l_rec.lar_attribute6 := p_lar_attribute6;
543 l_rec.lar_attribute7 := p_lar_attribute7;
544 l_rec.lar_attribute8 := p_lar_attribute8;
545 l_rec.lar_attribute9 := p_lar_attribute9;
546 l_rec.lar_attribute10 := p_lar_attribute10;
547 l_rec.lar_attribute11 := p_lar_attribute11;
548 l_rec.lar_attribute12 := p_lar_attribute12;
549 l_rec.lar_attribute13 := p_lar_attribute13;
550 l_rec.lar_attribute14 := p_lar_attribute14;
551 l_rec.lar_attribute15 := p_lar_attribute15;
552 l_rec.lar_attribute16 := p_lar_attribute16;
553 l_rec.lar_attribute17 := p_lar_attribute17;
554 l_rec.lar_attribute18 := p_lar_attribute18;
555 l_rec.lar_attribute19 := p_lar_attribute19;
556 l_rec.lar_attribute20 := p_lar_attribute20;
557 l_rec.lar_attribute21 := p_lar_attribute21;
558 l_rec.lar_attribute22 := p_lar_attribute22;
559 l_rec.lar_attribute23 := p_lar_attribute23;
560 l_rec.lar_attribute24 := p_lar_attribute24;
561 l_rec.lar_attribute25 := p_lar_attribute25;
562 l_rec.lar_attribute26 := p_lar_attribute26;
563 l_rec.lar_attribute27 := p_lar_attribute27;
564 l_rec.lar_attribute28 := p_lar_attribute28;
565 l_rec.lar_attribute29 := p_lar_attribute29;
566 l_rec.lar_attribute30 := p_lar_attribute30;
567 l_rec.absence_attendance_type_id := p_absence_attendance_type_id;
568 l_rec.abs_attendance_reason_id := p_abs_attendance_reason_id;
569 l_rec.object_version_number := p_object_version_number;
570 --
571 -- Return the plsql record structure.
572 --
573 hr_utility.set_location(' Leaving:'||l_proc, 10);
574 Return(l_rec);
575 --
576 End convert_args;
577 --
578 end ben_lar_shd;