[Home] [Help]
PACKAGE BODY: APPS.PAY_WCI_ACCOUNTS_API
Source
1 Package Body pay_wci_accounts_api as
2 /* $Header: pypwaapi.pkb 115.2 2002/12/05 14:13:01 swinton noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := 'pay_wci_accounts_api';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< create_wci_account >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_wci_account
13 (p_validate in boolean default false
14 ,p_effective_date in date
15 ,p_business_group_id in number
16 ,p_carrier_id in number
17 ,p_account_number in varchar2
18 ,p_name in varchar2 default null
19 ,p_location_id in number default null
20 ,p_comments in varchar2 default null
21 ,p_account_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||'update_wci_account';
29 l_effective_date date;
30
31 begin
32
33 hr_utility.set_location('Entering:'|| l_proc, 10);
34 --
35 -- Issue a savepoint
36 --
37 savepoint create_wci_account;
38 hr_utility.set_location(l_proc, 20);
39 --
40 -- Truncate the time portion from all IN date parameters
41 --
42 l_effective_date := trunc(p_effective_date);
43 --
44 -- Call Before Process User Hook
45 --
46 begin
47 pay_wci_accounts_bk1.create_wci_account_b
48 (p_effective_date => l_effective_date
49 ,p_object_version_number => p_object_version_number
50 ,p_business_group_id => p_business_group_id
51 ,p_carrier_id => p_carrier_id
52 ,p_account_number => p_account_number
53 ,p_name => p_name
54 ,p_location_id => p_location_id
55 ,p_comments => p_comments
56 );
57 exception
58 when hr_api.cannot_find_prog_unit then
59 hr_api.cannot_find_prog_unit_error
60 (p_module_name => 'create_wci_account'
61 ,p_hook_type => 'BP'
62 );
63 end;
64 hr_utility.set_location(l_proc, 30);
65 --
66 -- Validation in addition to Row Handlers
67 --
68 hr_utility.set_location(l_proc, 40);
69 --
70 -- Process Logic
71 --
72 -- Call the row handler
73 --
74 pay_pwa_ins.ins
75 (p_business_group_id => p_business_group_id
76 ,p_carrier_id => p_carrier_id
77 ,p_account_number => p_account_number
78 ,p_object_version_number => p_object_version_number
79 ,p_name => p_name
80 ,p_location_id => p_location_id
81 ,p_comments => p_comments
82 ,p_account_id => p_account_id
83 );
84
85 hr_utility.set_location(l_proc, 50);
86 --
87 -- Call After Process User Hook
88 --
89 begin
90 pay_wci_accounts_bk1.create_wci_account_a
91 (p_effective_date => l_effective_date
92 ,p_account_id => p_account_id
93 ,p_object_version_number => p_object_version_number
94 ,p_business_group_id => p_business_group_id
95 ,p_carrier_id => p_carrier_id
96 ,p_account_number => p_account_number
97 ,p_name => p_name
98 ,p_location_id => p_location_id
99 ,p_comments => p_comments
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_wci_account'
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 hr_utility.set_location(' Leaving:'||l_proc, 70);
119
120 exception
121
122 when hr_api.validate_enabled then
123 --
124 -- As the Validate_Enabled exception has been raised
125 -- we must rollback to the savepoint
126 --
127 rollback to create_wci_account;
128 --
129 -- Only set output warning arguments
130 -- (Any key or derived arguments must be set to null
131 -- when validation only mode is being used.)
132 --
133 p_account_id := null;
134 p_object_version_number := null;
135 hr_utility.set_location(' Leaving:'||l_proc, 80);
136 when others then
137 --
138 -- A validation or unexpected error has occured
139 --
140 rollback to create_wci_account;
141 --
142 -- Bugfix 2692195
143 -- Set all out parameters to null
144 --
145 p_account_id := null;
146 p_object_version_number := null;
147 --
148 hr_utility.set_location(' Leaving:'||l_proc, 90);
149 raise;
150 end create_wci_account;
151 --
152 -- ----------------------------------------------------------------------------
153 -- |--------------------------< update_wci_account >--------------------------|
154 -- ----------------------------------------------------------------------------
155 --
156 procedure update_wci_account
157 (p_validate in boolean default false
158 ,p_effective_date in date
159 ,p_account_id in number
160 ,p_object_version_number in out nocopy number
161 ,p_name in varchar2 default hr_api.g_varchar2
162 ,p_account_number in varchar2 default hr_api.g_varchar2
163 ,p_location_id in number default hr_api.g_number
164 ,p_comments in varchar2 default hr_api.g_varchar2
165 ) is
166 --
167 -- Declare cursors and local variables
168 --
169
170 l_proc varchar2(72) := g_package||'update_wci_account';
171 l_business_group_id number;
172 l_effective_date date;
173 l_carrier_id number;
174 l_object_version_number number;
175 --
176 cursor csr_record_details is
177 select business_group_id, carrier_id
178 from pay_wci_accounts
179 where account_id = p_account_id;
180
181 begin
182
183 hr_utility.set_location('Entering:'|| l_proc, 10);
184 --
185 -- Store in out parameters
186 --
187 l_object_version_number := p_object_version_number;
188 --
189 -- Issue a savepoint
190 --
191 savepoint update_wci_account;
192 hr_utility.set_location(l_proc, 20);
193 --
194 -- Truncate the time portion from all IN date parameters
195 --
196 l_effective_date := trunc(p_effective_date);
197 --
198 -- Derive necessary parameters
199 --
200 open csr_record_details;
201 fetch csr_record_details into l_business_group_id, l_carrier_id;
202 close csr_record_details;
203 --
204 -- Call Before Process User Hook
205 --
206 begin
207 pay_wci_accounts_bk2.update_wci_account_b
208 (p_effective_date => l_effective_date
209 ,p_account_id => p_account_id
210 ,p_object_version_number => p_object_version_number
211 ,p_business_group_id => l_business_group_id
212 ,p_carrier_id => l_carrier_id
213 ,p_name => p_name
214 ,p_account_number => p_account_number
215 ,p_location_id => p_location_id
216 ,p_comments => p_comments
217 );
218 exception
219 when hr_api.cannot_find_prog_unit then
220 hr_api.cannot_find_prog_unit_error
221 (p_module_name => 'update_wci_account'
222 ,p_hook_type => 'BP'
223 );
224 end;
225 hr_utility.set_location(l_proc, 30);
226 --
227 -- Validation in addition to Row Handlers
228 --
229 hr_utility.set_location(l_proc, 40);
230 --
231 -- Process Logic
232 --
233 -- Call the row handler
234 --
235 pay_pwa_upd.upd
236 (p_account_id => p_account_id
237 ,p_object_version_number => p_object_version_number
238 ,p_name => p_name
239 ,p_account_number => p_account_number
240 ,p_location_id => p_location_id
241 ,p_comments => p_comments
242 );
243
244 hr_utility.set_location(l_proc, 50);
245 --
246 -- Call After Process User Hook
247 --
248 begin
249 pay_wci_accounts_bk2.update_wci_account_a
250 (p_effective_date => l_effective_date
251 ,p_account_id => p_account_id
252 ,p_object_version_number => p_object_version_number
253 ,p_business_group_id => l_business_group_id
254 ,p_carrier_id => l_carrier_id
255 ,p_name => p_name
256 ,p_account_number => p_account_number
257 ,p_location_id => p_location_id
258 ,p_comments => p_comments
259 );
260 exception
261 when hr_api.cannot_find_prog_unit then
262 hr_api.cannot_find_prog_unit_error
263 (p_module_name => 'update_wci_account'
264 ,p_hook_type => 'AP'
265 );
266 end;
267 hr_utility.set_location(l_proc, 60);
268 --
269 -- When in validation only mode raise the Validate_Enabled exception
270 --
271 if p_validate then
272 raise hr_api.validate_enabled;
273 end if;
274 --
275 -- Set all output arguments
276 --
277 hr_utility.set_location(' Leaving:'||l_proc, 70);
278
279 exception
280
281 when hr_api.validate_enabled then
282 --
283 -- As the Validate_Enabled exception has been raised
284 -- we must rollback to the savepoint
285 --
286 rollback to update_wci_account;
287 --
288 -- Only set output warning arguments
289 -- (Any key or derived arguments must be set to null
290 -- when validation only mode is being used.)
291 --
292 p_object_version_number := l_object_version_number;
293 hr_utility.set_location(' Leaving:'||l_proc, 80);
294 when others then
295 --
296 -- A validation or unexpected error has occured
297 --
298 rollback to create_wci_account;
299 --
300 -- Bugfix 2692195
301 -- Reset all IN OUT parameters
302 --
303 p_object_version_number := l_object_version_number;
304 --
305 hr_utility.set_location(' Leaving:'||l_proc, 90);
306 raise;
307 end update_wci_account;
308 --
309 -- ----------------------------------------------------------------------------
310 -- |--------------------------< delete_wci_account >--------------------------|
311 -- ----------------------------------------------------------------------------
312 --
313 procedure delete_wci_account
314 (p_validate in boolean default false
315 ,p_account_id in number
316 ,p_object_version_number in number
317 ) is
318 --
319 -- Declare cursors and local variables
320 --
321
322 l_proc varchar2(72) := g_package||'delete_wci_account';
323 l_business_group_id number;
324 --
325 cursor csr_business_group_id is
326 select business_group_id
327 from pay_wci_accounts
328 where account_id = p_account_id;
329
330 begin
331
332 hr_utility.set_location('Entering:'|| l_proc, 10);
333 --
334 -- Issue a savepoint
335 --
336 savepoint delete_wci_account;
337 hr_utility.set_location(l_proc, 20);
338 --
339 -- Truncate the time portion from all IN date parameters
340 --
341 -- Derive necessary parameters
342 --
343 open csr_business_group_id;
344 fetch csr_business_group_id into l_business_group_id;
345 close csr_business_group_id;
346 --
347 -- Call Before Process User Hook
348 --
349 begin
350 pay_wci_accounts_bk3.delete_wci_account_b
351 (p_account_id => p_account_id
352 ,p_business_group_id => l_business_group_id
353 ,p_object_version_number => p_object_version_number
354 );
355 exception
356 when hr_api.cannot_find_prog_unit then
357 hr_api.cannot_find_prog_unit_error
358 (p_module_name => 'delete_wci_account'
359 ,p_hook_type => 'BP'
360 );
361 end;
362 hr_utility.set_location(l_proc, 30);
363 --
364 -- Validation in addition to Row Handlers
365 --
366 hr_utility.set_location(l_proc, 40);
367 --
368 -- Process Logic
369 --
370 -- Call the row handler
371 --
372 pay_pwa_del.del
373 (p_account_id => p_account_id
374 ,p_object_version_number => p_object_version_number
375 );
376
377 hr_utility.set_location(l_proc, 50);
378 --
379 -- Call After Process User Hook
380 --
381 begin
382 pay_wci_accounts_bk3.delete_wci_account_a
383 (p_account_id => p_account_id
384 ,p_business_group_id => l_business_group_id
385 ,p_object_version_number => p_object_version_number
386 );
387 exception
388 when hr_api.cannot_find_prog_unit then
389 hr_api.cannot_find_prog_unit_error
390 (p_module_name => 'delete_wci_account'
391 ,p_hook_type => 'AP'
392 );
393 end;
394 hr_utility.set_location(l_proc, 60);
395 --
396 -- When in validation only mode raise the Validate_Enabled exception
397 --
398 if p_validate then
399 raise hr_api.validate_enabled;
400 end if;
401 --
402 -- Set all output arguments
403 --
404 hr_utility.set_location(' Leaving:'||l_proc, 70);
405
406 exception
407
408 when hr_api.validate_enabled then
409 --
410 -- As the Validate_Enabled exception has been raised
411 -- we must rollback to the savepoint
412 --
413 rollback to delete_wci_account;
414 --
415 -- Only set output warning arguments
416 -- (Any key or derived arguments must be set to null
417 -- when validation only mode is being used.)
418 --
419 hr_utility.set_location(' Leaving:'||l_proc, 80);
420 when others then
421 --
422 -- A validation or unexpected error has occured
423 --
424 rollback to delete_wci_account;
425 hr_utility.set_location(' Leaving:'||l_proc, 90);
426 raise;
427
428 end delete_wci_account;
429 --
430 end pay_wci_accounts_api;