DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ENB_SHD

Source


1 Package Body ben_enb_shd as
2 /* $Header: beenbrhi.pkb 115.15 2002/12/16 07:02:08 rpgupta ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_enb_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_ENRT_BNFT_PK') Then
37     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38     hr_utility.set_message_token('PROCEDURE', l_proc);
39     hr_utility.set_message_token('STEP','5');
40     hr_utility.raise_error;
41   ElsIf (p_constraint_name = 'DFLT_FLAG_FLG') Then
42     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('STEP','15');
45     hr_utility.raise_error;
46   ElsIf (p_constraint_name = 'VAL_HAS_BN_FLAG_FLG1') Then
47     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
48     hr_utility.set_message_token('PROCEDURE', l_proc);
49     hr_utility.set_message_token('STEP','20');
50     hr_utility.raise_error;
51   Else
52     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
53     hr_utility.set_message_token('PROCEDURE', l_proc);
54     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
55     hr_utility.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   (
66   p_enrt_bnft_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 		 enrt_bnft_id
76 		,dflt_flag
77 		,val_has_bn_prortd_flag
78 		,bndry_perd_cd
79 		,val
80 		,nnmntry_uom
81 		,bnft_typ_cd
82 		,entr_val_at_enrt_flag
83 		,mn_val
84 		,mx_val
85 		,incrmt_val
86                 ,dflt_val
87 		,rt_typ_cd
88 		,cvg_mlt_cd
89 		,ctfn_rqd_flag
90 		,ordr_num
91 		,crntly_enrld_flag
92 		,elig_per_elctbl_chc_id
93 		,prtt_enrt_rslt_id
94 		,comp_lvl_fctr_id
95 		,business_group_id
96 		,enb_attribute_category
97 		,enb_attribute1
98 		,enb_attribute2
99 		,enb_attribute3
100 		,enb_attribute4
101 		,enb_attribute5
102 		,enb_attribute6
103 		,enb_attribute7
104 		,enb_attribute8
105 		,enb_attribute9
106 		,enb_attribute10
107 		,enb_attribute11
108 		,enb_attribute12
109 		,enb_attribute13
110 		,enb_attribute14
111 		,enb_attribute15
112 		,enb_attribute16
113 		,enb_attribute17
114 		,enb_attribute18
115 		,enb_attribute19
116 		,enb_attribute20
117 		,enb_attribute21
118 		,enb_attribute22
119 		,enb_attribute23
120 		,enb_attribute24
121 		,enb_attribute25
122 		,enb_attribute26
123 		,enb_attribute27
124 		,enb_attribute28
125 		,enb_attribute29
126         ,enb_attribute30
127         ,request_id
128         ,program_application_id
129         ,program_id
130         ,mx_wout_ctfn_val
131         ,mx_wo_ctfn_flag
132         ,program_update_date
133         ,object_version_number
134     from	ben_enrt_bnft
135     where	enrt_bnft_id = p_enrt_bnft_id;
136 
137 --
138   l_proc	varchar2(72)	:= g_package||'api_updating';
139   l_fct_ret	boolean;
140 --
141 Begin
142   hr_utility.set_location('Entering:'||l_proc, 5);
143   --
144   If (
145 	p_enrt_bnft_id is null and
146 	p_object_version_number is null
147      ) Then
148     --
149     -- One of the primary key arguments is null therefore we must
150     -- set the returning function value to false
151     --
152     l_fct_ret := false;
153   Else
154     If (
155 	p_enrt_bnft_id = g_old_rec.enrt_bnft_id and
156 	p_object_version_number = g_old_rec.object_version_number
157        ) Then
158       hr_utility.set_location(l_proc, 10);
159       --
160       -- The g_old_rec is current therefore we must
161       -- set the returning function to true
162       --
163       l_fct_ret := true;
164     Else
165       --
166       -- Select the current row into g_old_rec
167       --
168       Open C_Sel1;
169       Fetch C_Sel1 Into g_old_rec;
170       If C_Sel1%notfound Then
171         Close C_Sel1;
172         --
173         -- The primary key is invalid therefore we must error
174         --
175         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
176         hr_utility.raise_error;
177       End If;
178       Close C_Sel1;
179       If (p_object_version_number <> g_old_rec.object_version_number) Then
180         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
181         hr_utility.raise_error;
182       End If;
183       hr_utility.set_location(l_proc, 15);
184       l_fct_ret := true;
185     End If;
186   End If;
187   hr_utility.set_location(' Leaving:'||l_proc, 20);
188   Return (l_fct_ret);
189 --
190 End api_updating;
191 --
192 -- ----------------------------------------------------------------------------
193 -- |---------------------------------< lck >----------------------------------|
194 -- ----------------------------------------------------------------------------
195 Procedure lck
196   (
197   p_enrt_bnft_id                       in number,
198   p_object_version_number              in number
199   ) is
200 --
201 -- Cursor selects the 'current' row from the HR Schema
202 --
203   Cursor C_Sel1 is
204     select
205 		 enrt_bnft_id
206 		,dflt_flag
207 		,val_has_bn_prortd_flag
208 		,bndry_perd_cd
209 		,val
210 		,nnmntry_uom
211 		,bnft_typ_cd
212 		,entr_val_at_enrt_flag
213 		,mn_val
214 		,mx_val
215 		,incrmt_val
216                 ,dflt_val
217 		,rt_typ_cd
218 		,cvg_mlt_cd
219 		,ctfn_rqd_flag
220 		,ordr_num
221 		,crntly_enrld_flag
222 		,elig_per_elctbl_chc_id
223 		,prtt_enrt_rslt_id
224 		,comp_lvl_fctr_id
225 		,business_group_id
226 		,enb_attribute_category
227 		,enb_attribute1
228 		,enb_attribute2
229 		,enb_attribute3
230 		,enb_attribute4
231 		,enb_attribute5
232 		,enb_attribute6
233 		,enb_attribute7
234 		,enb_attribute8
235 		,enb_attribute9
236 		,enb_attribute10
237 		,enb_attribute11
238 		,enb_attribute12
239 		,enb_attribute13
240 		,enb_attribute14
241 		,enb_attribute15
242 		,enb_attribute16
243 		,enb_attribute17
244 		,enb_attribute18
245 		,enb_attribute19
246 		,enb_attribute20
247 		,enb_attribute21
248 		,enb_attribute22
249 		,enb_attribute23
250 		,enb_attribute24
251 		,enb_attribute25
252 		,enb_attribute26
253 		,enb_attribute27
254 		,enb_attribute28
255 		,enb_attribute29
256         ,enb_attribute30
257         ,request_id
258         ,program_application_id
259         ,program_id
260         ,mx_wout_ctfn_val
261         ,mx_wo_ctfn_flag
262         ,program_update_date
263         ,object_version_number
264     from	ben_enrt_bnft
265     where	enrt_bnft_id = p_enrt_bnft_id
266     for	update nowait;
267 --
268   l_proc	varchar2(72) := g_package||'lck';
269 --
270 Begin
271   hr_utility.set_location('Entering:'||l_proc, 5);
272   --
273   -- Add any mandatory argument checking here:
274   -- Example:
275   -- hr_api.mandatory_arg_error
276   --   (p_api_name       => l_proc,
277   --    p_argument       => 'object_version_number',
278   --    p_argument_value => p_object_version_number);
279   --
280   Open  C_Sel1;
281   Fetch C_Sel1 Into g_old_rec;
282   If C_Sel1%notfound then
283     Close C_Sel1;
284     --
285     -- The primary key is invalid therefore we must error
286     --
287     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
288     hr_utility.raise_error;
289   End If;
290   Close C_Sel1;
291   If (p_object_version_number <> g_old_rec.object_version_number) Then
292         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
293         hr_utility.raise_error;
294       End If;
295 --
296   hr_utility.set_location(' Leaving:'||l_proc, 10);
297 --
298 -- We need to trap the ORA LOCK exception
299 --
300 Exception
301   When HR_Api.Object_Locked then
302     --
303     -- The object is locked therefore we need to supply a meaningful
304     -- error message.
305     --
306     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
307     hr_utility.set_message_token('TABLE_NAME', 'ben_enrt_bnft');
308     hr_utility.raise_error;
309 End lck;
310 --
311 -- ----------------------------------------------------------------------------
312 -- |-----------------------------< convert_args >-----------------------------|
313 -- ----------------------------------------------------------------------------
314 Function convert_args
315  (
316    p_enrt_bnft_id                   in  number
317   ,p_dflt_flag                      in  varchar2
318   ,p_val_has_bn_prortd_flag         in  varchar2
319   ,p_bndry_perd_cd                  in  varchar2
320   ,p_val                            in  number
321   ,p_nnmntry_uom                    in  varchar2
322   ,p_bnft_typ_cd                    in  varchar2
323   ,p_entr_val_at_enrt_flag          in  varchar2
324   ,p_mn_val                         in  number
325   ,p_mx_val                         in  number
326   ,p_incrmt_val                     in  number
327   ,p_dflt_val                       in  number
328   ,p_rt_typ_cd                      in  varchar2
329   ,p_cvg_mlt_cd                     in  varchar2
330   ,p_ctfn_rqd_flag                  in  varchar2
331   ,p_ordr_num                       in  number
332   ,p_crntly_enrld_flag              in  varchar2
333   ,p_elig_per_elctbl_chc_id         in  number
334   ,p_prtt_enrt_rslt_id              in  number
335   ,p_comp_lvl_fctr_id               in  number
336   ,p_business_group_id              in  number
337   ,p_enb_attribute_category         in  varchar2
338   ,p_enb_attribute1                 in  varchar2
339   ,p_enb_attribute2                 in  varchar2
340   ,p_enb_attribute3                 in  varchar2
341   ,p_enb_attribute4                 in  varchar2
342   ,p_enb_attribute5                 in  varchar2
343   ,p_enb_attribute6                 in  varchar2
344   ,p_enb_attribute7                 in  varchar2
345   ,p_enb_attribute8                 in  varchar2
346   ,p_enb_attribute9                 in  varchar2
347   ,p_enb_attribute10                in  varchar2
348   ,p_enb_attribute11                in  varchar2
349   ,p_enb_attribute12                in  varchar2
350   ,p_enb_attribute13                in  varchar2
351   ,p_enb_attribute14                in  varchar2
352   ,p_enb_attribute15                in  varchar2
353   ,p_enb_attribute16                in  varchar2
354   ,p_enb_attribute17                in  varchar2
355   ,p_enb_attribute18                in  varchar2
356   ,p_enb_attribute19                in  varchar2
357   ,p_enb_attribute20                in  varchar2
358   ,p_enb_attribute21                in  varchar2
359   ,p_enb_attribute22                in  varchar2
360   ,p_enb_attribute23                in  varchar2
361   ,p_enb_attribute24                in  varchar2
362   ,p_enb_attribute25                in  varchar2
363   ,p_enb_attribute26                in  varchar2
364   ,p_enb_attribute27                in  varchar2
365   ,p_enb_attribute28                in  varchar2
366   ,p_enb_attribute29                in  varchar2
367   ,p_enb_attribute30                in  varchar2
368   ,p_request_id                     in  number
369   ,p_program_application_id         in  number
370   ,p_program_id                     in  number
371   ,p_mx_wout_ctfn_val               in  number
372   ,p_mx_wo_ctfn_flag                in  varchar2
373   ,p_program_update_date            in  date
374   ,p_object_version_number          in  number
375  )
376 	Return g_rec_type is
377 --
378   l_rec	  g_rec_type;
379   l_proc  varchar2(72) := g_package||'convert_args';
380 --
381 Begin
382   --
383   hr_utility.set_location('Entering:'||l_proc, 5);
384   --
385   -- Convert arguments into local l_rec structure.
386   --
387   l_rec.enrt_bnft_id                    := p_enrt_bnft_id          ;
388   l_rec.dflt_flag                       := p_dflt_flag             ;
389   l_rec.val_has_bn_prortd_flag          := p_val_has_bn_prortd_flag;
390   l_rec.bndry_perd_cd                   := p_bndry_perd_cd         ;
391   l_rec.val                             := p_val                   ;
392   l_rec.nnmntry_uom                     := p_nnmntry_uom           ;
393   l_rec.bnft_typ_cd                     := p_bnft_typ_cd           ;
394   l_rec.entr_val_at_enrt_flag           := p_entr_val_at_enrt_flag ;
395   l_rec.mn_val                          := p_mn_val                ;
396   l_rec.mx_val                          := p_mx_val                ;
397   l_rec.incrmt_val                      := p_incrmt_val            ;
398   l_rec.dflt_val                        := p_dflt_val              ;
399   l_rec.rt_typ_cd                       := p_rt_typ_cd             ;
400   l_rec.cvg_mlt_cd                      := p_cvg_mlt_cd            ;
401   l_rec.ctfn_rqd_flag                   := p_ctfn_rqd_flag         ;
402   l_rec.ordr_num                        := p_ordr_num              ;
403   l_rec.crntly_enrld_flag               := p_crntly_enrld_flag     ;
404   l_rec.elig_per_elctbl_chc_id          := p_elig_per_elctbl_chc_id;
405   l_rec.prtt_enrt_rslt_id               := p_prtt_enrt_rslt_id     ;
406   l_rec.comp_lvl_fctr_id                := p_comp_lvl_fctr_id      ;
407   l_rec.business_group_id               := p_business_group_id     ;
408   l_rec.enb_attribute_category          := p_enb_attribute_category;
409   l_rec.enb_attribute1                  := p_enb_attribute1        ;
410   l_rec.enb_attribute2                  := p_enb_attribute2        ;
411   l_rec.enb_attribute3                  := p_enb_attribute3        ;
412   l_rec.enb_attribute4                  := p_enb_attribute4        ;
413   l_rec.enb_attribute5                  := p_enb_attribute5        ;
414   l_rec.enb_attribute6                  := p_enb_attribute6        ;
415   l_rec.enb_attribute7                  := p_enb_attribute7        ;
416   l_rec.enb_attribute8                  := p_enb_attribute8        ;
417   l_rec.enb_attribute9                  := p_enb_attribute9        ;
418   l_rec.enb_attribute10                 := p_enb_attribute10       ;
419   l_rec.enb_attribute11                 := p_enb_attribute11       ;
420   l_rec.enb_attribute12                 := p_enb_attribute12       ;
421   l_rec.enb_attribute13                 := p_enb_attribute13       ;
422   l_rec.enb_attribute14                 := p_enb_attribute14       ;
423   l_rec.enb_attribute15                 := p_enb_attribute15       ;
424   l_rec.enb_attribute16                 := p_enb_attribute16       ;
425   l_rec.enb_attribute17                 := p_enb_attribute17       ;
426   l_rec.enb_attribute18                 := p_enb_attribute18       ;
427   l_rec.enb_attribute19                 := p_enb_attribute19       ;
428   l_rec.enb_attribute20                 := p_enb_attribute20       ;
429   l_rec.enb_attribute21                 := p_enb_attribute21       ;
430   l_rec.enb_attribute22                 := p_enb_attribute22       ;
431   l_rec.enb_attribute23                 := p_enb_attribute23       ;
432   l_rec.enb_attribute24                 := p_enb_attribute24       ;
433   l_rec.enb_attribute25                 := p_enb_attribute25       ;
434   l_rec.enb_attribute26                 := p_enb_attribute26       ;
435   l_rec.enb_attribute27                 := p_enb_attribute27       ;
436   l_rec.enb_attribute28                 := p_enb_attribute28       ;
437   l_rec.enb_attribute29                 := p_enb_attribute29       ;
438   l_rec.enb_attribute30                 := p_enb_attribute30       ;
439   l_rec.request_id                      := p_request_id            ;
440   l_rec.program_application_id          := p_program_application_id;
441   l_rec.program_id                      := p_program_id            ;
442   l_rec.mx_wout_ctfn_val                := p_mx_wout_ctfn_val      ;
443   l_rec.mx_wo_ctfn_flag                 := p_mx_wo_ctfn_flag       ;
444   l_rec.program_update_date             := p_program_update_date   ;
445   l_rec.object_version_number           := p_object_version_number ;
446   --
447   -- Return the plsql record structure.
448   --
449   hr_utility.set_location(' Leaving:'||l_proc, 10);
450   Return(l_rec);
451 --
452 End convert_args;
453 --
454 end ben_enb_shd;