[Home] [Help]
PACKAGE BODY: APPS.BEN_EGL_INS
Source
1 Package Body ben_egl_ins as
2
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_egl_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_egl_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_egl_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: ben_eligy_criteria
64 --
65 insert into ben_eligy_criteria
66 (
67 eligy_criteria_id,
68 name,
69 short_code,
70 description,
71 criteria_type,
72 crit_col1_val_type_cd,
73 crit_col1_datatype,
74 col1_lookup_type,
75 col1_value_set_id,
76 access_table_name1,
77 access_column_name1,
78 time_entry_access_table_name1,
79 time_entry_access_col_name1,
80 crit_col2_val_type_cd,
81 crit_col2_datatype,
82 col2_lookup_type,
83 col2_value_set_id,
84 access_table_name2,
85 access_column_name2,
86 time_entry_access_table_name2,
87 time_entry_access_col_name2,
88 access_calc_rule,
89 allow_range_validation_flag,
90 user_defined_flag,
91 business_group_id,
92 legislation_code,
93 egl_attribute_category,
94 egl_attribute1,
95 egl_attribute2,
96 egl_attribute3,
97 egl_attribute4,
98 egl_attribute5,
99 egl_attribute6,
100 egl_attribute7,
101 egl_attribute8,
102 egl_attribute9,
103 egl_attribute10,
104 egl_attribute11,
105 egl_attribute12,
106 egl_attribute13,
107 egl_attribute14,
108 egl_attribute15,
109 egl_attribute16,
110 egl_attribute17,
111 egl_attribute18,
112 egl_attribute19,
113 egl_attribute20,
114 egl_attribute21,
115 egl_attribute22,
116 egl_attribute23,
117 egl_attribute24,
118 egl_attribute25,
119 egl_attribute26,
120 egl_attribute27,
121 egl_attribute28,
122 egl_attribute29,
123 egl_attribute30,
124 object_version_number,
125 allow_range_validation_flag2,
126 access_calc_rule2,
127 time_access_calc_rule1,
128 time_access_calc_rule2
129 )
130 Values
131 ( p_rec.eligy_criteria_id,
132 p_rec.name,
133 p_rec.short_code,
134 p_rec.description,
135 p_rec.criteria_type,
136 p_rec.crit_col1_val_type_cd,
137 p_rec.crit_col1_datatype,
138 p_rec.col1_lookup_type,
139 p_rec.col1_value_set_id,
140 p_rec.access_table_name1,
141 p_rec.access_column_name1,
142 p_rec.time_entry_access_tab_nam1,
143 p_rec.time_entry_access_col_nam1,
144 p_rec.crit_col2_val_type_cd,
145 p_rec.crit_col2_datatype,
146 p_rec.col2_lookup_type,
147 p_rec.col2_value_set_id,
148 p_rec.access_table_name2,
149 p_rec.access_column_name2,
150 p_rec.time_entry_access_tab_nam2,
151 p_rec.time_entry_access_col_nam2,
152 p_rec.access_calc_rule,
153 p_rec.allow_range_validation_flg,
154 p_rec.user_defined_flag,
155 p_rec.business_group_id,
156 p_rec.legislation_code,
157 p_rec.egl_attribute_category,
158 p_rec.egl_attribute1,
159 p_rec.egl_attribute2,
160 p_rec.egl_attribute3,
161 p_rec.egl_attribute4,
162 p_rec.egl_attribute5,
163 p_rec.egl_attribute6,
164 p_rec.egl_attribute7,
165 p_rec.egl_attribute8,
166 p_rec.egl_attribute9,
167 p_rec.egl_attribute10,
168 p_rec.egl_attribute11,
169 p_rec.egl_attribute12,
170 p_rec.egl_attribute13,
171 p_rec.egl_attribute14,
172 p_rec.egl_attribute15,
173 p_rec.egl_attribute16,
174 p_rec.egl_attribute17,
175 p_rec.egl_attribute18,
176 p_rec.egl_attribute19,
177 p_rec.egl_attribute20,
178 p_rec.egl_attribute21,
179 p_rec.egl_attribute22,
180 p_rec.egl_attribute23,
181 p_rec.egl_attribute24,
182 p_rec.egl_attribute25,
183 p_rec.egl_attribute26,
184 p_rec.egl_attribute27,
185 p_rec.egl_attribute28,
186 p_rec.egl_attribute29,
187 p_rec.egl_attribute30,
188 p_rec.object_version_number,
189 p_Rec.allow_range_validation_flag2,
190 p_rec.access_calc_rule2,
191 p_rec.time_access_calc_rule1,
192 p_Rec.time_access_calc_rule2
193 );
194 --
195 ben_egl_shd.g_api_dml := false; -- Unset the api dml status
196 --
197 hr_utility.set_location(' Leaving:'||l_proc, 10);
198 Exception
199 When hr_api.check_integrity_violated Then
200 -- A check constraint has been violated
201 ben_egl_shd.g_api_dml := false; -- Unset the api dml status
202 ben_egl_shd.constraint_error
203 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
204 When hr_api.parent_integrity_violated Then
205 -- Parent integrity has been violated
206 ben_egl_shd.g_api_dml := false; -- Unset the api dml status
207 ben_egl_shd.constraint_error
208 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
209 When hr_api.unique_integrity_violated Then
210 -- Unique integrity has been violated
211 ben_egl_shd.g_api_dml := false; -- Unset the api dml status
212 ben_egl_shd.constraint_error
213 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
214 When Others Then
215 ben_egl_shd.g_api_dml := false; -- Unset the api dml status
216 Raise;
217 End insert_dml;
218 --
219 -- ----------------------------------------------------------------------------
220 -- |------------------------------< pre_insert >------------------------------|
221 -- ----------------------------------------------------------------------------
222 -- {Start Of Comments}
223 --
224 -- Description:
225 -- This private procedure contains any processing which is required before
226 -- the insert dml. Presently, if the entity has a corresponding primary
227 -- key which is maintained by an associating sequence, the primary key for
228 -- the entity will be populated with the next sequence value in
229 -- preparation for the insert dml.
230 --
231 -- Prerequisites:
232 -- This is an internal procedure which is called from the ins procedure.
233 --
234 -- In Parameters:
235 -- A Pl/Sql record structre.
236 --
237 -- Post Success:
238 -- Processing continues.
239 --
240 -- Post Failure:
241 -- If an error has occurred, an error message and exception will be raised
242 -- but not handled.
243 --
244 -- Developer Implementation Notes:
245 -- Any pre-processing required before the insert dml is issued should be
246 -- coded within this procedure. As stated above, a good example is the
247 -- generation of a primary key number via a corresponding sequence.
248 -- It is important to note that any 3rd party maintenance should be reviewed
249 -- before placing in this procedure.
250 --
251 -- Access Status:
252 -- Internal Row Handler Use Only.
253 --
254 -- {End Of Comments}
255 -- ----------------------------------------------------------------------------
256 Procedure pre_insert(p_rec in out nocopy ben_egl_shd.g_rec_type) is
257 --
258 l_proc varchar2(72) := g_package||'pre_insert';
259 --
260 Cursor C_Sel1 is select ben_eligy_criteria_s.nextval from sys.dual;
261 --
262 Begin
263 hr_utility.set_location('Entering:'||l_proc, 5);
264 --
265 --
266 -- Select the next sequence number
267 --
268 Open C_Sel1;
269 Fetch C_Sel1 Into p_rec.eligy_criteria_id;
270 Close C_Sel1;
271 --
272 hr_utility.set_location(' Leaving:'||l_proc, 10);
273 End pre_insert;
274 --
275 -- ----------------------------------------------------------------------------
276 -- |-----------------------------< post_insert >------------------------------|
277 -- ----------------------------------------------------------------------------
278 -- {Start Of Comments}
279 --
280 -- Description:
281 -- This private procedure contains any processing which is required after the
282 -- insert dml.
283 --
284 -- Prerequisites:
285 -- This is an internal procedure which is called from the ins procedure.
286 --
287 -- In Parameters:
288 -- A Pl/Sql record structre.
289 --
290 -- Post Success:
291 -- Processing continues.
292 --
293 -- Post Failure:
294 -- If an error has occurred, an error message and exception will be raised
295 -- but not handled.
296 --
297 -- Developer Implementation Notes:
298 -- Any post-processing required after the insert dml is issued should be
299 -- coded within this procedure. It is important to note that any 3rd party
300 -- maintenance should be reviewed before placing in this procedure.
301 --
302 -- Access Status:
303 -- Internal Row Handler Use Only.
304 --
305 -- {End Of Comments}
306 -- ----------------------------------------------------------------------------
307 Procedure post_insert(p_rec in ben_egl_shd.g_rec_type
308 ,p_effective_date in date) is
309 --
310 l_proc varchar2(72) := g_package||'post_insert';
311 l_eligy_criteria_id ben_eligy_criteria.eligy_criteria_id%TYPE;
312 --
313 Begin
314
315 hr_utility.set_location('Entering:'||l_proc, 5);
316 --
317 --
318 -- Start of API User Hook for post_insert.
319 --
320 begin
321 --
322 ben_egl_rki.after_insert
323 (
324 p_eligy_criteria_id => p_rec.eligy_criteria_id
325 ,p_name => p_rec.name
326 ,p_short_code => p_rec.short_code
327 ,p_description => p_rec.description
328 ,p_criteria_type => p_rec.criteria_type
329 ,p_crit_col1_val_type_cd => p_rec.crit_col1_val_type_cd
330 ,p_crit_col1_datatype => p_rec.crit_col1_datatype
331 ,p_col1_lookup_type => p_rec.col1_lookup_type
332 ,p_col1_value_set_id => p_rec.col1_value_set_id
333 ,p_access_table_name1 => p_rec.access_table_name1
334 ,p_access_column_name1 => p_rec.access_column_name1
335 ,p_time_entry_access_tab_nam1 => p_rec.time_entry_access_tab_nam1
336 ,p_time_entry_access_col_nam1 => p_rec.time_entry_access_col_nam1
337 ,p_crit_col2_val_type_cd => p_rec.crit_col2_val_type_cd
338 ,p_crit_col2_datatype => p_rec.crit_col2_datatype
339 ,p_col2_lookup_type => p_rec.col2_lookup_type
340 ,p_col2_value_set_id => p_rec.col2_value_set_id
341 ,p_access_table_name2 => p_rec.access_table_name2
342 ,p_access_column_name2 => p_rec.access_column_name2
343 ,p_time_entry_access_tab_nam2 => p_rec.time_entry_access_tab_nam2
344 ,p_time_entry_access_col_nam2 => p_rec.time_entry_access_col_nam2
345 ,p_access_calc_rule => p_rec.access_calc_rule
346 ,p_allow_range_validation_flg => p_rec.allow_range_validation_flg
347 ,p_user_defined_flag => p_rec.user_defined_flag
348 ,p_business_group_id => p_rec.business_group_id
349 ,p_legislation_code => p_rec.legislation_code
350 ,p_egl_attribute_category => p_rec.egl_attribute_category
351 ,p_egl_attribute1 => p_rec.egl_attribute1
352 ,p_egl_attribute2 => p_rec.egl_attribute2
353 ,p_egl_attribute3 => p_rec.egl_attribute3
354 ,p_egl_attribute4 => p_rec.egl_attribute4
355 ,p_egl_attribute5 => p_rec.egl_attribute5
356 ,p_egl_attribute6 => p_rec.egl_attribute6
357 ,p_egl_attribute7 => p_rec.egl_attribute7
358 ,p_egl_attribute8 => p_rec.egl_attribute8
359 ,p_egl_attribute9 => p_rec.egl_attribute9
360 ,p_egl_attribute10 => p_rec.egl_attribute10
361 ,p_egl_attribute11 => p_rec.egl_attribute11
362 ,p_egl_attribute12 => p_rec.egl_attribute12
363 ,p_egl_attribute13 => p_rec.egl_attribute13
364 ,p_egl_attribute14 => p_rec.egl_attribute14
365 ,p_egl_attribute15 => p_rec.egl_attribute15
366 ,p_egl_attribute16 => p_rec.egl_attribute16
367 ,p_egl_attribute17 => p_rec.egl_attribute17
368 ,p_egl_attribute18 => p_rec.egl_attribute18
369 ,p_egl_attribute19 => p_rec.egl_attribute19
370 ,p_egl_attribute20 => p_rec.egl_attribute20
371 ,p_egl_attribute21 => p_rec.egl_attribute21
372 ,p_egl_attribute22 => p_rec.egl_attribute22
373 ,p_egl_attribute23 => p_rec.egl_attribute23
374 ,p_egl_attribute24 => p_rec.egl_attribute24
375 ,p_egl_attribute25 => p_rec.egl_attribute25
376 ,p_egl_attribute26 => p_rec.egl_attribute26
377 ,p_egl_attribute27 => p_rec.egl_attribute27
378 ,p_egl_attribute28 => p_rec.egl_attribute28
379 ,p_egl_attribute29 => p_rec.egl_attribute29
380 ,p_egl_attribute30 => p_rec.egl_attribute30
381 ,p_object_version_number => p_rec.object_version_number
382 ,p_effective_date => p_effective_date
383 ,p_allow_range_validation_flag2 => p_rec.allow_range_validation_flag2
384 ,p_access_calc_rule2 => p_rec.access_calc_rule2
385 ,p_time_access_calc_rule1 => p_rec.time_access_calc_rule1
386 ,p_time_access_calc_rule2 => p_rec.time_access_calc_rule2
387
388 );
389 --
390 exception
391 --
392 when hr_api.cannot_find_prog_unit then
393 --
394 hr_api.cannot_find_prog_unit_error
395 (p_module_name => 'ben_eligy_criteria'
396 ,p_hook_type => 'AI');
397 --
398 end;
399 --
400 -- End of API User Hook for post_insert.
401 --
402 --
403 hr_utility.set_location(' Leaving:'||l_proc, 10);
404 End post_insert;
405 --
406 -- ----------------------------------------------------------------------------
407 -- |---------------------------------< ins >----------------------------------|
408 -- ----------------------------------------------------------------------------
409 Procedure ins
410 (
411 p_rec in out nocopy ben_egl_shd.g_rec_type
412 ,p_effective_date in date
413 ) is
414 --
415 l_proc varchar2(72) := g_package||'ins';
416 --
417 Begin
418 hr_utility.set_location('Entering:'||l_proc, 5);
419 --
420 -- Call the supporting insert validate operations
421 --
422 ben_egl_bus.insert_validate(p_rec
423 ,p_effective_date);
424 --
425 -- Call the supporting pre-insert operation
426 --
427 pre_insert(p_rec);
428 --
429 -- Insert the row
430 --
431 insert_dml(p_rec);
432 --
433 -- Call the supporting post-insert operation
434 --
435 post_insert(p_rec
436 ,p_effective_date);
437 end ins;
438 --
439 -- ----------------------------------------------------------------------------
440 -- |---------------------------------< ins >----------------------------------|
441 -- ----------------------------------------------------------------------------
442 Procedure ins
443 (
444 p_eligy_criteria_id out nocopy number
445 ,p_name in varchar2 default null
446 ,p_short_code in varchar2 default null
447 ,p_description in varchar2 default null
448 ,p_criteria_type in varchar2 default null
449 ,p_crit_col1_val_type_cd in varchar2 default null
450 ,p_crit_col1_datatype in varchar2 default null
451 ,p_col1_lookup_type in varchar2 default null
452 ,p_col1_value_set_id in number default null
453 ,p_access_table_name1 in varchar2 default null
454 ,p_access_column_name1 in varchar2 default null
455 ,p_time_entry_access_tab_nam1 in varchar2 default null
456 ,p_time_entry_access_col_nam1 in varchar2 default null
457 ,p_crit_col2_val_type_cd in varchar2 default null
458 ,p_crit_col2_datatype in varchar2 default null
459 ,p_col2_lookup_type in varchar2 default null
460 ,p_col2_value_set_id in number default null
461 ,p_access_table_name2 in varchar2 default null
462 ,p_access_column_name2 in varchar2 default null
463 ,p_time_entry_access_tab_nam2 in varchar2 default null
464 ,p_time_entry_access_col_nam2 in varchar2 default null
465 ,p_access_calc_rule in number default null
466 ,p_allow_range_validation_flg in varchar2 default null
467 ,p_user_defined_flag in varchar2 default null
468 ,p_business_group_id in number default null
469 ,p_legislation_code in varchar2 default null
470 ,p_egl_attribute_category in varchar2 default null
471 ,p_egl_attribute1 in varchar2 default null
472 ,p_egl_attribute2 in varchar2 default null
473 ,p_egl_attribute3 in varchar2 default null
474 ,p_egl_attribute4 in varchar2 default null
475 ,p_egl_attribute5 in varchar2 default null
476 ,p_egl_attribute6 in varchar2 default null
477 ,p_egl_attribute7 in varchar2 default null
478 ,p_egl_attribute8 in varchar2 default null
479 ,p_egl_attribute9 in varchar2 default null
480 ,p_egl_attribute10 in varchar2 default null
481 ,p_egl_attribute11 in varchar2 default null
482 ,p_egl_attribute12 in varchar2 default null
483 ,p_egl_attribute13 in varchar2 default null
484 ,p_egl_attribute14 in varchar2 default null
485 ,p_egl_attribute15 in varchar2 default null
486 ,p_egl_attribute16 in varchar2 default null
487 ,p_egl_attribute17 in varchar2 default null
488 ,p_egl_attribute18 in varchar2 default null
489 ,p_egl_attribute19 in varchar2 default null
490 ,p_egl_attribute20 in varchar2 default null
491 ,p_egl_attribute21 in varchar2 default null
492 ,p_egl_attribute22 in varchar2 default null
493 ,p_egl_attribute23 in varchar2 default null
494 ,p_egl_attribute24 in varchar2 default null
495 ,p_egl_attribute25 in varchar2 default null
496 ,p_egl_attribute26 in varchar2 default null
497 ,p_egl_attribute27 in varchar2 default null
498 ,p_egl_attribute28 in varchar2 default null
499 ,p_egl_attribute29 in varchar2 default null
500 ,p_egl_attribute30 in varchar2 default null
501 ,p_object_version_number out nocopy number
502 ,p_effective_date in date
503 ,p_allow_range_validation_flag2 in varchar2 default null
504 ,p_access_calc_rule2 in number default null
505 ,p_time_access_calc_rule1 in number default null
506 ,p_time_access_calc_rule2 in number default null
507 ) is
508 --
509 l_rec ben_egl_shd.g_rec_type;
510 l_proc varchar2(72) := g_package||'ins';
511 --
512 Begin
513 hr_utility.set_location('Entering:'||l_proc, 5);
514 --
515 -- Call conversion function to turn arguments into the
516 -- p_rec structure.
517 --
518 l_rec :=
519 ben_egl_shd.convert_args
520 (
521 null
522 ,p_name
523 ,p_short_code
524 ,p_description
525 ,p_criteria_type
526 ,p_crit_col1_val_type_cd
527 ,p_crit_col1_datatype
528 ,p_col1_lookup_type
529 ,p_col1_value_set_id
530 ,p_access_table_name1
531 ,p_access_column_name1
532 ,p_time_entry_access_tab_nam1
533 ,p_time_entry_access_col_nam1
534 ,p_crit_col2_val_type_cd
535 ,p_crit_col2_datatype
536 ,p_col2_lookup_type
537 ,p_col2_value_set_id
538 ,p_access_table_name2
539 ,p_access_column_name2
540 ,p_time_entry_access_tab_nam2
541 ,p_time_entry_access_col_nam2
542 ,p_access_calc_rule
543 ,p_allow_range_validation_flg
544 ,p_user_defined_flag
545 ,p_business_group_id
546 ,p_legislation_code
547 ,p_egl_attribute_category
548 ,p_egl_attribute1
549 ,p_egl_attribute2
550 ,p_egl_attribute3
551 ,p_egl_attribute4
552 ,p_egl_attribute5
553 ,p_egl_attribute6
554 ,p_egl_attribute7
555 ,p_egl_attribute8
556 ,p_egl_attribute9
557 ,p_egl_attribute10
558 ,p_egl_attribute11
559 ,p_egl_attribute12
560 ,p_egl_attribute13
561 ,p_egl_attribute14
562 ,p_egl_attribute15
563 ,p_egl_attribute16
564 ,p_egl_attribute17
565 ,p_egl_attribute18
566 ,p_egl_attribute19
567 ,p_egl_attribute20
568 ,p_egl_attribute21
569 ,p_egl_attribute22
570 ,p_egl_attribute23
571 ,p_egl_attribute24
572 ,p_egl_attribute25
573 ,p_egl_attribute26
574 ,p_egl_attribute27
575 ,p_egl_attribute28
576 ,p_egl_attribute29
577 ,p_egl_attribute30
578 ,null
579 ,p_allow_range_validation_flag2
580 ,p_access_calc_rule2
581 ,p_time_access_calc_rule1
582 ,p_time_access_calc_rule2
583 );
584 --
585 -- Having converted the arguments into the ben_egl_rec
586 -- plsql record structure we call the corresponding record business process.
587 --
588 ins(l_rec
589 ,p_effective_date);
590 --
591 -- As the primary key argument(s)
592 -- are specified as an OUT's we must set these values.
593 --
594 p_eligy_criteria_id := l_rec.eligy_criteria_id;
595 p_object_version_number := l_rec.object_version_number;
596 --
597 hr_utility.set_location(' Leaving:'||l_proc, 10);
598 End ins;
599 --
600 end ben_egl_ins;