DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BCI_BUS

Source


1 Package Body ben_bci_bus as
2 /* $Header: bebcirhi.pkb 120.0 2005/05/28 00:35:20 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_bci_bus.';  -- Global package name
9 --
10 --
11 --  ---------------------------------------------------------------------------
12 --  |---------------------< return_legislation_code >-------------------------|
13 --  ---------------------------------------------------------------------------
14 --
15 --  Description:
16 --    Return the legislation code for a specific primary key value
17 --
18 --  Prerequisites:
19 --    The primary key identified by p_batch_benft_cert_id already exists.
20 --
21 --  In Arguments:
22 --    p_batch_benft_cert_id
23 --
24 --  Post Success:
25 --    If the value is found this function will return the values business
26 --    group legislation code.
27 --
28 --  Post Failure:
29 --    An error is raised if the value does not exist.
30 --
31 --  Access Status:
32 --    Internal Development Use Only.
33 --
34 function return_legislation_code
35   (p_batch_benft_cert_id in number) return varchar2 is
36   --
37   -- Declare cursor
38   --
39   cursor csr_leg_code is
40     select bg.legislation_code
41         from   per_business_groups_perf bg,
42                ben_benefit_actions bba, ben_batch_bnft_cert_info bpa
43         where bba.benefit_action_id      = bpa.benefit_action_id
44         and   bba.business_group_id = bg.business_group_id
45     and   bpa.batch_benft_cert_id = p_batch_benft_cert_id;
46   --
47   -- Declare local variables
48   --
49   l_legislation_code  varchar2(150);
50   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
51   --
52 begin
53   --
54   hr_utility.set_location('Entering:'|| l_proc, 10);
55   --
56   -- Ensure that all the mandatory parameter are not null
57   --
58   hr_api.mandatory_arg_error(p_api_name       => l_proc,
59                              p_argument       => 'batch_benft_cert_id',
60                              p_argument_value =>p_batch_benft_cert_id);
61   --
62   open csr_leg_code;
63     --
64     fetch csr_leg_code into l_legislation_code;
65     --
66     if csr_leg_code%notfound then
67       --
68       close csr_leg_code;
69       --
70       -- The primary key is invalid therefore we must error
71       --
72       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
73       fnd_message.raise_error;
74       --
75     end if;
76     --
77   close csr_leg_code;
78   --
79   hr_utility.set_location(' Leaving:'|| l_proc, 20);
80   --
81   return l_legislation_code;
82   --
83 end return_legislation_code;
84 --
85 --
86 
87 -- ----------------------------------------------------------------------------
88 -- |------< chk_batch_benft_cert_id >------|
89 -- ----------------------------------------------------------------------------
90 --
91 -- Description
92 --   This procedure is used to check that the primary key for the table
93 --   is created properly. It should be null on insert and
94 --   should not be able to be updated.
95 --
96 -- Pre Conditions
97 --   None.
98 --
99 -- In Parameters
100 --   batch_benft_cert_id PK of record being inserted or updated.
101 --   object_version_number Object version number of record being
102 --                         inserted or updated.
103 --
104 -- Post Success
105 --   Processing continues
106 --
107 -- Post Failure
108 --   Errors handled by the procedure
109 --
110 -- Access Status
111 --   Internal table handler use only.
112 --
113 Procedure chk_batch_benft_cert_id(p_batch_benft_cert_id                in number,
114                            p_object_version_number       in number) is
115   --
116   l_proc         varchar2(72) := g_package||'chk_batch_benft_cert_id';
117   l_api_updating boolean;
118   --
119 Begin
120   --
121   hr_utility.set_location('Entering:'||l_proc, 5);
122   --
123   l_api_updating := ben_bci_shd.api_updating
124     (p_batch_benft_cert_id                => p_batch_benft_cert_id,
125      p_object_version_number       => p_object_version_number);
126   --
127   if (l_api_updating
128      and nvl(p_batch_benft_cert_id,hr_api.g_number)
129      <>  ben_bci_shd.g_old_rec.batch_benft_cert_id) then
130     --
131     -- raise error as PK has changed
132     --
133     ben_bci_shd.constraint_error('BATCH_BNFT_CERT_INFO_PK');
134     --
135   elsif not l_api_updating then
136     --
137     -- check if PK is null
138     --
139     if p_batch_benft_cert_id is not null then
140       --
141       -- raise error as PK is not null
142       --
143       ben_bci_shd.constraint_error('BATCH_BNFT_CERT_INFO_PK');
144       --
145     end if;
146     --
147   end if;
148   --
149   hr_utility.set_location('Leaving:'||l_proc, 10);
150   --
151 End chk_batch_benft_cert_id;
152 --
153 -- ----------------------------------------------------------------------------
154 -- |------< chk_typ_cd >------|
155 -- ----------------------------------------------------------------------------
156 --
157 -- Description
158 --   This procedure is used to check that the lookup value is valid.
159 --
160 -- Pre Conditions
161 --   None.
162 --
163 -- In Parameters
164 --   batch_benft_cert_id PK of record being inserted or updated.
165 --   typ_cd Value of lookup code.
166 --   effective_date effective date
167 --   object_version_number Object version number of record being
168 --                         inserted or updated.
169 --
170 -- Post Success
171 --   Processing continues
172 --
173 -- Post Failure
174 --   Error handled by procedure
175 --
176 -- Access Status
177 --   Internal table handler use only.
178 --
179 Procedure chk_typ_cd(p_batch_benft_cert_id                in number,
180                             p_typ_cd               in varchar2,
181                             p_effective_date              in date,
182                             p_object_version_number       in number) is
183   --
184   l_proc         varchar2(72) := g_package||'chk_typ_cd';
185   l_api_updating boolean;
186   --
187 Begin
188   --
189   hr_utility.set_location('Entering:'||l_proc, 5);
190   --
191   l_api_updating := ben_bci_shd.api_updating
192     (p_batch_benft_cert_id                => p_batch_benft_cert_id,
193      p_object_version_number       => p_object_version_number);
194   --
195   if (l_api_updating
196       and p_typ_cd
197       <> nvl(ben_bci_shd.g_old_rec.typ_cd,hr_api.g_varchar2)
198       or not l_api_updating)
199       and p_typ_cd is not null then
200     --
201     -- check if value of lookup falls within lookup type.
202     --
203     if hr_api.not_exists_in_hr_lookups
204           (p_lookup_type    => 'ENTER-LKP-TYPE',
205            p_lookup_code    => p_typ_cd,
206            p_effective_date => p_effective_date) then
207       --
208       -- raise error as does not exist as lookup
209       --
210       hr_utility.set_message(801,'HR_LOOKUP_DOES_NOT_EXIST');
211       hr_utility.raise_error;
212       --
213     end if;
214     --
215   end if;
216   --
217   hr_utility.set_location('Leaving:'||l_proc,10);
218   --
219 end chk_typ_cd;
220 --
221 -- ----------------------------------------------------------------------------
222 -- |---------------------------< insert_validate >----------------------------|
223 -- ----------------------------------------------------------------------------
224 Procedure insert_validate(p_rec in ben_bci_shd.g_rec_type
225                          ,p_effective_date in date) is
226 --
227   l_proc  varchar2(72) := g_package||'insert_validate';
228 --
229 Begin
230   hr_utility.set_location('Entering:'||l_proc, 5);
231   --
232   -- Call all supporting business operations
233   --
234   --
235   --
236   chk_batch_benft_cert_id
237   (p_batch_benft_cert_id          => p_rec.batch_benft_cert_id,
238    p_object_version_number => p_rec.object_version_number);
239   --
240 /*
241   chk_typ_cd
242   (p_batch_benft_cert_id          => p_rec.batch_benft_cert_id,
243    p_typ_cd         => p_rec.typ_cd,
244    p_effective_date        => p_effective_date,
245    p_object_version_number => p_rec.object_version_number);
246 */
247   --
248   --
249   --
250   hr_utility.set_location(' Leaving:'||l_proc, 10);
251 End insert_validate;
252 --
253 -- ----------------------------------------------------------------------------
254 -- |---------------------------< update_validate >----------------------------|
255 -- ----------------------------------------------------------------------------
256 Procedure update_validate(p_rec in ben_bci_shd.g_rec_type
257                          ,p_effective_date in date) 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_batch_benft_cert_id
269   (p_batch_benft_cert_id          => p_rec.batch_benft_cert_id,
270    p_object_version_number => p_rec.object_version_number);
271   --
272 /*
273   chk_typ_cd
274  (p_batch_benft_cert_id          => p_rec.batch_benft_cert_id,
275    p_typ_cd         => p_rec.typ_cd,
276    p_effective_date        => p_effective_date,
277    p_object_version_number => p_rec.object_version_number);
278 */
279   --
280   --
281   --
282   hr_utility.set_location(' Leaving:'||l_proc, 10);
283 End update_validate;
284 --
285 -- ----------------------------------------------------------------------------
286 -- |---------------------------< delete_validate >----------------------------|
287 -- ----------------------------------------------------------------------------
288 Procedure delete_validate(p_rec in ben_bci_shd.g_rec_type
289                          ,p_effective_date in date) is
290 --
291   l_proc  varchar2(72) := g_package||'delete_validate';
292 --
293 Begin
294   hr_utility.set_location('Entering:'||l_proc, 5);
295   --
296   -- Call all supporting business operations
297   --
298   hr_utility.set_location(' Leaving:'||l_proc, 10);
299 End delete_validate;
300 --
301 end ben_bci_bus;