DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_ERG_API

Source


1 Package Body pqp_erg_api as
2 /* $Header: pqergapi.pkb 120.1 2006/10/20 18:43:18 sshetty noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  pqp_erg_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |---------------------< create_exception_group >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_exception_group
13   (p_validate                      in     boolean  default false
14   ,p_exception_group_name           in     varchar2 default null
15   ,p_exception_report_id            in     number
16   ,p_legislation_code               in     varchar2 default null
17   ,p_business_group_id              in     number   default null
18   ,p_consolidation_set_id           in     number   default null
19   ,p_payroll_id                     in     number   default null
20   ,p_exception_group_id                out nocopy number
21   ,p_object_version_number             out nocopy number
22   ,p_output_format                  in     varchar2
23   ) is
24 
25   --
26   -- Declare cursors and local variables
27   --
28 
29   l_proc                       varchar2(72) := g_package||'create_exception_group';
30   l_exception_group_id  number;
31   l_object_version_number      number;
32   l_output_format              pqp_exception_report_groups.output_format%TYPE;
33 
34 begin
35   hr_utility.set_location('Entering:'|| l_proc, 10);
36   --
37   -- Issue a savepoint
38   --
39   savepoint create_exception_group;
40 
41   hr_utility.set_location(l_proc, 20);
42   --
43   -- Call Before Process User Hook
44   --
45   l_output_format :=p_output_format;
46   begin
47     pqp_exception_group_bk1.create_exception_group_b
48       (p_exception_group_name    => p_exception_group_name
49       ,p_exception_report_id     => p_exception_report_id
50       ,p_legislation_code        => p_legislation_code
51       ,p_business_group_id       => p_business_group_id
52       ,p_consolidation_set_id    => p_consolidation_set_id
53       ,p_payroll_id              => p_payroll_id
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_exception_group'
59         ,p_hook_type   => 'BP'
60         );
61   end;
62   hr_utility.set_location(l_proc, 30);
63   --
64   -- Validation in addition to Row Handlers
65   --
66   hr_utility.set_location(l_proc, 40);
67   --
68   -- Process Logic
69   --
70   IF p_output_format ='TXT' THEN
71    l_output_format:='PDF' ;
72   END IF;
73 
74   pqp_erg_ins.ins (
75    p_exception_group_name  => p_exception_group_name
76   ,p_exception_report_id   => p_exception_report_id
77   ,p_legislation_code      => p_legislation_code
78   ,p_business_group_id     => p_business_group_id
79   ,p_consolidation_set_id  => p_consolidation_set_id
80   ,p_payroll_id            => p_payroll_id
81   ,p_exception_group_id    => l_exception_group_id
82   ,p_object_version_number => l_object_version_number
83   ,p_output_format         => l_output_format
84       );
85 
86   hr_utility.set_location(l_proc, 50);
87   --
88   -- Call After Process User Hook
89   --
90   begin
91     pqp_exception_group_bk1.create_exception_group_a
92       (p_exception_group_name    => p_exception_group_name
93       ,p_exception_report_id     => p_exception_report_id
94       ,p_legislation_code        => p_legislation_code
95       ,p_business_group_id       => p_business_group_id
96       ,p_consolidation_set_id    => p_consolidation_set_id
97       ,p_payroll_id              => p_payroll_id
98       ,p_exception_group_id      => l_exception_group_id
99       ,p_object_version_number   => l_object_version_number
100       );
101   exception
102     when hr_api.cannot_find_prog_unit then
103       hr_api.cannot_find_prog_unit_error
104         (p_module_name => 'create_exception_group'
105         ,p_hook_type   => 'AP'
106         );
107   end;
108   hr_utility.set_location(l_proc, 60);
109   --
110   -- When in validation only mode raise the Validate_Enabled exception
111   --
112   if p_validate then
113     raise hr_api.validate_enabled;
114   end if;
115   --
116   -- Set all output arguments
117   --
118   p_exception_group_id        := l_exception_group_id;
119   p_object_version_number      := l_object_version_number;
120   --
121   hr_utility.set_location(' Leaving:'||l_proc, 70);
122 exception
123   when hr_api.validate_enabled then
124     --
125     -- As the Validate_Enabled exception has been raised
126     -- we must rollback to the savepoint
127     --
128     rollback to create_exception_group;
129     --
130     -- Only set output warning arguments
131     -- (Any key or derived arguments must be set to null
132     -- when validation only mode is being used.)
133     --
134     p_exception_group_id        := null;
135     p_object_version_number      := null;
136     hr_utility.set_location(' Leaving:'||l_proc, 80);
137   when others then
138     --
139     -- A validation or unexpected error has occured
140     --
141     rollback to create_exception_group;
142     p_exception_group_id        := null;
143     p_object_version_number     := null;
144     hr_utility.set_location(' Leaving:'||l_proc, 90);
145     raise;
146 end create_exception_group;
147 --
148 -- ----------------------------------------------------------------------------
149 -- |---------------------< update_exception_group >--------------------------|
150 -- ----------------------------------------------------------------------------
151 --
152 procedure update_exception_group
153   (p_validate                     in     boolean   default false
154   ,p_exception_group_id           in     number    default hr_api.g_number
155   ,p_exception_group_name         in     varchar2  default hr_api.g_varchar2
156   ,p_exception_report_id          in     number    default hr_api.g_number
157   ,p_legislation_code             in     varchar2  default hr_api.g_varchar2
158   ,p_business_group_id            in     number    default hr_api.g_number
159   ,p_consolidation_set_id         in     number    default hr_api.g_number
160   ,p_payroll_id                   in     number    default hr_api.g_number
161   ,p_object_version_number        in out nocopy number
162   ,p_output_format                in     varchar2  default hr_api.g_varchar2
163   ) is
164 
165   --
166   -- Declare cursors and local variables
167   --
168 
169   l_proc                varchar2(72) := g_package||'update_exception_group';
170   l_object_version_number      number;
171 
172   l_output_format              pqp_exception_report_groups.output_format%TYPE;
173 begin
174   hr_utility.set_location('Entering:'|| l_proc, 10);
175   --
176   -- Issue a savepoint
177   --
178   savepoint update_exception_group;
179 
180   hr_utility.set_location(l_proc, 20);
181   --
182   -- Call Before Process User Hook
183   --
184   l_output_format:=p_output_format;
185   begin
186     pqp_exception_group_bk2.update_exception_group_b
187       (p_exception_group_name    => p_exception_group_name
188       ,p_exception_report_id     => p_exception_report_id
189       ,p_legislation_code        => p_legislation_code
190       ,p_business_group_id       => p_business_group_id
191       ,p_consolidation_set_id    => p_consolidation_set_id
192       ,p_payroll_id              => p_payroll_id
193       ,p_exception_group_id      => p_exception_group_id
194       ,p_object_version_number   => p_object_version_number
195       );
196   exception
197     when hr_api.cannot_find_prog_unit then
198       hr_api.cannot_find_prog_unit_error
199         (p_module_name => 'update_exception_group'
200         ,p_hook_type   => 'BP'
201         );
202   end;
203   hr_utility.set_location(l_proc, 30);
204   --
205   -- Validation in addition to Row Handlers
206   --
207   hr_utility.set_location(l_proc, 40);
208   --
209   -- Process Logic
210   --
211   l_object_version_number  := p_object_version_number;
212 
213   IF p_output_format ='TXT' THEN
214    l_output_format:='PDF' ;
215   END IF;
216 
217   pqp_erg_upd.upd (
218    p_exception_group_name  => p_exception_group_name
219   ,p_exception_report_id   => p_exception_report_id
220   ,p_legislation_code      => p_legislation_code
221   ,p_business_group_id     => p_business_group_id
222   ,p_consolidation_set_id  => p_consolidation_set_id
223   ,p_payroll_id            => p_payroll_id
224   ,p_exception_group_id    => p_exception_group_id
225   ,p_object_version_number => l_object_version_number
226   ,p_output_format         => l_output_format
227       );
228 
229   hr_utility.set_location(l_proc, 50);
230   --
231   -- Call After Process User Hook
232   --
233   begin
234     pqp_exception_group_bk2.update_exception_group_a
235       (p_exception_group_name    => p_exception_group_name
236       ,p_exception_report_id     => p_exception_report_id
237       ,p_legislation_code        => p_legislation_code
238       ,p_business_group_id       => p_business_group_id
239       ,p_consolidation_set_id    => p_consolidation_set_id
240       ,p_payroll_id              => p_payroll_id
241       ,p_exception_group_id      => p_exception_group_id
242       ,p_object_version_number   => l_object_version_number
243       );
244   exception
245     when hr_api.cannot_find_prog_unit then
246       hr_api.cannot_find_prog_unit_error
247         (p_module_name => 'update_exception_group'
248         ,p_hook_type   => 'AP'
249         );
250   end;
251   hr_utility.set_location(l_proc, 60);
252   --
253   -- When in validation only mode raise the Validate_Enabled exception
254   --
255   if p_validate then
256     raise hr_api.validate_enabled;
257   end if;
258   --
259   -- Set all output arguments
260   --
261   p_object_version_number      := l_object_version_number;
262   --
263   hr_utility.set_location(' Leaving:'||l_proc, 70);
264 exception
265   when hr_api.validate_enabled then
266     --
267     -- As the Validate_Enabled exception has been raised
268     -- we must rollback to the savepoint
269     --
270     rollback to update_exception_group;
271     --
272     -- Only set output warning arguments
273     -- (Any key or derived arguments must be set to null
274     -- when validation only mode is being used.)
275     --
276     p_object_version_number      := null;
277     hr_utility.set_location(' Leaving:'||l_proc, 80);
278   when others then
279     --
280     -- A validation or unexpected error has occured
281     --
282     rollback to update_exception_group;
283     p_object_version_number      :=  l_object_version_number    ;
284     hr_utility.set_location(' Leaving:'||l_proc, 90);
285     raise;
286 end update_exception_group;
287 --
288 -- ----------------------------------------------------------------------------
289 -- |---------------------< delete_exception_group >--------------------------|
290 -- ----------------------------------------------------------------------------
291 --
292 procedure delete_exception_group
293   (p_validate                      in     boolean  default false
294   ,p_exception_group_id            in     number
295   ,p_object_version_number         in     number
296   ) is
297 
298   --
299   -- Declare cursors and local variables
300   --
301 
302   l_proc                varchar2(72) := g_package||'delete_exception_group';
303 
304 begin
305   hr_utility.set_location('Entering:'|| l_proc, 10);
306   --
307   -- Issue a savepoint
308   --
309   savepoint delete_exception_group;
310   --
311   hr_utility.set_location(l_proc, 20);
312   --
313   -- Call Before Process User Hook
314   --
315   begin
316     pqp_exception_group_bk3.delete_exception_group_b
317       (p_exception_group_id => p_exception_group_id
318       ,p_object_version_number => p_object_version_number
319       );
320   exception
321     when hr_api.cannot_find_prog_unit then
322       hr_api.cannot_find_prog_unit_error
323         (p_module_name => 'delete_exception_group'
324         ,p_hook_type   => 'BP'
325         );
326   end;
327   hr_utility.set_location(l_proc, 30);
328   --
329   -- Validation in addition to Row Handlers
330   --
331 
332 
333 
334   hr_utility.set_location(l_proc, 40);
335   --
336   -- Process Logic
337   --
338 
339 
340   pqp_erg_del.del (
341     p_exception_group_id => p_exception_group_id
342    ,p_object_version_number => p_object_version_number
343       );
344 
345   hr_utility.set_location(l_proc, 50);
346   --
347   -- Call After Process User Hook
348   --
349   begin
350     pqp_exception_group_bk3.delete_exception_group_a
351       (p_exception_group_id => p_exception_group_id
352       ,p_object_version_number => p_object_version_number
353       );
354   exception
355     when hr_api.cannot_find_prog_unit then
356       hr_api.cannot_find_prog_unit_error
357         (p_module_name => 'delete_exception_group'
358         ,p_hook_type   => 'AP'
359         );
360   end;
361   hr_utility.set_location(l_proc, 60);
362   --
363   -- When in validation only mode raise the Validate_Enabled exception
364   --
365   if p_validate then
366     raise hr_api.validate_enabled;
367   end if;
368   --
369   -- Set all output arguments
370   --
371   --
372   hr_utility.set_location(' Leaving:'||l_proc, 70);
373 exception
374   when hr_api.validate_enabled then
375     --
376     -- As the Validate_Enabled exception has been raised
377     -- we must rollback to the savepoint
378     --
379     rollback to delete_exception_group;
380     --
381     -- Only set output warning arguments
382     -- (Any key or derived arguments must be set to null
383     -- when validation only mode is being used.)
384     --
385     hr_utility.set_location(' Leaving:'||l_proc, 80);
386   when others then
387     --
388     -- A validation or unexpected error has occured
389     --
390     rollback to delete_exception_group;
391     hr_utility.set_location(' Leaving:'||l_proc, 90);
392     raise;
393 end delete_exception_group;
394 --
395 -- ----------------------------------------------------------------------------
396 -- |---------------------< delete_exception_group >--------------------------|
397 -- ----------------------------------------------------------------------------
398 --
399 procedure delete_exception_group
400   (p_validate                      in     boolean  default false
401   ,p_exception_group_name          in     varchar2
402   ,p_business_group_id		   in	  number
403   ) is
404 
405   --
406   -- Declare cursors and local variables
407   --
408   Cursor c_GrpDets Is
409   Select * from pqp_exception_report_groups
410   Where exception_group_name = p_exception_group_name
411     and business_group_id    = p_business_group_id;
412 
413 
414   -- RowType variable declaration
415   r_GrpDets		c_GrpDets%ROWTYPE;
416 
417   -- Local variable declaration
418   l_proc                varchar2(72) := g_package||'delete_exception_group';
419 
420 begin
421   hr_utility.set_location('Entering:'|| l_proc, 10);
422   --
423   -- Process Logic
424   --
425   For r_GrpDets in c_GrpDets
426   Loop -- 1
427 
428     pqp_erg_api.delete_exception_group
429       		(p_validate			=> p_validate
430       		,p_exception_group_id		=> r_GrpDets.exception_group_id
431       		,p_object_version_number	=> r_GrpDets.object_version_number
432       		);
433 
434   End Loop; -- 1
435   --
436   hr_utility.set_location(l_proc, 20);
440   hr_utility.set_location(' Leaving:'||l_proc, 30);
437   -- Set all output arguments
438   --
439   --
441 exception
442   when others then
443     --
444     -- A validation or unexpected error has occured
445     --
446     hr_utility.set_location(' Leaving:'||l_proc, 40);
447     raise;
448 end delete_exception_group;
449 --
450 end pqp_erg_api;