[Home] [Help]
PACKAGE BODY: APPS.PER_BPA_INS
Source
1 Package Body per_bpa_ins 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_ins.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< insert_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the actual dml insert logic. The processing of
17 -- this procedure are as follows:
18 -- 1) Initialise the object_version_number to 1 if the object_version_number
19 -- is defined as an attribute for this entity.
20 -- 2) To set and unset the g_api_dml status as required (as we are about to
21 -- perform dml).
22 -- 3) To insert the row into the schema.
23 -- 4) To trap any constraint violations that may have occurred.
24 -- 5) To raise any other errors.
25 --
26 -- Prerequisites:
27 -- This is an internal private procedure which must be called from the ins
28 -- procedure and must have all mandatory attributes set (except the
29 -- object_version_number which is initialised within this procedure).
30 --
31 -- In Parameters:
32 -- A Pl/Sql record structre.
33 --
34 -- Post Success:
35 -- The specified row will be inserted into the schema.
36 --
37 -- Post Failure:
38 -- On the insert dml failure it is important to note that we always reset the
39 -- g_api_dml status to false.
40 -- If a check, unique or parent integrity constraint violation is raised the
41 -- constraint_error procedure will be called.
42 -- If any other error is reported, the error will be raised after the
43 -- g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 -- None.
47 --
48 -- Access Status:
49 -- Internal Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml
54 (p_rec in out nocopy per_bpa_shd.g_rec_type
55 ) is
56 --
57 l_proc varchar2(72) := g_package||'insert_dml';
58 --
59 Begin
60 hr_utility.set_location('Entering:'||l_proc, 5);
61 p_rec.object_version_number := 1; -- Initialise the object version
62 --
63 --
64 --
65 -- Insert the row into: per_bf_processed_assignments
66 --
67 insert into per_bf_processed_assignments
68 (processed_assignment_id,
69 payroll_run_id,
70 assignment_id,
71 object_version_number,
72 bpa_attribute_category,
73 bpa_attribute1,
74 bpa_attribute2,
75 bpa_attribute3,
76 bpa_attribute4,
77 bpa_attribute5,
78 bpa_attribute6,
79 bpa_attribute7,
80 bpa_attribute8,
81 bpa_attribute9,
82 bpa_attribute10,
83 bpa_attribute11,
84 bpa_attribute12,
85 bpa_attribute13,
86 bpa_attribute14,
87 bpa_attribute15,
88 bpa_attribute16,
89 bpa_attribute17,
90 bpa_attribute18,
91 bpa_attribute19,
92 bpa_attribute20,
93 bpa_attribute21,
94 bpa_attribute22,
95 bpa_attribute23,
96 bpa_attribute24,
97 bpa_attribute25,
98 bpa_attribute26,
99 bpa_attribute27,
100 bpa_attribute28,
101 bpa_attribute29,
102 bpa_attribute30
103 )
104 Values
105 (p_rec.processed_assignment_id,
106 p_rec.payroll_run_id,
107 p_rec.assignment_id,
108 p_rec.object_version_number,
109 p_rec.bpa_attribute_category,
110 p_rec.bpa_attribute1,
111 p_rec.bpa_attribute2,
112 p_rec.bpa_attribute3,
113 p_rec.bpa_attribute4,
114 p_rec.bpa_attribute5,
115 p_rec.bpa_attribute6,
116 p_rec.bpa_attribute7,
117 p_rec.bpa_attribute8,
118 p_rec.bpa_attribute9,
119 p_rec.bpa_attribute10,
120 p_rec.bpa_attribute11,
121 p_rec.bpa_attribute12,
122 p_rec.bpa_attribute13,
123 p_rec.bpa_attribute14,
124 p_rec.bpa_attribute15,
125 p_rec.bpa_attribute16,
126 p_rec.bpa_attribute17,
127 p_rec.bpa_attribute18,
128 p_rec.bpa_attribute19,
129 p_rec.bpa_attribute20,
130 p_rec.bpa_attribute21,
131 p_rec.bpa_attribute22,
132 p_rec.bpa_attribute23,
133 p_rec.bpa_attribute24,
134 p_rec.bpa_attribute25,
135 p_rec.bpa_attribute26,
136 p_rec.bpa_attribute27,
137 p_rec.bpa_attribute28,
138 p_rec.bpa_attribute29,
139 p_rec.bpa_attribute30
140 );
141 --
142 --
143 --
144 hr_utility.set_location(' Leaving:'||l_proc, 10);
145 Exception
146 When hr_api.check_integrity_violated Then
147 -- A check constraint has been violated
148 --
149 per_bpa_shd.constraint_error
150 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
151 When hr_api.parent_integrity_violated Then
152 -- Parent integrity has been violated
153 --
154 per_bpa_shd.constraint_error
155 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
156 When hr_api.unique_integrity_violated Then
157 -- Unique integrity has been violated
158 --
159 per_bpa_shd.constraint_error
160 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
161 When Others Then
162 --
163 Raise;
164 End insert_dml;
165 --
166 -- ----------------------------------------------------------------------------
167 -- |------------------------------< pre_insert >------------------------------|
168 -- ----------------------------------------------------------------------------
169 -- {Start Of Comments}
170 --
171 -- Description:
172 -- This private procedure contains any processing which is required before
173 -- the insert dml. Presently, if the entity has a corresponding primary
174 -- key which is maintained by an associating sequence, the primary key for
175 -- the entity will be populated with the next sequence value in
176 -- preparation for the insert dml.
177 --
178 -- Prerequisites:
179 -- This is an internal procedure which is called from the ins procedure.
180 --
181 -- In Parameters:
182 -- A Pl/Sql record structre.
183 --
184 -- Post Success:
185 -- Processing continues.
186 --
187 -- Post Failure:
188 -- If an error has occurred, an error message and exception will be raised
189 -- but not handled.
190 --
191 -- Developer Implementation Notes:
192 -- Any pre-processing required before the insert dml is issued should be
193 -- coded within this procedure. As stated above, a good example is the
194 -- generation of a primary key number via a corresponding sequence.
195 -- It is important to note that any 3rd party maintenance should be reviewed
196 -- before placing in this procedure.
197 --
198 -- Access Status:
199 -- Internal Row Handler Use Only.
200 --
201 -- {End Of Comments}
202 -- ----------------------------------------------------------------------------
203 Procedure pre_insert
204 (p_rec in out nocopy per_bpa_shd.g_rec_type
205 ) is
206 --
207 l_proc varchar2(72) := g_package||'pre_insert';
208 --
209 Cursor C_Sel1 is select per_bf_processed_assignments_s.nextval from sys.dual;
210 --
211 Begin
212 hr_utility.set_location('Entering:'||l_proc, 5);
213 --
214 --
215 -- Select the next sequence number
216 --
217 Open C_Sel1;
218 Fetch C_Sel1 Into p_rec.processed_assignment_id;
219 Close C_Sel1;
220 --
221 hr_utility.set_location(' Leaving:'||l_proc, 10);
222 End pre_insert;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |-----------------------------< post_insert >------------------------------|
226 -- ----------------------------------------------------------------------------
227 -- {Start Of Comments}
228 --
229 -- Description:
230 -- This private procedure contains any processing which is required after the
231 -- insert dml.
232 --
233 -- Prerequisites:
234 -- This is an internal procedure which is called from the ins procedure.
235 --
236 -- In Parameters:
237 -- A Pl/Sql record structre.
238 --
239 -- Post Success:
240 -- Processing continues.
241 --
242 -- Post Failure:
243 -- If an error has occurred, an error message and exception will be raised
244 -- but not handled.
245 --
246 -- Developer Implementation Notes:
247 -- Any post-processing required after the insert dml is issued should be
248 -- coded within this procedure. It is important to note that any 3rd party
249 -- maintenance should be reviewed before placing in this procedure.
250 --
251 -- Access Status:
252 -- Internal Row Handler Use Only.
253 --
254 -- {End Of Comments}
255 -- ----------------------------------------------------------------------------
256 Procedure post_insert
257 (p_effective_date in date
258 ,p_rec in per_bpa_shd.g_rec_type
259 ) is
260 --
261 l_proc varchar2(72) := g_package||'post_insert';
262 --
263 Begin
264 hr_utility.set_location('Entering:'||l_proc, 5);
265 begin
266 --
267 per_bpa_rki.after_insert
268 (p_effective_date => p_effective_date,
269 p_processed_assignment_id => p_rec.processed_assignment_id,
270 p_payroll_run_id => p_rec.payroll_run_id,
271 p_assignment_id => p_rec.assignment_id,
272 p_object_version_number => p_rec.object_version_number,
273 p_bpa_attribute_category => p_rec.bpa_attribute_category,
274 p_bpa_attribute1 => p_rec.bpa_attribute1,
275 p_bpa_attribute2 => p_rec.bpa_attribute2,
276 p_bpa_attribute3 => p_rec.bpa_attribute3,
277 p_bpa_attribute4 => p_rec.bpa_attribute4,
278 p_bpa_attribute5 => p_rec.bpa_attribute5,
279 p_bpa_attribute6 => p_rec.bpa_attribute6,
280 p_bpa_attribute7 => p_rec.bpa_attribute7,
281 p_bpa_attribute8 => p_rec.bpa_attribute8,
282 p_bpa_attribute9 => p_rec.bpa_attribute9,
283 p_bpa_attribute10 => p_rec.bpa_attribute10,
284 p_bpa_attribute11 => p_rec.bpa_attribute11,
285 p_bpa_attribute12 => p_rec.bpa_attribute12,
286 p_bpa_attribute13 => p_rec.bpa_attribute13,
287 p_bpa_attribute14 => p_rec.bpa_attribute14,
288 p_bpa_attribute15 => p_rec.bpa_attribute15,
289 p_bpa_attribute16 => p_rec.bpa_attribute16,
290 p_bpa_attribute17 => p_rec.bpa_attribute17,
291 p_bpa_attribute18 => p_rec.bpa_attribute18,
292 p_bpa_attribute19 => p_rec.bpa_attribute19,
293 p_bpa_attribute20 => p_rec.bpa_attribute20,
294 p_bpa_attribute21 => p_rec.bpa_attribute21,
295 p_bpa_attribute22 => p_rec.bpa_attribute22,
296 p_bpa_attribute23 => p_rec.bpa_attribute23,
297 p_bpa_attribute24 => p_rec.bpa_attribute24,
298 p_bpa_attribute25 => p_rec.bpa_attribute25,
299 p_bpa_attribute26 => p_rec.bpa_attribute26,
300 p_bpa_attribute27 => p_rec.bpa_attribute27,
301 p_bpa_attribute28 => p_rec.bpa_attribute28,
302 p_bpa_attribute29 => p_rec.bpa_attribute29,
303 p_bpa_attribute30 => p_rec.bpa_attribute30
304 );
305 --
306 exception
307 --
308 when hr_api.cannot_find_prog_unit then
309 --
310 hr_api.cannot_find_prog_unit_error
311 (p_module_name => 'PER_BF_PROCESSED_ASSIGNMENTS'
312 ,p_hook_type => 'AI');
313 --
314 end;
315 --
316 hr_utility.set_location(' Leaving:'||l_proc, 10);
317 End post_insert;
318 --
319 -- ----------------------------------------------------------------------------
320 -- |---------------------------------< ins >----------------------------------|
321 -- ----------------------------------------------------------------------------
322 Procedure ins
323 (p_effective_date in date,
324 p_rec in out nocopy per_bpa_shd.g_rec_type
325 ) is
326 --
327 l_proc varchar2(72) := g_package||'ins';
328 --
329 Begin
330 hr_utility.set_location('Entering:'||l_proc, 5);
331 --
332 -- Call the supporting insert validate operations
333 --
334 per_bpa_bus.insert_validate
335 (p_effective_date
336 ,p_rec
337 );
338 --
339 -- Call the supporting pre-insert operation
340 --
341 pre_insert(p_rec);
342 --
343 -- Insert the row
344 --
345 insert_dml(p_rec);
346 --
347 -- Call the supporting post-insert operation
348 --
349 post_insert
350 (p_effective_date
351 ,p_rec
352 );
353 --
354 hr_utility.set_location('Leaving:'||l_proc, 20);
355 end ins;
356 --
357 -- ----------------------------------------------------------------------------
358 -- |---------------------------------< ins >----------------------------------|
359 -- ----------------------------------------------------------------------------
360 Procedure ins
361 (p_effective_date in date,
362 p_processed_assignment_id out nocopy number,
363 p_payroll_run_id in number,
364 p_assignment_id in number,
365 p_object_version_number out nocopy number,
366 p_bpa_attribute_category in varchar2 default null,
367 p_bpa_attribute1 in varchar2 default null,
368 p_bpa_attribute2 in varchar2 default null,
369 p_bpa_attribute3 in varchar2 default null,
370 p_bpa_attribute4 in varchar2 default null,
371 p_bpa_attribute5 in varchar2 default null,
372 p_bpa_attribute6 in varchar2 default null,
373 p_bpa_attribute7 in varchar2 default null,
374 p_bpa_attribute8 in varchar2 default null,
375 p_bpa_attribute9 in varchar2 default null,
376 p_bpa_attribute10 in varchar2 default null,
377 p_bpa_attribute11 in varchar2 default null,
378 p_bpa_attribute12 in varchar2 default null,
379 p_bpa_attribute13 in varchar2 default null,
380 p_bpa_attribute14 in varchar2 default null,
381 p_bpa_attribute15 in varchar2 default null,
382 p_bpa_attribute16 in varchar2 default null,
383 p_bpa_attribute17 in varchar2 default null,
384 p_bpa_attribute18 in varchar2 default null,
385 p_bpa_attribute19 in varchar2 default null,
386 p_bpa_attribute20 in varchar2 default null,
387 p_bpa_attribute21 in varchar2 default null,
388 p_bpa_attribute22 in varchar2 default null,
389 p_bpa_attribute23 in varchar2 default null,
390 p_bpa_attribute24 in varchar2 default null,
391 p_bpa_attribute25 in varchar2 default null,
392 p_bpa_attribute26 in varchar2 default null,
393 p_bpa_attribute27 in varchar2 default null,
394 p_bpa_attribute28 in varchar2 default null,
395 p_bpa_attribute29 in varchar2 default null,
396 p_bpa_attribute30 in varchar2 default null
397 ) is
398 --
399 l_rec per_bpa_shd.g_rec_type;
400 l_proc varchar2(72) := g_package||'ins';
401 --
402 Begin
403 hr_utility.set_location('Entering:'||l_proc, 5);
404 --
405 -- Call conversion function to turn arguments into the
406 -- p_rec structure.
407 --
408 l_rec :=
409 per_bpa_shd.convert_args
410 (null,
411 p_payroll_run_id,
412 p_assignment_id,
413 null,
414 p_bpa_attribute_category,
415 p_bpa_attribute1,
416 p_bpa_attribute2,
417 p_bpa_attribute3,
418 p_bpa_attribute4,
419 p_bpa_attribute5,
420 p_bpa_attribute6,
421 p_bpa_attribute7,
422 p_bpa_attribute8,
423 p_bpa_attribute9,
424 p_bpa_attribute10,
425 p_bpa_attribute11,
426 p_bpa_attribute12,
427 p_bpa_attribute13,
428 p_bpa_attribute14,
429 p_bpa_attribute15,
430 p_bpa_attribute16,
431 p_bpa_attribute17,
432 p_bpa_attribute18,
433 p_bpa_attribute19,
434 p_bpa_attribute20,
435 p_bpa_attribute21,
436 p_bpa_attribute22,
437 p_bpa_attribute23,
438 p_bpa_attribute24,
439 p_bpa_attribute25,
440 p_bpa_attribute26,
441 p_bpa_attribute27,
442 p_bpa_attribute28,
443 p_bpa_attribute29,
444 p_bpa_attribute30
445 );
446 --
447 -- Having converted the arguments into the per_bpa_rec
448 -- plsql record structure we call the corresponding record business process.
449 --
450 ins(p_effective_date
451 ,l_rec
452 );
453 --
454 -- As the primary key argument(s)
455 -- are specified as an OUT's we must set these values.
456 --
457 p_processed_assignment_id := l_rec.processed_assignment_id;
458 p_object_version_number := l_rec.object_version_number;
459 --
460 hr_utility.set_location(' Leaving:'||l_proc, 10);
461 End ins;
462 --
463 end per_bpa_ins;