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