1 Package Body ben_pff_ins as
2 /* $Header: bepffrhi.pkb 120.0 2005/05/28 10:42:25 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_pff_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 ben_pff_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 ben_pff_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: ben_pct_fl_tm_fctr
64 --
65 insert into ben_pct_fl_tm_fctr
66 ( pct_fl_tm_fctr_id,
67 name,
68 business_group_id,
69 mx_pct_val,
70 mn_pct_val,
71 no_mn_pct_val_flag,
72 no_mx_pct_val_flag,
73 use_prmry_asnt_only_flag,
74 use_sum_of_all_asnts_flag,
75 rndg_cd,
76 rndg_rl,
77 pff_attribute_category,
78 pff_attribute1,
79 pff_attribute2,
80 pff_attribute3,
81 pff_attribute4,
82 pff_attribute5,
83 pff_attribute6,
84 pff_attribute7,
85 pff_attribute8,
86 pff_attribute9,
87 pff_attribute10,
88 pff_attribute11,
89 pff_attribute12,
90 pff_attribute13,
91 pff_attribute14,
92 pff_attribute15,
93 pff_attribute16,
94 pff_attribute17,
95 pff_attribute18,
96 pff_attribute19,
97 pff_attribute20,
98 pff_attribute21,
99 pff_attribute22,
100 pff_attribute23,
101 pff_attribute24,
102 pff_attribute25,
103 pff_attribute26,
104 pff_attribute27,
105 pff_attribute28,
106 pff_attribute29,
107 pff_attribute30,
108 object_version_number
109 )
110 Values
111 ( p_rec.pct_fl_tm_fctr_id,
112 p_rec.name,
113 p_rec.business_group_id,
114 p_rec.mx_pct_val,
115 p_rec.mn_pct_val,
116 p_rec.no_mn_pct_val_flag,
117 p_rec.no_mx_pct_val_flag,
118 p_rec.use_prmry_asnt_only_flag,
119 p_rec.use_sum_of_all_asnts_flag,
120 p_rec.rndg_cd,
121 p_rec.rndg_rl,
122 p_rec.pff_attribute_category,
123 p_rec.pff_attribute1,
124 p_rec.pff_attribute2,
125 p_rec.pff_attribute3,
126 p_rec.pff_attribute4,
127 p_rec.pff_attribute5,
128 p_rec.pff_attribute6,
129 p_rec.pff_attribute7,
130 p_rec.pff_attribute8,
131 p_rec.pff_attribute9,
132 p_rec.pff_attribute10,
133 p_rec.pff_attribute11,
134 p_rec.pff_attribute12,
135 p_rec.pff_attribute13,
136 p_rec.pff_attribute14,
137 p_rec.pff_attribute15,
138 p_rec.pff_attribute16,
139 p_rec.pff_attribute17,
140 p_rec.pff_attribute18,
141 p_rec.pff_attribute19,
142 p_rec.pff_attribute20,
143 p_rec.pff_attribute21,
144 p_rec.pff_attribute22,
145 p_rec.pff_attribute23,
146 p_rec.pff_attribute24,
147 p_rec.pff_attribute25,
148 p_rec.pff_attribute26,
149 p_rec.pff_attribute27,
150 p_rec.pff_attribute28,
151 p_rec.pff_attribute29,
152 p_rec.pff_attribute30,
153 p_rec.object_version_number
154 );
155 --
156 ben_pff_shd.g_api_dml := false; -- Unset the api dml status
157 --
158 hr_utility.set_location(' Leaving:'||l_proc, 10);
159 Exception
160 When hr_api.check_integrity_violated Then
161 -- A check constraint has been violated
162 ben_pff_shd.g_api_dml := false; -- Unset the api dml status
163 ben_pff_shd.constraint_error
164 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
165 When hr_api.parent_integrity_violated Then
166 -- Parent integrity has been violated
167 ben_pff_shd.g_api_dml := false; -- Unset the api dml status
168 ben_pff_shd.constraint_error
169 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
170 When hr_api.unique_integrity_violated Then
171 -- Unique integrity has been violated
172 ben_pff_shd.g_api_dml := false; -- Unset the api dml status
173 ben_pff_shd.constraint_error
174 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
175 When Others Then
176 ben_pff_shd.g_api_dml := false; -- Unset the api dml status
177 Raise;
178 End insert_dml;
179 --
180 -- ----------------------------------------------------------------------------
181 -- |------------------------------< pre_insert >------------------------------|
182 -- ----------------------------------------------------------------------------
183 -- {Start Of Comments}
184 --
185 -- Description:
186 -- This private procedure contains any processing which is required before
187 -- the insert dml. Presently, if the entity has a corresponding primary
188 -- key which is maintained by an associating sequence, the primary key for
189 -- the entity will be populated with the next sequence value in
190 -- preparation for the insert dml.
191 --
192 -- Prerequisites:
193 -- This is an internal procedure which is called from the ins procedure.
194 --
195 -- In Parameters:
196 -- A Pl/Sql record structre.
197 --
198 -- Post Success:
199 -- Processing continues.
200 --
201 -- Post Failure:
202 -- If an error has occurred, an error message and exception will be raised
203 -- but not handled.
204 --
205 -- Developer Implementation Notes:
206 -- Any pre-processing required before the insert dml is issued should be
207 -- coded within this procedure. As stated above, a good example is the
208 -- generation of a primary key number via a corresponding sequence.
209 -- It is important to note that any 3rd party maintenance should be reviewed
210 -- before placing in this procedure.
211 --
212 -- Access Status:
213 -- Internal Row Handler Use Only.
214 --
215 -- {End Of Comments}
216 -- ----------------------------------------------------------------------------
217 Procedure pre_insert(p_rec in out nocopy ben_pff_shd.g_rec_type) is
218 --
219 l_proc varchar2(72) := g_package||'pre_insert';
220 --
221 Cursor C_Sel1 is select ben_pct_fl_tm_fctr_s.nextval from sys.dual;
222 --
223 Begin
224 hr_utility.set_location('Entering:'||l_proc, 5);
225 --
226 --
227 -- Select the next sequence number
228 --
229 Open C_Sel1;
230 Fetch C_Sel1 Into p_rec.pct_fl_tm_fctr_id;
231 Close C_Sel1;
232 --
233 hr_utility.set_location(' Leaving:'||l_proc, 10);
234 End pre_insert;
235 --
236 -- ----------------------------------------------------------------------------
237 -- |-----------------------------< post_insert >------------------------------|
238 -- ----------------------------------------------------------------------------
239 -- {Start Of Comments}
240 --
241 -- Description:
242 -- This private procedure contains any processing which is required after the
243 -- insert dml.
244 --
245 -- Prerequisites:
246 -- This is an internal procedure which is called from the ins procedure.
247 --
248 -- In Parameters:
249 -- A Pl/Sql record structre.
250 --
251 -- Post Success:
252 -- Processing continues.
253 --
254 -- Post Failure:
255 -- If an error has occurred, an error message and exception will be raised
256 -- but not handled.
257 --
258 -- Developer Implementation Notes:
259 -- Any post-processing required after the insert dml is issued should be
260 -- coded within this procedure. It is important to note that any 3rd party
261 -- maintenance should be reviewed before placing in this procedure.
262 --
263 -- Access Status:
264 -- Internal Row Handler Use Only.
265 --
266 -- {End Of Comments}
267 -- ----------------------------------------------------------------------------
268 Procedure post_insert(
269 p_effective_date in date,p_rec in ben_pff_shd.g_rec_type) is
270 --
271 l_proc varchar2(72) := g_package||'post_insert';
272 --
273 Begin
274 hr_utility.set_location('Entering:'||l_proc, 5);
275 --
276 --
277 -- Start of API User Hook for post_insert.
278 --
279 begin
280 --
281 ben_pff_rki.after_insert
282 (
283 p_pct_fl_tm_fctr_id =>p_rec.pct_fl_tm_fctr_id
284 ,p_name =>p_rec.name
285 ,p_business_group_id =>p_rec.business_group_id
286 ,p_mx_pct_val =>p_rec.mx_pct_val
287 ,p_mn_pct_val =>p_rec.mn_pct_val
288 ,p_no_mn_pct_val_flag =>p_rec.no_mn_pct_val_flag
289 ,p_no_mx_pct_val_flag =>p_rec.no_mx_pct_val_flag
290 ,p_use_prmry_asnt_only_flag =>p_rec.use_prmry_asnt_only_flag
291 ,p_use_sum_of_all_asnts_flag =>p_rec.use_sum_of_all_asnts_flag
292 ,p_rndg_cd =>p_rec.rndg_cd
293 ,p_rndg_rl =>p_rec.rndg_rl
294 ,p_pff_attribute_category =>p_rec.pff_attribute_category
295 ,p_pff_attribute1 =>p_rec.pff_attribute1
296 ,p_pff_attribute2 =>p_rec.pff_attribute2
297 ,p_pff_attribute3 =>p_rec.pff_attribute3
298 ,p_pff_attribute4 =>p_rec.pff_attribute4
299 ,p_pff_attribute5 =>p_rec.pff_attribute5
300 ,p_pff_attribute6 =>p_rec.pff_attribute6
301 ,p_pff_attribute7 =>p_rec.pff_attribute7
302 ,p_pff_attribute8 =>p_rec.pff_attribute8
303 ,p_pff_attribute9 =>p_rec.pff_attribute9
304 ,p_pff_attribute10 =>p_rec.pff_attribute10
305 ,p_pff_attribute11 =>p_rec.pff_attribute11
306 ,p_pff_attribute12 =>p_rec.pff_attribute12
307 ,p_pff_attribute13 =>p_rec.pff_attribute13
308 ,p_pff_attribute14 =>p_rec.pff_attribute14
309 ,p_pff_attribute15 =>p_rec.pff_attribute15
310 ,p_pff_attribute16 =>p_rec.pff_attribute16
311 ,p_pff_attribute17 =>p_rec.pff_attribute17
312 ,p_pff_attribute18 =>p_rec.pff_attribute18
313 ,p_pff_attribute19 =>p_rec.pff_attribute19
314 ,p_pff_attribute20 =>p_rec.pff_attribute20
315 ,p_pff_attribute21 =>p_rec.pff_attribute21
316 ,p_pff_attribute22 =>p_rec.pff_attribute22
317 ,p_pff_attribute23 =>p_rec.pff_attribute23
318 ,p_pff_attribute24 =>p_rec.pff_attribute24
319 ,p_pff_attribute25 =>p_rec.pff_attribute25
320 ,p_pff_attribute26 =>p_rec.pff_attribute26
321 ,p_pff_attribute27 =>p_rec.pff_attribute27
322 ,p_pff_attribute28 =>p_rec.pff_attribute28
323 ,p_pff_attribute29 =>p_rec.pff_attribute29
324 ,p_pff_attribute30 =>p_rec.pff_attribute30
325 ,p_object_version_number =>p_rec.object_version_number
326 ,p_effective_date =>p_effective_date
327 );
328 --
329 exception
330 --
331 when hr_api.cannot_find_prog_unit then
332 --
333 hr_api.cannot_find_prog_unit_error
334 (p_module_name => 'ben_pct_fl_tm_fctr'
335 ,p_hook_type => 'AI');
336 --
337 end;
338 --
339 -- End of API User Hook for post_insert.
340 --
341 --
342 hr_utility.set_location(' Leaving:'||l_proc, 10);
343 End post_insert;
344 --
345 -- ----------------------------------------------------------------------------
346 -- |---------------------------------< ins >----------------------------------|
347 -- ----------------------------------------------------------------------------
348 Procedure ins
349 (
350 p_effective_date in date,
351 p_rec in out nocopy ben_pff_shd.g_rec_type
352 ) is
353 --
354 l_proc varchar2(72) := g_package||'ins';
355 --
356 Begin
357 hr_utility.set_location('Entering:'||l_proc, 5);
358 --
359 -- Call the supporting insert validate operations
360 --
361 ben_pff_bus.insert_validate(p_rec
362 ,p_effective_date);
363 --
364 -- Call the supporting pre-insert operation
365 --
366 pre_insert(p_rec);
367 --
368 -- Insert the row
369 --
370 insert_dml(p_rec);
371 --
372 -- Call the supporting post-insert operation
373 --
374 post_insert(
375 p_effective_date,p_rec);
376 end ins;
377 --
378 -- ----------------------------------------------------------------------------
379 -- |---------------------------------< ins >----------------------------------|
380 -- ----------------------------------------------------------------------------
381 Procedure ins
382 (
383 p_effective_date in date,
384 p_pct_fl_tm_fctr_id out nocopy number,
385 p_name in varchar2,
386 p_business_group_id in number,
387 p_mx_pct_val in number default null,
388 p_mn_pct_val in number default null,
389 p_no_mn_pct_val_flag in varchar2 default null,
390 p_no_mx_pct_val_flag in varchar2 default null,
391 p_use_prmry_asnt_only_flag in varchar2 default null,
392 p_use_sum_of_all_asnts_flag in varchar2 default null,
393 p_rndg_cd in varchar2 default null,
394 p_rndg_rl in number default null,
395 p_pff_attribute_category in varchar2 default null,
396 p_pff_attribute1 in varchar2 default null,
397 p_pff_attribute2 in varchar2 default null,
398 p_pff_attribute3 in varchar2 default null,
399 p_pff_attribute4 in varchar2 default null,
400 p_pff_attribute5 in varchar2 default null,
401 p_pff_attribute6 in varchar2 default null,
402 p_pff_attribute7 in varchar2 default null,
403 p_pff_attribute8 in varchar2 default null,
404 p_pff_attribute9 in varchar2 default null,
405 p_pff_attribute10 in varchar2 default null,
406 p_pff_attribute11 in varchar2 default null,
407 p_pff_attribute12 in varchar2 default null,
408 p_pff_attribute13 in varchar2 default null,
409 p_pff_attribute14 in varchar2 default null,
410 p_pff_attribute15 in varchar2 default null,
411 p_pff_attribute16 in varchar2 default null,
412 p_pff_attribute17 in varchar2 default null,
413 p_pff_attribute18 in varchar2 default null,
414 p_pff_attribute19 in varchar2 default null,
415 p_pff_attribute20 in varchar2 default null,
416 p_pff_attribute21 in varchar2 default null,
417 p_pff_attribute22 in varchar2 default null,
418 p_pff_attribute23 in varchar2 default null,
419 p_pff_attribute24 in varchar2 default null,
420 p_pff_attribute25 in varchar2 default null,
421 p_pff_attribute26 in varchar2 default null,
422 p_pff_attribute27 in varchar2 default null,
423 p_pff_attribute28 in varchar2 default null,
424 p_pff_attribute29 in varchar2 default null,
425 p_pff_attribute30 in varchar2 default null,
426 p_object_version_number out nocopy number
427 ) is
428 --
429 l_rec ben_pff_shd.g_rec_type;
430 l_proc varchar2(72) := g_package||'ins';
431 --
432 Begin
433 hr_utility.set_location('Entering:'||l_proc, 5);
434 --
435 -- Call conversion function to turn arguments into the
436 -- p_rec structure.
437 --
438 l_rec :=
439 ben_pff_shd.convert_args
440 (
441 null,
442 p_name,
443 p_business_group_id,
444 p_mx_pct_val,
445 p_mn_pct_val,
446 p_no_mn_pct_val_flag,
447 p_no_mx_pct_val_flag,
448 p_use_prmry_asnt_only_flag,
449 p_use_sum_of_all_asnts_flag,
450 p_rndg_cd,
451 p_rndg_rl,
452 p_pff_attribute_category,
453 p_pff_attribute1,
454 p_pff_attribute2,
455 p_pff_attribute3,
456 p_pff_attribute4,
457 p_pff_attribute5,
458 p_pff_attribute6,
459 p_pff_attribute7,
460 p_pff_attribute8,
461 p_pff_attribute9,
462 p_pff_attribute10,
463 p_pff_attribute11,
464 p_pff_attribute12,
465 p_pff_attribute13,
466 p_pff_attribute14,
467 p_pff_attribute15,
468 p_pff_attribute16,
469 p_pff_attribute17,
470 p_pff_attribute18,
471 p_pff_attribute19,
472 p_pff_attribute20,
473 p_pff_attribute21,
474 p_pff_attribute22,
475 p_pff_attribute23,
476 p_pff_attribute24,
477 p_pff_attribute25,
478 p_pff_attribute26,
479 p_pff_attribute27,
480 p_pff_attribute28,
481 p_pff_attribute29,
482 p_pff_attribute30,
483 null
484 );
485 --
486 -- Having converted the arguments into the ben_pff_rec
487 -- plsql record structure we call the corresponding record business process.
488 --
489 ins(
490 p_effective_date,l_rec);
491 --
492 -- As the primary key argument(s)
493 -- are specified as an OUT's we must set these values.
494 --
495 p_pct_fl_tm_fctr_id := l_rec.pct_fl_tm_fctr_id;
496 p_object_version_number := l_rec.object_version_number;
497 --
498 hr_utility.set_location(' Leaving:'||l_proc, 10);
499 End ins;
500 --
501 end ben_pff_ins;