[Home] [Help]
PACKAGE BODY: APPS.BEN_LSF_INS
Source
1 Package Body ben_lsf_ins as
2 /* $Header: belsfrhi.pkb 120.0 2005/05/28 03:37:45 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_lsf_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_lsf_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_lsf_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: ben_los_fctr
64 --
65 insert into ben_los_fctr
66 ( los_fctr_id,
67 name,
68 business_group_id,
69 los_det_cd,
70 los_det_rl,
71 mn_los_num,
72 mx_los_num,
73 no_mx_los_num_apls_flag,
74 no_mn_los_num_apls_flag,
75 rndg_cd,
76 rndg_rl,
77 los_dt_to_use_cd,
78 los_dt_to_use_rl,
79 los_uom,
80 los_calc_rl,
81 los_alt_val_to_use_cd,
82 lsf_attribute_category,
83 lsf_attribute1,
84 lsf_attribute2,
85 lsf_attribute3,
86 lsf_attribute4,
87 lsf_attribute5,
88 lsf_attribute6,
89 lsf_attribute7,
90 lsf_attribute8,
91 lsf_attribute9,
92 lsf_attribute10,
93 lsf_attribute11,
94 lsf_attribute12,
95 lsf_attribute13,
96 lsf_attribute14,
97 lsf_attribute15,
98 lsf_attribute16,
99 lsf_attribute17,
100 lsf_attribute18,
101 lsf_attribute19,
102 lsf_attribute20,
103 lsf_attribute21,
104 lsf_attribute22,
105 lsf_attribute23,
106 lsf_attribute24,
107 lsf_attribute25,
108 lsf_attribute26,
109 lsf_attribute27,
110 lsf_attribute28,
111 lsf_attribute29,
112 lsf_attribute30,
113 object_version_number,
114 use_overid_svc_dt_flag
115 )
116 Values
117 ( p_rec.los_fctr_id,
118 p_rec.name,
119 p_rec.business_group_id,
120 p_rec.los_det_cd,
121 p_rec.los_det_rl,
122 p_rec.mn_los_num,
123 p_rec.mx_los_num,
124 p_rec.no_mx_los_num_apls_flag,
125 p_rec.no_mn_los_num_apls_flag,
126 p_rec.rndg_cd,
127 p_rec.rndg_rl,
128 p_rec.los_dt_to_use_cd,
129 p_rec.los_dt_to_use_rl,
130 p_rec.los_uom,
131 p_rec.los_calc_rl,
132 p_rec.los_alt_val_to_use_cd,
133 p_rec.lsf_attribute_category,
134 p_rec.lsf_attribute1,
135 p_rec.lsf_attribute2,
136 p_rec.lsf_attribute3,
137 p_rec.lsf_attribute4,
138 p_rec.lsf_attribute5,
139 p_rec.lsf_attribute6,
140 p_rec.lsf_attribute7,
141 p_rec.lsf_attribute8,
142 p_rec.lsf_attribute9,
143 p_rec.lsf_attribute10,
144 p_rec.lsf_attribute11,
145 p_rec.lsf_attribute12,
146 p_rec.lsf_attribute13,
147 p_rec.lsf_attribute14,
148 p_rec.lsf_attribute15,
149 p_rec.lsf_attribute16,
150 p_rec.lsf_attribute17,
151 p_rec.lsf_attribute18,
152 p_rec.lsf_attribute19,
153 p_rec.lsf_attribute20,
154 p_rec.lsf_attribute21,
155 p_rec.lsf_attribute22,
156 p_rec.lsf_attribute23,
157 p_rec.lsf_attribute24,
158 p_rec.lsf_attribute25,
159 p_rec.lsf_attribute26,
160 p_rec.lsf_attribute27,
161 p_rec.lsf_attribute28,
162 p_rec.lsf_attribute29,
163 p_rec.lsf_attribute30,
164 p_rec.object_version_number,
165 p_rec.use_overid_svc_dt_flag
166 );
167 --
168 ben_lsf_shd.g_api_dml := false; -- Unset the api dml status
169 --
170 hr_utility.set_location(' Leaving:'||l_proc, 10);
171 Exception
172 When hr_api.check_integrity_violated Then
173 -- A check constraint has been violated
174 ben_lsf_shd.g_api_dml := false; -- Unset the api dml status
175 ben_lsf_shd.constraint_error
176 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
177 When hr_api.parent_integrity_violated Then
178 -- Parent integrity has been violated
179 ben_lsf_shd.g_api_dml := false; -- Unset the api dml status
180 ben_lsf_shd.constraint_error
181 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
182 When hr_api.unique_integrity_violated Then
183 -- Unique integrity has been violated
184 ben_lsf_shd.g_api_dml := false; -- Unset the api dml status
185 ben_lsf_shd.constraint_error
186 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
187 When Others Then
188 ben_lsf_shd.g_api_dml := false; -- Unset the api dml status
189 Raise;
190 End insert_dml;
191 --
192 -- ----------------------------------------------------------------------------
193 -- |------------------------------< pre_insert >------------------------------|
194 -- ----------------------------------------------------------------------------
195 -- {Start Of Comments}
196 --
197 -- Description:
198 -- This private procedure contains any processing which is required before
199 -- the insert dml. Presently, if the entity has a corresponding primary
200 -- key which is maintained by an associating sequence, the primary key for
201 -- the entity will be populated with the next sequence value in
202 -- preparation for the insert dml.
203 --
204 -- Prerequisites:
205 -- This is an internal procedure which is called from the ins procedure.
206 --
207 -- In Parameters:
208 -- A Pl/Sql record structre.
209 --
210 -- Post Success:
211 -- Processing continues.
212 --
213 -- Post Failure:
214 -- If an error has occurred, an error message and exception will be raised
215 -- but not handled.
216 --
217 -- Developer Implementation Notes:
218 -- Any pre-processing required before the insert dml is issued should be
219 -- coded within this procedure. As stated above, a good example is the
220 -- generation of a primary key number via a corresponding sequence.
221 -- It is important to note that any 3rd party maintenance should be reviewed
222 -- before placing in this procedure.
223 --
224 -- Access Status:
225 -- Internal Row Handler Use Only.
226 --
227 -- {End Of Comments}
228 -- ----------------------------------------------------------------------------
229 Procedure pre_insert(p_rec in out nocopy ben_lsf_shd.g_rec_type) is
230 --
231 l_proc varchar2(72) := g_package||'pre_insert';
232 --
233 Cursor C_Sel1 is select ben_los_fctr_s.nextval from sys.dual;
234 --
235 Begin
236 hr_utility.set_location('Entering:'||l_proc, 5);
237 --
238 --
239 -- Select the next sequence number
240 --
241 Open C_Sel1;
242 Fetch C_Sel1 Into p_rec.los_fctr_id;
243 Close C_Sel1;
244 --
245 hr_utility.set_location(' Leaving:'||l_proc, 10);
246 End pre_insert;
247 --
248 -- ----------------------------------------------------------------------------
249 -- |-----------------------------< post_insert >------------------------------|
250 -- ----------------------------------------------------------------------------
251 -- {Start Of Comments}
252 --
253 -- Description:
254 -- This private procedure contains any processing which is required after the
255 -- insert dml.
256 --
257 -- Prerequisites:
258 -- This is an internal procedure which is called from the ins procedure.
259 --
260 -- In Parameters:
261 -- A Pl/Sql record structre.
262 --
263 -- Post Success:
264 -- Processing continues.
265 --
266 -- Post Failure:
267 -- If an error has occurred, an error message and exception will be raised
268 -- but not handled.
269 --
270 -- Developer Implementation Notes:
271 -- Any post-processing required after the insert dml is issued should be
272 -- coded within this procedure. It is important to note that any 3rd party
273 -- maintenance should be reviewed before placing in this procedure.
274 --
275 -- Access Status:
276 -- Internal Row Handler Use Only.
277 --
278 -- {End Of Comments}
279 -- ----------------------------------------------------------------------------
280 Procedure post_insert(
281 p_effective_date in date,p_rec in ben_lsf_shd.g_rec_type) is
282 --
283 l_proc varchar2(72) := g_package||'post_insert';
284 --
285 Begin
286 hr_utility.set_location('Entering:'||l_proc, 5);
287 --
288 --
289 -- Start of API User Hook for post_insert.
290 --
291 begin
292 --
293 ben_lsf_rki.after_insert
294 (
295 p_los_fctr_id =>p_rec.los_fctr_id
296 ,p_name =>p_rec.name
297 ,p_business_group_id =>p_rec.business_group_id
298 ,p_los_det_cd =>p_rec.los_det_cd
299 ,p_los_det_rl =>p_rec.los_det_rl
300 ,p_mn_los_num =>p_rec.mn_los_num
301 ,p_mx_los_num =>p_rec.mx_los_num
302 ,p_no_mx_los_num_apls_flag =>p_rec.no_mx_los_num_apls_flag
303 ,p_no_mn_los_num_apls_flag =>p_rec.no_mn_los_num_apls_flag
304 ,p_rndg_cd =>p_rec.rndg_cd
305 ,p_rndg_rl =>p_rec.rndg_rl
306 ,p_los_dt_to_use_cd =>p_rec.los_dt_to_use_cd
307 ,p_los_dt_to_use_rl =>p_rec.los_dt_to_use_rl
308 ,p_los_uom =>p_rec.los_uom
309 ,p_los_calc_rl =>p_rec.los_calc_rl
310 ,p_los_alt_val_to_use_cd =>p_rec.los_alt_val_to_use_cd
311 ,p_lsf_attribute_category =>p_rec.lsf_attribute_category
312 ,p_lsf_attribute1 =>p_rec.lsf_attribute1
313 ,p_lsf_attribute2 =>p_rec.lsf_attribute2
314 ,p_lsf_attribute3 =>p_rec.lsf_attribute3
315 ,p_lsf_attribute4 =>p_rec.lsf_attribute4
316 ,p_lsf_attribute5 =>p_rec.lsf_attribute5
317 ,p_lsf_attribute6 =>p_rec.lsf_attribute6
318 ,p_lsf_attribute7 =>p_rec.lsf_attribute7
319 ,p_lsf_attribute8 =>p_rec.lsf_attribute8
320 ,p_lsf_attribute9 =>p_rec.lsf_attribute9
321 ,p_lsf_attribute10 =>p_rec.lsf_attribute10
322 ,p_lsf_attribute11 =>p_rec.lsf_attribute11
323 ,p_lsf_attribute12 =>p_rec.lsf_attribute12
324 ,p_lsf_attribute13 =>p_rec.lsf_attribute13
325 ,p_lsf_attribute14 =>p_rec.lsf_attribute14
326 ,p_lsf_attribute15 =>p_rec.lsf_attribute15
327 ,p_lsf_attribute16 =>p_rec.lsf_attribute16
328 ,p_lsf_attribute17 =>p_rec.lsf_attribute17
329 ,p_lsf_attribute18 =>p_rec.lsf_attribute18
330 ,p_lsf_attribute19 =>p_rec.lsf_attribute19
331 ,p_lsf_attribute20 =>p_rec.lsf_attribute20
332 ,p_lsf_attribute21 =>p_rec.lsf_attribute21
333 ,p_lsf_attribute22 =>p_rec.lsf_attribute22
334 ,p_lsf_attribute23 =>p_rec.lsf_attribute23
335 ,p_lsf_attribute24 =>p_rec.lsf_attribute24
336 ,p_lsf_attribute25 =>p_rec.lsf_attribute25
337 ,p_lsf_attribute26 =>p_rec.lsf_attribute26
338 ,p_lsf_attribute27 =>p_rec.lsf_attribute27
339 ,p_lsf_attribute28 =>p_rec.lsf_attribute28
340 ,p_lsf_attribute29 =>p_rec.lsf_attribute29
341 ,p_lsf_attribute30 =>p_rec.lsf_attribute30
342 ,p_object_version_number =>p_rec.object_version_number
343 ,p_use_overid_svc_dt_flag =>p_rec.use_overid_svc_dt_flag
344 ,p_effective_date =>p_effective_date
345 );
346 --
347 exception
348 --
349 when hr_api.cannot_find_prog_unit then
350 --
351 hr_api.cannot_find_prog_unit_error
352 (p_module_name => 'ben_los_fctr'
353 ,p_hook_type => 'AI');
354 --
355 end;
356 --
357 -- End of API User Hook for post_insert.
358 --
359 --
360 hr_utility.set_location(' Leaving:'||l_proc, 10);
361 End post_insert;
362 --
363 -- ----------------------------------------------------------------------------
364 -- |---------------------------------< ins >----------------------------------|
365 -- ----------------------------------------------------------------------------
366 Procedure ins
367 (
368 p_effective_date in date,
369 p_rec in out nocopy ben_lsf_shd.g_rec_type
370 ) is
371 --
372 l_proc varchar2(72) := g_package||'ins';
373 --
374 Begin
375 hr_utility.set_location('Entering:'||l_proc, 5);
376 --
377 -- Call the supporting insert validate operations
378 --
379 ben_lsf_bus.insert_validate(p_rec
380 ,p_effective_date);
381 --
382 -- Call the supporting pre-insert operation
383 --
384 pre_insert(p_rec);
385 --
386 -- Insert the row
387 --
388 insert_dml(p_rec);
389 --
390 -- Call the supporting post-insert operation
391 --
392 post_insert(
393 p_effective_date,p_rec);
394 end ins;
395 --
396 -- ----------------------------------------------------------------------------
397 -- |---------------------------------< ins >----------------------------------|
398 -- ----------------------------------------------------------------------------
399 Procedure ins
400 (
401 p_effective_date in date,
402 p_los_fctr_id out nocopy number,
403 p_name in varchar2,
404 p_business_group_id in number,
405 p_los_det_cd in varchar2 default null,
406 p_los_det_rl in number default null,
407 p_mn_los_num in number default null,
408 p_mx_los_num in number default null,
409 p_no_mx_los_num_apls_flag in varchar2 default null,
410 p_no_mn_los_num_apls_flag in varchar2 default null,
411 p_rndg_cd in varchar2 default null,
412 p_rndg_rl in number default null,
413 p_los_dt_to_use_cd in varchar2 default null,
414 p_los_dt_to_use_rl in number default null,
415 p_los_uom in varchar2 default null,
416 p_los_calc_rl in number default null,
417 p_los_alt_val_to_use_cd in varchar2 default null,
418 p_lsf_attribute_category in varchar2 default null,
419 p_lsf_attribute1 in varchar2 default null,
420 p_lsf_attribute2 in varchar2 default null,
421 p_lsf_attribute3 in varchar2 default null,
422 p_lsf_attribute4 in varchar2 default null,
423 p_lsf_attribute5 in varchar2 default null,
424 p_lsf_attribute6 in varchar2 default null,
425 p_lsf_attribute7 in varchar2 default null,
426 p_lsf_attribute8 in varchar2 default null,
427 p_lsf_attribute9 in varchar2 default null,
428 p_lsf_attribute10 in varchar2 default null,
429 p_lsf_attribute11 in varchar2 default null,
430 p_lsf_attribute12 in varchar2 default null,
431 p_lsf_attribute13 in varchar2 default null,
432 p_lsf_attribute14 in varchar2 default null,
433 p_lsf_attribute15 in varchar2 default null,
434 p_lsf_attribute16 in varchar2 default null,
435 p_lsf_attribute17 in varchar2 default null,
436 p_lsf_attribute18 in varchar2 default null,
437 p_lsf_attribute19 in varchar2 default null,
438 p_lsf_attribute20 in varchar2 default null,
439 p_lsf_attribute21 in varchar2 default null,
440 p_lsf_attribute22 in varchar2 default null,
441 p_lsf_attribute23 in varchar2 default null,
442 p_lsf_attribute24 in varchar2 default null,
443 p_lsf_attribute25 in varchar2 default null,
444 p_lsf_attribute26 in varchar2 default null,
445 p_lsf_attribute27 in varchar2 default null,
446 p_lsf_attribute28 in varchar2 default null,
447 p_lsf_attribute29 in varchar2 default null,
448 p_lsf_attribute30 in varchar2 default null,
449 p_object_version_number out nocopy number,
450 p_use_overid_svc_dt_flag in varchar2 default null
451 ) is
452 --
453 l_rec ben_lsf_shd.g_rec_type;
454 l_proc varchar2(72) := g_package||'ins';
455 --
456 Begin
457 hr_utility.set_location('Entering:'||l_proc, 5);
458 --
459 -- Call conversion function to turn arguments into the
460 -- p_rec structure.
461 --
462 l_rec :=
463 ben_lsf_shd.convert_args
464 (
465 null,
466 p_name,
467 p_business_group_id,
468 p_los_det_cd,
469 p_los_det_rl,
470 p_mn_los_num,
471 p_mx_los_num,
472 p_no_mx_los_num_apls_flag,
473 p_no_mn_los_num_apls_flag,
474 p_rndg_cd,
475 p_rndg_rl,
476 p_los_dt_to_use_cd,
477 p_los_dt_to_use_rl,
478 p_los_uom,
479 p_los_calc_rl,
480 p_los_alt_val_to_use_cd,
481 p_lsf_attribute_category,
482 p_lsf_attribute1,
483 p_lsf_attribute2,
484 p_lsf_attribute3,
485 p_lsf_attribute4,
486 p_lsf_attribute5,
487 p_lsf_attribute6,
488 p_lsf_attribute7,
489 p_lsf_attribute8,
490 p_lsf_attribute9,
491 p_lsf_attribute10,
492 p_lsf_attribute11,
493 p_lsf_attribute12,
494 p_lsf_attribute13,
495 p_lsf_attribute14,
496 p_lsf_attribute15,
497 p_lsf_attribute16,
498 p_lsf_attribute17,
499 p_lsf_attribute18,
500 p_lsf_attribute19,
501 p_lsf_attribute20,
502 p_lsf_attribute21,
503 p_lsf_attribute22,
504 p_lsf_attribute23,
505 p_lsf_attribute24,
506 p_lsf_attribute25,
507 p_lsf_attribute26,
508 p_lsf_attribute27,
509 p_lsf_attribute28,
510 p_lsf_attribute29,
511 p_lsf_attribute30,
512 null,
513 p_use_overid_svc_dt_flag
514 );
515 --
516 -- Having converted the arguments into the ben_lsf_rec
517 -- plsql record structure we call the corresponding record business process.
518 --
519 ins(
520 p_effective_date,l_rec);
521 --
522 -- As the primary key argument(s)
523 -- are specified as an OUT's we must set these values.
524 --
525 p_los_fctr_id := l_rec.los_fctr_id;
526 p_object_version_number := l_rec.object_version_number;
527 --
528 hr_utility.set_location(' Leaving:'||l_proc, 10);
529 End ins;
530 --
531 end ben_lsf_ins;