[Home] [Help]
PACKAGE BODY: APPS.BEN_EGD_INS
Source
1 Package Body ben_egd_ins as
2 /* $Header: beegdrhi.pkb 120.1 2008/04/24 10:18:32 bachakra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_egd_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_egd_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_egd_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: ben_elig_dpnt
64 --
65 insert into ben_elig_dpnt
66 ( elig_dpnt_id,
67 create_dt,
68 elig_strt_dt,
69 elig_thru_dt,
70 ovrdn_flag,
71 ovrdn_thru_dt,
72 inelg_rsn_cd,
73 dpnt_inelig_flag,
74 elig_per_elctbl_chc_id,
75 per_in_ler_id,
76 elig_per_id,
77 elig_per_opt_id,
78 elig_cvrd_dpnt_id,
79 dpnt_person_id,
80 business_group_id,
81 egd_attribute_category,
82 egd_attribute1,
83 egd_attribute2,
84 egd_attribute3,
85 egd_attribute4,
86 egd_attribute5,
87 egd_attribute6,
88 egd_attribute7,
89 egd_attribute8,
90 egd_attribute9,
91 egd_attribute10,
92 egd_attribute11,
93 egd_attribute12,
94 egd_attribute13,
95 egd_attribute14,
96 egd_attribute15,
97 egd_attribute16,
98 egd_attribute17,
99 egd_attribute18,
100 egd_attribute19,
101 egd_attribute20,
102 egd_attribute21,
103 egd_attribute22,
104 egd_attribute23,
105 egd_attribute24,
106 egd_attribute25,
107 egd_attribute26,
108 egd_attribute27,
109 egd_attribute28,
110 egd_attribute29,
111 egd_attribute30,
112 request_id,
113 program_application_id,
114 program_id,
115 program_update_date,
116 object_version_number
117 )
118 Values
119 ( p_rec.elig_dpnt_id,
120 p_rec.create_dt,
121 p_rec.elig_strt_dt,
122 p_rec.elig_thru_dt,
123 p_rec.ovrdn_flag,
124 p_rec.ovrdn_thru_dt,
125 p_rec.inelg_rsn_cd,
126 p_rec.dpnt_inelig_flag,
127 p_rec.elig_per_elctbl_chc_id,
128 p_rec.per_in_ler_id,
129 p_rec.elig_per_id,
130 p_rec.elig_per_opt_id,
131 p_rec.elig_cvrd_dpnt_id,
132 p_rec.dpnt_person_id,
133 p_rec.business_group_id,
134 p_rec.egd_attribute_category,
135 p_rec.egd_attribute1,
136 p_rec.egd_attribute2,
137 p_rec.egd_attribute3,
138 p_rec.egd_attribute4,
139 p_rec.egd_attribute5,
140 p_rec.egd_attribute6,
141 p_rec.egd_attribute7,
142 p_rec.egd_attribute8,
143 p_rec.egd_attribute9,
144 p_rec.egd_attribute10,
145 p_rec.egd_attribute11,
146 p_rec.egd_attribute12,
147 p_rec.egd_attribute13,
148 p_rec.egd_attribute14,
149 p_rec.egd_attribute15,
150 p_rec.egd_attribute16,
151 p_rec.egd_attribute17,
152 p_rec.egd_attribute18,
153 p_rec.egd_attribute19,
154 p_rec.egd_attribute20,
155 p_rec.egd_attribute21,
156 p_rec.egd_attribute22,
157 p_rec.egd_attribute23,
158 p_rec.egd_attribute24,
159 p_rec.egd_attribute25,
160 p_rec.egd_attribute26,
161 p_rec.egd_attribute27,
162 p_rec.egd_attribute28,
163 p_rec.egd_attribute29,
164 p_rec.egd_attribute30,
165 p_rec.request_id,
166 p_rec.program_application_id,
167 p_rec.program_id,
168 p_rec.program_update_date,
169 p_rec.object_version_number
170 );
171 --
172 ben_egd_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_egd_shd.g_api_dml := false; -- Unset the api dml status
179 ben_egd_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_egd_shd.g_api_dml := false; -- Unset the api dml status
184 ben_egd_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_egd_shd.g_api_dml := false; -- Unset the api dml status
189 ben_egd_shd.constraint_error
190 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
191 When Others Then
192 ben_egd_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 structre.
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(p_rec in out nocopy ben_egd_shd.g_rec_type) is
234 --
235 l_proc varchar2(72) := g_package||'pre_insert';
236 --
237 Cursor C_Sel1 is select ben_elig_dpnt_s.nextval from sys.dual;
238 --
239 Begin
240 hr_utility.set_location('Entering:'||l_proc, 5);
241 --
242 --
243 -- Select the next sequence number
244 --
245 Open C_Sel1;
246 Fetch C_Sel1 Into p_rec.elig_dpnt_id;
247 Close C_Sel1;
248 --
249 hr_utility.set_location(' Leaving:'||l_proc, 10);
250 End pre_insert;
251 --
252 -- ----------------------------------------------------------------------------
253 -- |-----------------------------< post_insert >------------------------------|
254 -- ----------------------------------------------------------------------------
255 -- {Start Of Comments}
256 --
257 -- Description:
258 -- This private procedure contains any processing which is required after the
259 -- insert dml.
260 --
261 -- Prerequisites:
262 -- This is an internal procedure which is called from the ins procedure.
263 --
264 -- In Parameters:
265 -- A Pl/Sql record structre.
266 --
267 -- Post Success:
268 -- Processing continues.
269 --
270 -- Post Failure:
271 -- If an error has occurred, an error message and exception will be raised
272 -- but not handled.
273 --
274 -- Developer Implementation Notes:
275 -- Any post-processing required after the insert dml is issued should be
276 -- coded within this procedure. It is important to note that any 3rd party
277 -- maintenance should be reviewed before placing in this procedure.
278 --
279 -- Access Status:
280 -- Internal Row Handler Use Only.
281 --
282 -- {End Of Comments}
283 -- ----------------------------------------------------------------------------
284 Procedure post_insert(
285 p_effective_date in date,p_rec in ben_egd_shd.g_rec_type) is
286 --
287 l_proc varchar2(72) := g_package||'post_insert';
288 --
289 l_old_rec ben_egd_ler.g_egd_ler_rec;
290 l_new_rec ben_egd_ler.g_egd_ler_rec;
291 --
292 Begin
293 hr_utility.set_location('Entering:'||l_proc, 5);
294 --
295 -- Life event trigger
296 --
297 l_old_rec.business_group_id := null;
298 l_old_rec.dpnt_person_id := null;
299 l_old_rec.elig_strt_dt :=null;
300 l_old_rec.elig_thru_dt := null;
301 l_old_rec.dpnt_inelig_flag := null;
302 l_old_rec.ovrdn_thru_dt := null;
303 l_old_rec.ovrdn_flag := null;
304 l_old_rec.create_dt := null;
305 --
306 l_new_rec.business_group_id := p_rec.business_group_id;
307 l_new_rec.dpnt_person_id := p_rec.dpnt_person_id;
308 l_new_rec.elig_strt_dt := p_rec.elig_strt_dt;
309 l_new_rec.elig_thru_dt := p_rec.elig_thru_dt;
310 l_new_rec.dpnt_inelig_flag := p_rec.dpnt_inelig_flag;
311 l_new_rec.ovrdn_thru_dt := p_rec.ovrdn_thru_dt;
312 l_new_rec.ovrdn_flag := p_rec.ovrdn_flag;
313 l_new_rec.create_dt := p_rec.create_dt;
314 l_new_rec.per_in_ler_id := p_rec.per_in_ler_id; --Bug 5630251
315 --
316 ben_egd_ler.ler_chk(l_old_rec,l_new_rec,p_effective_date);
317 --
318 -- Start of API User Hook for post_insert.
319 --
320 begin
321 --
322 ben_egd_rki.after_insert
323 (
324 p_elig_dpnt_id =>p_rec.elig_dpnt_id
325 ,p_create_dt =>p_rec.create_dt
326 ,p_elig_strt_dt =>p_rec.elig_strt_dt
327 ,p_elig_thru_dt =>p_rec.elig_thru_dt
328 ,p_ovrdn_flag =>p_rec.ovrdn_flag
329 ,p_ovrdn_thru_dt =>p_rec.ovrdn_thru_dt
330 ,p_inelg_rsn_cd =>p_rec.inelg_rsn_cd
331 ,p_dpnt_inelig_flag =>p_rec.dpnt_inelig_flag
332 ,p_elig_per_elctbl_chc_id =>p_rec.elig_per_elctbl_chc_id
333 ,p_per_in_ler_id =>p_rec.per_in_ler_id
334 ,p_elig_per_id =>p_rec.elig_per_id
335 ,p_elig_per_opt_id =>p_rec.elig_per_opt_id
336 ,p_elig_cvrd_dpnt_id =>p_rec.elig_cvrd_dpnt_id
337 ,p_dpnt_person_id =>p_rec.dpnt_person_id
338 ,p_business_group_id =>p_rec.business_group_id
339 ,p_egd_attribute_category =>p_rec.egd_attribute_category
340 ,p_egd_attribute1 =>p_rec.egd_attribute1
341 ,p_egd_attribute2 =>p_rec.egd_attribute2
342 ,p_egd_attribute3 =>p_rec.egd_attribute3
343 ,p_egd_attribute4 =>p_rec.egd_attribute4
344 ,p_egd_attribute5 =>p_rec.egd_attribute5
345 ,p_egd_attribute6 =>p_rec.egd_attribute6
346 ,p_egd_attribute7 =>p_rec.egd_attribute7
347 ,p_egd_attribute8 =>p_rec.egd_attribute8
348 ,p_egd_attribute9 =>p_rec.egd_attribute9
349 ,p_egd_attribute10 =>p_rec.egd_attribute10
350 ,p_egd_attribute11 =>p_rec.egd_attribute11
351 ,p_egd_attribute12 =>p_rec.egd_attribute12
352 ,p_egd_attribute13 =>p_rec.egd_attribute13
353 ,p_egd_attribute14 =>p_rec.egd_attribute14
354 ,p_egd_attribute15 =>p_rec.egd_attribute15
355 ,p_egd_attribute16 =>p_rec.egd_attribute16
356 ,p_egd_attribute17 =>p_rec.egd_attribute17
357 ,p_egd_attribute18 =>p_rec.egd_attribute18
358 ,p_egd_attribute19 =>p_rec.egd_attribute19
359 ,p_egd_attribute20 =>p_rec.egd_attribute20
360 ,p_egd_attribute21 =>p_rec.egd_attribute21
361 ,p_egd_attribute22 =>p_rec.egd_attribute22
362 ,p_egd_attribute23 =>p_rec.egd_attribute23
363 ,p_egd_attribute24 =>p_rec.egd_attribute24
364 ,p_egd_attribute25 =>p_rec.egd_attribute25
365 ,p_egd_attribute26 =>p_rec.egd_attribute26
366 ,p_egd_attribute27 =>p_rec.egd_attribute27
367 ,p_egd_attribute28 =>p_rec.egd_attribute28
368 ,p_egd_attribute29 =>p_rec.egd_attribute29
369 ,p_egd_attribute30 =>p_rec.egd_attribute30
370 ,p_request_id =>p_rec.request_id
371 ,p_program_application_id =>p_rec.program_application_id
372 ,p_program_id =>p_rec.program_id
373 ,p_program_update_date =>p_rec.program_update_date
374 ,p_object_version_number =>p_rec.object_version_number
375 ,p_effective_date =>p_effective_date
376 );
377 --
378 exception
379 --
380 when hr_api.cannot_find_prog_unit then
381 --
382 hr_api.cannot_find_prog_unit_error
383 (p_module_name => 'ben_elig_dpnt'
384 ,p_hook_type => 'AI');
385 --
386 end;
387 --
388 -- End of API User Hook for post_insert.
389 --
390 --
391 hr_utility.set_location(' Leaving:'||l_proc, 10);
392 End post_insert;
393 --
394 -- ----------------------------------------------------------------------------
395 -- |---------------------------------< ins >----------------------------------|
396 -- ----------------------------------------------------------------------------
397 Procedure ins
398 (
399 p_effective_date in date,
400 p_rec in out nocopy ben_egd_shd.g_rec_type
401 ) is
402 --
403 l_proc varchar2(72) := g_package||'ins';
404 --
405 Begin
406 hr_utility.set_location('Entering:'||l_proc, 5);
407 --
408 -- Call the supporting insert validate operations
409 --
410 ben_egd_bus.insert_validate(p_rec
411 ,p_effective_date);
412 --
413 -- Call the supporting pre-insert operation
414 --
415 pre_insert(p_rec);
416 --
417 -- Insert the row
418 --
419 insert_dml(p_rec);
420 --
421 -- Call the supporting post-insert operation
422 --
423 post_insert(
424 p_effective_date,p_rec);
425 end ins;
426 --
427 -- ----------------------------------------------------------------------------
428 -- |---------------------------------< ins >----------------------------------|
429 -- ----------------------------------------------------------------------------
430 Procedure ins
431 (
432 p_effective_date in date,
433 p_elig_dpnt_id out nocopy number,
434 p_create_dt in date,
435 p_elig_strt_dt in date default null,
436 p_elig_thru_dt in date default null,
437 p_ovrdn_flag in varchar2,
438 p_ovrdn_thru_dt in date default null,
439 p_inelg_rsn_cd in varchar2 default null,
440 p_dpnt_inelig_flag in varchar2,
441 p_elig_per_elctbl_chc_id in number default null,
442 p_per_in_ler_id in number default null,
443 p_elig_per_id in number default null,
444 p_elig_per_opt_id in number default null,
445 p_elig_cvrd_dpnt_id in number default null,
446 p_dpnt_person_id in number,
447 p_business_group_id in number,
448 p_egd_attribute_category in varchar2 default null,
449 p_egd_attribute1 in varchar2 default null,
450 p_egd_attribute2 in varchar2 default null,
451 p_egd_attribute3 in varchar2 default null,
452 p_egd_attribute4 in varchar2 default null,
453 p_egd_attribute5 in varchar2 default null,
454 p_egd_attribute6 in varchar2 default null,
455 p_egd_attribute7 in varchar2 default null,
456 p_egd_attribute8 in varchar2 default null,
457 p_egd_attribute9 in varchar2 default null,
458 p_egd_attribute10 in varchar2 default null,
459 p_egd_attribute11 in varchar2 default null,
460 p_egd_attribute12 in varchar2 default null,
461 p_egd_attribute13 in varchar2 default null,
462 p_egd_attribute14 in varchar2 default null,
463 p_egd_attribute15 in varchar2 default null,
464 p_egd_attribute16 in varchar2 default null,
465 p_egd_attribute17 in varchar2 default null,
466 p_egd_attribute18 in varchar2 default null,
467 p_egd_attribute19 in varchar2 default null,
468 p_egd_attribute20 in varchar2 default null,
469 p_egd_attribute21 in varchar2 default null,
470 p_egd_attribute22 in varchar2 default null,
471 p_egd_attribute23 in varchar2 default null,
472 p_egd_attribute24 in varchar2 default null,
473 p_egd_attribute25 in varchar2 default null,
474 p_egd_attribute26 in varchar2 default null,
475 p_egd_attribute27 in varchar2 default null,
476 p_egd_attribute28 in varchar2 default null,
477 p_egd_attribute29 in varchar2 default null,
478 p_egd_attribute30 in varchar2 default null,
479 p_request_id in number default null,
480 p_program_application_id in number default null,
481 p_program_id in number default null,
482 p_program_update_date in date default null,
483 p_object_version_number out nocopy number
484 ) is
485 --
486 l_rec ben_egd_shd.g_rec_type;
487 l_proc varchar2(72) := g_package||'ins';
488 --
489 Begin
490 hr_utility.set_location('Entering:'||l_proc, 5);
491 --
492 -- Call conversion function to turn arguments into the
493 -- p_rec structure.
494 --
495 l_rec :=
496 ben_egd_shd.convert_args
497 (
498 null,
499 p_create_dt,
500 p_elig_strt_dt,
501 p_elig_thru_dt,
502 p_ovrdn_flag,
503 p_ovrdn_thru_dt,
504 p_inelg_rsn_cd,
505 p_dpnt_inelig_flag,
506 p_elig_per_elctbl_chc_id,
507 p_per_in_ler_id,
508 p_elig_per_id,
509 p_elig_per_opt_id,
510 p_elig_cvrd_dpnt_id,
511 p_dpnt_person_id,
512 p_business_group_id,
513 p_egd_attribute_category,
514 p_egd_attribute1,
515 p_egd_attribute2,
516 p_egd_attribute3,
517 p_egd_attribute4,
518 p_egd_attribute5,
519 p_egd_attribute6,
520 p_egd_attribute7,
521 p_egd_attribute8,
522 p_egd_attribute9,
523 p_egd_attribute10,
524 p_egd_attribute11,
525 p_egd_attribute12,
526 p_egd_attribute13,
527 p_egd_attribute14,
528 p_egd_attribute15,
529 p_egd_attribute16,
530 p_egd_attribute17,
531 p_egd_attribute18,
532 p_egd_attribute19,
533 p_egd_attribute20,
534 p_egd_attribute21,
535 p_egd_attribute22,
536 p_egd_attribute23,
537 p_egd_attribute24,
538 p_egd_attribute25,
539 p_egd_attribute26,
540 p_egd_attribute27,
541 p_egd_attribute28,
542 p_egd_attribute29,
543 p_egd_attribute30,
544 p_request_id,
545 p_program_application_id,
546 p_program_id,
547 p_program_update_date,
548 null
549 );
550 --
551 -- Having converted the arguments into the ben_egd_rec
552 -- plsql record structure we call the corresponding record business process.
553 --
554 ins(
555 p_effective_date,l_rec);
556 --
557 -- As the primary key argument(s)
558 -- are specified as an OUT's we must set these values.
559 --
560 p_elig_dpnt_id := l_rec.elig_dpnt_id;
561 p_object_version_number := l_rec.object_version_number;
562 --
563 hr_utility.set_location(' Leaving:'||l_proc, 10);
564 End ins;
565 --
566 end ben_egd_ins;