DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_USER_TABLE_API

Source


1 Package Body pay_user_table_api as
2 /* $Header: pyputapi.pkb 120.0 2005/05/29 08:02:50 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  pay_user_table_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< create_user_table >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_user_table
13   (p_validate                      in     boolean  default false
14   ,p_effective_date                in     date
15   ,p_business_group_id             in     number   default null
16   ,p_legislation_code              in     varchar2 default null
17   ,p_range_or_match                in     varchar2 default 'M'
18   ,p_user_key_units                in     varchar2 default 'N'
19   ,p_user_table_name               in     varchar2
20   ,p_user_row_title                in     varchar2 default null
21   ,p_user_table_id                    out nocopy number
22   ,p_object_version_number            out nocopy number
23   ) is
24   --
25   -- Declare cursors and local variables
26   --
27 
28   l_proc                varchar2(72) := g_package||'create_user_table';
29   l_effective_date      date;
30   l_ovn                 number;
31   l_user_table_id       number;
32 begin
33   hr_utility.set_location('Entering:'|| l_proc, 10);
34   --
35   -- Issue a savepoint
36   --
37   savepoint create_user_table;
38   --
39   -- Truncate the time portion from all IN date parameters
40   --
41   l_effective_date := trunc(p_effective_date);
42   --
43   -- Call Before Process User Hook
44   --
45   begin
46     pay_user_table_bk1.create_user_table_b
47       (p_effective_date                => l_effective_date
48       ,p_business_group_id             => p_business_group_id
49       ,p_legislation_code              => p_legislation_code
50       ,p_range_or_match                => p_range_or_match
51       ,p_user_key_units                => p_user_key_units
52       ,p_user_table_name               => p_user_table_name
53       ,p_user_row_title                => p_user_row_title
54       );
55   exception
56     when hr_api.cannot_find_prog_unit then
57       hr_api.cannot_find_prog_unit_error
58         (p_module_name => 'create_user_table'
59         ,p_hook_type   => 'BP'
60         );
61   end;
62   --
63   -- Process Logic
64   --
65   pay_put_ins.ins
66     (p_effective_date                => l_effective_date
67     ,p_business_group_id             => p_business_group_id
68     ,p_legislation_code              => p_legislation_code
69     ,p_range_or_match                => p_range_or_match
70     ,p_user_key_units                => p_user_key_units
71     ,p_user_table_name               => p_user_table_name
72     ,p_user_row_title                => p_user_row_title
73     ,p_user_table_id                 => l_user_table_id
74     ,p_object_version_number         => l_ovn
75     );
76   --
77   -- Call After Process User Hook
78   --
79   begin
80     pay_user_table_bk1.create_user_table_a
81       (p_effective_date                => l_effective_date
82       ,p_business_group_id             => p_business_group_id
83       ,p_legislation_code              => p_legislation_code
84       ,p_range_or_match                => p_range_or_match
85       ,p_user_key_units                => p_user_key_units
86       ,p_user_table_name               => p_user_table_name
87       ,p_user_row_title                => p_user_row_title
88       ,p_user_table_id                 => l_user_table_id
89       ,p_object_version_number         => l_ovn
90       );
91   exception
92     when hr_api.cannot_find_prog_unit then
93       hr_api.cannot_find_prog_unit_error
94         (p_module_name => 'create_user_table'
95         ,p_hook_type   => 'AP'
96         );
97   end;
98   --
99   -- When in validation only mode raise the Validate_Enabled exception
100   --
101   if p_validate then
102     raise hr_api.validate_enabled;
103   end if;
104   --
105   -- Set all output arguments
106   --
107   p_user_table_id          := l_user_table_id;
108   p_object_version_number  := l_ovn;
109   --
110 ---For MLS----------------------------------------------------------------------
111 pay_ptt_ins.ins_tl(userenv('LANG'),p_user_table_id,
112                              p_user_table_name,p_user_row_title);
113 --------------------------------------------------------------------------------
114   hr_utility.set_location(' Leaving:'||l_proc, 70);
115 exception
116   when hr_api.validate_enabled then
117     --
118     -- As the Validate_Enabled exception has been raised
119     -- we must rollback to the savepoint
120     --
121     rollback to create_user_table;
122     --
123     -- Only set output warning arguments
124     -- (Any key or derived arguments must be set to null
125     -- when validation only mode is being used.)
126     --
127     p_user_table_id := null;
128     p_object_version_number  := null;
129     hr_utility.set_location(' Leaving:'||l_proc, 80);
130   when others then
131     --
132     -- A validation or unexpected error has occured
133     --
134     rollback to create_user_table;
135     hr_utility.set_location(' Leaving:'||l_proc, 90);
136     raise;
137 end create_user_table;
138 --
139 -- ----------------------------------------------------------------------------
140 -- |--------------------------< update_user_table >--------------------------|
141 -- ----------------------------------------------------------------------------
142 --
143 procedure update_user_table
144   (p_validate                      in     boolean  default false
145   ,p_user_table_id                 in     number
146   ,p_effective_date                in     date
147   ,p_user_table_name               in     varchar2 default hr_api.g_varchar2
148   ,p_user_row_title                in     varchar2 default hr_api.g_varchar2
149   ,p_object_version_number         in out nocopy number
150   ) is
151   --
152   -- Declare cursors and local variables
153   --
154   l_proc                varchar2(72) := g_package||'update_user_table';
155   l_ovn                 number       := p_object_version_number;
156   l_effective_date      date;
157 begin
158   hr_utility.set_location('Entering:'|| l_proc, 10);
159   --
160   -- Issue a savepoint
161   --
162   savepoint update_user_table;
163   --
164   -- Truncate the time portion from all IN date parameters
165   --
166   l_effective_date := trunc(p_effective_date);
167   --
168   -- Call Before Process User Hook
169   --
170   begin
171     pay_user_table_bk2.update_user_table_b
172       (p_effective_date                => l_effective_date
173       ,p_user_table_id                 => p_user_table_id
174       ,p_user_table_name               => p_user_table_name
175       ,p_user_row_title                => p_user_row_title
176       ,p_object_version_number         => l_ovn
177       );
178   exception
179     when hr_api.cannot_find_prog_unit then
180       hr_api.cannot_find_prog_unit_error
181         (p_module_name => 'update_user_table'
182         ,p_hook_type   => 'BP'
183         );
184   end;
185   --
186   -- Process Logic
187   --
188   pay_put_upd.upd
189   (p_effective_date        => l_effective_date
190   ,p_user_table_id         => p_user_table_id
191   ,p_user_table_name       => p_user_table_name
192   ,p_user_row_title        => p_user_row_title
193   ,p_object_version_number => l_ovn
194   );
195   --
196   -- Call After Process User Hook
197   --
198   begin
199     pay_user_table_bk2.update_user_table_a
200       (p_effective_date                => l_effective_date
201       ,p_user_table_id                 => p_user_table_id
202       ,p_user_table_name               => p_user_table_name
203       ,p_user_row_title                => p_user_row_title
204       ,p_object_version_number         => l_ovn
205       );
206   exception
207     when hr_api.cannot_find_prog_unit then
208       hr_api.cannot_find_prog_unit_error
209         (p_module_name => 'update_user_table'
210         ,p_hook_type   => 'AP'
211         );
212   end;
213   --
214   -- When in validation only mode raise the Validate_Enabled exception
215   --
216   if p_validate then
217     raise hr_api.validate_enabled;
218   end if;
219   --
220   -- Set all output arguments
221   --
222   p_object_version_number  := l_ovn;
223   --
224 ---For MLS----------------------------------------------------------------------
225 pay_ptt_upd.upd_tl(userenv('LANG'),p_user_table_id,
226                              p_user_table_name,p_user_row_title);
227 --------------------------------------------------------------------------------
228   hr_utility.set_location(' Leaving:'||l_proc, 70);
229 exception
230   when hr_api.validate_enabled then
231     --
232     -- As the Validate_Enabled exception has been raised
233     -- we must rollback to the savepoint
234     --
235     rollback to update_user_table;
236     --
237     -- Only set output warning arguments
238     -- (Any key or derived arguments must be set to null
239     -- when validation only mode is being used.)
240     --
241     p_object_version_number  := null;
242     hr_utility.set_location(' Leaving:'||l_proc, 80);
243   when others then
244     --
245     -- A validation or unexpected error has occured
246     --
247     rollback to update_user_table;
248     hr_utility.set_location(' Leaving:'||l_proc, 90);
249     raise;
250 end update_user_table;
251 --
252 -- ----------------------------------------------------------------------------
253 -- |--------------------------< delete_user_table >--------------------------|
254 -- ----------------------------------------------------------------------------
255 --
256 procedure delete_user_table
257   (p_validate                      in     boolean  default false
258   ,p_user_table_id                 in     number
259   ,p_object_version_number         in out nocopy number
260   ) is
261   --
262   -- Declare cursors and local variables
263   --
264 
265   l_proc                varchar2(72) := g_package||'delete_user_table';
266   l_ovn                 number       := p_object_version_number;
267 begin
268   hr_utility.set_location('Entering:'|| l_proc, 10);
269   --
270   -- Issue a savepoint
271   --
272   savepoint delete_user_table;
273   --
274   -- Call Before Process User Hook
275   --
276   begin
277     pay_user_table_bk3.delete_user_table_b
278       (p_user_table_id                 => p_user_table_id
279       ,p_object_version_number         => l_ovn
280       );
281   exception
282     when hr_api.cannot_find_prog_unit then
283       hr_api.cannot_find_prog_unit_error
284         (p_module_name => 'delete_user_table'
285         ,p_hook_type   => 'BP'
286         );
287   end;
288   --
289   -- Process Logic
290   --
291   pay_put_del.del
292   (p_user_table_id         => p_user_table_id
293   ,p_object_version_number => l_ovn
294   );
295   --
296   -- Call After Process User Hook
297   --
298   begin
299     pay_user_table_bk3.delete_user_table_a
300       (p_user_table_id                 => p_user_table_id
301       ,p_object_version_number         => l_ovn
302       );
303   exception
304     when hr_api.cannot_find_prog_unit then
305       hr_api.cannot_find_prog_unit_error
306         (p_module_name => 'delete_user_table'
307         ,p_hook_type   => 'AP'
308         );
309   end;
310   --
311   -- When in validation only mode raise the Validate_Enabled exception
312   --
313   if p_validate then
314     raise hr_api.validate_enabled;
315   end if;
316   --
317   -- Set all output arguments
318   --
319   p_object_version_number  := l_ovn;
320   --
321 ---For MLS----------------------------------------------------------------------
322 pay_ptt_del.del_tl(p_user_table_id);
323 --------------------------------------------------------------------------------
324 
325   hr_utility.set_location(' Leaving:'||l_proc, 70);
326 exception
327   when hr_api.validate_enabled then
328     --
329     -- As the Validate_Enabled exception has been raised
330     -- we must rollback to the savepoint
331     --
332     rollback to delete_user_table;
333     --
334     -- Only set output warning arguments
335     -- (Any key or derived arguments must be set to null
336     -- when validation only mode is being used.)
337     --
338     p_object_version_number  := null;
339     hr_utility.set_location(' Leaving:'||l_proc, 80);
340   when others then
341     --
342     -- A validation or unexpected error has occured
343     --
344     rollback to delete_user_table;
345     hr_utility.set_location(' Leaving:'||l_proc, 90);
346     raise;
347 end delete_user_table;
348 --
349 end pay_user_table_api;