[Home] [Help]
PACKAGE BODY: APPS.PER_BBA_INS
Source
1 Package Body per_bba_ins as
2 /* $Header: pebbarhi.pkb 115.8 2002/12/02 13:03:45 apholt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_bba_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(p_rec in out nocopy per_bba_shd.g_rec_type) is
54 --
55 l_proc varchar2(72) := g_package||'insert_dml';
56 --
57 Begin
58 hr_utility.set_location('Entering:'||l_proc, 5);
59 p_rec.object_version_number := 1; -- Initialise the object version
60 --
61 --
62 -- Insert the row into: per_bf_balance_amounts
63 --
64 insert into per_bf_balance_amounts
65 ( balance_amount_id,
66 balance_type_id,
67 processed_assignment_id,
68 business_group_id,
69 ytd_amount,
70 fytd_amount,
71 ptd_amount,
72 mtd_amount,
73 qtd_amount,
74 run_amount,
75 object_version_number,
76 bba_attribute_category,
77 bba_attribute1,
78 bba_attribute2,
79 bba_attribute3,
80 bba_attribute4,
81 bba_attribute5,
82 bba_attribute6,
83 bba_attribute7,
84 bba_attribute8,
85 bba_attribute9,
86 bba_attribute10,
87 bba_attribute11,
88 bba_attribute12,
89 bba_attribute13,
90 bba_attribute14,
91 bba_attribute15,
92 bba_attribute16,
93 bba_attribute17,
94 bba_attribute18,
95 bba_attribute19,
96 bba_attribute20,
97 bba_attribute21,
98 bba_attribute22,
99 bba_attribute23,
100 bba_attribute24,
101 bba_attribute25,
102 bba_attribute26,
103 bba_attribute27,
104 bba_attribute28,
105 bba_attribute29,
106 bba_attribute30
107 )
108 Values
109 ( p_rec.balance_amount_id,
110 p_rec.balance_type_id,
111 p_rec.processed_assignment_id,
112 p_rec.business_group_id,
113 p_rec.ytd_amount,
114 p_rec.fytd_amount,
115 p_rec.ptd_amount,
116 p_rec.mtd_amount,
117 p_rec.qtd_amount,
118 p_rec.run_amount,
119 p_rec.object_version_number,
120 p_rec.bba_attribute_category,
121 p_rec.bba_attribute1,
122 p_rec.bba_attribute2,
123 p_rec.bba_attribute3,
124 p_rec.bba_attribute4,
125 p_rec.bba_attribute5,
126 p_rec.bba_attribute6,
127 p_rec.bba_attribute7,
128 p_rec.bba_attribute8,
129 p_rec.bba_attribute9,
130 p_rec.bba_attribute10,
131 p_rec.bba_attribute11,
132 p_rec.bba_attribute12,
133 p_rec.bba_attribute13,
134 p_rec.bba_attribute14,
135 p_rec.bba_attribute15,
136 p_rec.bba_attribute16,
137 p_rec.bba_attribute17,
138 p_rec.bba_attribute18,
139 p_rec.bba_attribute19,
140 p_rec.bba_attribute20,
141 p_rec.bba_attribute21,
142 p_rec.bba_attribute22,
143 p_rec.bba_attribute23,
144 p_rec.bba_attribute24,
145 p_rec.bba_attribute25,
146 p_rec.bba_attribute26,
147 p_rec.bba_attribute27,
148 p_rec.bba_attribute28,
149 p_rec.bba_attribute29,
150 p_rec.bba_attribute30
151 );
152 --
153 --
154 hr_utility.set_location(' Leaving:'||l_proc, 10);
155 Exception
156 When hr_api.check_integrity_violated Then
157 -- A check constraint has been violated
158 per_bba_shd.constraint_error
159 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
160 When hr_api.parent_integrity_violated Then
161 -- Parent integrity has been violated
162 per_bba_shd.constraint_error
163 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
164 When hr_api.unique_integrity_violated Then
165 -- Unique integrity has been violated
166 per_bba_shd.constraint_error
167 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
168 When Others Then
169 Raise;
170 End insert_dml;
171 --
172 -- ----------------------------------------------------------------------------
173 -- |------------------------------< pre_insert >------------------------------|
174 -- ----------------------------------------------------------------------------
175 -- {Start Of Comments}
176 --
177 -- Description:
178 -- This private procedure contains any processing which is required before
179 -- the insert dml. Presently, if the entity has a corresponding primary
180 -- key which is maintained by an associating sequence, the primary key for
181 -- the entity will be populated with the next sequence value in
182 -- preparation for the insert dml.
183 --
184 -- Prerequisites:
185 -- This is an internal procedure which is called from the ins procedure.
186 --
187 -- In Parameters:
188 -- A Pl/Sql record structre.
189 --
190 -- Post Success:
191 -- Processing continues.
192 --
193 -- Post Failure:
194 -- If an error has occurred, an error message and exception will be raised
195 -- but not handled.
196 --
197 -- Developer Implementation Notes:
198 -- Any pre-processing required before the insert dml is issued should be
199 -- coded within this procedure. As stated above, a good example is the
200 -- generation of a primary key number via a corresponding sequence.
201 -- It is important to note that any 3rd party maintenance should be reviewed
202 -- before placing in this procedure.
203 --
204 -- Access Status:
205 -- Internal Row Handler Use Only.
206 --
207 -- {End Of Comments}
208 -- ----------------------------------------------------------------------------
209 Procedure pre_insert(p_rec in out nocopy per_bba_shd.g_rec_type) is
210 --
211 l_proc varchar2(72) := g_package||'pre_insert';
212 --
213 Cursor C_Sel1 is select per_bf_balance_amounts_s.nextval from sys.dual;
214 --
215 --
216 Begin
217 hr_utility.set_location('Entering:'||l_proc, 5);
218 --
219 Open C_Sel1;
220 Fetch C_Sel1 Into p_rec.balance_amount_id;
221 Close C_Sel1;
222 --
223 hr_utility.set_location(' Leaving:'||l_proc, 10);
224 End pre_insert;
225 --
226 -- ----------------------------------------------------------------------------
227 -- |-----------------------------< post_insert >------------------------------|
228 -- ----------------------------------------------------------------------------
229 -- {Start Of Comments}
230 --
231 -- Description:
232 -- This private procedure contains any processing which is required after the
233 -- insert dml.
234 --
235 -- Prerequisites:
236 -- This is an internal procedure which is called from the ins procedure.
237 --
238 -- In Parameters:
239 -- A Pl/Sql record structre.
240 --
241 -- Post Success:
242 -- Processing continues.
243 --
244 -- Post Failure:
245 -- If an error has occurred, an error message and exception will be raised
246 -- but not handled.
247 --
248 -- Developer Implementation Notes:
249 -- Any post-processing required after the insert dml is issued should be
250 -- coded within this procedure. It is important to note that any 3rd party
251 -- maintenance should be reviewed before placing in this procedure.
252 --
253 -- Access Status:
254 -- Internal Row Handler Use Only.
255 --
256 -- {End Of Comments}
257 -- ----------------------------------------------------------------------------
258 Procedure post_insert(p_effective_date in date,
259 p_rec in per_bba_shd.g_rec_type) 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_bba_rki.after_insert
268 (p_effective_date => p_effective_date,
269 p_balance_amount_id => p_rec.balance_amount_id,
270 p_balance_type_id => p_rec.balance_type_id,
271 p_processed_assignment_id => p_rec.processed_assignment_id,
272 p_business_group_id => p_rec.business_group_id,
273 p_ytd_amount => p_rec.ytd_amount,
274 p_fytd_amount => p_rec.fytd_amount,
275 p_ptd_amount => p_rec.ptd_amount,
276 p_mtd_amount => p_rec.mtd_amount,
277 p_qtd_amount => p_rec.qtd_amount,
278 p_run_amount => p_rec.run_amount,
279 p_object_version_number => p_rec.object_version_number,
280 p_bba_attribute_category => p_rec.bba_attribute_category,
281 p_bba_attribute1 => p_rec.bba_attribute1,
282 p_bba_attribute2 => p_rec.bba_attribute2,
283 p_bba_attribute3 => p_rec.bba_attribute3,
284 p_bba_attribute4 => p_rec.bba_attribute4,
285 p_bba_attribute5 => p_rec.bba_attribute5,
286 p_bba_attribute6 => p_rec.bba_attribute6,
287 p_bba_attribute7 => p_rec.bba_attribute7,
288 p_bba_attribute8 => p_rec.bba_attribute8,
289 p_bba_attribute9 => p_rec.bba_attribute9,
290 p_bba_attribute10 => p_rec.bba_attribute10,
291 p_bba_attribute11 => p_rec.bba_attribute11,
292 p_bba_attribute12 => p_rec.bba_attribute12,
293 p_bba_attribute13 => p_rec.bba_attribute13,
294 p_bba_attribute14 => p_rec.bba_attribute14,
295 p_bba_attribute15 => p_rec.bba_attribute15,
296 p_bba_attribute16 => p_rec.bba_attribute16,
297 p_bba_attribute17 => p_rec.bba_attribute17,
298 p_bba_attribute18 => p_rec.bba_attribute18,
299 p_bba_attribute19 => p_rec.bba_attribute19,
300 p_bba_attribute20 => p_rec.bba_attribute20,
301 p_bba_attribute21 => p_rec.bba_attribute21,
302 p_bba_attribute22 => p_rec.bba_attribute22,
303 p_bba_attribute23 => p_rec.bba_attribute23,
304 p_bba_attribute24 => p_rec.bba_attribute24,
305 p_bba_attribute25 => p_rec.bba_attribute25,
306 p_bba_attribute26 => p_rec.bba_attribute26,
307 p_bba_attribute27 => p_rec.bba_attribute27,
308 p_bba_attribute28 => p_rec.bba_attribute28,
309 p_bba_attribute29 => p_rec.bba_attribute29,
310 p_bba_attribute30 => p_rec.bba_attribute30
311 );
312 --
313 exception
314 --
315 when hr_api.cannot_find_prog_unit then
316 --
317 hr_api.cannot_find_prog_unit_error
318 (p_module_name => 'PER_BF_BALANCE_AMOUNTS'
319 ,p_hook_type => 'AI');
320 --
321 end;
322 --
323 hr_utility.set_location(' Leaving:'||l_proc, 10);
324 End post_insert;
325 --
326 -- ----------------------------------------------------------------------------
327 -- |---------------------------------< ins >----------------------------------|
328 -- ----------------------------------------------------------------------------
329 Procedure ins
330 (
331 p_effective_date in date,
332 p_rec in out nocopy per_bba_shd.g_rec_type
333 ) is
334 --
335 l_proc varchar2(72) := g_package||'ins';
336 --
337 Begin
338 hr_utility.set_location('Entering:'||l_proc, 5);
339 --
340 -- Call the supporting insert validate operations
341 --
342 --
343 per_bba_bus.insert_validate(p_effective_date,
344 p_rec
345 );
346 --
347 -- Call the supporting pre-insert operation
348 --
349 pre_insert(p_rec);
350 --
351 -- Insert the row
352 --
353 insert_dml(p_rec);
354 --
355 -- Call the supporting post-insert operation
356 --
357 post_insert(p_effective_date,
358 p_rec);
359 --
360 hr_utility.set_location('Leaving:'||l_proc, 20);
361 end ins;
362 --
363 -- ----------------------------------------------------------------------------
364 -- |---------------------------------< ins >----------------------------------|
365 -- ----------------------------------------------------------------------------
366 Procedure ins
367 (
368 p_effective_date in date,
369 p_balance_amount_id out nocopy number,
370 p_balance_type_id in number,
371 p_processed_assignment_id in number,
372 p_business_group_id in number,
373 p_ytd_amount in number default null,
374 p_fytd_amount in number default null,
375 p_ptd_amount in number default null,
376 p_mtd_amount in number default null,
377 p_qtd_amount in number default null,
378 p_run_amount in number default null,
379 p_object_version_number out nocopy number,
380 p_bba_attribute_category in varchar2 default null,
381 p_bba_attribute1 in varchar2 default null,
382 p_bba_attribute2 in varchar2 default null,
383 p_bba_attribute3 in varchar2 default null,
384 p_bba_attribute4 in varchar2 default null,
385 p_bba_attribute5 in varchar2 default null,
386 p_bba_attribute6 in varchar2 default null,
387 p_bba_attribute7 in varchar2 default null,
388 p_bba_attribute8 in varchar2 default null,
389 p_bba_attribute9 in varchar2 default null,
390 p_bba_attribute10 in varchar2 default null,
391 p_bba_attribute11 in varchar2 default null,
392 p_bba_attribute12 in varchar2 default null,
393 p_bba_attribute13 in varchar2 default null,
394 p_bba_attribute14 in varchar2 default null,
395 p_bba_attribute15 in varchar2 default null,
396 p_bba_attribute16 in varchar2 default null,
397 p_bba_attribute17 in varchar2 default null,
398 p_bba_attribute18 in varchar2 default null,
399 p_bba_attribute19 in varchar2 default null,
400 p_bba_attribute20 in varchar2 default null,
401 p_bba_attribute21 in varchar2 default null,
402 p_bba_attribute22 in varchar2 default null,
403 p_bba_attribute23 in varchar2 default null,
404 p_bba_attribute24 in varchar2 default null,
405 p_bba_attribute25 in varchar2 default null,
406 p_bba_attribute26 in varchar2 default null,
407 p_bba_attribute27 in varchar2 default null,
408 p_bba_attribute28 in varchar2 default null,
409 p_bba_attribute29 in varchar2 default null,
410 p_bba_attribute30 in varchar2 default null
411 ) is
412 --
413 l_rec per_bba_shd.g_rec_type;
414 l_proc varchar2(72) := g_package||'ins';
415 --
416 Begin
417 hr_utility.set_location('Entering:'||l_proc, 5);
418 --
419 -- Call conversion function to turn arguments into the
420 -- p_rec structure.
421 --
422 l_rec :=
423 per_bba_shd.convert_args
424 (
425 null,
426 p_balance_type_id,
427 p_processed_assignment_id,
428 p_business_group_id,
429 p_ytd_amount,
430 p_fytd_amount,
431 p_ptd_amount,
432 p_mtd_amount,
433 p_qtd_amount,
434 p_run_amount,
435 null,
436 p_bba_attribute_category,
437 p_bba_attribute1,
438 p_bba_attribute2,
439 p_bba_attribute3,
440 p_bba_attribute4,
441 p_bba_attribute5,
442 p_bba_attribute6,
443 p_bba_attribute7,
444 p_bba_attribute8,
445 p_bba_attribute9,
446 p_bba_attribute10,
447 p_bba_attribute11,
448 p_bba_attribute12,
449 p_bba_attribute13,
450 p_bba_attribute14,
451 p_bba_attribute15,
452 p_bba_attribute16,
453 p_bba_attribute17,
454 p_bba_attribute18,
455 p_bba_attribute19,
456 p_bba_attribute20,
457 p_bba_attribute21,
458 p_bba_attribute22,
459 p_bba_attribute23,
460 p_bba_attribute24,
461 p_bba_attribute25,
462 p_bba_attribute26,
463 p_bba_attribute27,
464 p_bba_attribute28,
465 p_bba_attribute29,
466 p_bba_attribute30
467 );
468 --
469 -- Having converted the arguments into the per_bba_rec
470 -- plsql record structure we call the corresponding record business process.
471 --
472 ins(p_effective_date,
473 l_rec
474 );
475 --
476 -- As the primary key argument(s)
477 -- are specified as an OUT's we must set these values.
478 --
479 p_balance_amount_id := l_rec.balance_amount_id;
480 p_object_version_number := l_rec.object_version_number;
481 --
482 hr_utility.set_location(' Leaving:'||l_proc, 10);
483 End ins;
484 --
485 end per_bba_ins;