[Home] [Help]
PACKAGE BODY: APPS.FA_MASSADD_DIST_PKG
Source
1 PACKAGE BODY FA_MASSADD_DIST_PKG as
2 /* $Header: faxmadtb.pls 120.3 2005/07/25 09:58:44 yyoon ship $ */
3
4 PROCEDURE DIST_SET (X_name varchar2,
5 X_total_units number,
6 X_mass_addition_id number,
7 X_success out nocopy boolean,
8 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
9
10 h_unit_percentage number;
11 h_dist_units number;
12 h_ccid number;
13 h_location_id number;
14 h_employee_id number;
15 h_massadd_dist_id number;
16
17 cursor dist_defaults is
18 select dd.unit_percentage, dd.deprn_expense_ccid,
19 dd.location_id, dd.employee_id
20 from fa_distribution_sets ds, fa_distribution_defaults dd
21 where ds.name = X_name
22 and ds.dist_set_id = dd.dist_set_id;
23
24 begin
25 X_success := FALSE;
26
27 delete from fa_massadd_distributions
28 where mass_addition_id = X_mass_addition_id;
29
30 open dist_defaults;
31 loop
32 fetch dist_defaults into
33 h_unit_percentage, h_ccid, h_location_id, h_employee_id;
34
35 if (dist_defaults%NOTFOUND) then exit; end if;
36
37 h_dist_units := X_total_units * h_unit_percentage / 100;
38
39 select fa_massadd_distributions_s.nextval
40 into h_massadd_dist_id from dual;
41
42 insert into fa_massadd_distributions (
43 massadd_dist_id, mass_addition_id, units,
44 deprn_expense_ccid, location_id, employee_id) values (
45 h_massadd_dist_id, X_mass_addition_id, h_dist_units,
46 h_ccid, h_location_id, h_employee_id);
47 end loop;
48 -- commit;
49 X_success := TRUE;
50
51 exception when others then
52 app_exception.raise_exception;
53
54 end dist_set;
55
56
57 PROCEDURE SAVEPT (p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
58 begin
59 savepoint distset;
60 end savept;
61
62 PROCEDURE ROLLBK (p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
63 begin
64
65 rollback to savepoint distset;
66
67 end rollbk;
68
69 END FA_MASSADD_DIST_PKG;