DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BEC_SHD

Source


1 Package Body ben_bec_shd as
2 /* $Header: bebecrhi.pkb 120.0 2005/05/28 00:37:26 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_bec_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 = 'AVCON_BEN_B_DFLT__000') 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 = 'AVCON_BEN_B_MNDTR_000') 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','10');
45     hr_utility.raise_error;
46   ElsIf (p_constraint_name = 'BEN_BATCH_ELCTBL_CHC_INFO_FK1') 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','15');
50     hr_utility.raise_error;
51   ElsIf (p_constraint_name = 'BEN_BATCH_ELCTBL_CHC_INFO_FK2') Then
52     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
53     hr_utility.set_message_token('PROCEDURE', l_proc);
54     hr_utility.set_message_token('STEP','20');
55     hr_utility.raise_error;
56   ElsIf (p_constraint_name = 'BEN_BATCH_ELCTBL_CHC_INFO_PK') Then
57     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
58     hr_utility.set_message_token('PROCEDURE', l_proc);
59     hr_utility.set_message_token('STEP','25');
60     hr_utility.raise_error;
61   Else
62     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
63     hr_utility.set_message_token('PROCEDURE', l_proc);
64     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
65     hr_utility.raise_error;
66   End If;
67   --
68   hr_utility.set_location(' Leaving:'||l_proc, 10);
69 End constraint_error;
70 --
71 -- ----------------------------------------------------------------------------
72 -- |-----------------------------< api_updating >-----------------------------|
73 -- ----------------------------------------------------------------------------
74 Function api_updating
75   (
76   p_batch_elctbl_id                    in number,
77   p_object_version_number              in number
78   )      Return Boolean Is
79 --
80   --
81   -- Cursor selects the 'current' row from the HR Schema
82   --
83   Cursor C_Sel1 is
84     select
85 		batch_elctbl_id,
86 	benefit_action_id,
87 	person_id,
88 	pgm_id,
89 	pl_id,
90 	oipl_id,
91 	enrt_cvg_strt_dt,
92 	enrt_perd_strt_dt,
93 	enrt_perd_end_dt,
94 	erlst_deenrt_dt,
95 	dflt_enrt_dt,
96 	enrt_typ_cycl_cd,
97 	comp_lvl_cd,
98 	mndtry_flag,
99 	dflt_flag,
100 	business_group_id,
101 	object_version_number
102     from	ben_batch_elctbl_chc_info
103     where	batch_elctbl_id = p_batch_elctbl_id;
104 --
105   l_proc	varchar2(72)	:= g_package||'api_updating';
106   l_fct_ret	boolean;
107 --
108 Begin
109   hr_utility.set_location('Entering:'||l_proc, 5);
110   --
111   If (
112 	p_batch_elctbl_id is null and
113 	p_object_version_number is null
114      ) Then
115     --
116     -- One of the primary key arguments is null therefore we must
117     -- set the returning function value to false
118     --
119     l_fct_ret := false;
120   Else
121     If (
122 	p_batch_elctbl_id = g_old_rec.batch_elctbl_id and
123 	p_object_version_number = g_old_rec.object_version_number
124        ) Then
125       hr_utility.set_location(l_proc, 10);
126       --
127       -- The g_old_rec is current therefore we must
128       -- set the returning function to true
129       --
130       l_fct_ret := true;
131     Else
132       --
133       -- Select the current row into g_old_rec
134       --
135       Open C_Sel1;
136       Fetch C_Sel1 Into g_old_rec;
137       If C_Sel1%notfound Then
138         Close C_Sel1;
139         --
140         -- The primary key is invalid therefore we must error
141         --
142         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
143         hr_utility.raise_error;
144       End If;
145       Close C_Sel1;
146       If (p_object_version_number <> g_old_rec.object_version_number) Then
147         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
148         hr_utility.raise_error;
149       End If;
150       hr_utility.set_location(l_proc, 15);
151       l_fct_ret := true;
152     End If;
153   End If;
154   hr_utility.set_location(' Leaving:'||l_proc, 20);
155   Return (l_fct_ret);
156 --
157 End api_updating;
158 --
159 -- ----------------------------------------------------------------------------
160 -- |---------------------------------< lck >----------------------------------|
161 -- ----------------------------------------------------------------------------
162 Procedure lck
163   (
164   p_batch_elctbl_id                    in number,
165   p_object_version_number              in number
166   ) is
167 --
168 -- Cursor selects the 'current' row from the HR Schema
169 --
170   Cursor C_Sel1 is
171     select 	batch_elctbl_id,
172 	benefit_action_id,
173 	person_id,
174 	pgm_id,
175 	pl_id,
176 	oipl_id,
177 	enrt_cvg_strt_dt,
178 	enrt_perd_strt_dt,
179 	enrt_perd_end_dt,
180 	erlst_deenrt_dt,
181 	dflt_enrt_dt,
182 	enrt_typ_cycl_cd,
183 	comp_lvl_cd,
184 	mndtry_flag,
185 	dflt_flag,
186 	business_group_id,
187 	object_version_number
188     from	ben_batch_elctbl_chc_info
189     where	batch_elctbl_id = p_batch_elctbl_id
190     for	update nowait;
191 --
192   l_proc	varchar2(72) := g_package||'lck';
193 --
194 Begin
195   hr_utility.set_location('Entering:'||l_proc, 5);
196   --
197   -- Add any mandatory argument checking here:
198   -- Example:
199   -- hr_api.mandatory_arg_error
200   --   (p_api_name       => l_proc,
201   --    p_argument       => 'object_version_number',
202   --    p_argument_value => p_object_version_number);
203   --
204   Open  C_Sel1;
205   Fetch C_Sel1 Into g_old_rec;
206   If C_Sel1%notfound then
207     Close C_Sel1;
208     --
209     -- The primary key is invalid therefore we must error
210     --
211     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
212     hr_utility.raise_error;
213   End If;
214   Close C_Sel1;
215   If (p_object_version_number <> g_old_rec.object_version_number) Then
216         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
217         hr_utility.raise_error;
218       End If;
219 --
220   hr_utility.set_location(' Leaving:'||l_proc, 10);
221 --
222 -- We need to trap the ORA LOCK exception
223 --
224 Exception
225   When HR_Api.Object_Locked then
226     --
227     -- The object is locked therefore we need to supply a meaningful
228     -- error message.
229     --
230     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
231     hr_utility.set_message_token('TABLE_NAME', 'ben_batch_elctbl_chc_info');
232     hr_utility.raise_error;
233 End lck;
234 --
235 -- ----------------------------------------------------------------------------
236 -- |-----------------------------< convert_args >-----------------------------|
237 -- ----------------------------------------------------------------------------
238 Function convert_args
239 	(
240 	p_batch_elctbl_id               in number,
241 	p_benefit_action_id             in number,
242 	p_person_id                     in number,
243 	p_pgm_id                        in number,
244 	p_pl_id                         in number,
245 	p_oipl_id                       in number,
246 	p_enrt_cvg_strt_dt              in date,
247 	p_enrt_perd_strt_dt             in date,
248 	p_enrt_perd_end_dt              in date,
249 	p_erlst_deenrt_dt               in date,
250 	p_dflt_enrt_dt                  in date,
251 	p_enrt_typ_cycl_cd              in varchar2,
252 	p_comp_lvl_cd                   in varchar2,
253 	p_mndtry_flag                   in varchar2,
254 	p_dflt_flag                     in varchar2,
255 	p_business_group_id             in number,
256 	p_object_version_number         in number
257 	)
258 	Return g_rec_type is
259 --
260   l_rec	  g_rec_type;
261   l_proc  varchar2(72) := g_package||'convert_args';
262 --
263 Begin
264   --
265   hr_utility.set_location('Entering:'||l_proc, 5);
266   --
267   -- Convert arguments into local l_rec structure.
268   --
269   l_rec.batch_elctbl_id                  := p_batch_elctbl_id;
270   l_rec.benefit_action_id                := p_benefit_action_id;
271   l_rec.person_id                        := p_person_id;
272   l_rec.pgm_id                           := p_pgm_id;
273   l_rec.pl_id                            := p_pl_id;
274   l_rec.oipl_id                          := p_oipl_id;
275   l_rec.enrt_cvg_strt_dt                 := p_enrt_cvg_strt_dt;
276   l_rec.enrt_perd_strt_dt                := p_enrt_perd_strt_dt;
277   l_rec.enrt_perd_end_dt                 := p_enrt_perd_end_dt;
278   l_rec.erlst_deenrt_dt                  := p_erlst_deenrt_dt;
279   l_rec.dflt_enrt_dt                     := p_dflt_enrt_dt;
280   l_rec.enrt_typ_cycl_cd                 := p_enrt_typ_cycl_cd;
281   l_rec.comp_lvl_cd                      := p_comp_lvl_cd;
282   l_rec.mndtry_flag                      := p_mndtry_flag;
283   l_rec.dflt_flag                        := p_dflt_flag;
284   l_rec.business_group_id                := p_business_group_id;
285   l_rec.object_version_number            := p_object_version_number;
286   --
287   -- Return the plsql record structure.
288   --
289   hr_utility.set_location(' Leaving:'||l_proc, 10);
290   Return(l_rec);
291 --
292 End convert_args;
293 --
294 end ben_bec_shd;