DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_BALANCE_ATTRIBUTE_API

Source


1 Package Body PAY_BALANCE_ATTRIBUTE_API as
2 /* $Header: pypbaapi.pkb 115.1 2002/12/11 15:11:03 exjones noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  PAY_BALANCE_ATTRIBUTE_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-----------------------< create_balance_attribute >-----------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_balance_attribute
13   (p_validate                      in            boolean  default false
14   ,p_attribute_id                  in            number
15   ,p_defined_balance_id            in            number
16   ,p_business_group_id             in            number
17   ,p_legislation_code              in            varchar2 default null
18   ,p_balance_attribute_id             out nocopy number
19   ) is
20   --
21   -- Declare cursors and local variables
22   --
23   l_proc           varchar2(72) := g_package||'create_balance_attribute';
24   --
25   -- Declare OUT variables
26   --
27   l_balance_attribute_id     pay_balance_attributes.balance_attribute_id%type;
28   --
29 begin
30   hr_utility.set_location('Entering:'|| l_proc, 10);
31   --
32   -- Issue a savepoint
33   --
34   savepoint create_balance_attribute;
35   --
36   -- Truncate the time portion from all IN date parameters
37   --
38     hr_utility.set_location(l_proc, 20);
39   --
40   -- Call Before Process User Hook
41   --
42   begin
43     PAY_BALANCE_ATTRIBUTE_BK1.create_balance_attribute_b
44       (p_attribute_id                  => p_attribute_id
45       ,p_defined_balance_id            => p_defined_balance_id
46       ,p_business_group_id             => p_business_group_id
47       ,p_legislation_code              => p_legislation_code
48       );
49   exception
50     when hr_api.cannot_find_prog_unit then
51       hr_api.cannot_find_prog_unit_error
52         (p_module_name => 'create_balance_attribute'
53         ,p_hook_type   => 'BP'
54         );
55   end;
56   --
57   hr_utility.set_location(l_proc, 25);
58   --
59   -- Validation in addition to Row Handlers
60   --
61   -- Process Logic
62   --
63     pay_pba_ins.ins
64        (p_attribute_id         => p_attribute_id
65        ,p_defined_balance_id   => p_defined_balance_id
66        ,p_legislation_code     => p_legislation_code
67        ,p_business_group_id    => p_business_group_id
68        ,p_balance_attribute_id => l_balance_attribute_id
69        );
70     --
71     hr_utility.set_location(l_proc, 30);
72   --
73   -- Call After Process User Hook
74   --
75   begin
76     PAY_BALANCE_ATTRIBUTE_BK1.create_balance_attribute_a
77       (p_attribute_id                  => p_attribute_id
78       ,p_defined_balance_id            => p_defined_balance_id
79       ,p_business_group_id             => p_business_group_id
80       ,p_legislation_code              => p_legislation_code
81       ,p_balance_attribute_id          => l_balance_attribute_id
82       );
83   exception
84     when hr_api.cannot_find_prog_unit then
85       hr_api.cannot_find_prog_unit_error
86         (p_module_name => 'create_balance_attribute'
87         ,p_hook_type   => 'AP'
88         );
89   end;
90   --
91     hr_utility.set_location(l_proc, 40);
92   --
93   -- When in validation only mode raise the Validate_Enabled exception
94   --
95   if p_validate then
96     raise hr_api.validate_enabled;
97   end if;
98   --
99   -- Set all output arguments
100   --
101   p_balance_attribute_id           := l_balance_attribute_id;
102   --
103   hr_utility.set_location(' Leaving:'||l_proc, 70);
104 exception
105   when hr_api.validate_enabled then
106     --
107     -- As the Validate_Enabled exception has been raised
108     -- we must rollback to the savepoint
109     --
110     rollback to create_balance_attribute;
111     --
112     -- Only set output warning arguments
113     -- (Any key or derived arguments must be set to null
114     -- when validation only mode is being used.)
115     --
116     p_balance_attribute_id             := null;
117     hr_utility.set_location(' Leaving:'||l_proc, 80);
118   when others then
119     --
120     -- A validation or unexpected error has occured
121     --
122     rollback to create_balance_attribute;
123     hr_utility.set_location(' Leaving:'||l_proc, 90);
124     raise;
125 end create_balance_attribute;
126 --
127 -- ----------------------------------------------------------------------------
128 -- |----------------< delete_balance_attribute >-----------------------|
129 -- ----------------------------------------------------------------------------
130 --
131 procedure delete_balance_attribute
132   (p_validate                      in     boolean  default false
133   ,p_balance_attribute_id          in     number
134   ,p_business_group_id             in     number   default null
135   ,p_legislation_code              in     varchar2 default null
136   ) is
137   --
138   -- Declare cursors and local variables
139   --
140   l_proc           varchar2(72) := g_package||'delete_balance_attribute';
141   --
142 begin
146   --
143   hr_utility.set_location('Entering:'|| l_proc, 10);
144   --
145   -- Issue a savepoint
147   savepoint delete_balance_attribute;
148   --
149     hr_utility.set_location(l_proc, 20);
150   --
151   -- Call Before Process User Hook
152   --
153   begin
154     PAY_BALANCE_ATTRIBUTE_BK2.delete_balance_attribute_b
155       (p_balance_attribute_id          => p_balance_attribute_id
156       ,p_business_group_id             => p_business_group_id
157       ,p_legislation_code              => p_legislation_code
158       );
159   exception
160     when hr_api.cannot_find_prog_unit then
161       hr_api.cannot_find_prog_unit_error
162         (p_module_name => 'delete_balance_attribute'
163         ,p_hook_type   => 'BP'
164         );
165   end;
166   hr_utility.set_location(l_proc, 25);
167   --
168   -- Validation in addition to Row Handlers
169   --
170   -- Process Logic
171   --
172     pay_pba_del.del
173        (p_balance_attribute_id    => p_balance_attribute_id
174        );
175     --
176     hr_utility.set_location(l_proc, 30);
177   --
178   -- Call After Process User Hook
179   --
180   begin
181     PAY_BALANCE_ATTRIBUTE_BK2.delete_balance_attribute_a
182       (p_balance_attribute_id          => p_balance_attribute_id
183       ,p_business_group_id             => p_business_group_id
184       ,p_legislation_code              => p_legislation_code
185       );
186   exception
187     when hr_api.cannot_find_prog_unit then
188       hr_api.cannot_find_prog_unit_error
189         (p_module_name => 'delete_balance_attribute'
190         ,p_hook_type   => 'AP'
191         );
192   end;
193   --
194     hr_utility.set_location(l_proc, 40);
195   --
196   -- When in validation only mode raise the Validate_Enabled exception
197   --
198   if p_validate then
199     raise hr_api.validate_enabled;
200   end if;
201   --
202   -- Set all output arguments
203   --
204   --
205   hr_utility.set_location(' Leaving:'||l_proc, 70);
206 exception
207   when hr_api.validate_enabled then
208     --
209     -- As the Validate_Enabled exception has been raised
210     -- we must rollback to the savepoint
211     --
212     rollback to delete_balance_attribute;
213     --
214   when others then
215     --
216     -- A validation or unexpected error has occured
217     --
218     rollback to delete_balance_attribute;
219     hr_utility.set_location(' Leaving:'||l_proc, 90);
220     raise;
221 end delete_balance_attribute;
222 --
223 end PAY_BALANCE_ATTRIBUTE_API;