[Home] [Help]
PACKAGE BODY: APPS.PSP_ORGANIZATION_ACCOUNTS_API
Source
1 Package Body psp_organization_accounts_api as
2 /* $Header: PSPOAAIB.pls 120.0 2005/11/20 23:57:11 dpaudel noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' psp_organization_accounts_api.';
7 p_legislation_code varchar(50):=hr_api.userenv_lang;
8
9 --
10 -- ----------------------------------------------------------------------------
11 -- |-------------------------- create_organization_account --------------------|
12 -- ----------------------------------------------------------------------------
13 --
14 procedure create_organization_account
15 (p_validate in boolean default false
16 , p_gl_code_combination_id in number
17 , p_project_id in number
18 , p_expenditure_organization_id in number
19 , p_expenditure_type in varchar2
20 , p_task_id in number
21 , p_award_id in number
22 , p_comments in varchar2
23 , p_attribute_category in varchar2
24 , p_attribute1 in varchar2
25 , p_attribute2 in varchar2
26 , p_attribute3 in varchar2
27 , p_attribute4 in varchar2
28 , p_attribute5 in varchar2
29 , p_attribute6 in varchar2
30 , p_attribute7 in varchar2
31 , p_attribute8 in varchar2
32 , p_attribute9 in varchar2
33 , p_attribute10 in varchar2
34 , p_attribute11 in varchar2
35 , p_attribute12 in varchar2
36 , p_attribute13 in varchar2
37 , p_attribute14 in varchar2
38 , p_attribute15 in varchar2
39 , p_set_of_books_id in number
40 , p_account_type_code in varchar2
41 , p_start_date_active in date
42 , p_business_group_id in number
43 , p_end_date_active in date
44 , p_organization_id in number
45 , p_poeta_start_date in date
46 , p_poeta_end_date in date
47 , p_funding_source_code in varchar2
48 , p_object_version_number in out nocopy number
49 , p_organization_account_id out nocopy number
50 , p_return_status out nocopy boolean
51 )
52 IS
53 --
54 -- Declare cursors and local variables
55 --
56 l_object_version_number number(9);
57 l_proc varchar2(72) := g_package||'create_organization_account';
58 l_poeta_start_date date;
59 l_poeta_end_date date;
60 l_start_date_active date;
61 l_end_date_active date;
62
63 begin
64 hr_utility.set_location('Entering:'|| l_proc, 10);
65 --
66 -- Issue a savepoint
67 --
68 savepoint create_organization_account;
69 --
70 -- Remember IN OUT parameter IN values
71 --
72 l_object_version_number := p_object_version_number;
73
74 --
75 -- Truncate the time portion from all IN date parameters
76 --
77 l_poeta_start_date := trunc(p_poeta_start_date);
78 l_poeta_end_date := trunc(p_poeta_end_date);
79 l_start_date_active := trunc(p_start_date_active);
80 l_end_date_active := trunc(p_end_date_active);
81
82 --
83 -- Call Before Process User Hook
84 --
85 begin
86 psp_organization_accounts_bk1.create_organization_account_b
87 ( p_gl_code_combination_id => p_gl_code_combination_id
88 , p_project_id => p_project_id
89 , p_expenditure_organization_id => p_expenditure_organization_id
90 , p_expenditure_type => p_expenditure_type
91 , p_task_id => p_task_id
92 , p_award_id => p_award_id
93 , p_comments => p_comments
94 , p_attribute_category => p_attribute_category
95 , p_attribute1 => p_attribute1
96 , p_attribute2 => p_attribute2
97 , p_attribute3 => p_attribute3
98 , p_attribute4 => p_attribute4
99 , p_attribute5 => p_attribute5
100 , p_attribute6 => p_attribute6
101 , p_attribute7 => p_attribute7
102 , p_attribute8 => p_attribute8
103 , p_attribute9 => p_attribute9
104 , p_attribute10 => p_attribute10
105 , p_attribute11 => p_attribute11
106 , p_attribute12 => p_attribute12
107 , p_attribute13 => p_attribute13
108 , p_attribute14 => p_attribute14
109 , p_attribute15 => p_attribute15
110 , p_set_of_books_id => p_set_of_books_id
111 , p_account_type_code => p_account_type_code
112 , p_start_date_active => l_start_date_active
113 , p_business_group_id => p_business_group_id
114 , p_end_date_active => l_end_date_active
115 , p_organization_id => p_organization_id
116 , p_poeta_start_date => l_poeta_start_date
117 , p_poeta_end_date => l_poeta_end_date
118 , p_funding_source_code => p_funding_source_code
119 );
120 exception
121 when hr_api.cannot_find_prog_unit then
122 hr_api.cannot_find_prog_unit_error
123 (p_module_name => 'create_organization_account'
124 ,p_hook_type => 'BP'
125 );
126 end;
127 --
128 -- Validation in addition to Row Handlers
129 --
130
131
132
133 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134 -- Process Logic - Call the row-handler ins procedure
135 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
136
137 psp_poa_ins.ins
138 ( p_organization_account_id => p_organization_account_id
139 , p_set_of_books_id => p_set_of_books_id
140 , p_account_type_code => p_account_type_code
141 , p_start_date_active => l_start_date_active
142 , p_business_group_id => p_business_group_id
143 , p_organization_id => p_organization_id
144 , p_gl_code_combination_id => p_gl_code_combination_id
145 , p_project_id => p_project_id
146 , p_expenditure_organization_id => p_expenditure_organization_id
147 , p_expenditure_type => p_expenditure_type
148 , p_task_id => p_task_id
149 , p_award_id => p_award_id
150 , p_comments => p_comments
151 , p_attribute_category => p_attribute_category
152 , p_attribute1 => p_attribute1
153 , p_attribute2 => p_attribute2
154 , p_attribute3 => p_attribute3
155 , p_attribute4 => p_attribute4
156 , p_attribute5 => p_attribute5
157 , p_attribute6 => p_attribute6
158 , p_attribute7 => p_attribute7
159 , p_attribute8 => p_attribute8
160 , p_attribute9 => p_attribute9
161 , p_attribute10 => p_attribute10
162 , p_attribute11 => p_attribute11
163 , p_attribute12 => p_attribute12
164 , p_attribute13 => p_attribute13
165 , p_attribute14 => p_attribute14
166 , p_attribute15 => p_attribute15
167 , p_end_date_active => l_end_date_active
168 , p_poeta_start_date => l_poeta_start_date
169 , p_poeta_end_date => l_poeta_end_date
170 , p_object_version_number => p_object_version_number
171 , p_funding_source_code => p_funding_source_code
172 );
173
174 --
175 -- Call After Process User Hook
176 --
177 begin
178 psp_organization_accounts_bk1.create_organization_account_a
179 ( p_organization_account_id => p_organization_account_id
180 , p_gl_code_combination_id => p_gl_code_combination_id
181 , p_project_id => p_project_id
182 , p_expenditure_organization_id => p_expenditure_organization_id
183 , p_expenditure_type => p_expenditure_type
184 , p_task_id => p_task_id
185 , p_award_id => p_award_id
186 , p_comments => p_comments
187 , p_attribute_category => p_attribute_category
188 , p_attribute1 => p_attribute1
189 , p_attribute2 => p_attribute2
190 , p_attribute3 => p_attribute3
191 , p_attribute4 => p_attribute4
192 , p_attribute5 => p_attribute5
193 , p_attribute6 => p_attribute6
194 , p_attribute7 => p_attribute7
195 , p_attribute8 => p_attribute8
196 , p_attribute9 => p_attribute9
197 , p_attribute10 => p_attribute10
198 , p_attribute11 => p_attribute11
199 , p_attribute12 => p_attribute12
200 , p_attribute13 => p_attribute13
201 , p_attribute14 => p_attribute14
202 , p_attribute15 => p_attribute15
203 , p_set_of_books_id => p_set_of_books_id
204 , p_account_type_code => p_account_type_code
205 , p_start_date_active => l_start_date_active
206 , p_business_group_id => p_business_group_id
207 , p_end_date_active => l_end_date_active
208 , p_organization_id => p_organization_id
209 , p_poeta_start_date => l_poeta_start_date
210 , p_poeta_end_date => l_poeta_end_date
211 , p_funding_source_code => p_funding_source_code
212 );
213 exception
214 when hr_api.cannot_find_prog_unit then
215 hr_api.cannot_find_prog_unit_error
216 (p_module_name => 'create_organization_account'
217 ,p_hook_type => 'AP'
218 );
219 end;
220 --
221 -- When in validation only mode raise the Validate_Enabled exception
222 --
223 if p_validate then
224 raise hr_api.validate_enabled;
225 end if;
226 --
227 -- Set all IN OUT and OUT parameters with out values
228 --
229 p_object_version_number := l_object_version_number;
230
231 --
232 hr_utility.set_location(' Leaving:'||l_proc, 70);
233 exception
234 when hr_api.validate_enabled then
235 --
236 -- As the Validate_Enabled exception has been raised
237 -- we must rollback to the savepoint
238 --
239 rollback to create_organization_account;
240 --
241 -- Reset IN OUT parameters and set OUT parameters
242 -- (Any key or derived arguments must be set to null
243 -- when validation only mode is being used.)
244 --
245 p_object_version_number := null;
246 hr_utility.set_location(' Leaving:'||l_proc, 80);
247 when others then
248 --
249 -- A validation or unexpected error has occured
250 --
251 rollback to create_organization_account;
252 --
253 -- Reset IN OUT parameters and set all
254 -- OUT parameters, including warnings, to null
255 --
256 p_object_version_number := null;
257 hr_utility.set_location(' Leaving:'||l_proc, 90);
258 raise;
259 end create_organization_account;
260
261
262
263
264
265
266
267
268 --
269 -- ----------------------------------------------------------------------------
270 -- |---------------------- update_organization_account ------------------------|
271 -- ----------------------------------------------------------------------------
272 --
273 procedure update_organization_account
274 ( p_validate in boolean default false
275 , p_organization_account_id in number
276 , p_gl_code_combination_id in number
277 , p_project_id in number
278 , p_expenditure_organization_id in number
279 , p_expenditure_type in varchar2
280 , p_task_id in number
281 , p_award_id in number
282 , p_comments in varchar2
283 , p_attribute_category in varchar2
284 , p_attribute1 in varchar2
285 , p_attribute2 in varchar2
286 , p_attribute3 in varchar2
287 , p_attribute4 in varchar2
288 , p_attribute5 in varchar2
289 , p_attribute6 in varchar2
290 , p_attribute7 in varchar2
291 , p_attribute8 in varchar2
292 , p_attribute9 in varchar2
293 , p_attribute10 in varchar2
294 , p_attribute11 in varchar2
295 , p_attribute12 in varchar2
296 , p_attribute13 in varchar2
297 , p_attribute14 in varchar2
298 , p_attribute15 in varchar2
299 , p_set_of_books_id in number
300 , p_account_type_code in varchar2
301 , p_start_date_active in date
302 , p_business_group_id in number
306 , p_poeta_end_date in date
303 , p_end_date_active in date
304 , p_organization_id in number
305 , p_poeta_start_date in date
307 , p_funding_source_code in varchar2
308 , p_object_version_number in out nocopy number
309 , p_return_status out nocopy boolean
310 ) is
311 --
312 -- Declare cursors and local variables
313 --
314 l_object_version_number number(9);
315 l_proc varchar2(72) := g_package||'update_organization_account';
316 l_poeta_start_date date;
317 l_poeta_end_date date;
318 l_start_date_active date;
319 l_end_date_active date;
320
321 begin
322 hr_utility.set_location('Entering:'|| l_proc, 10);
323 --
324 -- Issue a savepoint
325 --
326 savepoint update_organization_account;
327 --
328 -- Remember IN OUT parameter IN values
329 --
330 l_object_version_number := p_object_version_number;
331
332 --
333 -- Truncate the time portion from all IN date parameters
334 --
335 l_poeta_start_date:= trunc(p_poeta_start_date);
336 l_poeta_end_date:= trunc(p_poeta_end_date);
337 l_start_date_active := trunc(p_start_date_active);
338 l_end_date_active := trunc(p_end_date_active);
339
340 --
341 -- Call Before Process User Hook
342 --
343 begin
344 psp_organization_accounts_bk2.update_organization_account_b
345 ( p_organization_account_id => p_organization_account_id
346 , p_gl_code_combination_id => p_gl_code_combination_id
347 , p_project_id => p_project_id
348 , p_expenditure_organization_id => p_expenditure_organization_id
349 , p_expenditure_type => p_expenditure_type
350 , p_task_id => p_task_id
351 , p_award_id => p_award_id
352 , p_comments => p_comments
353 , p_attribute_category => p_attribute_category
354 , p_attribute1 => p_attribute1
355 , p_attribute2 => p_attribute2
356 , p_attribute3 => p_attribute3
357 , p_attribute4 => p_attribute4
358 , p_attribute5 => p_attribute5
359 , p_attribute6 => p_attribute6
360 , p_attribute7 => p_attribute7
361 , p_attribute8 => p_attribute8
362 , p_attribute9 => p_attribute9
363 , p_attribute10 => p_attribute10
364 , p_attribute11 => p_attribute11
365 , p_attribute12 => p_attribute12
366 , p_attribute13 => p_attribute13
367 , p_attribute14 => p_attribute14
368 , p_attribute15 => p_attribute15
369 , p_set_of_books_id => p_set_of_books_id
370 , p_account_type_code => p_account_type_code
371 , p_start_date_active => l_start_date_active
372 , p_business_group_id => p_business_group_id
373 , p_end_date_active => l_end_date_active
374 , p_organization_id => p_organization_id
375 , p_poeta_start_date => l_poeta_start_date
376 , p_poeta_end_date => l_poeta_end_date
377 , p_funding_source_code => p_funding_source_code
378 );
379 exception
380 when hr_api.cannot_find_prog_unit then
381 hr_api.cannot_find_prog_unit_error
382 (p_module_name => 'update_organization_account'
383 ,p_hook_type => 'BP'
384 );
385 end;
386 --
387 -- Validation in addition to Row Handlers
388 --
389
390 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
391 -- Process Logic - Call the row-handler upd procedure
392 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
393 psp_poa_upd.upd
394 ( p_organization_account_id => p_organization_account_id
395 , p_set_of_books_id => p_set_of_books_id
396 , p_account_type_code => p_account_type_code
397 , p_start_date_active => l_start_date_active
398 , p_business_group_id => p_business_group_id
399 , p_organization_id => p_organization_id
400 , p_gl_code_combination_id => p_gl_code_combination_id
401 , p_project_id => p_project_id
402 , p_expenditure_organization_id => p_expenditure_organization_id
403 , p_expenditure_type => p_expenditure_type
404 , p_task_id => p_task_id
405 , p_award_id => p_award_id
406 , p_comments => p_comments
407 , p_attribute_category => p_attribute_category
408 , p_attribute1 => p_attribute1
409 , p_attribute2 => p_attribute2
410 , p_attribute3 => p_attribute3
411 , p_attribute4 => p_attribute4
412 , p_attribute5 => p_attribute5
413 , p_attribute6 => p_attribute6
414 , p_attribute7 => p_attribute7
415 , p_attribute8 => p_attribute8
416 , p_attribute9 => p_attribute9
417 , p_attribute10 => p_attribute10
418 , p_attribute11 => p_attribute11
419 , p_attribute12 => p_attribute12
420 , p_attribute13 => p_attribute13
421 , p_attribute14 => p_attribute14
422 , p_attribute15 => p_attribute15
423 , p_end_date_active => l_end_date_active
424 , p_poeta_start_date => l_poeta_start_date
425 , p_poeta_end_date => l_poeta_end_date
426 , p_object_version_number => p_object_version_number
427 , p_funding_source_code => p_funding_source_code
428 );
429
430
431 --
432 -- Call After Process User Hook
433 --
434 begin
435 psp_organization_accounts_bk2.update_organization_account_a
436 ( p_organization_account_id => p_organization_account_id
437 , p_gl_code_combination_id => p_gl_code_combination_id
438 , p_project_id => p_project_id
439 , p_expenditure_organization_id => p_expenditure_organization_id
440 , p_expenditure_type => p_expenditure_type
441 , p_task_id => p_task_id
442 , p_award_id => p_award_id
443 , p_comments => p_comments
444 , p_attribute_category => p_attribute_category
445 , p_attribute1 => p_attribute1
446 , p_attribute2 => p_attribute2
447 , p_attribute3 => p_attribute3
448 , p_attribute4 => p_attribute4
449 , p_attribute5 => p_attribute5
450 , p_attribute6 => p_attribute6
451 , p_attribute7 => p_attribute7
452 , p_attribute8 => p_attribute8
453 , p_attribute9 => p_attribute9
457 , p_attribute13 => p_attribute13
454 , p_attribute10 => p_attribute10
455 , p_attribute11 => p_attribute11
456 , p_attribute12 => p_attribute12
458 , p_attribute14 => p_attribute14
459 , p_attribute15 => p_attribute15
460 , p_set_of_books_id => p_set_of_books_id
461 , p_account_type_code => p_account_type_code
462 , p_start_date_active => l_start_date_active
463 , p_business_group_id => p_business_group_id
464 , p_end_date_active => l_end_date_active
465 , p_organization_id => p_organization_id
466 , p_poeta_start_date => l_poeta_start_date
467 , p_poeta_end_date => l_poeta_end_date
468 , p_funding_source_code => p_funding_source_code
469 );
470 exception
471 when hr_api.cannot_find_prog_unit then
472 hr_api.cannot_find_prog_unit_error
473 (p_module_name => 'update_organization_account'
474 ,p_hook_type => 'AP'
475 );
476 end;
477 --
478 -- When in validation only mode raise the Validate_Enabled exception
479 --
480 if p_validate then
481 raise hr_api.validate_enabled;
482 end if;
483 --
484 -- Set all IN OUT and OUT parameters with out values
485 --
486 p_object_version_number := l_object_version_number;
487
488 hr_utility.set_location(' Leaving:'||l_proc, 70);
489 exception
490 when hr_api.validate_enabled then
491 --
492 -- As the Validate_Enabled exception has been raised
493 -- we must rollback to the savepoint
494 --
495 rollback to update_organization_account;
496 --
497 -- Reset IN OUT parameters and set OUT parameters
498 -- (Any key or derived arguments must be set to null
499 -- when validation only mode is being used.)
500 --
501 p_object_version_number := null;
502 hr_utility.set_location(' Leaving:'||l_proc, 80);
503 when others then
504 --
505 -- A validation or unexpected error has occured
506 --
507 rollback to update_organization_account;
508 --
509 -- Reset IN OUT parameters and set all
510 -- OUT parameters, including warnings, to null
511 --
512 p_object_version_number := null;
513 hr_utility.set_location(' Leaving:'||l_proc, 90);
514 raise;
515 end update_organization_account;
516
517
518
519
520
521 --
522 -- ----------------------------------------------------------------------------
523 -- |--------------------- delete_organization_account -------------------------|
524 -- ----------------------------------------------------------------------------
525 --
526 procedure delete_organization_account
527 ( p_validate in boolean default false
528 , p_organization_account_id in number
529 , p_object_version_number in out nocopy number
530 , p_return_status out nocopy boolean
531 ) is
532 --
533 -- Declare cursors and local variables
534 --
535 l_object_version_number number(9);
536 l_proc varchar2(72) := g_package||'delete_organization_account';
537 begin
538 hr_utility.set_location('Entering:'|| l_proc, 10);
539 --
540 -- Issue a savepoint
541 --
542 savepoint delete_organization_account;
543 --
544 -- Remember IN OUT parameter IN values
545 --
546 l_object_version_number := p_object_version_number;
547
548 --
549 -- Call Before Process User Hook
550 --
551 begin
552 psp_organization_accounts_bk3.delete_organization_account_b
553 ( p_organization_account_id => p_organization_account_id
554 );
555 exception
556 when hr_api.cannot_find_prog_unit then
557 hr_api.cannot_find_prog_unit_error
558 (p_module_name => 'delete_organization_account'
559 ,p_hook_type => 'BP'
560 );
561 end;
562 --
563 -- Validation in addition to Row Handlers
564 --
565
566
567
568 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
569 -- Process Logic - Call the row-handler del procedure
570 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
571
572
573 psp_poa_del.del
574 ( p_organization_account_id => p_organization_account_id
575 , p_object_version_number => p_object_version_number
576 );
577
578
579 --
580 -- Call After Process User Hook
581 --
582 begin
583 psp_organization_accounts_bk3.delete_organization_account_a
584 ( p_organization_account_id => p_organization_account_id
585 );
586 exception
587 when hr_api.cannot_find_prog_unit then
588 hr_api.cannot_find_prog_unit_error
589 (p_module_name => 'delete_organization_account'
590 ,p_hook_type => 'AP'
591 );
592 end;
593 --
594 -- When in validation only mode raise the Validate_Enabled exception
595 --
596 if p_validate then
597 raise hr_api.validate_enabled;
598 end if;
599 --
600 -- Set all IN OUT and OUT parameters with out values
601 --
602 p_object_version_number := l_object_version_number;
603 hr_utility.set_location(' Leaving:'||l_proc, 70);
604 exception
605 when hr_api.validate_enabled then
606 --
607 -- As the Validate_Enabled exception has been raised
608 -- we must rollback to the savepoint
609 --
610 rollback to delete_organization_account;
611 --
612 -- Reset IN OUT parameters and set OUT parameters
613 -- (Any key or derived arguments must be set to null
614 -- when validation only mode is being used.)
615 --
616 p_object_version_number := null;
617 hr_utility.set_location(' Leaving:'||l_proc, 80);
618 when others then
619 --
620 -- A validation or unexpected error has occured
621 --
622 rollback to delete_organization_account;
623 --
624 -- Reset IN OUT parameters and set all
625 -- OUT parameters, including warnings, to null
626 --
627 p_object_version_number := null;
628 hr_utility.set_location(' Leaving:'||l_proc, 90);
629 raise;
630 end delete_organization_account;
631 --
632 end psp_organization_accounts_api;