[Home] [Help]
PACKAGE BODY: APPS.BEN_BMN_BUS
Source
1 Package Body ben_bmn_bus as
2 /* $Header: bebmnrhi.pkb 115.7 2002/12/09 12:40:49 lakrish ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_bmn_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< chk_reporting_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 -- reporting_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_reporting_id(p_reporting_id in number,
37 p_object_version_number in number) is
38 --
39 l_proc varchar2(72) := g_package||'chk_reporting_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_bmn_shd.api_updating
47 (p_reporting_id => p_reporting_id,
48 p_object_version_number => p_object_version_number);
49 --
50 if (l_api_updating
51 and nvl(p_reporting_id,hr_api.g_number)
52 <> ben_bmn_shd.g_old_rec.reporting_id) then
53 --
54 -- raise error as PK has changed
55 --
56 ben_bmn_shd.constraint_error('BEN_REPORTING_PK');
57 --
58 elsif not l_api_updating then
59 --
60 -- check if PK is null
61 --
62 if p_reporting_id is not null then
63 --
64 -- raise error as PK is not null
65 --
66 ben_bmn_shd.constraint_error('BEN_REPORTING_PK');
67 --
68 end if;
69 --
70 end if;
71 --
72 hr_utility.set_location('Leaving:'||l_proc, 10);
73 --
74 End chk_reporting_id;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |-----------------------------< chk_benefit_action_id >--------------------|
78 -- ----------------------------------------------------------------------------
79 --
80 -- Description
81 -- This procedure checks that a referenced foreign key actually exists
82 -- in the referenced table.
83 --
84 -- Pre-Conditions
85 -- None.
86 --
87 -- In Parameters
88 -- p_reporting_id PK
89 -- p_benefit_action_id ID of FK column
90 -- p_object_version_number object version number
91 --
92 -- Post Success
93 -- Processing continues
94 --
95 -- Post Failure
96 -- Error raised.
97 --
98 -- Access Status
99 -- Internal table handler use only.
100 --
101 Procedure chk_benefit_action_id (p_reporting_id in number,
102 p_benefit_action_id in number,
103 p_object_version_number in number) is
104 --
105 l_proc varchar2(72) := g_package||'chk_benefit_action_id';
106 l_api_updating boolean;
107 l_dummy varchar2(1);
108 --
109 cursor c1 is
110 select null
111 from ben_benefit_actions a
112 where a.benefit_action_id = p_benefit_action_id;
113 --
114 Begin
115 --
116 hr_utility.set_location('Entering:'||l_proc,5);
117 --
118 l_api_updating := ben_bmn_shd.api_updating
119 (p_reporting_id => p_reporting_id,
120 p_object_version_number => p_object_version_number);
121 --
122 if (l_api_updating
123 and nvl(p_benefit_action_id,hr_api.g_number)
124 <> nvl(ben_bmn_shd.g_old_rec.benefit_action_id,hr_api.g_number)
125 or not l_api_updating) then
126 --
127 -- check if benefit_action_id value exists in ben_benefit_actions table
128 --
129 open c1;
130 --
131 fetch c1 into l_dummy;
132 if c1%notfound then
133 --
134 close c1;
135 --
136 -- raise error as FK does not relate to PK in ben_benefit_actions
137 -- table.
138 --
139 ben_bmn_shd.constraint_error('BEN_REPORTING_FK1');
140 --
141 end if;
142 --
143 close c1;
144 --
145 end if;
146 --
147 hr_utility.set_location('Leaving:'||l_proc,10);
148 --
149 End chk_benefit_action_id;
150 --
151 -- ----------------------------------------------------------------------------
152 -- |--------------------< chk_rep_typ_cd >------------------------------------|
153 -- ----------------------------------------------------------------------------
154 --
155 -- Description
156 -- This procedure is used to check that the lookup value is valid.
157 --
158 -- Pre Conditions
159 -- None.
160 --
161 -- In Parameters
162 -- benefit_action_id PK of record being inserted or updated.
163 -- rep_typ_cd Value of lookup code.
164 -- effective_date effective date
165 -- object_version_number Object version number of record being
166 -- inserted or updated.
167 --
168 -- Post Success
169 -- Processing continues
170 --
171 -- Post Failure
172 -- Error handled by procedure
173 --
174 -- Access Status
175 -- Internal table handler use only.
176 --
177 Procedure chk_rep_typ_cd(p_reporting_id in number,
178 p_rep_typ_cd in varchar2,
179 p_effective_date in date,
180 p_object_version_number in number) is
181 --
182 l_proc varchar2(72) := g_package||'chk_rep_typ_cd';
183 l_api_updating boolean;
184 --
185 Begin
186 --
187 hr_utility.set_location('Entering:'||l_proc, 5);
188 --
189 l_api_updating := ben_bmn_shd.api_updating
190 (p_reporting_id => p_reporting_id,
191 p_object_version_number => p_object_version_number);
192 --
193 if (l_api_updating
194 and p_rep_typ_cd
195 <> nvl(ben_bmn_shd.g_old_rec.rep_typ_cd,hr_api.g_varchar2)
196 or not l_api_updating) then
197 --
198 -- check if value of lookup falls within lookup type.
199 --
200 if hr_api.not_exists_in_hr_lookups
201 (p_lookup_type => 'BEN_REP_TYP',
202 p_lookup_code => p_rep_typ_cd,
203 p_effective_date => p_effective_date) then
204 --
205 -- raise error as does not exist as lookup
206 --
207 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
208 fnd_message.set_token('FIELD','p_rep_typ_cd');
209 fnd_message.set_token('TYPE','BEN_REP_TYP');
210 fnd_message.raise_error;
211 --
212 end if;
213 --
214 end if;
215 --
216 hr_utility.set_location('Leaving:'||l_proc,10);
217 --
218 end chk_rep_typ_cd;
219 --
220 -- ----------------------------------------------------------------------------
221 -- |---------------------------< insert_validate >----------------------------|
222 -- ----------------------------------------------------------------------------
223 Procedure insert_validate(p_rec in ben_bmn_shd.g_rec_type) is
224 --
225 l_proc varchar2(72) := g_package||'insert_validate';
226 --
227 Begin
228 hr_utility.set_location('Entering:'||l_proc, 5);
229 --
230 -- Call all supporting business operations
231 --
232 --
233 --
234 chk_reporting_id
235 (p_reporting_id => p_rec.reporting_id,
236 p_object_version_number => p_rec.object_version_number);
237 --
238 chk_benefit_action_id
239 (p_reporting_id => p_rec.reporting_id,
240 p_benefit_action_id => p_rec.benefit_action_id,
241 p_object_version_number => p_rec.object_version_number);
242 --
243 /*
244 chk_rep_typ_cd
245 (p_reporting_id => p_rec.reporting_id,
246 p_rep_typ_cd => p_rec.rep_typ_cd,
247 p_effective_date => p_rec.effective_date,
248 p_object_version_number => p_rec.object_verison_number);
249 */
250 --
251 hr_utility.set_location(' Leaving:'||l_proc, 10);
252 End insert_validate;
253 --
254 -- ----------------------------------------------------------------------------
255 -- |---------------------------< update_validate >----------------------------|
256 -- ----------------------------------------------------------------------------
257 Procedure update_validate(p_rec in ben_bmn_shd.g_rec_type) is
258 --
259 l_proc varchar2(72) := g_package||'update_validate';
260 --
261 Begin
262 hr_utility.set_location('Entering:'||l_proc, 5);
263 --
264 -- Call all supporting business operations
265 --
266 --
267 --
268 chk_reporting_id
269 (p_reporting_id => p_rec.reporting_id,
270 p_object_version_number => p_rec.object_version_number);
271 --
272 chk_benefit_action_id
273 (p_reporting_id => p_rec.reporting_id,
274 p_benefit_action_id => p_rec.benefit_action_id,
275 p_object_version_number => p_rec.object_version_number);
276 --
277 /*
278 chk_rep_typ_cd
279 (p_reporting_id => p_rec.reporting_id,
280 p_rep_typ_cd => p_rec.rep_typ_cd,
281 p_effective_date => p_rec.effective_date,
282 p_object_version_number => p_rec.object_verison_number);
283 */
284 --
285 hr_utility.set_location(' Leaving:'||l_proc, 10);
286 End update_validate;
287 --
288 -- ----------------------------------------------------------------------------
289 -- |---------------------------< delete_validate >----------------------------|
290 -- ----------------------------------------------------------------------------
291 Procedure delete_validate(p_rec in ben_bmn_shd.g_rec_type) is
292 --
293 l_proc varchar2(72) := g_package||'delete_validate';
294 --
295 Begin
296 hr_utility.set_location('Entering:'||l_proc, 5);
297 --
298 -- Call all supporting business operations
299 --
300 hr_utility.set_location(' Leaving:'||l_proc, 10);
301 End delete_validate;
302 --
303 end ben_bmn_bus;