[Home] [Help]
PACKAGE BODY: APPS.PER_BPA_SHD
Source
1 Package Body per_bpa_shd as
2 /* $Header: pebparhi.pkb 115.6 2002/12/02 13:36:46 apholt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_bpa_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE
15 ) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 hr_utility.set_location('Entering:'||l_proc, 5);
21 --
22 If (p_constraint_name = 'PER_BF_PROCESSED_ASSIGNS_FK1') Then
23 fnd_message.set_name('PER', 'HR_52935_NO_RUN_AVAIL');
24 fnd_message.set_token('PROCEDURE', l_proc);
25 fnd_message.set_token('STEP','5');
26 fnd_message.raise_error;
27 ElsIf (p_constraint_name = 'PER_BF_PROCESSED_ASSIGNS_PK') Then
28 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
29 fnd_message.set_token('PROCEDURE', l_proc);
30 fnd_message.set_token('STEP','10');
31 fnd_message.raise_error;
32 ElsIf (p_constraint_name = 'PER_BF_PROCESSED_ASSIGNS_UK1') Then
33 fnd_message.set_name('PER', 'PER_289360_BF_PAYROLL_NOT_UNIQ');
34 fnd_message.set_token('PROCEDURE', l_proc);
35 fnd_message.set_token('STEP','15');
36 fnd_message.raise_error;
37 ElsIf (p_constraint_name = 'PER_BF_PROCESSED_ASSIGNS_BPAB') Then
38 fnd_message.set_name('PER', 'PER_289355_BF_BAL_CHILD_EXIST');
39 fnd_message.set_token('PROCEDURE', l_proc);
40 fnd_message.set_token('STEP','20');
41 fnd_message.raise_error;
42 ElsIf (p_constraint_name = 'PER_BF_PROCESSED_ASSIGNS_BPAP') Then
43 fnd_message.set_name('PER', 'PER_289356_BF_PAY_CHILD_EXIST');
44 fnd_message.set_token('PROCEDURE', l_proc);
45 fnd_message.set_token('STEP','25');
46 fnd_message.raise_error;
47 Else
48 fnd_message.set_name('PER', 'HR_7877_API_INVALID_CONSTRAINT');
49 fnd_message.set_token('PROCEDURE', l_proc);
50 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
51 fnd_message.raise_error;
52 End If;
53 --
54 hr_utility.set_location(' Leaving:'||l_proc, 10);
55 End constraint_error;
56 --
57 -- ----------------------------------------------------------------------------
58 -- |-----------------------------< api_updating >-----------------------------|
59 -- ----------------------------------------------------------------------------
60 Function api_updating
61 (p_processed_assignment_id in number
62 ,p_object_version_number in number
63 )
64 Return Boolean Is
65 --
66 --
67 -- Cursor selects the 'current' row from the HR Schema
68 --
69 Cursor C_Sel1 is
70 select
71 processed_assignment_id,
72 payroll_run_id,
73 assignment_id,
74 object_version_number,
75 bpa_attribute_category,
76 bpa_attribute1,
77 bpa_attribute2,
78 bpa_attribute3,
79 bpa_attribute4,
80 bpa_attribute5,
81 bpa_attribute6,
82 bpa_attribute7,
83 bpa_attribute8,
84 bpa_attribute9,
85 bpa_attribute10,
86 bpa_attribute11,
87 bpa_attribute12,
88 bpa_attribute13,
89 bpa_attribute14,
90 bpa_attribute15,
91 bpa_attribute16,
92 bpa_attribute17,
93 bpa_attribute18,
94 bpa_attribute19,
95 bpa_attribute20,
96 bpa_attribute21,
97 bpa_attribute22,
98 bpa_attribute23,
99 bpa_attribute24,
100 bpa_attribute25,
101 bpa_attribute26,
102 bpa_attribute27,
103 bpa_attribute28,
104 bpa_attribute29,
105 bpa_attribute30
106 from per_bf_processed_assignments
107 where processed_assignment_id = p_processed_assignment_id;
108 --
109 l_proc varchar2(72) := g_package||'api_updating';
110 l_fct_ret boolean;
111 --
112 Begin
113 hr_utility.set_location('Entering:'||l_proc, 5);
114 --
115 If (p_processed_assignment_id is null and
116 p_object_version_number is null
117 ) Then
118 --
119 -- One of the primary key arguments is null therefore we must
120 -- set the returning function value to false
121 --
122 l_fct_ret := false;
123 Else
124 If (p_processed_assignment_id = g_old_rec.processed_assignment_id and
125 p_object_version_number = g_old_rec.object_version_number
126 ) Then
127 hr_utility.set_location(l_proc, 10);
128 --
129 -- The g_old_rec is current therefore we must
130 -- set the returning function to true
131 --
132 l_fct_ret := true;
133 Else
134 --
135 -- Select the current row into g_old_rec
136 --
137 Open C_Sel1;
138 Fetch C_Sel1 Into g_old_rec;
139 If C_Sel1%notfound Then
140 Close C_Sel1;
141 --
142 -- The primary key is invalid therefore we must error
143 --
144 fnd_message.set_name('PER', 'HR_7220_INVALID_PRIMARY_KEY');
145 fnd_message.raise_error;
146 End If;
147 Close C_Sel1;
148 If (p_object_version_number <> g_old_rec.object_version_number) Then
149 fnd_message.set_name('PER', 'HR_7155_OBJECT_INVALID');
150 fnd_message.raise_error;
151 End If;
152 hr_utility.set_location(l_proc, 15);
153 l_fct_ret := true;
154 End If;
155 End If;
156 hr_utility.set_location(' Leaving:'||l_proc, 20);
157 Return (l_fct_ret);
158 --
159 End api_updating;
160 --
161 -- ----------------------------------------------------------------------------
162 -- |---------------------------------< lck >----------------------------------|
163 -- ----------------------------------------------------------------------------
164 Procedure lck
165 (p_processed_assignment_id in number
166 ,p_object_version_number in number
167 ) is
168 --
169 -- Cursor selects the 'current' row from the HR Schema
170 --
171 Cursor C_Sel1 is
172 select
173 processed_assignment_id,
174 payroll_run_id,
175 assignment_id,
176 object_version_number,
177 bpa_attribute_category,
178 bpa_attribute1,
179 bpa_attribute2,
180 bpa_attribute3,
181 bpa_attribute4,
182 bpa_attribute5,
183 bpa_attribute6,
184 bpa_attribute7,
185 bpa_attribute8,
186 bpa_attribute9,
187 bpa_attribute10,
188 bpa_attribute11,
189 bpa_attribute12,
190 bpa_attribute13,
191 bpa_attribute14,
192 bpa_attribute15,
193 bpa_attribute16,
194 bpa_attribute17,
195 bpa_attribute18,
196 bpa_attribute19,
197 bpa_attribute20,
198 bpa_attribute21,
199 bpa_attribute22,
200 bpa_attribute23,
201 bpa_attribute24,
202 bpa_attribute25,
203 bpa_attribute26,
204 bpa_attribute27,
205 bpa_attribute28,
206 bpa_attribute29,
207 bpa_attribute30
208 from per_bf_processed_assignments
209 where processed_assignment_id = p_processed_assignment_id
210 for update nowait;
211 --
212 l_proc varchar2(72) := g_package||'lck';
213 --
214 Begin
215 hr_utility.set_location('Entering:'||l_proc, 5);
216 --
217 -- Add any mandatory argument checking here:
218 -- Example:
219 -- hr_api.mandatory_arg_error
220 -- (p_api_name => l_proc,
221 -- p_argument => 'object_version_number',
222 -- p_argument_value => p_object_version_number);
223 --
224 hr_api.mandatory_arg_error(p_api_name => l_proc
225 ,p_argument => 'PROCESSED_ASSIGNMENT_ID'
226 ,p_argument_value => p_processed_assignment_id);
227 --
228 Open C_Sel1;
229 Fetch C_Sel1 Into g_old_rec;
230 If C_Sel1%notfound then
231 Close C_Sel1;
232 --
233 -- The primary key is invalid therefore we must error
234 --
235 fnd_message.set_name('PER', 'HR_7220_INVALID_PRIMARY_KEY');
236 fnd_message.raise_error;
237 End If;
238 Close C_Sel1;
239 If (p_object_version_number <> g_old_rec.object_version_number) Then
240 fnd_message.set_name('PER', 'HR_7155_OBJECT_INVALID');
241 fnd_message.raise_error;
242 End If;
243 --
244 hr_utility.set_location(' Leaving:'||l_proc, 10);
245 --
246 -- We need to trap the ORA LOCK exception
247 --
248 Exception
249 When HR_Api.Object_Locked then
250 --
251 -- The object is locked therefore we need to supply a meaningful
252 -- error message.
253 --
254 fnd_message.set_name('PER', 'HR_7165_OBJECT_LOCKED');
255 fnd_message.set_token('TABLE_NAME', 'per_bf_processed_assignments');
256 fnd_message.raise_error;
257 End lck;
258 --
259 -- ----------------------------------------------------------------------------
260 -- |-----------------------------< convert_args >-----------------------------|
261 -- ----------------------------------------------------------------------------
262 Function convert_args
263 (p_processed_assignment_id in number,
264 p_payroll_run_id in number,
265 p_assignment_id in number,
266 p_object_version_number in number,
267 p_bpa_attribute_category in varchar2,
268 p_bpa_attribute1 in varchar2,
269 p_bpa_attribute2 in varchar2,
270 p_bpa_attribute3 in varchar2,
271 p_bpa_attribute4 in varchar2,
272 p_bpa_attribute5 in varchar2,
273 p_bpa_attribute6 in varchar2,
274 p_bpa_attribute7 in varchar2,
275 p_bpa_attribute8 in varchar2,
276 p_bpa_attribute9 in varchar2,
277 p_bpa_attribute10 in varchar2,
278 p_bpa_attribute11 in varchar2,
279 p_bpa_attribute12 in varchar2,
280 p_bpa_attribute13 in varchar2,
281 p_bpa_attribute14 in varchar2,
282 p_bpa_attribute15 in varchar2,
283 p_bpa_attribute16 in varchar2,
284 p_bpa_attribute17 in varchar2,
285 p_bpa_attribute18 in varchar2,
286 p_bpa_attribute19 in varchar2,
287 p_bpa_attribute20 in varchar2,
288 p_bpa_attribute21 in varchar2,
289 p_bpa_attribute22 in varchar2,
290 p_bpa_attribute23 in varchar2,
291 p_bpa_attribute24 in varchar2,
292 p_bpa_attribute25 in varchar2,
293 p_bpa_attribute26 in varchar2,
294 p_bpa_attribute27 in varchar2,
295 p_bpa_attribute28 in varchar2,
296 p_bpa_attribute29 in varchar2,
297 p_bpa_attribute30 in varchar2
298 )
299 Return g_rec_type is
300 --
301 l_rec g_rec_type;
302 l_proc varchar2(72) := g_package||'convert_args';
303 --
304 Begin
305 --
306 hr_utility.set_location('Entering:'||l_proc, 5);
307 --
308 -- Convert arguments into local l_rec structure.
309 --
310 l_rec.processed_assignment_id := p_processed_assignment_id;
311 l_rec.payroll_run_id := p_payroll_run_id;
312 l_rec.assignment_id := p_assignment_id;
313 l_rec.object_version_number := p_object_version_number;
314 l_rec.bpa_attribute_category := p_bpa_attribute_category;
315 l_rec.bpa_attribute1 := p_bpa_attribute1;
316 l_rec.bpa_attribute2 := p_bpa_attribute2;
317 l_rec.bpa_attribute3 := p_bpa_attribute3;
318 l_rec.bpa_attribute4 := p_bpa_attribute4;
319 l_rec.bpa_attribute5 := p_bpa_attribute5;
320 l_rec.bpa_attribute6 := p_bpa_attribute6;
321 l_rec.bpa_attribute7 := p_bpa_attribute7;
322 l_rec.bpa_attribute8 := p_bpa_attribute8;
323 l_rec.bpa_attribute9 := p_bpa_attribute9;
324 l_rec.bpa_attribute10 := p_bpa_attribute10;
325 l_rec.bpa_attribute11 := p_bpa_attribute11;
326 l_rec.bpa_attribute12 := p_bpa_attribute12;
327 l_rec.bpa_attribute13 := p_bpa_attribute13;
328 l_rec.bpa_attribute14 := p_bpa_attribute14;
329 l_rec.bpa_attribute15 := p_bpa_attribute15;
330 l_rec.bpa_attribute16 := p_bpa_attribute16;
331 l_rec.bpa_attribute17 := p_bpa_attribute17;
332 l_rec.bpa_attribute18 := p_bpa_attribute18;
333 l_rec.bpa_attribute19 := p_bpa_attribute19;
334 l_rec.bpa_attribute20 := p_bpa_attribute20;
335 l_rec.bpa_attribute21 := p_bpa_attribute21;
336 l_rec.bpa_attribute22 := p_bpa_attribute22;
337 l_rec.bpa_attribute23 := p_bpa_attribute23;
338 l_rec.bpa_attribute24 := p_bpa_attribute24;
339 l_rec.bpa_attribute25 := p_bpa_attribute25;
340 l_rec.bpa_attribute26 := p_bpa_attribute26;
341 l_rec.bpa_attribute27 := p_bpa_attribute27;
342 l_rec.bpa_attribute28 := p_bpa_attribute28;
343 l_rec.bpa_attribute29 := p_bpa_attribute29;
344 l_rec.bpa_attribute30 := p_bpa_attribute30;
345 --
346 -- Return the plsql record structure.
347 --
348 hr_utility.set_location(' Leaving:'||l_proc, 10);
349 Return(l_rec);
350 --
351 End convert_args;
352 --
353 end per_bpa_shd;