DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_RFP_BUS

Source


1 Package Body pay_rfp_bus as
2 /* $Header: pyrfprhi.pkb 120.0 2005/05/29 08:21 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_rfp_bus.';  -- Global package name
9 --
10 --
11 --  ---------------------------------------------------------------------------
12 --  |--------------------< chk_report_format_mapping_id >---------------------|
13 --  ---------------------------------------------------------------------------
14 --
15 Procedure chk_report_format_mapping_id
16   ( p_report_format_mapping_id  in  number ) IS
17 --
18 cursor csr_report_format_mapping_id  is
19   select null
20   from   pay_report_format_mappings_f
21   where  report_format_mapping_id = p_report_format_mapping_id;
22 --
23   l_proc     varchar2(72) := g_package || 'chk_report_format_mapping_id';
24   l_exists   varchar2(1);
25 --
26 Begin
27   --
28   hr_utility.set_location('Entering:'|| l_proc, 10);
29   --
30         hr_api.mandatory_arg_error
31                    ( p_api_name       =>  l_proc
32                     ,p_argument       =>  'REPORT_FORMAT_MAPPING_ID'
33                     ,p_argument_value =>  p_report_format_mapping_id
34                    );
35 
36         open csr_report_format_mapping_id;
37         fetch csr_report_format_mapping_id into l_exists;
38 
39         if csr_report_format_mapping_id%notfound then
40 
41              close csr_report_format_mapping_id;
42 
43              fnd_message.set_name('PAY', 'PAY_33174_PARENT_ID_INVALID');
44              fnd_message.set_token('PARENT' , 'Report Format Mapping Id' );
45              fnd_message.raise_error;
46 
47         end if ;
48 
49         close csr_report_format_mapping_id;
50   --
51   hr_utility.set_location(' Leaving:'|| l_proc, 20);
52   --
53 End chk_report_format_mapping_id;
54 --
55 -- ----------------------------------------------------------------------------
56 -- |-----------------------------< chk_unique_key >---------------------------|
57 -- ----------------------------------------------------------------------------
58 -- {Start Of Comments}
59 --
60 -- Description:
61 --   This procedure is used to check the uniqueness of the combination
62 --   report_format_mapping_id and parameter_name.
63 --   This is required since there is no primary key constraint on the table.
64 --
65 -- Pre Conditions:
66 --   Should be called only while insert. Since these columns are non-updatable
67 --   it is not required to check the uniqueness while update.
68 --
69 -- In Arguments:
70 --   report_format_mapping_id
71 --   parameter_name
72 --
73 -- Post Success:
74 --   Processing Continues.
75 --
76 --
77 -- Post Failure:
78 --   Failure might occur if any of the parameters are null or the combination
79 --   already exists.
80 --   Errors are trapped and reported.
81 --
82 -- {End Of Comments}
83 -- ----------------------------------------------------------------------------
84 Procedure chk_unique_key
85   ( p_report_format_mapping_id   in  number
86    ,p_parameter_name             in  varchar2
87   ) IS
88 --
89 cursor csr_unique_key  is
90   select null
91   from   pay_report_format_parameters
92   where  report_format_mapping_id = p_report_format_mapping_id
93   and    parameter_name = p_parameter_name;
94 --
95   l_proc     varchar2(72) := g_package || 'chk_unique_key';
96   l_exists   varchar2(1);
97 --
98 Begin
99   --
100   hr_utility.set_location('Entering:'|| l_proc, 10);
101   --
102         hr_api.mandatory_arg_error
103                    ( p_api_name       =>  l_proc
104                     ,p_argument       =>  'REPORT_FORMAT_MAPPING_ID'
105                     ,p_argument_value =>  p_report_format_mapping_id
106                    );
107 
108         hr_api.mandatory_arg_error
109                    ( p_api_name       =>  l_proc
110                     ,p_argument       =>  'PARAMETER_NAME'
111                     ,p_argument_value =>  p_parameter_name
112                    );
113 
114         open csr_unique_key;
115         fetch csr_unique_key into l_exists;
116 
117         if csr_unique_key%found then
118 
119              close csr_unique_key;
120 
121              fnd_message.set_name( 'PAY' , 'PAY_33256_INV_UKEY1' );
122              fnd_message.set_token( 'COL1' , 'REPORT_FORMAT_MAPPING_ID');
123              fnd_message.set_token( 'COL2' , 'PARAMETER_NAME');
124              fnd_message.set_token( 'COL1_VAL', p_report_format_mapping_id);
125              fnd_message.set_token( 'COL2_VAL', p_parameter_name);
126              fnd_message.raise_error ;
127 
128         end if ;
129 
130         close csr_unique_key;
131   --
132   hr_utility.set_location(' Leaving:'|| l_proc, 20);
133   --
134 End chk_unique_key;
135 --
136 -- ----------------------------------------------------------------------------
137 -- |---------------------------< chk_parameter_value >------------------------|
138 -- ----------------------------------------------------------------------------
139 -- {Start Of Comments}
140 --
141 -- Description:
142 --   This procedure checks the validity of the parameter_value.
143 --   The parameter_value cannot be null.
144 --
145 -- Pre Conditions:
146 --   None.
147 --
148 --
149 -- In Arguments:
150 --   parameter_value.
151 --
152 --
153 -- Post Success:
154 --   Processing Continues.
155 --
156 --
157 -- Post Failure:
158 --   Failure might occur if the parameter_value is null.
159 --   Errors are trapped and reported.
160 --
161 -- {End Of Comments}
162 -- ----------------------------------------------------------------------------
163 Procedure chk_parameter_value
164   ( p_parameter_value   in  varchar2 ) IS
165 --
166   l_proc     varchar2(72) := g_package || 'chk_parameter_value';
167 --
168 Begin
169   --
170   hr_utility.set_location('Entering:'|| l_proc, 10);
171   --
172         hr_api.mandatory_arg_error
173                    ( p_api_name       =>  l_proc
174                     ,p_argument       =>  'PARAMETER_VALUE'
175                     ,p_argument_value =>  p_parameter_value
176                    );
177   --
178   hr_utility.set_location(' Leaving:'|| l_proc, 20);
179   --
180 End chk_parameter_value;
181 --
182 -- ----------------------------------------------------------------------------
183 -- |-----------------------< chk_non_updateable_args >------------------------|
184 -- ----------------------------------------------------------------------------
185 -- {Start Of Comments}
186 --
187 -- Description:
188 --   This procedure is used to ensure that non updateable attributes have
189 --   not been updated. If an attribute has been updated an error is generated.
190 --
191 -- Pre Conditions:
192 --   g_old_rec has been populated with details of the values currently in
193 --   the database.
194 --
195 -- In Arguments:
196 --   p_rec has been populated with the updated values the user would like the
197 --   record set to.
198 --
199 -- Post Success:
200 --   Processing continues if all the non updateable attributes have not
201 --   changed.
202 --
203 -- Post Failure:
204 --   An application error is raised if any of the non updatable attributes
205 --   have been altered.
206 --
207 -- {End Of Comments}
208 -- ----------------------------------------------------------------------------
209 Procedure chk_non_updateable_args
210   (p_rec in pay_rfp_shd.g_rec_type
211   ) IS
212 --
213   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
214 --
215 Begin
216   --
217   -- Only proceed with the validation if a row exists for the current
218   -- record in the HR Schema.
219   --
220   IF NOT pay_rfp_shd.api_updating
221       (p_report_format_mapping_id          => p_rec.report_format_mapping_id
222       ,p_parameter_name                    => p_rec.parameter_name
223       ,p_object_version_number             => p_rec.object_version_number
224       ) THEN
225      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
226      fnd_message.set_token('PROCEDURE ', l_proc);
227      fnd_message.set_token('STEP ', '5');
228      fnd_message.raise_error;
229   END IF;
230   --
231 End chk_non_updateable_args;
232 --
233 -- ----------------------------------------------------------------------------
234 -- |---------------------------< insert_validate >----------------------------|
235 -- ----------------------------------------------------------------------------
236 Procedure insert_validate
237   (p_rec                          in pay_rfp_shd.g_rec_type
238   ) is
239 --
240   l_proc  varchar2(72) := g_package||'insert_validate';
241 --
242 Begin
243   hr_utility.set_location('Entering:'||l_proc, 5);
244   --
245   -- Call all supporting business operations
246   --
247   -- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS.
248   --
249   --
250   -- Validate Dependent Attributes
251   --
252   chk_report_format_mapping_id
253      ( p_report_format_mapping_id => p_rec.report_format_mapping_id );
254   --
255   chk_unique_key
256      ( p_report_format_mapping_id => p_rec.report_format_mapping_id
257       ,p_parameter_name           => p_rec.parameter_name
258      );
259   --
260   chk_parameter_value
261      ( p_parameter_value          => p_rec.parameter_value
262      );
263   --
264   hr_utility.set_location(' Leaving:'||l_proc, 10);
265 End insert_validate;
266 --
267 -- ----------------------------------------------------------------------------
268 -- |---------------------------< update_validate >----------------------------|
269 -- ----------------------------------------------------------------------------
270 Procedure update_validate
271   (p_rec                          in pay_rfp_shd.g_rec_type
272   ) is
273 --
274   l_proc  varchar2(72) := g_package||'update_validate';
275 --
276 Begin
277   hr_utility.set_location('Entering:'||l_proc, 5);
278   --
279   -- Call all supporting business operations
280   --
281   -- CLIENT_INFO not set.  No lookup validation or joins to HR_LOOKUPS.
282   --
283   --
284   -- Validate Dependent Attributes
285   --
286   chk_non_updateable_args
287     (p_rec              => p_rec
288     );
289   --
290   chk_parameter_value
291      ( p_parameter_value          => p_rec.parameter_value
292      );
293   --
294   hr_utility.set_location(' Leaving:'||l_proc, 10);
295 End update_validate;
296 --
297 -- ----------------------------------------------------------------------------
298 -- |---------------------------< delete_validate >----------------------------|
299 -- ----------------------------------------------------------------------------
300 Procedure delete_validate
301   (p_rec                          in pay_rfp_shd.g_rec_type
302   ) is
303 --
304   l_proc  varchar2(72) := g_package||'delete_validate';
305 --
306 Begin
307   hr_utility.set_location('Entering:'||l_proc, 5);
308   --
309   -- Call all supporting business operations
310   --
311   hr_utility.set_location(' Leaving:'||l_proc, 10);
312 End delete_validate;
313 --
314 end pay_rfp_bus;