DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EAC_SHD

Source


5 -- |                     Private Global Definitions                           |
1 Package Body ben_eac_shd as
2 /* $Header: beeacrhi.pkb 115.8 2002/12/09 12:51:17 lakrish ship $ */
3 --
4 -- ----------------------------------------------------------------------------
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_eac_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 --
34   hr_utility.set_location('Entering:'||l_proc, 5);
31   l_proc 	varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
35   --
36   If (p_constraint_name = 'BEN_ELIG_AGE_CVG_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_AGE_CVG_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_AGE_CVG_PK') Then
47     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
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_age_cvg_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_age_cvg_id,
76 	effective_start_date,
77 	effective_end_date,
78 	business_group_id,
79 	dpnt_cvg_eligy_prfl_id,
80 	age_fctr_id,
81 	cvg_strt_cd,
82 	cvg_strt_rl,
83 	cvg_thru_cd,
84 	cvg_thru_rl,
85         excld_flag,
86 	eac_attribute_category,
87 	eac_attribute1,
88 	eac_attribute2,
89 	eac_attribute3,
90 	eac_attribute4,
91 	eac_attribute5,
92 	eac_attribute6,
93 	eac_attribute7,
94 	eac_attribute8,
95 	eac_attribute9,
96 	eac_attribute10,
97 	eac_attribute11,
98 	eac_attribute12,
99 	eac_attribute13,
100 	eac_attribute14,
101 	eac_attribute15,
102 	eac_attribute16,
103 	eac_attribute17,
104 	eac_attribute18,
105 	eac_attribute19,
106 	eac_attribute20,
107 	eac_attribute21,
108 	eac_attribute22,
109 	eac_attribute23,
110 	eac_attribute24,
111 	eac_attribute25,
112 	eac_attribute26,
113 	eac_attribute27,
114 	eac_attribute28,
115 	eac_attribute29,
116 	eac_attribute30,
117 	object_version_number
118     from	ben_elig_age_cvg_f
119     where	elig_age_cvg_id = p_elig_age_cvg_id
120     and		p_effective_date
121     between	effective_start_date and effective_end_date;
122 --
123   l_proc	varchar2(72)	:= g_package||'api_updating';
124   l_fct_ret	boolean;
125 --
126 Begin
127   hr_utility.set_location('Entering:'||l_proc, 5);
128   --
129   If (p_effective_date is null or
130       p_elig_age_cvg_id is null or
131       p_object_version_number is null) Then
132     --
133     -- One of the primary key arguments is null therefore we must
134     -- set the returning function value to false
135     --
136     l_fct_ret := false;
137   Else
138     If (p_elig_age_cvg_id = g_old_rec.elig_age_cvg_id and
139         p_object_version_number = g_old_rec.object_version_number) Then
140       hr_utility.set_location(l_proc, 10);
141       --
142       -- The g_old_rec is current therefore we must
143       -- set the returning function to true
144       --
145       l_fct_ret := true;
146     Else
147       --
148       -- Select the current row
149       --
150       Open C_Sel1;
151       Fetch C_Sel1 Into g_old_rec;
152       If C_Sel1%notfound Then
153         Close C_Sel1;
154         --
155         -- The primary key is invalid therefore we must error
156         --
157         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
158         fnd_message.raise_error;
159       End If;
160       Close C_Sel1;
161       If (p_object_version_number <> g_old_rec.object_version_number) Then
162         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
163         fnd_message.raise_error;
164       End If;
165       hr_utility.set_location(l_proc, 15);
166       l_fct_ret := true;
167     End If;
168   End If;
169   hr_utility.set_location(' Leaving:'||l_proc, 20);
170   Return (l_fct_ret);
171 --
172 End api_updating;
173 --
174 -- ----------------------------------------------------------------------------
175 -- |--------------------------< find_dt_del_modes >---------------------------|
176 -- ----------------------------------------------------------------------------
177 Procedure find_dt_del_modes
178 	(p_effective_date	in  date,
179 	 p_base_key_value	in  number,
180 	 p_zap		 out nocopy boolean,
181 	 p_delete	 out nocopy boolean,
182 	 p_future_change out nocopy boolean,
183 	 p_delete_next_change out nocopy boolean) is
184 --
188   --
185   l_proc 		varchar2(72) 	:= g_package||'find_dt_del_modes';
186 --
187   l_parent_key_value1	number;
189   Cursor C_Sel1 Is
190     select  t.dpnt_cvg_eligy_prfl_id
191     from    ben_elig_age_cvg_f t
192     where   t.elig_age_cvg_id = p_base_key_value
193     and     p_effective_date
194     between t.effective_start_date and t.effective_end_date;
195 --
196 Begin
197   hr_utility.set_location('Entering:'||l_proc, 5);
198   Open  C_Sel1;
199   Fetch C_Sel1 Into l_parent_key_value1;
200   If C_Sel1%notfound then
201     Close C_Sel1;
202     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
203     fnd_message.set_token('PROCEDURE', l_proc);
204     fnd_message.set_token('STEP','10');
205     fnd_message.raise_error;
206   End If;
207   Close C_Sel1;
208   --
209   -- Call the corresponding datetrack api
210   --
211   dt_api.find_dt_del_modes
212 	(p_effective_date	=> p_effective_date,
213 	 p_base_table_name	=> 'ben_elig_age_cvg_f',
214 	 p_base_key_column	=> 'elig_age_cvg_id',
215 	 p_base_key_value	=> p_base_key_value,
216 	 p_parent_table_name1	=> 'ben_dpnt_cvg_eligy_prfl_f',
217 	 p_parent_key_column1	=> 'dpnt_cvg_eligy_prfl_id',
218 	 p_parent_key_value1	=> l_parent_key_value1,
219 	 p_zap			=> p_zap,
220 	 p_delete		=> p_delete,
221 	 p_future_change	=> p_future_change,
222 	 p_delete_next_change	=> p_delete_next_change);
223   --
224   hr_utility.set_location(' Leaving:'||l_proc, 10);
225 End find_dt_del_modes;
226 --
227 -- ----------------------------------------------------------------------------
228 -- |--------------------------< find_dt_upd_modes >---------------------------|
229 -- ----------------------------------------------------------------------------
230 Procedure find_dt_upd_modes
231 	(p_effective_date	in  date,
232 	 p_base_key_value	in  number,
233 	 p_correction	 out nocopy boolean,
234 	 p_update	 out nocopy boolean,
235 	 p_update_override out nocopy boolean,
236 	 p_update_change_insert out nocopy boolean) is
237 --
238   l_proc 	varchar2(72) := g_package||'find_dt_upd_modes';
239 --
240 Begin
241   hr_utility.set_location('Entering:'||l_proc, 5);
242   --
243   -- Call the corresponding datetrack api
244   --
245   dt_api.find_dt_upd_modes
246 	(p_effective_date	=> p_effective_date,
247 	 p_base_table_name	=> 'ben_elig_age_cvg_f',
248 	 p_base_key_column	=> 'elig_age_cvg_id',
249 	 p_base_key_value	=> p_base_key_value,
250 	 p_correction		=> p_correction,
251 	 p_update		=> p_update,
252 	 p_update_override	=> p_update_override,
253 	 p_update_change_insert	=> p_update_change_insert);
254   --
255   hr_utility.set_location(' Leaving:'||l_proc, 10);
256 End find_dt_upd_modes;
257 --
258 -- ----------------------------------------------------------------------------
259 -- |------------------------< upd_effective_end_date >------------------------|
260 -- ----------------------------------------------------------------------------
261 Procedure upd_effective_end_date
262 	(p_effective_date		in date,
263 	 p_base_key_value		in number,
264 	 p_new_effective_end_date	in date,
265 	 p_validation_start_date	in date,
266 	 p_validation_end_date		in date,
267          p_object_version_number       out nocopy number) is
268 --
269   l_proc 		  varchar2(72) := g_package||'upd_effective_end_date';
270   l_object_version_number number;
271 --
272 Begin
273   hr_utility.set_location('Entering:'||l_proc, 5);
274   --
275   -- Because we are updating a row we must get the next object
276   -- version number.
277   --
278   l_object_version_number :=
279     dt_api.get_object_version_number
280 	(p_base_table_name	=> 'ben_elig_age_cvg_f',
281 	 p_base_key_column	=> 'elig_age_cvg_id',
282 	 p_base_key_value	=> p_base_key_value);
283   --
284   hr_utility.set_location(l_proc, 10);
285   g_api_dml := true;  -- Set the api dml status
289   --
286   --
287   -- Update the specified datetrack row setting the effective
288   -- end date to the specified new effective end date.
290   update  ben_elig_age_cvg_f t
291   set	  t.effective_end_date	  = p_new_effective_end_date,
292 	  t.object_version_number = l_object_version_number
293   where	  t.elig_age_cvg_id	  = p_base_key_value
294   and	  p_effective_date
295   between t.effective_start_date and t.effective_end_date;
296   --
297   g_api_dml := false;   -- Unset the api dml status
298   p_object_version_number := l_object_version_number;
299   hr_utility.set_location(' Leaving:'||l_proc, 15);
300 --
301 Exception
302   When Others Then
303     g_api_dml := false;   -- Unset the api dml status
304     Raise;
305 End upd_effective_end_date;
306 --
307 -- ----------------------------------------------------------------------------
308 -- |---------------------------------< lck >----------------------------------|
309 -- ----------------------------------------------------------------------------
310 Procedure lck
311 	(p_effective_date	 in  date,
312 	 p_datetrack_mode	 in  varchar2,
313 	 p_elig_age_cvg_id	 in  number,
314 	 p_object_version_number in  number,
315 	 p_validation_start_date out nocopy date,
316 	 p_validation_end_date	 out nocopy date) is
317 --
318   l_proc		  varchar2(72) := g_package||'lck';
319   l_validation_start_date date;
320   l_validation_end_date	  date;
321   l_object_invalid 	  exception;
322   l_argument		  varchar2(30);
323   --
324   -- Cursor C_Sel1 selects the current locked row as of session date
325   -- ensuring that the object version numbers match.
326   --
327   Cursor C_Sel1 is
328     select
329 	elig_age_cvg_id,
330 	effective_start_date,
331 	effective_end_date,
332 	business_group_id,
333 	dpnt_cvg_eligy_prfl_id,
334 	age_fctr_id,
335 	cvg_strt_cd,
336 	cvg_strt_rl,
337 	cvg_thru_cd,
338 	cvg_thru_rl,
339         excld_flag,
340 	eac_attribute_category,
341 	eac_attribute1,
342 	eac_attribute2,
343 	eac_attribute3,
344 	eac_attribute4,
345 	eac_attribute5,
346 	eac_attribute6,
347 	eac_attribute7,
348 	eac_attribute8,
349 	eac_attribute9,
350 	eac_attribute10,
351 	eac_attribute11,
352 	eac_attribute12,
353 	eac_attribute13,
354 	eac_attribute14,
355 	eac_attribute15,
356 	eac_attribute16,
357 	eac_attribute17,
358 	eac_attribute18,
359 	eac_attribute19,
360 	eac_attribute20,
361 	eac_attribute21,
362 	eac_attribute22,
363 	eac_attribute23,
364 	eac_attribute24,
365 	eac_attribute25,
366 	eac_attribute26,
367 	eac_attribute27,
368 	eac_attribute28,
369 	eac_attribute29,
370 	eac_attribute30,
371 	object_version_number
375     between effective_start_date and effective_end_date
372     from    ben_elig_age_cvg_f
373     where   elig_age_cvg_id         = p_elig_age_cvg_id
374     and	    p_effective_date
376     for update nowait;
377   --
378   --
379   --
380 Begin
381   hr_utility.set_location('Entering:'||l_proc, 5);
382   --
383   -- Ensure that all the mandatory arguments are not null
384   --
385   hr_api.mandatory_arg_error(p_api_name       => l_proc,
386                              p_argument       => 'effective_date',
387                              p_argument_value => p_effective_date);
388   --
389   hr_api.mandatory_arg_error(p_api_name       => l_proc,
390                              p_argument       => 'datetrack_mode',
391                              p_argument_value => p_datetrack_mode);
392   --
393   hr_api.mandatory_arg_error(p_api_name       => l_proc,
394                              p_argument       => 'elig_age_cvg_id',
395                              p_argument_value => p_elig_age_cvg_id);
396   --
397   hr_api.mandatory_arg_error(p_api_name       => l_proc,
398                              p_argument       => 'object_version_number',
399                              p_argument_value => p_object_version_number);
400   --
401   -- Check to ensure the datetrack mode is not INSERT.
402   --
403   If (p_datetrack_mode <> 'INSERT') then
404     --
405     -- We must select and lock the current row.
406     --
407     Open  C_Sel1;
408     Fetch C_Sel1 Into g_old_rec;
409     If C_Sel1%notfound then
410       Close C_Sel1;
411       --
412       -- The primary key is invalid therefore we must error
413       --
414       fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
415       fnd_message.raise_error;
416     End If;
420         fnd_message.raise_error;
417     Close C_Sel1;
418     If (p_object_version_number <> g_old_rec.object_version_number) Then
419         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
421       End If;
422     hr_utility.set_location(l_proc, 15);
423     --
424     --
425     -- Validate the datetrack mode mode getting the validation start
426     -- and end dates for the specified datetrack operation.
427     --
428     dt_api.validate_dt_mode
429 	(p_effective_date	   => p_effective_date,
430 	 p_datetrack_mode	   => p_datetrack_mode,
431 	 p_base_table_name	   => 'ben_elig_age_cvg_f',
432 	 p_base_key_column	   => 'elig_age_cvg_id',
433 	 p_base_key_value 	   => p_elig_age_cvg_id,
434 	 p_parent_table_name1      => 'ben_dpnt_cvg_eligy_prfl_f',
435 	 p_parent_key_column1      => 'dpnt_cvg_eligy_prfl_id',
436 	 p_parent_key_value1       => g_old_rec.dpnt_cvg_eligy_prfl_id,
437          p_enforce_foreign_locking => true,
438 	 p_validation_start_date   => l_validation_start_date,
439  	 p_validation_end_date	   => l_validation_end_date);
440   Else
441     --
442     -- We are doing a datetrack 'INSERT' which is illegal within this
443     -- procedure therefore we must error (note: to lck on insert the
444     -- private procedure ins_lck should be called).
445     --
446     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
447     fnd_message.set_token('PROCEDURE', l_proc);
448     fnd_message.set_token('STEP','20');
449     fnd_message.raise_error;
450   End If;
451   --
452   -- Set the validation start and end date OUT arguments
453   --
454   p_validation_start_date := l_validation_start_date;
455   p_validation_end_date   := l_validation_end_date;
456   --
457   hr_utility.set_location(' Leaving:'||l_proc, 30);
458 --
459 -- We need to trap the ORA LOCK exception
460 --
461 Exception
462   When HR_Api.Object_Locked then
463     --
464     -- The object is locked therefore we need to supply a meaningful
465     -- error message.
466     --
467     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
468     fnd_message.set_token('TABLE_NAME', 'ben_elig_age_cvg_f');
469     fnd_message.raise_error;
470   When l_object_invalid then
471     --
472     -- The object doesn't exist or is invalid
473     --
474     fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
475     fnd_message.set_token('TABLE_NAME', 'ben_elig_age_cvg_f');
476     fnd_message.raise_error;
477 End lck;
478 --
479 -- ----------------------------------------------------------------------------
480 -- |-----------------------------< convert_args >-----------------------------|
481 -- ----------------------------------------------------------------------------
482 Function convert_args
483 	(
484 	p_elig_age_cvg_id               in number,
485 	p_effective_start_date          in date,
486 	p_effective_end_date            in date,
487 	p_business_group_id             in number,
488 	p_dpnt_cvg_eligy_prfl_id        in number,
489 	p_age_fctr_id                   in number,
490 	p_cvg_strt_cd                   in varchar2,
491 	p_cvg_strt_rl                   in number,
492 	p_cvg_thru_cd                   in varchar2,
493 	p_cvg_thru_rl                   in number,
494         p_excld_flag                    in varchar2,
495 	p_eac_attribute_category        in varchar2,
496 	p_eac_attribute1                in varchar2,
497 	p_eac_attribute2                in varchar2,
498 	p_eac_attribute3                in varchar2,
499 	p_eac_attribute4                in varchar2,
500 	p_eac_attribute5                in varchar2,
501 	p_eac_attribute6                in varchar2,
502 	p_eac_attribute7                in varchar2,
503 	p_eac_attribute8                in varchar2,
504 	p_eac_attribute9                in varchar2,
505 	p_eac_attribute10               in varchar2,
506 	p_eac_attribute11               in varchar2,
507 	p_eac_attribute12               in varchar2,
508 	p_eac_attribute13               in varchar2,
509 	p_eac_attribute14               in varchar2,
510 	p_eac_attribute15               in varchar2,
511 	p_eac_attribute16               in varchar2,
512 	p_eac_attribute17               in varchar2,
513 	p_eac_attribute18               in varchar2,
514 	p_eac_attribute19               in varchar2,
515 	p_eac_attribute20               in varchar2,
516 	p_eac_attribute21               in varchar2,
517 	p_eac_attribute22               in varchar2,
518 	p_eac_attribute23               in varchar2,
519 	p_eac_attribute24               in varchar2,
520 	p_eac_attribute25               in varchar2,
521 	p_eac_attribute26               in varchar2,
522 	p_eac_attribute27               in varchar2,
523 	p_eac_attribute28               in varchar2,
524 	p_eac_attribute29               in varchar2,
525 	p_eac_attribute30               in varchar2,
526 	p_object_version_number         in number
527 	)
528 	Return g_rec_type is
529 --
530   l_rec	  g_rec_type;
534   --
531   l_proc  varchar2(72) := g_package||'convert_args';
532 --
533 Begin
535   hr_utility.set_location('Entering:'||l_proc, 5);
536   --
537   -- Convert arguments into local l_rec structure.
538   --
539   l_rec.elig_age_cvg_id                  := p_elig_age_cvg_id;
540   l_rec.effective_start_date             := p_effective_start_date;
541   l_rec.effective_end_date               := p_effective_end_date;
542   l_rec.business_group_id                := p_business_group_id;
543   l_rec.dpnt_cvg_eligy_prfl_id           := p_dpnt_cvg_eligy_prfl_id;
544   l_rec.age_fctr_id                      := p_age_fctr_id;
545   l_rec.cvg_strt_cd                      := p_cvg_strt_cd;
546   l_rec.cvg_strt_rl                      := p_cvg_strt_rl;
547   l_rec.cvg_thru_cd                      := p_cvg_thru_cd;
548   l_rec.cvg_thru_rl                      := p_cvg_thru_rl;
549   l_rec.excld_flag                       := p_excld_flag;
550   l_rec.eac_attribute_category           := p_eac_attribute_category;
551   l_rec.eac_attribute1                   := p_eac_attribute1;
552   l_rec.eac_attribute2                   := p_eac_attribute2;
553   l_rec.eac_attribute3                   := p_eac_attribute3;
554   l_rec.eac_attribute4                   := p_eac_attribute4;
555   l_rec.eac_attribute5                   := p_eac_attribute5;
556   l_rec.eac_attribute6                   := p_eac_attribute6;
557   l_rec.eac_attribute7                   := p_eac_attribute7;
558   l_rec.eac_attribute8                   := p_eac_attribute8;
559   l_rec.eac_attribute9                   := p_eac_attribute9;
560   l_rec.eac_attribute10                  := p_eac_attribute10;
561   l_rec.eac_attribute11                  := p_eac_attribute11;
562   l_rec.eac_attribute12                  := p_eac_attribute12;
563   l_rec.eac_attribute13                  := p_eac_attribute13;
564   l_rec.eac_attribute14                  := p_eac_attribute14;
565   l_rec.eac_attribute15                  := p_eac_attribute15;
566   l_rec.eac_attribute16                  := p_eac_attribute16;
567   l_rec.eac_attribute17                  := p_eac_attribute17;
568   l_rec.eac_attribute18                  := p_eac_attribute18;
569   l_rec.eac_attribute19                  := p_eac_attribute19;
570   l_rec.eac_attribute20                  := p_eac_attribute20;
571   l_rec.eac_attribute21                  := p_eac_attribute21;
572   l_rec.eac_attribute22                  := p_eac_attribute22;
573   l_rec.eac_attribute23                  := p_eac_attribute23;
574   l_rec.eac_attribute24                  := p_eac_attribute24;
575   l_rec.eac_attribute25                  := p_eac_attribute25;
576   l_rec.eac_attribute26                  := p_eac_attribute26;
577   l_rec.eac_attribute27                  := p_eac_attribute27;
578   l_rec.eac_attribute28                  := p_eac_attribute28;
579   l_rec.eac_attribute29                  := p_eac_attribute29;
580   l_rec.eac_attribute30                  := p_eac_attribute30;
584   --
581   l_rec.object_version_number            := p_object_version_number;
582   --
583   -- Return the plsql record structure.
585   hr_utility.set_location(' Leaving:'||l_proc, 10);
586   Return(l_rec);
587 --
588 End convert_args;
589 --
590 end ben_eac_shd;