[Home] [Help]
PACKAGE BODY: APPS.BEN_EJP_SHD
Source
1 Package Body ben_ejp_shd as
2 /* $Header: beejprhi.pkb 120.2 2006/02/27 00:35:00 rtagarra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_ejp_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_JOB_PRTE_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_JOB_PRTE_FK2') 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 ElsIf (p_constraint_name = 'BEN_ELIG_JOB_PRTE_PK') Then
47 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
48 fnd_message.set_token('PROCEDURE', l_proc);
49 fnd_message.set_token('STEP','15');
50 fnd_message.raise_error;
51 Else
52 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
53 fnd_message.set_token('PROCEDURE', l_proc);
54 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
55 fnd_message.raise_error;
56 End If;
57 --
58 hr_utility.set_location(' Leaving:'||l_proc, 10);
59 End constraint_error;
60 --
61 -- ----------------------------------------------------------------------------
62 -- |-----------------------------< api_updating >-----------------------------|
63 -- ----------------------------------------------------------------------------
64 Function api_updating
65 (p_effective_date in date,
66 p_elig_job_prte_id in number,
67 p_object_version_number in number
68 ) Return Boolean Is
69 --
70 --
71 -- Cursor selects the 'current' row from the HR Schema
72 --
73 Cursor C_Sel1 is
74 select
75 elig_job_prte_id,
76 effective_start_date,
77 effective_end_date,
78 ordr_num,
79 excld_flag,
80 job_id,
81 eligy_prfl_id,
82 business_group_id,
83 ejp_attribute_category,
84 ejp_attribute1,
85 ejp_attribute2,
86 ejp_attribute3,
87 ejp_attribute4,
88 ejp_attribute5,
89 ejp_attribute6,
90 ejp_attribute7,
91 ejp_attribute8,
92 ejp_attribute9,
93 ejp_attribute10,
94 ejp_attribute11,
95 ejp_attribute12,
96 ejp_attribute13,
97 ejp_attribute14,
98 ejp_attribute15,
99 ejp_attribute16,
100 ejp_attribute17,
101 ejp_attribute18,
102 ejp_attribute19,
103 ejp_attribute20,
104 ejp_attribute21,
105 ejp_attribute22,
106 ejp_attribute23,
107 ejp_attribute24,
108 ejp_attribute25,
109 ejp_attribute26,
110 ejp_attribute27,
111 ejp_attribute28,
112 ejp_attribute29,
113 ejp_attribute30,
114 object_version_number,
115 criteria_score,
116 criteria_weight
117 from ben_elig_job_prte_f
118 where elig_job_prte_id = p_elig_job_prte_id
119 and p_effective_date
120 between effective_start_date and effective_end_date;
121 --
122 l_proc varchar2(72) := g_package||'api_updating';
123 l_fct_ret boolean;
124 --
125 Begin
126 hr_utility.set_location('Entering:'||l_proc, 5);
127 --
128 If (p_effective_date is null or
129 p_elig_job_prte_id is null or
130 p_object_version_number is null) Then
131 --
132 -- One of the primary key arguments is null therefore we must
133 -- set the returning function value to false
134 --
135 l_fct_ret := false;
136 Else
137 If (p_elig_job_prte_id = g_old_rec.elig_job_prte_id and
138 p_object_version_number = g_old_rec.object_version_number) Then
139 hr_utility.set_location(l_proc, 10);
140 --
141 -- The g_old_rec is current therefore we must
142 -- set the returning function to true
143 --
144 l_fct_ret := true;
145 Else
146 --
147 -- Select the current row
148 --
149 Open C_Sel1;
150 Fetch C_Sel1 Into g_old_rec;
151 If C_Sel1%notfound Then
152 Close C_Sel1;
153 --
154 -- The primary key is invalid therefore we must error
155 --
156 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
157 fnd_message.raise_error;
158 End If;
159 Close C_Sel1;
160 If (p_object_version_number <> g_old_rec.object_version_number) Then
161 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
162 fnd_message.raise_error;
163 End If;
164 hr_utility.set_location(l_proc, 15);
165 l_fct_ret := true;
166 End If;
167 End If;
168 hr_utility.set_location(' Leaving:'||l_proc, 20);
169 Return (l_fct_ret);
170 --
171 End api_updating;
172 --
173 -- ----------------------------------------------------------------------------
174 -- |--------------------------< find_dt_del_modes >---------------------------|
175 -- ----------------------------------------------------------------------------
176 Procedure find_dt_del_modes
177 (p_effective_date in date,
178 p_base_key_value in number,
179 p_zap out nocopy boolean,
180 p_delete out nocopy boolean,
181 p_future_change out nocopy boolean,
182 p_delete_next_change out nocopy boolean) is
183 --
184 l_proc varchar2(72) := g_package||'find_dt_del_modes';
185 --
186 l_parent_key_value1 number;
187 --
188 Cursor C_Sel1 Is
189 select t.eligy_prfl_id
190 from ben_elig_job_prte_f t
191 where t.elig_job_prte_id = p_base_key_value
192 and p_effective_date
193 between t.effective_start_date and t.effective_end_date;
194 --
195 Begin
196 hr_utility.set_location('Entering:'||l_proc, 5);
197 Open C_Sel1;
198 Fetch C_Sel1 Into l_parent_key_value1;
199 If C_Sel1%notfound then
200 Close C_Sel1;
201 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
202 fnd_message.set_token('PROCEDURE', l_proc);
203 fnd_message.set_token('STEP','10');
204 fnd_message.raise_error;
205 End If;
206 Close C_Sel1;
207 --
208 -- Call the corresponding datetrack api
209 --
210 dt_api.find_dt_del_modes
211 (p_effective_date => p_effective_date,
212 p_base_table_name => 'ben_elig_job_prte_f',
213 p_base_key_column => 'elig_job_prte_id',
214 p_base_key_value => p_base_key_value,
215 p_parent_table_name1 => 'ben_eligy_prfl_f',
216 p_parent_key_column1 => 'eligy_prfl_id',
217 p_parent_key_value1 => l_parent_key_value1,
218 p_zap => p_zap,
219 p_delete => p_delete,
220 p_future_change => p_future_change,
221 p_delete_next_change => p_delete_next_change);
222 --
223 hr_utility.set_location(' Leaving:'||l_proc, 10);
224 End find_dt_del_modes;
225 --
226 -- ----------------------------------------------------------------------------
227 -- |--------------------------< find_dt_upd_modes >---------------------------|
228 -- ----------------------------------------------------------------------------
229 Procedure find_dt_upd_modes
230 (p_effective_date in date,
231 p_base_key_value in number,
232 p_correction out nocopy boolean,
233 p_update out nocopy boolean,
234 p_update_override out nocopy boolean,
235 p_update_change_insert out nocopy boolean) is
236 --
237 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
238 --
239 Begin
240 hr_utility.set_location('Entering:'||l_proc, 5);
241 --
242 -- Call the corresponding datetrack api
243 --
244 dt_api.find_dt_upd_modes
245 (p_effective_date => p_effective_date,
246 p_base_table_name => 'ben_elig_job_prte_f',
247 p_base_key_column => 'elig_job_prte_id',
248 p_base_key_value => p_base_key_value,
249 p_correction => p_correction,
250 p_update => p_update,
251 p_update_override => p_update_override,
252 p_update_change_insert => p_update_change_insert);
253 --
254 hr_utility.set_location(' Leaving:'||l_proc, 10);
255 End find_dt_upd_modes;
256 --
257 -- ----------------------------------------------------------------------------
258 -- |------------------------< upd_effective_end_date >------------------------|
259 -- ----------------------------------------------------------------------------
260 Procedure upd_effective_end_date
261 (p_effective_date in date,
262 p_base_key_value in number,
263 p_new_effective_end_date in date,
264 p_validation_start_date in date,
265 p_validation_end_date in date,
266 p_object_version_number out nocopy number) is
267 --
268 l_proc varchar2(72) := g_package||'upd_effective_end_date';
269 l_object_version_number number;
270 --
271 Begin
272 hr_utility.set_location('Entering:'||l_proc, 5);
273 --
274 -- Because we are updating a row we must get the next object
275 -- version number.
276 --
277 l_object_version_number :=
278 dt_api.get_object_version_number
279 (p_base_table_name => 'ben_elig_job_prte_f',
280 p_base_key_column => 'elig_job_prte_id',
281 p_base_key_value => p_base_key_value);
282 --
283 hr_utility.set_location(l_proc, 10);
284 g_api_dml := true; -- Set the api dml status
285 --
286 -- Update the specified datetrack row setting the effective
287 -- end date to the specified new effective end date.
288 --
289 update ben_elig_job_prte_f t
290 set t.effective_end_date = p_new_effective_end_date,
291 t.object_version_number = l_object_version_number
292 where t.elig_job_prte_id = p_base_key_value
293 and p_effective_date
294 between t.effective_start_date and t.effective_end_date;
295 --
296 g_api_dml := false; -- Unset the api dml status
297 p_object_version_number := l_object_version_number;
298 hr_utility.set_location(' Leaving:'||l_proc, 15);
299 --
300 Exception
301 When Others Then
302 g_api_dml := false; -- Unset the api dml status
303 Raise;
304 End upd_effective_end_date;
305 --
306 -- ----------------------------------------------------------------------------
307 -- |---------------------------------< lck >----------------------------------|
308 -- ----------------------------------------------------------------------------
309 Procedure lck
310 (p_effective_date in date,
311 p_datetrack_mode in varchar2,
312 p_elig_job_prte_id in number,
313 p_object_version_number in number,
314 p_validation_start_date out nocopy date,
315 p_validation_end_date out nocopy date) is
316 --
317 l_proc varchar2(72) := g_package||'lck';
318 l_validation_start_date date;
319 l_validation_end_date date;
320 l_object_invalid exception;
321 l_argument varchar2(30);
322 --
323 -- Cursor C_Sel1 selects the current locked row as of session date
324 -- ensuring that the object version numbers match.
325 --
326 Cursor C_Sel1 is
327 select
328 elig_job_prte_id,
329 effective_start_date,
330 effective_end_date,
331 ordr_num,
332 excld_flag,
333 job_id,
334 eligy_prfl_id,
335 business_group_id,
336 ejp_attribute_category,
337 ejp_attribute1,
338 ejp_attribute2,
339 ejp_attribute3,
340 ejp_attribute4,
341 ejp_attribute5,
342 ejp_attribute6,
343 ejp_attribute7,
344 ejp_attribute8,
345 ejp_attribute9,
346 ejp_attribute10,
347 ejp_attribute11,
348 ejp_attribute12,
349 ejp_attribute13,
350 ejp_attribute14,
351 ejp_attribute15,
352 ejp_attribute16,
353 ejp_attribute17,
354 ejp_attribute18,
355 ejp_attribute19,
356 ejp_attribute20,
357 ejp_attribute21,
358 ejp_attribute22,
359 ejp_attribute23,
360 ejp_attribute24,
361 ejp_attribute25,
362 ejp_attribute26,
363 ejp_attribute27,
364 ejp_attribute28,
365 ejp_attribute29,
366 ejp_attribute30,
367 object_version_number ,
368 criteria_score,
369 criteria_weight
370
371 from ben_elig_job_prte_f
372 where elig_job_prte_id = p_elig_job_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_job_prte_id',
394 p_argument_value => p_elig_job_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_job_prte_f',
431 p_base_key_column => 'elig_job_prte_id',
432 p_base_key_value => p_elig_job_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_enforce_foreign_locking => true,
437 p_validation_start_date => l_validation_start_date,
438 p_validation_end_date => l_validation_end_date);
439 Else
440 --
441 -- We are doing a datetrack 'INSERT' which is illegal within this
442 -- procedure therefore we must error (note: to lck on insert the
443 -- private procedure ins_lck should be called).
444 --
445 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
446 fnd_message.set_token('PROCEDURE', l_proc);
447 fnd_message.set_token('STEP','20');
448 fnd_message.raise_error;
449 End If;
450 --
451 -- Set the validation start and end date OUT arguments
452 --
453 p_validation_start_date := l_validation_start_date;
454 p_validation_end_date := l_validation_end_date;
455 --
456 hr_utility.set_location(' Leaving:'||l_proc, 30);
457 --
458 -- We need to trap the ORA LOCK exception
459 --
460 Exception
461 When HR_Api.Object_Locked then
462 --
463 -- The object is locked therefore we need to supply a meaningful
464 -- error message.
465 --
466 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
467 fnd_message.set_token('TABLE_NAME', 'ben_elig_job_prte_f');
468 fnd_message.raise_error;
469 When l_object_invalid then
470 --
471 -- The object doesn't exist or is invalid
472 --
473 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
474 fnd_message.set_token('TABLE_NAME', 'ben_elig_job_prte_f');
475 fnd_message.raise_error;
476 End lck;
477 --
478 -- ----------------------------------------------------------------------------
479 -- |-----------------------------< convert_args >-----------------------------|
480 -- ----------------------------------------------------------------------------
481 Function convert_args
482 (
483 p_elig_job_prte_id in number,
484 p_effective_start_date in date,
485 p_effective_end_date in date,
486 p_ordr_num in number,
487 p_excld_flag in varchar2,
488 p_job_id in number,
489 p_eligy_prfl_id in number,
490 p_business_group_id in number,
491 p_ejp_attribute_category in varchar2,
492 p_ejp_attribute1 in varchar2,
493 p_ejp_attribute2 in varchar2,
494 p_ejp_attribute3 in varchar2,
495 p_ejp_attribute4 in varchar2,
496 p_ejp_attribute5 in varchar2,
497 p_ejp_attribute6 in varchar2,
498 p_ejp_attribute7 in varchar2,
499 p_ejp_attribute8 in varchar2,
500 p_ejp_attribute9 in varchar2,
501 p_ejp_attribute10 in varchar2,
502 p_ejp_attribute11 in varchar2,
503 p_ejp_attribute12 in varchar2,
504 p_ejp_attribute13 in varchar2,
505 p_ejp_attribute14 in varchar2,
506 p_ejp_attribute15 in varchar2,
507 p_ejp_attribute16 in varchar2,
508 p_ejp_attribute17 in varchar2,
509 p_ejp_attribute18 in varchar2,
510 p_ejp_attribute19 in varchar2,
511 p_ejp_attribute20 in varchar2,
512 p_ejp_attribute21 in varchar2,
513 p_ejp_attribute22 in varchar2,
514 p_ejp_attribute23 in varchar2,
515 p_ejp_attribute24 in varchar2,
516 p_ejp_attribute25 in varchar2,
517 p_ejp_attribute26 in varchar2,
518 p_ejp_attribute27 in varchar2,
519 p_ejp_attribute28 in varchar2,
520 p_ejp_attribute29 in varchar2,
521 p_ejp_attribute30 in varchar2,
522 p_object_version_number in number,
523 p_criteria_score in number,
524 p_criteria_weight in number
525
526 )
527 Return g_rec_type is
528 --
529 l_rec g_rec_type;
530 l_proc varchar2(72) := g_package||'convert_args';
531 --
532 Begin
533 --
534 hr_utility.set_location('Entering:'||l_proc, 5);
535 --
536 -- Convert arguments into local l_rec structure.
537 --
538 l_rec.elig_job_prte_id := p_elig_job_prte_id;
539 l_rec.effective_start_date := p_effective_start_date;
540 l_rec.effective_end_date := p_effective_end_date;
541 l_rec.ordr_num := p_ordr_num;
542 l_rec.excld_flag := p_excld_flag;
543 l_rec.job_id := p_job_id;
544 l_rec.eligy_prfl_id := p_eligy_prfl_id;
545 l_rec.business_group_id := p_business_group_id;
546 l_rec.ejp_attribute_category := p_ejp_attribute_category;
547 l_rec.ejp_attribute1 := p_ejp_attribute1;
548 l_rec.ejp_attribute2 := p_ejp_attribute2;
549 l_rec.ejp_attribute3 := p_ejp_attribute3;
550 l_rec.ejp_attribute4 := p_ejp_attribute4;
551 l_rec.ejp_attribute5 := p_ejp_attribute5;
552 l_rec.ejp_attribute6 := p_ejp_attribute6;
553 l_rec.ejp_attribute7 := p_ejp_attribute7;
554 l_rec.ejp_attribute8 := p_ejp_attribute8;
555 l_rec.ejp_attribute9 := p_ejp_attribute9;
556 l_rec.ejp_attribute10 := p_ejp_attribute10;
557 l_rec.ejp_attribute11 := p_ejp_attribute11;
558 l_rec.ejp_attribute12 := p_ejp_attribute12;
559 l_rec.ejp_attribute13 := p_ejp_attribute13;
560 l_rec.ejp_attribute14 := p_ejp_attribute14;
561 l_rec.ejp_attribute15 := p_ejp_attribute15;
562 l_rec.ejp_attribute16 := p_ejp_attribute16;
563 l_rec.ejp_attribute17 := p_ejp_attribute17;
564 l_rec.ejp_attribute18 := p_ejp_attribute18;
565 l_rec.ejp_attribute19 := p_ejp_attribute19;
566 l_rec.ejp_attribute20 := p_ejp_attribute20;
567 l_rec.ejp_attribute21 := p_ejp_attribute21;
568 l_rec.ejp_attribute22 := p_ejp_attribute22;
569 l_rec.ejp_attribute23 := p_ejp_attribute23;
570 l_rec.ejp_attribute24 := p_ejp_attribute24;
571 l_rec.ejp_attribute25 := p_ejp_attribute25;
572 l_rec.ejp_attribute26 := p_ejp_attribute26;
573 l_rec.ejp_attribute27 := p_ejp_attribute27;
574 l_rec.ejp_attribute28 := p_ejp_attribute28;
575 l_rec.ejp_attribute29 := p_ejp_attribute29;
576 l_rec.ejp_attribute30 := p_ejp_attribute30;
577 l_rec.object_version_number := p_object_version_number;
578 l_rec.criteria_score := p_criteria_score;
579 l_rec.criteria_weight := p_criteria_weight;
580
581 --
582 -- Return the plsql record structure.
583 --
584 hr_utility.set_location(' Leaving:'||l_proc, 10);
585 Return(l_rec);
586 --
587 End convert_args;
588 --
589 end ben_ejp_shd;