DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_STATUS_PROCESSING_RULE_API

Source


1 Package body pay_status_processing_rule_api as
2 /* $Header: pypprapi.pkb 115.3 2004/02/27 01:12:21 adkumar noship $ */
3 --
4 --
5 -- Package Variables
6 --
7 g_package  varchar2(33) := 'pay_status_processing_rule_api.';
8 --
9 -- ----------------------------------------------------------------------------
10 -- |------------------------< create_status_process_rule >------------------|
11 -- ----------------------------------------------------------------------------
12 --
13 procedure create_status_process_rule
14 (  p_validate                       in     boolean  default false
15   ,p_effective_date                 in     date
16   ,p_element_type_id                in     number
17   ,p_business_group_id              in     number   default null
18   ,p_legislation_code               in     varchar2 default null
19   ,p_assignment_status_type_id      in     number   default null
20   ,p_formula_id                     in     number   default null
21   ,p_comments                       in     varchar2 default null
22   ,p_legislation_subgroup           in     varchar2 default null
23   ,p_status_processing_rule_id         out nocopy number
24   ,p_effective_start_date              out nocopy date
25   ,p_effective_end_date                out nocopy date
26   ,p_object_version_number             out nocopy number
27   ,p_formula_mismatch_warning          out nocopy boolean
28 ) is
29  --
30   l_proc varchar2(72)          := g_package||'create_status_process_rule';
31   l_effective_date             date;
32   l_effective_start_date       pay_status_processing_rules_f.effective_start_date%type;
33   l_effective_end_date         pay_status_processing_rules_f.effective_end_date%type;
34   l_status_processing_rule_id  pay_status_processing_rules_f.status_processing_rule_id%type;
35   l_object_version_number      pay_status_processing_rules_f.object_version_number%type;
36   l_comment_id                 pay_status_processing_rules_f.comment_id%type;
37   l_formula_mismatch_warning boolean;
38  --
39 begin
40   --
41   hr_utility.set_location('Entering:'|| l_proc, 10);
42   --
43   -- Issue the savepoint.
44   --
45     savepoint create_status_process_rule;
46   --
47   --
48   -- Truncate the time portion from all IN date parameters
49   --
50   l_effective_date := trunc(p_effective_date);
51   --
52   -- Call Before Process User Hook
53   --
54   begin
55     pay_status_processing_rule_bk1.create_status_process_rule_b
56       (p_effective_date             =>  l_effective_date
57       ,p_element_type_id            =>  p_element_type_id
58       ,p_business_group_id          =>  p_business_group_id
59       ,p_legislation_code           =>  p_legislation_code
60       ,p_assignment_status_type_id  =>  p_assignment_status_type_id
61       ,p_formula_id                 =>  p_formula_id
62       ,p_comments                   =>  p_comments
63       ,p_legislation_subgroup       =>  p_legislation_subgroup
64       );
65   exception
66     when hr_api.cannot_find_prog_unit then
67       hr_api.cannot_find_prog_unit_error
68         (p_module_name => 'CREATE_STATUS_PROCESS_RULE'
69         ,p_hook_type   => 'BP'
70         );
71   end;
72   --
73   hr_utility.set_location('Entering:'||l_proc, 20);
74   --
75   -- Process Logic
76   --
77   pay_ppr_ins.ins
78   ( p_effective_date                 => l_effective_date
79    ,p_element_type_id                => p_element_type_id
80    ,p_business_group_id              => p_business_group_id
81    ,p_legislation_code               => p_legislation_code
82    ,p_assignment_status_type_id      => p_assignment_status_type_id
83    ,p_formula_id                     => p_formula_id
84    ,p_comments                       => p_comments
85    ,p_legislation_subgroup           => p_legislation_subgroup
86    ,p_status_processing_rule_id      => l_status_processing_rule_id
87    ,p_object_version_number          => l_object_version_number
88    ,p_effective_start_date           => l_effective_start_date
89    ,p_effective_end_date             => l_effective_end_date
90    ,p_comment_id                     => l_comment_id
91    ,p_formula_mismatch_warning       => l_formula_mismatch_warning
92   );
93   --
94   -- Call After Process User Hook
95     hr_utility.set_location('Entering:'||l_proc, 30);
96   --
97   begin
98     pay_status_processing_rule_bk1.create_status_process_rule_a
99       (p_effective_date             =>  l_effective_date
100       ,p_element_type_id            =>  p_element_type_id
101       ,p_business_group_id          =>  p_business_group_id
102       ,p_legislation_code           =>  p_legislation_code
103       ,p_assignment_status_type_id  =>  p_assignment_status_type_id
104       ,p_formula_id                 =>  p_formula_id
105       ,p_comments                   =>  p_comments
106       ,p_legislation_subgroup       =>  p_legislation_subgroup
107       ,p_status_processing_rule_id  =>  l_status_processing_rule_id
108       ,p_effective_start_date       =>  l_effective_start_date
109       ,p_effective_end_date         =>  l_effective_end_date
110       ,p_object_version_number      =>  l_object_version_number
111      ,p_formula_mismatch_warning    => l_formula_mismatch_warning
112       );
113   exception
114     when hr_api.cannot_find_prog_unit then
115       hr_api.cannot_find_prog_unit_error
116         (p_module_name => 'CREATE_STATUS_PROCESS_RULE'
117         ,p_hook_type   => 'AP'
118         );
119   end;
120   --
121  --
122  -- When in validation only mode raise the Validate_Enabled exception
123  --
124   If p_validate then
125     Raise HR_Api.Validate_Enabled;
126   End If;
127   -- set all OUT parameter for message
128     p_status_processing_rule_id := l_status_processing_rule_id;
129     p_effective_start_date      := l_effective_start_date;
130     p_effective_end_date        := l_effective_end_date;
131     p_object_version_number     := l_object_version_number;
132     p_formula_mismatch_warning  := l_formula_mismatch_warning;
133 --
134   hr_utility.set_location(' Leaving:'||l_proc, 40);
135 exception
136   --
137   when HR_Api.Validate_Enabled then
138     --
139     -- As the Validate_Enabled exception has been raised
140     -- we must rollback to the savepoint
141     --
142       ROLLBACK TO create_status_process_rule;
143     --
144     -- Only set output warning arguments
145     -- (Any key or derived arguments must be set to null
146     -- when validation only mode is being used.)
147     --
148       p_object_version_number         := null;
149       p_status_processing_rule_id     := null;
150       p_effective_start_date          := null;
154     --
151       p_effective_end_date            := null;
152     --
153       p_formula_mismatch_warning   := l_formula_mismatch_warning ;
155     hr_utility.set_location(' Leaving:'||l_proc, 50);
156   when others then
157     --
158     -- A validation or unexpected error has occured
159     --
160     rollback to create_status_process_rule;
161     hr_utility.set_location(' Leaving:'||l_proc, 60);
162     raise;
163 end create_status_process_rule;
164 
165 -- ----------------------------------------------------------------------------
166 -- |------------------------< update_status_process_rule >-----------------|
167 -- ----------------------------------------------------------------------------
168 --
169 procedure update_status_process_rule
170 (  p_validate                     in     boolean default false
171   ,p_effective_date               in     date
172   ,p_datetrack_mode               in     varchar2
176   ,p_comments                     in     varchar2  default hr_api.g_varchar2
173   ,p_status_processing_rule_id    in     number
174   ,p_object_version_number        in out nocopy number
175   ,p_formula_id                   in     number    default hr_api.g_number
177   ,p_effective_start_date            out nocopy date
178   ,p_effective_end_date              out nocopy date
179   ,p_formula_mismatch_warning        out nocopy boolean
180 ) is
181   --
182   -- Declare cursors and local variables
183   --
184   l_proc                  varchar2(72) := g_package||'update_status_process_rule';
185   l_object_version_number pay_status_processing_rules_f.object_version_number%type;
186   l_effective_date        date;
187   l_effective_start_date  pay_status_processing_rules_f.effective_start_date%type;
188   l_effective_end_date    pay_status_processing_rules_f.effective_end_date%type;
189   l_temp_ovn              pay_status_processing_rules_f.object_version_number%type;
190   l_formula_mismatch_warning boolean;
191   --
192 begin
193   hr_utility.set_location('Entering:'|| l_proc, 10);
194   --
195   -- Issue the savepoint.
196    --
197     savepoint update_status_process_rule;
198  --
199   l_temp_ovn   := p_object_version_number;
200   l_object_version_number := p_object_version_number;
201 
202   -- Truncate the time portion from all IN date parameters
203   --
204   l_effective_date := trunc(p_effective_date);
205   --
206   -- Call Before Process User Hook
207   --
208   begin
209     pay_status_processing_rule_bk2.update_status_process_rule_b
210       (p_effective_date             =>  l_effective_date
211       ,p_datetrack_mode             =>  p_datetrack_mode
212       ,p_status_processing_rule_id  =>  p_status_processing_rule_id
213       ,p_object_version_number      =>  l_object_version_number
214       ,p_formula_id                 =>  p_formula_id
215       ,p_comments                   =>  p_comments
216       );
217   exception
218     when hr_api.cannot_find_prog_unit then
219       hr_api.cannot_find_prog_unit_error
220         (p_module_name => 'UPDATE_STATUS_PROCESS_RULE'
221         ,p_hook_type   => 'BP'
222         );
223   end;
224   --
225   -- call business process
226   --
227     hr_utility.set_location(l_proc, 20);
228   --
229  pay_ppr_upd.upd
230  ( p_effective_date               => l_effective_date
231   ,p_datetrack_mode               => p_datetrack_mode
232   ,p_status_processing_rule_id    => p_status_processing_rule_id
233   ,p_object_version_number        => l_object_version_number
234   ,p_formula_id                   => p_formula_id
235   ,p_comments                     => p_comments
236   ,p_effective_start_date	  => l_effective_start_date
237   ,p_effective_end_date		  => l_effective_end_date
238   ,p_formula_mismatch_warning     => l_formula_mismatch_warning
239   );
240 
241    -- Call After Process User Hook
242   --
243     hr_utility.set_location(l_proc, 30);
244   --
245   begin
246     pay_status_processing_rule_bk2.update_status_process_rule_a
247       (p_effective_date             =>  l_effective_date
248       ,p_datetrack_mode             =>  p_datetrack_mode
249       ,p_status_processing_rule_id  =>  p_status_processing_rule_id
250       ,p_object_version_number      =>  l_object_version_number
251       ,p_formula_id                 =>  p_formula_id
252       ,p_comments                   =>  p_comments
253       ,p_effective_start_date       =>  l_effective_start_date
254       ,p_effective_end_date         =>  l_effective_end_date
255       ,p_formula_mismatch_warning   =>  l_formula_mismatch_warning
256       );
257   exception
258     when hr_api.cannot_find_prog_unit then
259       hr_api.cannot_find_prog_unit_error
260         (p_module_name => 'UPDATE_STATUS_PROCESS_RULE'
261         ,p_hook_type   => 'AP'
262         );
263   end;
264   --
265 
266   hr_utility.set_location(l_proc, 40);
267 --
268   --
269   -- If we are validating then raise the Validate_Enabled exception
270   --
271   If p_validate then
272     Raise HR_Api.Validate_Enabled;
273   End If;
274   --
275    --
276   -- Set all output arguments
277   --
278   p_object_version_number      := l_object_version_number;
279   p_effective_start_date       := l_effective_start_date;
280   p_effective_end_date         := l_effective_end_date;
281   p_formula_mismatch_warning   := l_formula_mismatch_warning ;
282 --
283   hr_utility.set_location('Leaving :'||l_proc, 50);
284 exception
285  WHEN hr_api.validate_enabled THEN
286     --
287     -- As the Validate_Enabled EXCEPTION has been raised
288     -- we must rollback to the SAVEPOINT
289     --
290     ROLLBACK TO update_status_process_rule;
291     --
292     -- Only set output warning arguments
293     -- (Any key or derived arguments must be set to null
294     -- WHEN validation only mode is being used.)
295     --
296     p_effective_start_date       := l_effective_start_date;
297     p_effective_end_date         := l_effective_end_date;
298     p_object_version_number      := l_temp_ovn;
299     p_formula_mismatch_warning   := l_formula_mismatch_warning ;
300     --
301     hr_utility.set_location(' Leaving:'||l_proc, 60);
302     --
303   WHEN others THEN
304     --
305     -- A validation or unexpected error has occured
306     --
307     ROLLBACK TO update_status_process_rule;
308     hr_utility.set_location(' Leaving:'||l_proc, 70);
309     RAISE;
310     --
311 end update_status_process_rule;
312 --
313 -- ----------------------------------------------------------------------------
314 -- |----------------------------< delete_status_process_rule >-------------------------|
315 -- ----------------------------------------------------------------------------
316 --
317 PROCEDURE delete_status_process_rule
318   (p_validate                       in    boolean  default false
319   ,p_effective_date                 in    date
320   ,p_datetrack_mode                 in    varchar2
321   ,p_status_processing_rule_id      in    number
322   ,p_object_version_number          in out nocopy number
323   ,p_effective_start_date              out nocopy date
324   ,p_effective_end_date                out nocopy date) IS
325   --
326   -- Declare cursors and local variables
327   --
328   l_proc                  varchar2(72) := g_package||'delete_status_process_rule';
329   l_object_version_number pay_status_processing_rules_f.object_version_number%TYPE;
330   l_effective_start_date  pay_status_processing_rules_f.effective_start_date%TYPE;
331   l_effective_end_date    pay_status_processing_rules_f.effective_end_date%TYPE;
332   l_effective_date        date;
333   l_temp_ovn              number := p_object_version_number;
334   --
335 BEGIN
336   --
337   hr_utility.set_location('Entering:'|| l_proc, 10);
338   --
339   -- Issue a SAVEPOINT IF operating in validation only mode
340   --
341   SAVEPOINT delete_status_process_rule;
342   --
343   l_effective_date := TRUNC(p_effective_date);
344   --
345   hr_utility.set_location(l_proc, 20);
346   --
347   -- Process Logic
348   --
349   l_object_version_number := p_object_version_number;
350   --
351   -- Call Before Process User Hook
352   --
353   begin
354     pay_status_processing_rule_bk3.delete_status_process_rule_b
355       (p_effective_date             =>  l_effective_date
356       ,p_datetrack_mode             =>  p_datetrack_mode
357       ,p_status_processing_rule_id  =>  p_status_processing_rule_id
358       ,p_object_version_number      =>  l_object_version_number
359       );
360   exception
361     when hr_api.cannot_find_prog_unit then
362       hr_api.cannot_find_prog_unit_error
363         (p_module_name => 'DELETE_STATUS_PROCESS_RULE'
364         ,p_hook_type   => 'BP'
365         );
366   end;
367   --
368   hr_utility.set_location(l_proc, 20);
369   --
370   pay_ppr_del.del
371   ( p_effective_date               => l_effective_date
372   ,p_datetrack_mode                => p_datetrack_mode
373   ,p_status_processing_rule_id     => p_status_processing_rule_id
374   ,p_object_version_number         => l_object_version_number
375   ,p_effective_start_date          => l_effective_start_date
376   ,p_effective_end_date            => l_effective_end_date);
377   --
378   -- Call After Process User Hook
379   --
380   hr_utility.set_location(l_proc, 30);
381   --
382   begin
383     pay_status_processing_rule_bk3.delete_status_process_rule_a
384       (p_effective_date             =>  l_effective_date
385       ,p_datetrack_mode             =>  p_datetrack_mode
386       ,p_status_processing_rule_id  =>  p_status_processing_rule_id
387       ,p_object_version_number      =>  l_object_version_number
388       ,p_effective_start_date       =>  l_effective_start_date
389       ,p_effective_end_date         =>  l_effective_end_date
390       );
391   exception
392     when hr_api.cannot_find_prog_unit then
393       hr_api.cannot_find_prog_unit_error
394         (p_module_name => 'DELETE_STATUS_PROCESS_RULE'
395         ,p_hook_type   => 'AP'
396         );
397   end;
398   --
399   hr_utility.set_location(l_proc, 40);
400   --
401   -- When in validation only mode RAISE the Validate_Enabled EXCEPTION
402   --
403   IF p_validate THEN
404     --
405     RAISE hr_api.validate_enabled;
406     --
407   END IF;
408   --
409   -- Set all output arguments
410   --
411   p_object_version_number := l_object_version_number;
412   p_effective_start_date  := l_effective_start_date;
413   p_effective_end_date    := l_effective_end_date;
414   --
415   hr_utility.set_location(' Leaving:'||l_proc, 50);
416   --
417 EXCEPTION
418   --
419   WHEN hr_api.validate_enabled THEN
420     --
421     -- As the Validate_Enabled EXCEPTION has been RAISED
422     -- we must rollback to the SAVEPOINT
423     --
424     ROLLBACK TO delete_status_process_rule;
425     --
426     -- Only set output warning arguments
427     -- (Any key or derived arguments must be set to null
428     -- WHEN validation only mode is being used.)
429     --
430     p_effective_start_date := null;
431     p_effective_end_date   := null;
432     p_object_version_number := l_temp_ovn;
433     --
434     hr_utility.set_location(' Leaving:'||l_proc, 60);
435     --
436   WHEN others THEN
437     --
438     -- A validation or unexpected error has occured
439     --
440     ROLLBACK TO delete_status_process_rule;
441     -- Reset IN OUT parameters and set OUT parameters.
442     hr_utility.set_location(' Leaving:'||l_proc, 70);
443     RAISE;
444     --
445 END delete_status_process_rule;
446 --
447 
448 END pay_status_processing_rule_api;