[Home] [Help]
PACKAGE BODY: APPS.PSP_POA_SHD
Source
1 Package Body psp_poa_shd as
2 /* $Header: PSPOARHB.pls 120.5 2006/09/05 11:10:12 dpaudel noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' psp_poa_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16 --
17 Return (nvl(g_api_dml, false));
18 --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25 (p_constraint_name in all_constraints.constraint_name%TYPE
26 ) Is
27 --
28 l_proc varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31 --
32 If (p_constraint_name = 'PSP_ORGANIZATION_ACCOUNTS_U1') Then
33 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34 fnd_message.set_token('PROCEDURE', l_proc);
35 fnd_message.set_token('STEP','5');
36 fnd_message.raise_error;
37 Else
38 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
39 fnd_message.set_token('PROCEDURE', l_proc);
40 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
41 fnd_message.raise_error;
42 End If;
43 --
44 End constraint_error;
45 --
46 -- ----------------------------------------------------------------------------
47 -- |-----------------------------< api_updating >-----------------------------|
48 -- ----------------------------------------------------------------------------
49 Function api_updating
50 (p_organization_account_id in number
51 ,p_object_version_number in number
52 )
53 Return Boolean Is
54 --
55 --
56 -- Cursor selects the 'current' row from the HR Schema
57 --
58 Cursor C_Sel1 is
59 select
60 organization_account_id
61 ,gl_code_combination_id
62 ,project_id
63 ,expenditure_organization_id
64 ,expenditure_type
65 ,task_id
66 ,award_id
67 ,comments
68 ,attribute_category
69 ,attribute1
70 ,attribute2
71 ,attribute3
72 ,attribute4
73 ,attribute5
74 ,attribute6
75 ,attribute7
76 ,attribute8
77 ,attribute9
78 ,attribute10
79 ,attribute11
80 ,attribute12
81 ,attribute13
82 ,attribute14
83 ,attribute15
84 ,set_of_books_id
85 ,account_type_code
86 ,start_date_active
87 ,business_group_id
88 ,end_date_active
89 ,organization_id
90 ,poeta_start_date
91 ,poeta_end_date
92 ,object_version_number
93 ,funding_source_code
94 from psp_organization_accounts
95 where organization_account_id = p_organization_account_id;
96 --
97 l_fct_ret boolean;
98 --
99 Begin
100 --
101 If (p_organization_account_id is null and
102 p_object_version_number is null
103 ) Then
104 --
105 -- One of the primary key arguments is null therefore we must
106 -- set the returning function value to false
107 --
108 l_fct_ret := false;
109 Else
110 If (p_organization_account_id
111 = psp_poa_shd.g_old_rec.organization_account_id and
112 p_object_version_number
113 = psp_poa_shd.g_old_rec.object_version_number
114 ) Then
115 --
116 -- The g_old_rec is current therefore we must
117 -- set the returning function to true
118 --
119 l_fct_ret := true;
120 Else
121 --
122 -- Select the current row into g_old_rec
123 --
124 Open C_Sel1;
125 Fetch C_Sel1 Into psp_poa_shd.g_old_rec;
126 If C_Sel1%notfound Then
127 Close C_Sel1;
128 --
129 -- The primary key is invalid therefore we must error
130 --
131 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
132 fnd_message.raise_error;
133 End If;
134 Close C_Sel1;
135 If (p_object_version_number
136 <> psp_poa_shd.g_old_rec.object_version_number) Then
137 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
138 fnd_message.raise_error;
139 End If;
140 l_fct_ret := true;
141 End If;
142 End If;
143 Return (l_fct_ret);
144 --
145 End api_updating;
146 --
147 -- ----------------------------------------------------------------------------
148 -- |---------------------------------< lck >----------------------------------|
149 -- ----------------------------------------------------------------------------
150 Procedure lck
151 (p_organization_account_id in number
152 ,p_object_version_number in number
153 ) is
154 --
155 -- Cursor selects the 'current' row from the HR Schema
156 --
157 Cursor C_Sel1 is
158 select
159 organization_account_id
160 ,gl_code_combination_id
161 ,project_id
162 ,expenditure_organization_id
163 ,expenditure_type
164 ,task_id
165 ,award_id
166 ,comments
167 ,attribute_category
168 ,attribute1
169 ,attribute2
170 ,attribute3
171 ,attribute4
172 ,attribute5
173 ,attribute6
174 ,attribute7
175 ,attribute8
176 ,attribute9
177 ,attribute10
178 ,attribute11
179 ,attribute12
180 ,attribute13
181 ,attribute14
182 ,attribute15
183 ,set_of_books_id
184 ,account_type_code
185 ,start_date_active
186 ,business_group_id
187 ,end_date_active
188 ,organization_id
189 ,poeta_start_date
190 ,poeta_end_date
191 ,object_version_number
192 ,funding_source_code
193 from psp_organization_accounts
194 where organization_account_id = p_organization_account_id
195 for update nowait;
196 --
197 l_proc varchar2(72) := g_package||'lck';
198 --
199 Begin
200 hr_utility.set_location('Entering:'||l_proc, 5);
201 --
202 hr_api.mandatory_arg_error
203 (p_api_name => l_proc
204 ,p_argument => 'ORGANIZATION_ACCOUNT_ID'
205 ,p_argument_value => p_organization_account_id
206 );
207 hr_utility.set_location(l_proc,6);
208 hr_api.mandatory_arg_error
209 (p_api_name => l_proc
210 ,p_argument => 'OBJECT_VERSION_NUMBER'
211 ,p_argument_value => p_object_version_number
212 );
213 --
214 Open C_Sel1;
215 Fetch C_Sel1 Into psp_poa_shd.g_old_rec;
216 If C_Sel1%notfound then
217 Close C_Sel1;
218 --
219 -- The primary key is invalid therefore we must error
220 --
221 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
222 fnd_message.raise_error;
223 End If;
224 Close C_Sel1;
225 If (p_object_version_number
226 <> psp_poa_shd.g_old_rec.object_version_number) Then
227 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
228 fnd_message.raise_error;
229 End If;
230 --
231 hr_utility.set_location(' Leaving:'||l_proc, 10);
232 --
233 -- We need to trap the ORA LOCK exception
234 --
235 Exception
236 When HR_Api.Object_Locked then
237 --
238 -- The object is locked therefore we need to supply a meaningful
239 -- error message.
240 --
241 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
242 fnd_message.set_token('TABLE_NAME', 'psp_organization_accounts');
243 fnd_message.raise_error;
244 End lck;
245 --
246 -- ----------------------------------------------------------------------------
247 -- |-----------------------------< convert_args >-----------------------------|
248 -- ----------------------------------------------------------------------------
249 Function convert_args
250 (p_organization_account_id in number
251 ,p_gl_code_combination_id in number
252 ,p_project_id in number
253 ,p_expenditure_organization_id in number
254 ,p_expenditure_type in varchar2
255 ,p_task_id in number
256 ,p_award_id in number
257 ,p_comments in varchar2
258 ,p_attribute_category in varchar2
259 ,p_attribute1 in varchar2
260 ,p_attribute2 in varchar2
261 ,p_attribute3 in varchar2
262 ,p_attribute4 in varchar2
263 ,p_attribute5 in varchar2
264 ,p_attribute6 in varchar2
265 ,p_attribute7 in varchar2
266 ,p_attribute8 in varchar2
267 ,p_attribute9 in varchar2
268 ,p_attribute10 in varchar2
269 ,p_attribute11 in varchar2
270 ,p_attribute12 in varchar2
271 ,p_attribute13 in varchar2
272 ,p_attribute14 in varchar2
273 ,p_attribute15 in varchar2
274 ,p_set_of_books_id in number
275 ,p_account_type_code in varchar2
276 ,p_start_date_active in date
277 ,p_business_group_id in number
278 ,p_end_date_active in date
279 ,p_organization_id in number
280 ,p_poeta_start_date in date
281 ,p_poeta_end_date in date
282 ,p_object_version_number in number
283 ,p_funding_source_code in varchar2
284 )
285 Return g_rec_type is
286 --
287 l_rec g_rec_type;
288 --
289 Begin
290 --
291 -- Convert arguments into local l_rec structure.
292 --
293 l_rec.organization_account_id := p_organization_account_id;
294 l_rec.gl_code_combination_id := p_gl_code_combination_id;
295 l_rec.project_id := p_project_id;
296 l_rec.expenditure_organization_id := p_expenditure_organization_id;
297 l_rec.expenditure_type := p_expenditure_type;
298 l_rec.task_id := p_task_id;
299 l_rec.award_id := p_award_id;
300 l_rec.comments := p_comments;
301 l_rec.attribute_category := p_attribute_category;
302 l_rec.attribute1 := p_attribute1;
303 l_rec.attribute2 := p_attribute2;
304 l_rec.attribute3 := p_attribute3;
305 l_rec.attribute4 := p_attribute4;
306 l_rec.attribute5 := p_attribute5;
307 l_rec.attribute6 := p_attribute6;
308 l_rec.attribute7 := p_attribute7;
309 l_rec.attribute8 := p_attribute8;
310 l_rec.attribute9 := p_attribute9;
311 l_rec.attribute10 := p_attribute10;
312 l_rec.attribute11 := p_attribute11;
313 l_rec.attribute12 := p_attribute12;
314 l_rec.attribute13 := p_attribute13;
315 l_rec.attribute14 := p_attribute14;
316 l_rec.attribute15 := p_attribute15;
317 l_rec.set_of_books_id := p_set_of_books_id;
318 l_rec.account_type_code := p_account_type_code;
319 l_rec.start_date_active := p_start_date_active;
320 l_rec.business_group_id := p_business_group_id;
321 l_rec.end_date_active := p_end_date_active;
322 l_rec.organization_id := p_organization_id;
323 l_rec.poeta_start_date := p_poeta_start_date;
324 l_rec.poeta_end_date := p_poeta_end_date;
325 l_rec.object_version_number := p_object_version_number;
326 l_rec.funding_source_code := p_funding_source_code;
327 --
328 -- Return the plsql record structure.
329 --
330 Return(l_rec);
331 --
332 End convert_args;
333 --
334 end psp_poa_shd;