[Home] [Help]
PACKAGE BODY: APPS.BEN_EIV_INS
Source
1 Package Body ben_eiv_ins as
2 /* $Header: beeivrhi.pkb 115.4 2002/12/22 20:25:28 pabodla noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_eiv_ins.'; -- Global package name
9 --
10 -- The following global variables are only to be used by
11 -- the set_base_key_value and pre_insert procedures.
12 --
13 g_extra_input_value_id_i number default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19 (p_extra_input_value_id in number) is
20 --
21 l_proc varchar2(72) := g_package||'set_base_key_value';
22 --
23 Begin
24 hr_utility.set_location('Entering:'||l_proc, 10);
25 --
26 ben_eiv_ins.g_extra_input_value_id_i := p_extra_input_value_id;
27 --
28 hr_utility.set_location(' Leaving:'||l_proc, 20);
29 End set_base_key_value;
30 --
31 --
32 -- ----------------------------------------------------------------------------
33 -- |------------------------------< insert_dml >------------------------------|
34 -- ----------------------------------------------------------------------------
35 -- {Start Of Comments}
36 --
37 -- Description:
38 -- This procedure controls the actual dml insert logic. The processing of
39 -- this procedure are as follows:
40 -- 1) Initialise the object_version_number to 1 if the object_version_number
41 -- is defined as an attribute for this entity.
42 -- 2) To set and unset the g_api_dml status as required (as we are about to
43 -- perform dml).
44 -- 3) To insert the row into the schema.
45 -- 4) To trap any constraint violations that may have occurred.
46 -- 5) To raise any other errors.
47 --
48 -- Prerequisites:
49 -- This is an internal private procedure which must be called from the ins
50 -- procedure and must have all mandatory attributes set (except the
51 -- object_version_number which is initialised within this procedure).
52 --
53 -- In Parameters:
54 -- A Pl/Sql record structre.
55 --
56 -- Post Success:
57 -- The specified row will be inserted into the schema.
58 --
59 -- Post Failure:
60 -- On the insert dml failure it is important to note that we always reset the
61 -- g_api_dml status to false.
62 -- If a check, unique or parent integrity constraint violation is raised the
63 -- constraint_error procedure will be called.
64 -- If any other error is reported, the error will be raised after the
65 -- g_api_dml status is reset.
66 --
67 -- Developer Implementation Notes:
68 -- None.
69 --
70 -- Access Status:
71 -- Internal Row Handler Use Only.
72 --
73 -- {End Of Comments}
74 -- ----------------------------------------------------------------------------
75 Procedure insert_dml
76 (p_rec in out nocopy ben_eiv_shd.g_rec_type
77 ) is
78 --
79 l_proc varchar2(72) := g_package||'insert_dml';
80 --
81 Begin
82 hr_utility.set_location('Entering:'||l_proc, 5);
83 p_rec.object_version_number := 1; -- Initialise the object version
84 --
85 ben_eiv_shd.g_api_dml := true; -- Set the api dml status
86 --
87 -- Insert the row into: ben_extra_input_values
88 --
89 insert into ben_extra_input_values
90 (extra_input_value_id
91 ,acty_base_rt_id
92 ,input_value_id
93 ,input_text
94 ,upd_when_ele_ended_cd
95 ,return_var_name
96 ,business_group_id
97 ,eiv_attribute_category
98 ,eiv_attribute1
99 ,eiv_attribute2
100 ,eiv_attribute3
101 ,eiv_attribute4
102 ,eiv_attribute5
103 ,eiv_attribute6
104 ,eiv_attribute7
105 ,eiv_attribute8
106 ,eiv_attribute9
107 ,eiv_attribute10
108 ,eiv_attribute11
109 ,eiv_attribute12
110 ,eiv_attribute13
111 ,eiv_attribute14
112 ,eiv_attribute15
113 ,eiv_attribute16
114 ,eiv_attribute17
115 ,eiv_attribute18
116 ,eiv_attribute19
117 ,eiv_attribute20
118 ,eiv_attribute21
119 ,eiv_attribute22
120 ,eiv_attribute23
121 ,eiv_attribute24
122 ,eiv_attribute25
123 ,eiv_attribute26
124 ,eiv_attribute27
125 ,eiv_attribute28
126 ,eiv_attribute29
127 ,eiv_attribute30
128 ,object_version_number
129 )
130 Values
131 (p_rec.extra_input_value_id
132 ,p_rec.acty_base_rt_id
133 ,p_rec.input_value_id
134 ,p_rec.input_text
135 ,p_rec.upd_when_ele_ended_cd
136 ,p_rec.return_var_name
137 ,p_rec.business_group_id
138 ,p_rec.eiv_attribute_category
139 ,p_rec.eiv_attribute1
140 ,p_rec.eiv_attribute2
141 ,p_rec.eiv_attribute3
142 ,p_rec.eiv_attribute4
143 ,p_rec.eiv_attribute5
144 ,p_rec.eiv_attribute6
145 ,p_rec.eiv_attribute7
146 ,p_rec.eiv_attribute8
147 ,p_rec.eiv_attribute9
148 ,p_rec.eiv_attribute10
149 ,p_rec.eiv_attribute11
150 ,p_rec.eiv_attribute12
151 ,p_rec.eiv_attribute13
152 ,p_rec.eiv_attribute14
153 ,p_rec.eiv_attribute15
154 ,p_rec.eiv_attribute16
155 ,p_rec.eiv_attribute17
156 ,p_rec.eiv_attribute18
157 ,p_rec.eiv_attribute19
158 ,p_rec.eiv_attribute20
159 ,p_rec.eiv_attribute21
160 ,p_rec.eiv_attribute22
161 ,p_rec.eiv_attribute23
162 ,p_rec.eiv_attribute24
163 ,p_rec.eiv_attribute25
164 ,p_rec.eiv_attribute26
165 ,p_rec.eiv_attribute27
166 ,p_rec.eiv_attribute28
167 ,p_rec.eiv_attribute29
168 ,p_rec.eiv_attribute30
169 ,p_rec.object_version_number
170 );
171 --
172 ben_eiv_shd.g_api_dml := false; -- Unset the api dml status
173 --
174 hr_utility.set_location(' Leaving:'||l_proc, 10);
175 Exception
176 When hr_api.check_integrity_violated Then
177 -- A check constraint has been violated
178 ben_eiv_shd.g_api_dml := false; -- Unset the api dml status
179 ben_eiv_shd.constraint_error
180 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
181 When hr_api.parent_integrity_violated Then
182 -- Parent integrity has been violated
183 ben_eiv_shd.g_api_dml := false; -- Unset the api dml status
184 ben_eiv_shd.constraint_error
185 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
186 When hr_api.unique_integrity_violated Then
187 -- Unique integrity has been violated
188 ben_eiv_shd.g_api_dml := false; -- Unset the api dml status
189 ben_eiv_shd.constraint_error
190 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
191 When Others Then
192 ben_eiv_shd.g_api_dml := false; -- Unset the api dml status
193 Raise;
194 End insert_dml;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |------------------------------< pre_insert >------------------------------|
198 -- ----------------------------------------------------------------------------
199 -- {Start Of Comments}
200 --
201 -- Description:
202 -- This private procedure contains any processing which is required before
203 -- the insert dml. Presently, if the entity has a corresponding primary
204 -- key which is maintained by an associating sequence, the primary key for
205 -- the entity will be populated with the next sequence value in
206 -- preparation for the insert dml.
207 --
208 -- Prerequisites:
209 -- This is an internal procedure which is called from the ins procedure.
210 --
211 -- In Parameters:
212 -- A Pl/Sql record structure.
213 --
214 -- Post Success:
215 -- Processing continues.
216 --
217 -- Post Failure:
218 -- If an error has occurred, an error message and exception will be raised
219 -- but not handled.
220 --
221 -- Developer Implementation Notes:
222 -- Any pre-processing required before the insert dml is issued should be
223 -- coded within this procedure. As stated above, a good example is the
224 -- generation of a primary key number via a corresponding sequence.
225 -- It is important to note that any 3rd party maintenance should be reviewed
226 -- before placing in this procedure.
227 --
228 -- Access Status:
229 -- Internal Row Handler Use Only.
230 --
231 -- {End Of Comments}
232 -- ----------------------------------------------------------------------------
233 Procedure pre_insert
234 (p_effective_date in date
235 ,p_rec in out nocopy ben_eiv_shd.g_rec_type
236 ) is
237 --
238 Cursor C_Sel1 is select ben_extra_input_values_s.nextval from sys.dual;
239 --
240 l_proc varchar2(72) := g_package||'pre_insert';
241 --
242 Begin
243 hr_utility.set_location('Entering:'||l_proc, 5);
244 --
245 -- Select the next sequence number
246 --
247 Open C_Sel1;
248 Fetch C_Sel1 Into p_rec.extra_input_value_id;
249 Close C_Sel1;
250 --
251 hr_utility.set_location(' Leaving:'||l_proc, 10);
252 End pre_insert;
253 --
254 -- ----------------------------------------------------------------------------
255 -- |-----------------------------< post_insert >------------------------------|
256 -- ----------------------------------------------------------------------------
257 -- {Start Of Comments}
258 --
259 -- Description:
260 -- This private procedure contains any processing which is required after
261 -- the insert dml.
262 --
263 -- Prerequisites:
264 -- This is an internal procedure which is called from the ins procedure.
265 --
266 -- In Parameters:
267 -- A Pl/Sql record structre.
268 --
269 -- Post Success:
270 -- Processing continues.
271 --
272 -- Post Failure:
273 -- If an error has occurred, an error message and exception will be raised
274 -- but not handled.
275 --
276 -- Developer Implementation Notes:
277 -- Any post-processing required after the insert dml is issued should be
278 -- coded within this procedure. It is important to note that any 3rd party
279 -- maintenance should be reviewed before placing in this procedure.
280 --
281 -- Access Status:
282 -- Internal Row Handler Use Only.
283 --
284 -- {End Of Comments}
285 -- ----------------------------------------------------------------------------
286 Procedure post_insert
287 (p_effective_date in date
288 ,p_rec in ben_eiv_shd.g_rec_type
289 ) is
290 --
291 l_proc varchar2(72) := g_package||'post_insert';
292 --
293 Begin
294 hr_utility.set_location('Entering:'||l_proc, 5);
295 begin
296 --
297 ben_eiv_rki.after_insert
298 (p_extra_input_value_id
299 => p_rec.extra_input_value_id
300 ,p_acty_base_rt_id
301 => p_rec.acty_base_rt_id
302 ,p_input_value_id
303 => p_rec.input_value_id
304 ,p_input_text
305 => p_rec.input_text
306 ,p_upd_when_ele_ended_cd
307 => p_rec.upd_when_ele_ended_cd
308 ,p_return_var_name
309 => p_rec.return_var_name
310 ,p_business_group_id
311 => p_rec.business_group_id
312 ,p_eiv_attribute_category
313 => p_rec.eiv_attribute_category
314 ,p_eiv_attribute1
315 => p_rec.eiv_attribute1
316 ,p_eiv_attribute2
317 => p_rec.eiv_attribute2
318 ,p_eiv_attribute3
319 => p_rec.eiv_attribute3
320 ,p_eiv_attribute4
321 => p_rec.eiv_attribute4
322 ,p_eiv_attribute5
323 => p_rec.eiv_attribute5
324 ,p_eiv_attribute6
325 => p_rec.eiv_attribute6
326 ,p_eiv_attribute7
327 => p_rec.eiv_attribute7
328 ,p_eiv_attribute8
329 => p_rec.eiv_attribute8
330 ,p_eiv_attribute9
331 => p_rec.eiv_attribute9
332 ,p_eiv_attribute10
333 => p_rec.eiv_attribute10
334 ,p_eiv_attribute11
335 => p_rec.eiv_attribute11
336 ,p_eiv_attribute12
337 => p_rec.eiv_attribute12
338 ,p_eiv_attribute13
339 => p_rec.eiv_attribute13
340 ,p_eiv_attribute14
341 => p_rec.eiv_attribute14
342 ,p_eiv_attribute15
343 => p_rec.eiv_attribute15
344 ,p_eiv_attribute16
345 => p_rec.eiv_attribute16
346 ,p_eiv_attribute17
347 => p_rec.eiv_attribute17
348 ,p_eiv_attribute18
349 => p_rec.eiv_attribute18
350 ,p_eiv_attribute19
351 => p_rec.eiv_attribute19
352 ,p_eiv_attribute20
353 => p_rec.eiv_attribute20
354 ,p_eiv_attribute21
355 => p_rec.eiv_attribute21
356 ,p_eiv_attribute22
357 => p_rec.eiv_attribute22
358 ,p_eiv_attribute23
359 => p_rec.eiv_attribute23
360 ,p_eiv_attribute24
361 => p_rec.eiv_attribute24
362 ,p_eiv_attribute25
363 => p_rec.eiv_attribute25
364 ,p_eiv_attribute26
365 => p_rec.eiv_attribute26
366 ,p_eiv_attribute27
367 => p_rec.eiv_attribute27
368 ,p_eiv_attribute28
369 => p_rec.eiv_attribute28
370 ,p_eiv_attribute29
371 => p_rec.eiv_attribute29
372 ,p_eiv_attribute30
373 => p_rec.eiv_attribute30
374 ,p_object_version_number
375 => p_rec.object_version_number
376 ,p_effective_date
377 => p_effective_date
378 );
379 --
380 exception
381 --
382 when hr_api.cannot_find_prog_unit then
383 --
384 hr_api.cannot_find_prog_unit_error
385 (p_module_name => 'BEN_EXTRA_INPUT_VALUES'
386 ,p_hook_type => 'AI');
387 --
388 end;
389 --
390 hr_utility.set_location(' Leaving:'||l_proc, 10);
391 End post_insert;
392 --
393 -- ----------------------------------------------------------------------------
394 -- |---------------------------------< ins >----------------------------------|
395 -- ----------------------------------------------------------------------------
396 Procedure ins
397 (p_effective_date in date
398 ,p_rec in out nocopy ben_eiv_shd.g_rec_type
399 ) is
400 --
401 l_proc varchar2(72) := g_package||'ins';
402 --
403 Begin
404 hr_utility.set_location('Entering:'||l_proc, 5);
405 --
406 -- Call the supporting insert validate operations
407 --
408 ben_eiv_bus.insert_validate
409 (p_rec
410 ,p_effective_date
411 );
412 --
413 -- Call the supporting pre-insert operation
414 --
415 ben_eiv_ins.pre_insert(p_effective_date
416 ,p_rec);
417 --
418 -- Insert the row
419 --
420 ben_eiv_ins.insert_dml(p_rec);
421 --
422 -- Call the supporting post-insert operation
423 --
424 ben_eiv_ins.post_insert
425 (p_effective_date
426 ,p_rec
427 );
428 --
429 hr_utility.set_location('Leaving:'||l_proc, 20);
430 end ins;
431 --
432 -- ----------------------------------------------------------------------------
433 -- |---------------------------------< ins >----------------------------------|
434 -- ----------------------------------------------------------------------------
435 Procedure ins
436 (p_effective_date in date
437 ,p_acty_base_rt_id in number
438 ,p_input_value_id in number
439 ,p_return_var_name in varchar2
440 ,p_business_group_id in number
441 ,p_input_text in varchar2 default null
442 ,p_upd_when_ele_ended_cd in varchar2 default null
443 ,p_eiv_attribute_category in varchar2 default null
444 ,p_eiv_attribute1 in varchar2 default null
445 ,p_eiv_attribute2 in varchar2 default null
446 ,p_eiv_attribute3 in varchar2 default null
447 ,p_eiv_attribute4 in varchar2 default null
448 ,p_eiv_attribute5 in varchar2 default null
449 ,p_eiv_attribute6 in varchar2 default null
450 ,p_eiv_attribute7 in varchar2 default null
451 ,p_eiv_attribute8 in varchar2 default null
452 ,p_eiv_attribute9 in varchar2 default null
453 ,p_eiv_attribute10 in varchar2 default null
454 ,p_eiv_attribute11 in varchar2 default null
455 ,p_eiv_attribute12 in varchar2 default null
456 ,p_eiv_attribute13 in varchar2 default null
457 ,p_eiv_attribute14 in varchar2 default null
458 ,p_eiv_attribute15 in varchar2 default null
459 ,p_eiv_attribute16 in varchar2 default null
460 ,p_eiv_attribute17 in varchar2 default null
461 ,p_eiv_attribute18 in varchar2 default null
462 ,p_eiv_attribute19 in varchar2 default null
463 ,p_eiv_attribute20 in varchar2 default null
464 ,p_eiv_attribute21 in varchar2 default null
465 ,p_eiv_attribute22 in varchar2 default null
466 ,p_eiv_attribute23 in varchar2 default null
467 ,p_eiv_attribute24 in varchar2 default null
468 ,p_eiv_attribute25 in varchar2 default null
469 ,p_eiv_attribute26 in varchar2 default null
470 ,p_eiv_attribute27 in varchar2 default null
471 ,p_eiv_attribute28 in varchar2 default null
472 ,p_eiv_attribute29 in varchar2 default null
473 ,p_eiv_attribute30 in varchar2 default null
474 ,p_extra_input_value_id out nocopy number
475 ,p_object_version_number out nocopy number
476 ) is
477 --
478 l_rec ben_eiv_shd.g_rec_type;
479 l_proc varchar2(72) := g_package||'ins';
480 --
481 Begin
482 hr_utility.set_location('Entering:'||l_proc, 5);
483 --
484 -- Call conversion function to turn arguments into the
485 -- p_rec structure.
486 --
487 l_rec :=
488 ben_eiv_shd.convert_args
489 (null
490 ,p_acty_base_rt_id
491 ,p_input_value_id
492 ,p_input_text
493 ,p_upd_when_ele_ended_cd
494 ,p_return_var_name
495 ,p_business_group_id
496 ,p_eiv_attribute_category
497 ,p_eiv_attribute1
498 ,p_eiv_attribute2
499 ,p_eiv_attribute3
500 ,p_eiv_attribute4
501 ,p_eiv_attribute5
502 ,p_eiv_attribute6
503 ,p_eiv_attribute7
504 ,p_eiv_attribute8
505 ,p_eiv_attribute9
506 ,p_eiv_attribute10
507 ,p_eiv_attribute11
508 ,p_eiv_attribute12
509 ,p_eiv_attribute13
510 ,p_eiv_attribute14
511 ,p_eiv_attribute15
512 ,p_eiv_attribute16
513 ,p_eiv_attribute17
514 ,p_eiv_attribute18
515 ,p_eiv_attribute19
516 ,p_eiv_attribute20
517 ,p_eiv_attribute21
518 ,p_eiv_attribute22
519 ,p_eiv_attribute23
520 ,p_eiv_attribute24
521 ,p_eiv_attribute25
522 ,p_eiv_attribute26
523 ,p_eiv_attribute27
524 ,p_eiv_attribute28
525 ,p_eiv_attribute29
526 ,p_eiv_attribute30
527 ,null
528 );
529 --
530 -- Having converted the arguments into the ben_eiv_rec
531 -- plsql record structure we call the corresponding record business process.
532 --
533 ben_eiv_ins.ins
534 (p_effective_date
535 ,l_rec
536 );
537 --
538 -- As the primary key argument(s)
539 -- are specified as an OUT's we must set these values.
540 --
541 p_extra_input_value_id := l_rec.extra_input_value_id;
542 p_object_version_number := l_rec.object_version_number;
543 --
544 hr_utility.set_location(' Leaving:'||l_proc, 10);
545 End ins;
546 --
547 end ben_eiv_ins;