[Home] [Help]
PACKAGE BODY: APPS.BEN_RVC_BUS
Source
1 Package Body ben_rvc_bus as
2 /* $Header: bervcrhi.pkb 115.2 2002/12/11 11:18:06 hnarayan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_rvc_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_prtt_rt_val_ctfn_prvdd_id >------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description
15 -- This procedure is used to check that the primary key for the table
16 -- is created properly. It should be null on insert and
17 -- should not be able to be updated.
18 --
19 -- Pre Conditions
20 -- None.
21 --
22 -- In Parameters
23 -- prtt_rt_val_ctfn_prvdd_id PK of record being inserted or updated.
24 -- object_version_number Object version number of record being
25 -- inserted or updated.
26 --
27 -- Post Success
28 -- Processing continues
29 --
30 -- Post Failure
31 -- Errors handled by the procedure
32 --
33 -- Access Status
34 -- Internal table handler use only.
35 --
36 Procedure chk_prtt_rt_val_ctfn_prvdd_id(p_prtt_rt_val_ctfn_prvdd_id in number,
37 p_object_version_number in number) is
38 --
39 l_proc varchar2(72) := g_package||'chk_prtt_rt_val_ctfn_prvdd_id';
40 l_api_updating boolean;
41 --
42 Begin
43 --
44 hr_utility.set_location('Entering:'||l_proc, 5);
45 --
46 l_api_updating := ben_rvc_shd.api_updating
47 (p_prtt_rt_val_ctfn_prvdd_id => p_prtt_rt_val_ctfn_prvdd_id,
48 p_object_version_number => p_object_version_number);
49 --
50 if (l_api_updating
51 and nvl(p_prtt_rt_val_ctfn_prvdd_id,hr_api.g_number)
52 <> ben_rvc_shd.g_old_rec.prtt_rt_val_ctfn_prvdd_id) then
53 --
54 -- raise error as PK has changed
55 --
56 ben_rvc_shd.constraint_error('BEN_prv_ctfn_prvdd_PK');
57 --
58 elsif not l_api_updating then
59 --
60 -- check if PK is null
61 --
62 if p_prtt_rt_val_ctfn_prvdd_id is not null then
63 --
64 -- raise error as PK is not null
65 --
66 ben_rvc_shd.constraint_error('BEN_prv_ctfn_prvdd_PK');
67 --
68 end if;
69 --
70 end if;
71 --
72 hr_utility.set_location('Leaving:'||l_proc, 10);
73 --
74 End chk_prtt_rt_val_ctfn_prvdd_id;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |------< chk_enrt_ctfn_rqd_flag >------|
78 -- ----------------------------------------------------------------------------
79 --
80 -- Description
81 -- This procedure is used to check that the lookup value is valid.
82 --
83 -- Pre Conditions
84 -- None.
85 --
86 -- In Parameters
87 -- prtt_rt_val_ctfn_prvdd_id PK of record being inserted or updated.
88 -- enrt_ctfn_rqd_flag Value of lookup code.
89 -- effective_date effective date
90 -- object_version_number Object version number of record being
91 -- inserted or updated.
92 --
93 -- Post Success
94 -- Processing continues
95 --
96 -- Post Failure
97 -- Error handled by procedure
98 --
99 -- Access Status
100 -- Internal table handler use only.
101 --
102 Procedure chk_enrt_ctfn_rqd_flag(p_prtt_rt_val_ctfn_prvdd_id in number,
103 p_enrt_ctfn_rqd_flag in varchar2,
104 p_effective_date in date,
105 p_object_version_number in number) is
106 --
107 l_proc varchar2(72) := g_package||'chk_enrt_ctfn_rqd_flag';
108 l_api_updating boolean;
109 --
110 Begin
111 --
112 hr_utility.set_location('Entering:'||l_proc, 5);
113 --
114 l_api_updating := ben_rvc_shd.api_updating
115 (p_prtt_rt_val_ctfn_prvdd_id => p_prtt_rt_val_ctfn_prvdd_id,
116 p_object_version_number => p_object_version_number);
117 --
118 if (l_api_updating
119 and p_enrt_ctfn_rqd_flag
120 <> nvl(ben_rvc_shd.g_old_rec.enrt_ctfn_rqd_flag,hr_api.g_varchar2)
121 or not l_api_updating) then
122 --
123 -- check if value of lookup falls within lookup type.
124 --
125 --
126 if hr_api.not_exists_in_hr_lookups
127 (p_lookup_type => 'YES_NO',
128 p_lookup_code => p_enrt_ctfn_rqd_flag,
129 p_effective_date => p_effective_date) then
130 --
131 -- raise error as does not exist as lookup
132 --
133 fnd_message.set_name('PAY','HR_LOOKUP_DOES_NOT_EXIST');
134 fnd_message.raise_error;
135 --
136 end if;
137 --
138 end if;
139 --
140 hr_utility.set_location('Leaving:'||l_proc,10);
141 --
142 end chk_enrt_ctfn_rqd_flag;
143 --
144 -- ----------------------------------------------------------------------------
145 -- |------< chk_enrt_ctfn_typ_cd >------|
146 -- ----------------------------------------------------------------------------
147 --
148 -- Description
149 -- This procedure is used to check that the lookup value is valid.
150 --
151 -- Pre Conditions
152 -- None.
153 --
154 -- In Parameters
155 -- prtt_rt_val_ctfn_prvdd_id PK of record being inserted or updated.
156 -- enrt_ctfn_typ_cd Value of lookup code.
157 -- effective_date effective date
158 -- object_version_number Object version number of record being
159 -- inserted or updated.
160 --
161 -- Post Success
162 -- Processing continues
163 --
164 -- Post Failure
165 -- Error handled by procedure
166 --
167 -- Access Status
168 -- Internal table handler use only.
169 --
170 Procedure chk_enrt_ctfn_typ_cd(p_prtt_rt_val_ctfn_prvdd_id in number,
171 p_enrt_ctfn_typ_cd in varchar2,
172 p_effective_date in date,
173 p_object_version_number in number) is
174 --
175 l_proc varchar2(72) := g_package||'chk_enrt_ctfn_typ_cd';
176 l_api_updating boolean;
177 --
178 Begin
179 --
180 hr_utility.set_location('Entering:'||l_proc, 5);
181 --
182 l_api_updating := ben_rvc_shd.api_updating
183 (p_prtt_rt_val_ctfn_prvdd_id => p_prtt_rt_val_ctfn_prvdd_id,
184 p_object_version_number => p_object_version_number);
185 --
186 if (l_api_updating
187 and p_enrt_ctfn_typ_cd
188 <> nvl(ben_rvc_shd.g_old_rec.enrt_ctfn_typ_cd,hr_api.g_varchar2)
189 or not l_api_updating) then
190 --
191 -- check if value of lookup falls within lookup type.
192 --
193 --
194 if hr_api.not_exists_in_hr_lookups
195 (p_lookup_type => 'BEN_ENRT_CTFN_TYP',
196 p_lookup_code => p_enrt_ctfn_typ_cd,
197 p_effective_date => p_effective_date) then
198 --
199 -- raise error as does not exist as lookup
200 --
201 fnd_message.set_name('PAY','HR_LOOKUP_DOES_NOT_EXIST');
202 fnd_message.raise_error;
203 --
204 end if;
205 --
206 end if;
207 --
208 hr_utility.set_location('Leaving:'||l_proc,10);
209 --
210 end chk_enrt_ctfn_typ_cd;
211 --
212 -- ----------------------------------------------------------------------------
213 -- |---------------------------< insert_validate >----------------------------|
214 -- ----------------------------------------------------------------------------
215 Procedure insert_validate(p_rec in ben_rvc_shd.g_rec_type
216 ,p_effective_date in date) is
217 --
218 l_proc varchar2(72) := g_package||'insert_validate';
219 --
220 Begin
221 hr_utility.set_location('Entering:'||l_proc, 5);
222 --
223 -- Call all supporting business operations
224 --
225 --
226 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
227 --
228 chk_prtt_rt_val_ctfn_prvdd_id
229 (p_prtt_rt_val_ctfn_prvdd_id => p_rec.prtt_rt_val_ctfn_prvdd_id,
230 p_object_version_number => p_rec.object_version_number);
231 --
232 chk_enrt_ctfn_rqd_flag
233 (p_prtt_rt_val_ctfn_prvdd_id => p_rec.prtt_rt_val_ctfn_prvdd_id,
234 p_enrt_ctfn_rqd_flag => p_rec.enrt_ctfn_rqd_flag,
235 p_effective_date => p_effective_date,
236 p_object_version_number => p_rec.object_version_number);
237 --
238 chk_enrt_ctfn_typ_cd
239 (p_prtt_rt_val_ctfn_prvdd_id => p_rec.prtt_rt_val_ctfn_prvdd_id,
240 p_enrt_ctfn_typ_cd => p_rec.enrt_ctfn_typ_cd,
241 p_effective_date => p_effective_date,
242 p_object_version_number => p_rec.object_version_number);
243 --
244 hr_utility.set_location(' Leaving:'||l_proc, 10);
245 End insert_validate;
246 --
247 -- ----------------------------------------------------------------------------
248 -- |---------------------------< update_validate >----------------------------|
249 -- ----------------------------------------------------------------------------
250 Procedure update_validate(p_rec in ben_rvc_shd.g_rec_type
251 ,p_effective_date in date) is
252 --
253 l_proc varchar2(72) := g_package||'update_validate';
254 --
255 Begin
256 hr_utility.set_location('Entering:'||l_proc, 5);
257 --
258 -- Call all supporting business operations
259 --
260 --
261 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
262 --
263 chk_prtt_rt_val_ctfn_prvdd_id
264 (p_prtt_rt_val_ctfn_prvdd_id => p_rec.prtt_rt_val_ctfn_prvdd_id,
265 p_object_version_number => p_rec.object_version_number);
266 --
267 chk_enrt_ctfn_rqd_flag
268 (p_prtt_rt_val_ctfn_prvdd_id => p_rec.prtt_rt_val_ctfn_prvdd_id,
269 p_enrt_ctfn_rqd_flag => p_rec.enrt_ctfn_rqd_flag,
270 p_effective_date => p_effective_date,
271 p_object_version_number => p_rec.object_version_number);
272 --
273 chk_enrt_ctfn_typ_cd
274 (p_prtt_rt_val_ctfn_prvdd_id => p_rec.prtt_rt_val_ctfn_prvdd_id,
275 p_enrt_ctfn_typ_cd => p_rec.enrt_ctfn_typ_cd,
276 p_effective_date => p_effective_date,
277 p_object_version_number => p_rec.object_version_number);
278 --
279 hr_utility.set_location(' Leaving:'||l_proc, 10);
280 End update_validate;
281 --
282 -- ----------------------------------------------------------------------------
283 -- |---------------------------< delete_validate >----------------------------|
284 -- ----------------------------------------------------------------------------
285 Procedure delete_validate(p_rec in ben_rvc_shd.g_rec_type
286 ,p_effective_date in date) is
287 --
288 l_proc varchar2(72) := g_package||'delete_validate';
289 --
290 Begin
291 hr_utility.set_location('Entering:'||l_proc, 5);
292 --
293 -- Call all supporting business operations
294 --
295 hr_utility.set_location(' Leaving:'||l_proc, 10);
296 End delete_validate;
297 --
298 --
299 -- ---------------------------------------------------------------------------
300 -- |---------------------< return_legislation_code >-------------------------|
301 -- ---------------------------------------------------------------------------
302 --
303 function return_legislation_code
304 (p_prtt_rt_val_ctfn_prvdd_id in number) return varchar2 is
308 cursor csr_leg_code is
305 --
306 -- Declare cursor
307 --
309 select a.legislation_code
310 from per_business_groups a,
311 ben_prtt_rt_val_ctfn_prvdd b
312 where b.prtt_rt_val_ctfn_prvdd_id = p_prtt_rt_val_ctfn_prvdd_id
313 and a.business_group_id = b.business_group_id;
314 --
315 -- Declare local variables
316 --
317 l_legislation_code varchar2(150);
318 l_proc varchar2(72) := g_package||'return_legislation_code';
319 --
320 begin
321 --
322 hr_utility.set_location('Entering:'|| l_proc, 10);
323 --
324 -- Ensure that all the mandatory parameter are not null
325 --
326 hr_api.mandatory_arg_error(p_api_name => l_proc,
327 p_argument => 'prtt_rt_val_ctfn_prvdd_id',
328 p_argument_value => p_prtt_rt_val_ctfn_prvdd_id);
329 --
330 open csr_leg_code;
331 --
332 fetch csr_leg_code into l_legislation_code;
333 --
334 if csr_leg_code%notfound then
335 --
336 close csr_leg_code;
337 --
338 -- The primary key is invalid therefore we must error
339 --
340 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
341 fnd_message.raise_error;
342 --
343 end if;
344 --
345 close csr_leg_code;
346 --
347 hr_utility.set_location(' Leaving:'|| l_proc, 20);
348 --
349 return l_legislation_code;
350 --
351 end return_legislation_code;
352 --
353 end ben_rvc_bus;