DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_RFT_BUS

Source


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