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