1 PACKAGE BODY FA_CUA_HR_DISTRIBUTION_PKG AS
2 /* $Header: FACHRDSMB.pls 120.1 2002/11/12 07:55:14 glchen ship $ */
3
4 Procedure Insert_row ( x_rowid in out nocopy varchar2
5 , x_distribution_id in out nocopy number
6 , x_dist_set_id in number
7 , x_book_type_code in varchar2
8 , x_distribution_line_percentage in number
9 , x_code_combination_id in number
10 , x_location_id in number
11 , x_assigned_to in number
12 , X_CREATION_DATE in date
13 , X_CREATED_BY in number
14 , X_LAST_UPDATE_DATE in date
15 , X_LAST_UPDATED_BY in number
16 , X_LAST_UPDATE_LOGIN in number
17 )
18 is
19 Cursor C1 is Select ROWID from FA_HIERARCHY_DISTRIBUTIONS
20 where distribution_id = x_distribution_id;
21 CURSOR C is Select FA_HIERARCHY_DISTRIBUTIONS_S.nextval from sys.dual;
22 Begin
23 if X_distribution_id is null then
24 open C;
25 fetch C into X_distribution_id ;
26 close C;
27 end if;
28 insert into FA_HIERARCHY_DISTRIBUTIONS
29 ( distribution_id
30 , dist_set_id
31 , book_type_code
32 , distribution_line_percentage
33 , code_combination_id
34 , location_id
35 , assigned_to
36 , CREATION_DATE
37 , CREATED_BY
38 , LAST_UPDATE_DATE
39 , LAST_UPDATED_BY
40 , LAST_UPDATE_LOGIN
41 ) Values
42 ( x_distribution_id
43 , x_dist_set_id
44 , x_book_type_code
45 , x_distribution_line_percentage
46 , x_code_combination_id
47 , x_location_id
48 , x_assigned_to
49 , X_CREATION_DATE
50 , X_CREATED_BY
51 , X_LAST_UPDATE_DATE
52 , X_LAST_UPDATED_BY
53 , X_LAST_UPDATE_LOGIN
54 );
55
56 Open C1;
57 fetch C1 into x_rowid;
58 if (C1%NOTFOUND) then
59 close C1;
60 raise no_data_found;
61 end if;
62 close C1;
63 end INSERT_ROW;
64
65
66
67 procedure LOCK_ROW ( x_rowid in varchar2
68 , x_distribution_id in number
69 , x_dist_set_id in number
70 , x_book_type_code in varchar2
71 , x_distribution_line_percentage in number
72 , x_code_combination_id in number
73 , x_location_id in number
74 , x_assigned_to in number
75 )
76 is
77 Cursor C1 is
78 Select
79 book_type_code
80 , distribution_id
81 , dist_set_id
82 , distribution_line_percentage
83 , code_combination_id
84 , location_id
85 , assigned_to
86 from FA_HIERARCHY_DISTRIBUTIONS
87 where rowid = x_rowid
88 FOR UPDATE NOWAIT;
89 tlinfo C1%ROWTYPE;
90 begin
91 open C1;
92 fetch c1 into tlinfo;
93 if (c1%notfound) then
94 FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
95 app_exception.raise_exception;
96 close c1;
97 return;
98 end if;
99 close c1;
100 if (
101 (tlinfo.distribution_id = x_distribution_id)
102 AND (tlinfo.dist_set_id = x_dist_set_id)
103 AND (tlinfo.book_type_code = x_book_type_code)
104 AND (tlinfo.distribution_line_percentage = x_distribution_line_percentage)
105 AND ((tlinfo.code_combination_id = X_code_combination_id)
106 OR ((tlinfo.code_combination_id is null)
107 AND (X_code_combination_id is null)))
108 AND ((tlinfo.location_id = X_location_id)
109 OR ((tlinfo.location_id is null)
110 AND (X_location_id is null)))
111 AND ((tlinfo.assigned_to = X_assigned_to)
112 OR ((tlinfo.assigned_to is null)
113 AND (X_assigned_to is null)))
114 ) then
115 null;
116 else
117 fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
118 app_exception.raise_exception;
119 end if;
120 return;
121
122 End lock_row;
123
124 procedure UPDATE_ROW ( x_rowid in varchar2
125 , x_distribution_id in number
126 , x_dist_set_id in number
127 , x_book_type_code in varchar2
128 , x_distribution_line_percentage in number
129 , x_code_combination_id in number
130 , x_location_id in number
131 , x_assigned_to in number
132 , X_LAST_UPDATE_DATE in date
133 , X_LAST_UPDATED_BY in number
134 , X_LAST_UPDATE_LOGIN in number
135 )
136 is
137 Begin
138 update FA_HIERARCHY_DISTRIBUTIONS
139 set
140 book_type_code = x_book_type_code
141 , distribution_line_percentage = x_distribution_line_percentage
142 , code_combination_id = x_code_combination_id
143 , location_id = x_location_id
144 , assigned_to = x_assigned_to
145 , LAST_UPDATE_DATE = X_LAST_UPDATE_DATE
146 , LAST_UPDATED_BY = X_LAST_UPDATED_BY
147 , LAST_UPDATE_LOGIN = X_LAST_UPDATE_LOGIN
148 where rowid = x_rowid;
149 if (sql%notfound) then
150 raise no_data_found;
151 end if;
152 End update_row;
153
154 procedure DELETE_ROW (
155 x_rowid in varchar2
156 )
157 is
158 Begin
159 delete from FA_HIERARCHY_DISTRIBUTIONS
160 where rowid = x_rowid;
161 if (sql%notfound) then
162 raise no_data_found;
163 end if;
164 End delete_row;
165
166 end FA_CUA_HR_DISTRIBUTION_PKG ;