DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_BAL_ATTRIB_DEFINITION_API

Source


1 Package Body PAY_BAL_ATTRIB_DEFINITION_API as
2 /* $Header: pyatdapi.pkb 115.3 2003/05/28 18:45:53 rthirlby noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  PAY_BAL_ATTRIB_DEFINITION_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-------------------< create_bal_attrib_definition >-----------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_bal_attrib_definition
13   (p_validate                      in     boolean  default false
14   ,p_effective_date                in     date
15   ,p_attribute_name                in     varchar2
16   ,p_business_group_id             in     number
17   ,p_legislation_code              in     varchar2 default null
18   ,p_alterable                     in     varchar2 default null
19   ,p_user_attribute_name           in     varchar2 default null
20   ,p_attribute_id                     out nocopy number
21   ) is
22   --
23   -- Declare cursors and local variables
24   --
25   l_proc           varchar2(72) := g_package||'create_bal_attrib_definition';
26   l_effective_date date;
27   --
28   -- Declare OUT variables
29   --
30   l_attribute_id     pay_bal_attribute_definitions.attribute_id%type;
31   --
32 begin
33   hr_utility.set_location('Entering:'|| l_proc, 10);
34   --
35   -- Issue a savepoint
36   --
37   savepoint create_bal_attrib_definition;
38   --
39   -- Truncate the time portion from all IN date parameters
40   --
41     l_effective_date := trunc(p_effective_date);
42     --
43     hr_utility.set_location(l_proc, 20);
44   --
45   -- Call Before Process User Hook
46   --
47   begin
48     PAY_BAL_ATTRIB_DEFINITION_BK1.create_bal_attrib_definition_b
49       (p_effective_date                => l_effective_date
50       ,p_attribute_name                => p_attribute_name
51       ,p_business_group_id             => p_business_group_id
52       ,p_legislation_code              => p_legislation_code
53       ,p_alterable                     => p_alterable
54       ,p_user_attribute_name           => p_user_attribute_name
55       );
56   exception
57     when hr_api.cannot_find_prog_unit then
58       hr_api.cannot_find_prog_unit_error
59         (p_module_name => 'create_bal_attrib_definition'
60         ,p_hook_type   => 'BP'
61         );
62   end;
63   --
64   hr_utility.set_location(l_proc, 25);
65   --
66   -- Validation in addition to Row Handlers
67   --
68   -- Process Logic
69   --
70     pay_bad_ins.ins
71        (p_effective_date      => l_effective_date
72        ,p_attribute_name      => p_attribute_name
73        ,p_alterable           => p_alterable
74        ,p_legislation_code    => p_legislation_code
75        ,p_business_group_id   => p_business_group_id
76        ,p_user_attribute_name => p_user_attribute_name
77        ,p_attribute_id        => l_attribute_id
78        );
79     --
80     hr_utility.set_location(l_proc, 30);
81   --
82   -- Call After Process User Hook
83   --
84   begin
85     PAY_BAL_ATTRIB_DEFINITION_BK1.create_bal_attrib_definition_a
86       (p_effective_date                => l_effective_date
87       ,p_attribute_name                => p_attribute_name
88       ,p_business_group_id             => p_business_group_id
89       ,p_legislation_code              => p_legislation_code
90       ,p_alterable                     => p_alterable
91       ,p_user_attribute_name           => p_user_attribute_name
92       ,p_attribute_id                  => l_attribute_id
93       );
94   exception
95     when hr_api.cannot_find_prog_unit then
96       hr_api.cannot_find_prog_unit_error
97         (p_module_name => 'create_bal_attrib_definition'
98         ,p_hook_type   => 'AP'
99         );
100   end;
101   --
102     hr_utility.set_location(l_proc, 40);
103   --
104   -- When in validation only mode raise the Validate_Enabled exception
105   --
106   if p_validate then
107     raise hr_api.validate_enabled;
108   end if;
109   --
110   -- Set all output arguments
111   --
112   p_attribute_id           := l_attribute_id;
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_bal_attrib_definition;
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_attribute_id             := null;
128     hr_utility.set_location(' Leaving:'||l_proc, 80);
129   when others then
130     --
131     -- A validation or unexpected error has occured
132     --
133     rollback to create_bal_attrib_definition;
134     p_attribute_id             := null;
135     hr_utility.set_location(' Leaving:'||l_proc, 90);
136     raise;
137 end create_bal_attrib_definition;
138 --
139 -- ----------------------------------------------------------------------------
140 -- |-------------------< delete_bal_attrib_definition >-----------------------|
141 -- ----------------------------------------------------------------------------
142 --
143 procedure delete_bal_attrib_definition
144   (p_validate                      in     boolean  default false
148   ) is
145   ,p_attribute_id                  in     number
146   ,p_business_group_id             in     number   default null
147   ,p_legislation_code              in     varchar2 default null
149   --
150   -- Declare cursors and local variables
151   --
152   l_proc           varchar2(72) := g_package||'delete_bal_attrib_definition';
153   --
154 begin
155   hr_utility.set_location('Entering:'|| l_proc, 10);
156   --
157   -- Issue a savepoint
158   --
159   savepoint delete_bal_attrib_definition;
160   --
161     hr_utility.set_location(l_proc, 20);
162   --
163   -- Call Before Process User Hook
164   --
165   begin
166     PAY_BAL_ATTRIB_DEFINITION_BK2.delete_bal_attrib_definition_b
167       (p_attribute_id                  => p_attribute_id
168       ,p_business_group_id             => p_business_group_id
169       ,p_legislation_code              => p_legislation_code
170       );
171   exception
172     when hr_api.cannot_find_prog_unit then
173       hr_api.cannot_find_prog_unit_error
177   end;
174         (p_module_name => 'delete_bal_attrib_definition'
175         ,p_hook_type   => 'BP'
176         );
178   hr_utility.set_location(l_proc, 25);
179   --
180   -- Validation in addition to Row Handlers
181   --
182   -- Process Logic
183   --
184     pay_bad_del.del
185        (p_attribute_id    => p_attribute_id
186        );
187     --
188     hr_utility.set_location(l_proc, 30);
189   --
190   -- Call After Process User Hook
191   --
192   begin
193     PAY_BAL_ATTRIB_DEFINITION_BK2.delete_bal_attrib_definition_a
194       (p_attribute_id                  => p_attribute_id
195       ,p_business_group_id             => p_business_group_id
196       ,p_legislation_code              => p_legislation_code
197       );
198   exception
199     when hr_api.cannot_find_prog_unit then
200       hr_api.cannot_find_prog_unit_error
201         (p_module_name => 'delete_bal_attrib_definition'
202         ,p_hook_type   => 'AP'
203         );
204   end;
205   --
206     hr_utility.set_location(l_proc, 40);
207   --
208   -- When in validation only mode raise the Validate_Enabled exception
209   --
210   if p_validate then
211     raise hr_api.validate_enabled;
212   end if;
213   --
214   -- Set all output arguments
215   --
216   --
217   hr_utility.set_location(' Leaving:'||l_proc, 70);
218 exception
219   when hr_api.validate_enabled then
220     --
221     -- As the Validate_Enabled exception has been raised
222     -- we must rollback to the savepoint
223     --
224     rollback to delete_bal_attrib_definition;
225     --
226   when others then
227     --
228     -- A validation or unexpected error has occured
229     --
230     rollback to delete_bal_attrib_definition;
231     hr_utility.set_location(' Leaving:'||l_proc, 90);
232     raise;
233 end delete_bal_attrib_definition;
234 --
235 end PAY_BAL_ATTRIB_DEFINITION_API;