DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ENB_INS

Source


1 Package Body ben_enb_ins as
2 /* $Header: beenbrhi.pkb 115.15 2002/12/16 07:02:08 rpgupta ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_enb_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_enb_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_enb_shd.g_api_dml := true;  -- Set the api dml status
62   --
66   (	 enrt_bnft_id
63   -- Insert the row into: ben_enrt_bnft
64   --
65   insert into ben_enrt_bnft
67 	,dflt_flag
68 	,val_has_bn_prortd_flag
69 	,bndry_perd_cd
70 	,val
71 	,nnmntry_uom
72 	,bnft_typ_cd
73 	,entr_val_at_enrt_flag
74 	,mn_val
75 	,mx_val
76 	,incrmt_val
77         ,dflt_val
78 	,rt_typ_cd
79 	,cvg_mlt_cd
80 	,ctfn_rqd_flag
81 	,ordr_num
82 	,crntly_enrld_flag
83 	,elig_per_elctbl_chc_id
84 	,prtt_enrt_rslt_id
85 	,comp_lvl_fctr_id
86 	,business_group_id
87 	,enb_attribute_category
88 	,enb_attribute1
89 	,enb_attribute2
90 	,enb_attribute3
91 	,enb_attribute4
92 	,enb_attribute5
93 	,enb_attribute6
94 	,enb_attribute7
95 	,enb_attribute8
96 	,enb_attribute9
97 	,enb_attribute10
98 	,enb_attribute11
99 	,enb_attribute12
100 	,enb_attribute13
101 	,enb_attribute14
102 	,enb_attribute15
103 	,enb_attribute16
104 	,enb_attribute17
105 	,enb_attribute18
106 	,enb_attribute19
107 	,enb_attribute20
108 	,enb_attribute21
109 	,enb_attribute22
110 	,enb_attribute23
111 	,enb_attribute24
112 	,enb_attribute25
113 	,enb_attribute26
114 	,enb_attribute27
115 	,enb_attribute28
116 	,enb_attribute29
117     ,enb_attribute30
118     ,request_id
119     ,program_application_id
120     ,program_id
121     ,mx_wout_ctfn_val
122     ,mx_wo_ctfn_flag
123     ,program_update_date
124     ,object_version_number
125   )
126   Values
127   (	p_rec.enrt_bnft_id           ,
128 	p_rec.dflt_flag              ,
129 	p_rec.val_has_bn_prortd_flag ,
130 	p_rec.bndry_perd_cd          ,
131 	p_rec.val                    ,
132 	p_rec.nnmntry_uom            ,
133 	p_rec.bnft_typ_cd            ,
134 	p_rec.entr_val_at_enrt_flag  ,
135 	p_rec.mn_val                 ,
136 	p_rec.mx_val                 ,
137 	p_rec.incrmt_val             ,
138         p_rec.dflt_val               ,
139 	p_rec.rt_typ_cd              ,
140 	p_rec.cvg_mlt_cd             ,
141 	p_rec.ctfn_rqd_flag          ,
142 	p_rec.ordr_num               ,
143 	p_rec.crntly_enrld_flag      ,
144 	p_rec.elig_per_elctbl_chc_id ,
145 	p_rec.prtt_enrt_rslt_id      ,
146 	p_rec.comp_lvl_fctr_id       ,
147 	p_rec.business_group_id      ,
148 	p_rec.enb_attribute_category ,
149 	p_rec.enb_attribute1         ,
150 	p_rec.enb_attribute2         ,
151 	p_rec.enb_attribute3         ,
152 	p_rec.enb_attribute4         ,
153 	p_rec.enb_attribute5         ,
154 	p_rec.enb_attribute6         ,
155 	p_rec.enb_attribute7         ,
156 	p_rec.enb_attribute8         ,
157 	p_rec.enb_attribute9         ,
158 	p_rec.enb_attribute10        ,
159 	p_rec.enb_attribute11        ,
160 	p_rec.enb_attribute12        ,
161 	p_rec.enb_attribute13        ,
162 	p_rec.enb_attribute14        ,
163 	p_rec.enb_attribute15        ,
164 	p_rec.enb_attribute16        ,
165 	p_rec.enb_attribute17        ,
166 	p_rec.enb_attribute18        ,
167 	p_rec.enb_attribute19        ,
168 	p_rec.enb_attribute20        ,
169 	p_rec.enb_attribute21        ,
170 	p_rec.enb_attribute22        ,
171 	p_rec.enb_attribute23        ,
172 	p_rec.enb_attribute24        ,
173 	p_rec.enb_attribute25        ,
174 	p_rec.enb_attribute26        ,
175 	p_rec.enb_attribute27        ,
176 	p_rec.enb_attribute28        ,
177 	p_rec.enb_attribute29        ,
178     p_rec.enb_attribute30        ,
179     p_rec.request_id             ,
180     p_rec.program_application_id ,
181     p_rec.program_id             ,
182     p_rec.mx_wout_ctfn_val       ,
183     p_rec.mx_wo_ctfn_flag        ,
184     p_rec.program_update_date    ,
185     p_rec.object_version_number
186   );
187   --
188   ben_enb_shd.g_api_dml := false;   -- Unset the api dml status
189   --
190   hr_utility.set_location(' Leaving:'||l_proc, 10);
191 Exception
192   When hr_api.check_integrity_violated Then
193     -- A check constraint has been violated
194     ben_enb_shd.g_api_dml := false;   -- Unset the api dml status
195     ben_enb_shd.constraint_error
196       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
197   When hr_api.parent_integrity_violated Then
198     -- Parent integrity has been violated
199     ben_enb_shd.g_api_dml := false;   -- Unset the api dml status
200     ben_enb_shd.constraint_error
201       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
202   When hr_api.unique_integrity_violated Then
203     -- Unique integrity has been violated
204     ben_enb_shd.g_api_dml := false;   -- Unset the api dml status
205     ben_enb_shd.constraint_error
206       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
207   When Others Then
208     ben_enb_shd.g_api_dml := false;   -- Unset the api dml status
209     Raise;
210 End insert_dml;
211 --
212 -- ----------------------------------------------------------------------------
213 -- |------------------------------< pre_insert >------------------------------|
214 -- ----------------------------------------------------------------------------
215 -- {Start Of Comments}
216 --
217 -- Description:
218 --   This private procedure contains any processing which is required before
219 --   the insert dml. Presently, if the entity has a corresponding primary
220 --   key which is maintained by an associating sequence, the primary key for
221 --   the entity will be populated with the next sequence value in
222 --   preparation for the insert dml.
223 --
224 -- Prerequisites:
225 --   This is an internal procedure which is called from the ins procedure.
229 --
226 --
227 -- In Parameters:
228 --   A Pl/Sql record structre.
230 -- Post Success:
231 --   Processing continues.
232 --
233 -- Post Failure:
234 --   If an error has occurred, an error message and exception will be raised
235 --   but not handled.
236 --
237 -- Developer Implementation Notes:
238 --   Any pre-processing required before the insert dml is issued should be
239 --   coded within this procedure. As stated above, a good example is the
240 --   generation of a primary key number via a corresponding sequence.
241 --   It is important to note that any 3rd party maintenance should be reviewed
242 --   before placing in this procedure.
243 --
244 -- Access Status:
245 --   Internal Row Handler Use Only.
246 --
247 -- {End Of Comments}
248 -- ----------------------------------------------------------------------------
249 Procedure pre_insert(p_rec  in out nocopy ben_enb_shd.g_rec_type) is
250 --
251   l_proc  varchar2(72) := g_package||'pre_insert';
252 --
253   Cursor C_Sel1 is select ben_enrt_bnft_s.nextval from sys.dual;
254 --
255 Begin
256   hr_utility.set_location('Entering:'||l_proc, 5);
257   --
258   --
259   -- Select the next sequence number
260   --
261   Open C_Sel1;
262   Fetch C_Sel1 Into p_rec.enrt_bnft_id;
263   Close C_Sel1;
264   --
265   hr_utility.set_location(' Leaving:'||l_proc, 10);
266 End pre_insert;
267 --
268 -- ----------------------------------------------------------------------------
269 -- |-----------------------------< post_insert >------------------------------|
270 -- ----------------------------------------------------------------------------
271 -- {Start Of Comments}
272 --
273 -- Description:
274 --   This private procedure contains any processing which is required after the
275 --   insert dml.
276 --
277 -- Prerequisites:
278 --   This is an internal procedure which is called from the ins procedure.
279 --
280 -- In Parameters:
281 --   A Pl/Sql record structre.
282 --
283 -- Post Success:
284 --   Processing continues.
285 --
286 -- Post Failure:
287 --   If an error has occurred, an error message and exception will be raised
288 --   but not handled.
289 --
290 -- Developer Implementation Notes:
291 --   Any post-processing required after the insert dml is issued should be
292 --   coded within this procedure. It is important to note that any 3rd party
293 --   maintenance should be reviewed before placing in this procedure.
294 --
295 -- Access Status:
296 --   Internal Row Handler Use Only.
297 --
298 -- {End Of Comments}
299 -- ----------------------------------------------------------------------------
300 Procedure post_insert(
301 p_effective_date in date,p_rec in ben_enb_shd.g_rec_type) is
302 --
303   l_proc  varchar2(72) := g_package||'post_insert';
304 --
305 Begin
306   hr_utility.set_location('Entering:'||l_proc, 5);
307 --
308   --
309   -- Start of API User Hook for post_insert.
310   --
311   begin
312     --
313     ben_enb_rki.after_insert
314 (
315   p_enrt_bnft_id                =>p_rec.enrt_bnft_id
316  ,p_dflt_flag                   =>p_rec.dflt_flag
317  ,p_val_has_bn_prortd_flag      =>p_rec.val_has_bn_prortd_flag
318  ,p_bndry_perd_cd               =>p_rec.bndry_perd_cd
319  ,p_val                         =>p_rec.val
320  ,p_nnmntry_uom                 =>p_rec.nnmntry_uom
321  ,p_bnft_typ_cd                 =>p_rec.bnft_typ_cd
322  ,p_entr_val_at_enrt_flag       =>p_rec.entr_val_at_enrt_flag
323  ,p_mn_val                      =>p_rec.mn_val
324  ,p_mx_val                      =>p_rec.mx_val
325  ,p_incrmt_val                  =>p_rec.incrmt_val
326  ,p_dflt_val                    =>p_rec.dflt_val
327  ,p_rt_typ_cd                   =>p_rec.rt_typ_cd
328  ,p_cvg_mlt_cd                  =>p_rec.cvg_mlt_cd
329  ,p_ctfn_rqd_flag               =>p_rec.ctfn_rqd_flag
330  ,p_ordr_num                    =>p_rec.ordr_num
331  ,p_crntly_enrld_flag           =>p_rec.crntly_enrld_flag
332  ,p_elig_per_elctbl_chc_id      =>p_rec.elig_per_elctbl_chc_id
333  ,p_prtt_enrt_rslt_id           =>p_rec.prtt_enrt_rslt_id
334  ,p_comp_lvl_fctr_id            =>p_rec.comp_lvl_fctr_id
335  ,p_business_group_id           =>p_rec.business_group_id
336  ,p_enb_attribute_category      =>p_rec.enb_attribute_category
337  ,p_enb_attribute1              =>p_rec.enb_attribute1
338  ,p_enb_attribute2              =>p_rec.enb_attribute2
339  ,p_enb_attribute3              =>p_rec.enb_attribute3
340  ,p_enb_attribute4              =>p_rec.enb_attribute4
341  ,p_enb_attribute5              =>p_rec.enb_attribute5
342  ,p_enb_attribute6              =>p_rec.enb_attribute6
343  ,p_enb_attribute7              =>p_rec.enb_attribute7
344  ,p_enb_attribute8              =>p_rec.enb_attribute8
345  ,p_enb_attribute9              =>p_rec.enb_attribute9
346  ,p_enb_attribute10             =>p_rec.enb_attribute10
347  ,p_enb_attribute11             =>p_rec.enb_attribute11
348  ,p_enb_attribute12             =>p_rec.enb_attribute12
349  ,p_enb_attribute13             =>p_rec.enb_attribute13
350  ,p_enb_attribute14             =>p_rec.enb_attribute14
351  ,p_enb_attribute15             =>p_rec.enb_attribute15
352  ,p_enb_attribute16             =>p_rec.enb_attribute16
353  ,p_enb_attribute17             =>p_rec.enb_attribute17
354  ,p_enb_attribute18             =>p_rec.enb_attribute18
355  ,p_enb_attribute19             =>p_rec.enb_attribute19
356  ,p_enb_attribute20             =>p_rec.enb_attribute20
357  ,p_enb_attribute21             =>p_rec.enb_attribute21
358  ,p_enb_attribute22             =>p_rec.enb_attribute22
362  ,p_enb_attribute26             =>p_rec.enb_attribute26
359  ,p_enb_attribute23             =>p_rec.enb_attribute23
360  ,p_enb_attribute24             =>p_rec.enb_attribute24
361  ,p_enb_attribute25             =>p_rec.enb_attribute25
363  ,p_enb_attribute27             =>p_rec.enb_attribute27
364  ,p_enb_attribute28             =>p_rec.enb_attribute28
365  ,p_enb_attribute29             =>p_rec.enb_attribute29
366  ,p_enb_attribute30             =>p_rec.enb_attribute30
367  ,p_request_id                  =>p_rec.request_id
368  ,p_program_application_id      =>p_rec.program_application_id
369  ,p_program_id                  =>p_rec.program_id
370  ,p_mx_wout_ctfn_val            =>p_rec.mx_wout_ctfn_val
371  ,p_mx_wo_ctfn_flag             =>p_rec.mx_wo_ctfn_flag
372  ,p_program_update_date         =>p_rec.program_update_date
373  ,p_object_version_number       =>p_rec.object_version_number
374  ,p_effective_date              =>p_effective_date
375 );
376     --
377   exception
378     --
379     when hr_api.cannot_find_prog_unit then
380       --
381       hr_api.cannot_find_prog_unit_error
382         (p_module_name => 'ben_enrt_bnft'
383         ,p_hook_type   => 'AI');
384       --
385   end;
386   --
387   -- End of API User Hook for post_insert.
388   --
389   --
390   hr_utility.set_location(' Leaving:'||l_proc, 10);
391 End post_insert;
392 --
393 -- ----------------------------------------------------------------------------
394 -- |---------------------------------< ins >----------------------------------|
395 -- ----------------------------------------------------------------------------
396 Procedure ins
397   (
398   p_effective_date in date,
399   p_rec        in out nocopy ben_enb_shd.g_rec_type
400   ) is
401 --
402   l_proc  varchar2(72) := g_package||'ins';
403 --
404 Begin
405   hr_utility.set_location('Entering:'||l_proc, 5);
406   --
407   -- Call the supporting insert validate operations
408   --
409   ben_enb_bus.insert_validate(p_rec
410   ,p_effective_date);
411   --
412   -- Call the supporting pre-insert operation
413   --
414   pre_insert(p_rec);
415   --
416   -- Insert the row
417   --
418   insert_dml(p_rec);
419   --
420   -- Call the supporting post-insert operation
421   --
422   post_insert(
423 p_effective_date,p_rec);
424 end ins;
425 --
426 -- ----------------------------------------------------------------------------
427 -- |---------------------------------< ins >----------------------------------|
428 -- ----------------------------------------------------------------------------
429 Procedure ins
430   (
431    p_effective_date                 in date
432   ,p_enrt_bnft_id                   out nocopy number
433   ,p_dflt_flag                      in  varchar2  default null
434   ,p_val_has_bn_prortd_flag         in  varchar2  default null
435   ,p_bndry_perd_cd                  in  varchar2  default null
436   ,p_val                            in  number    default null
437   ,p_nnmntry_uom                    in  varchar2  default null
438   ,p_bnft_typ_cd                    in  varchar2  default null
439   ,p_entr_val_at_enrt_flag          in  varchar2  default null
440   ,p_mn_val                         in  number    default null
441   ,p_mx_val                         in  number    default null
442   ,p_incrmt_val                     in  number    default null
443   ,p_dflt_val                       in  number    default null
444   ,p_rt_typ_cd                      in  varchar2  default null
445   ,p_cvg_mlt_cd                     in  varchar2  default null
446   ,p_ctfn_rqd_flag                  in  varchar2  default null
447   ,p_ordr_num                       in  number    default null
448   ,p_crntly_enrld_flag              in  varchar2  default null
449   ,p_elig_per_elctbl_chc_id         in  number    default null
450   ,p_prtt_enrt_rslt_id              in  number    default null
451   ,p_comp_lvl_fctr_id               in  number    default null
452   ,p_business_group_id              in  number    default null
453   ,p_enb_attribute_category         in  varchar2  default null
454   ,p_enb_attribute1                 in  varchar2  default null
455   ,p_enb_attribute2                 in  varchar2  default null
456   ,p_enb_attribute3                 in  varchar2  default null
457   ,p_enb_attribute4                 in  varchar2  default null
458   ,p_enb_attribute5                 in  varchar2  default null
459   ,p_enb_attribute6                 in  varchar2  default null
460   ,p_enb_attribute7                 in  varchar2  default null
461   ,p_enb_attribute8                 in  varchar2  default null
462   ,p_enb_attribute9                 in  varchar2  default null
463   ,p_enb_attribute10                in  varchar2  default null
464   ,p_enb_attribute11                in  varchar2  default null
465   ,p_enb_attribute12                in  varchar2  default null
466   ,p_enb_attribute13                in  varchar2  default null
467   ,p_enb_attribute14                in  varchar2  default null
468   ,p_enb_attribute15                in  varchar2  default null
469   ,p_enb_attribute16                in  varchar2  default null
470   ,p_enb_attribute17                in  varchar2  default null
471   ,p_enb_attribute18                in  varchar2  default null
472   ,p_enb_attribute19                in  varchar2  default null
473   ,p_enb_attribute20                in  varchar2  default null
474   ,p_enb_attribute21                in  varchar2  default null
475   ,p_enb_attribute22                in  varchar2  default null
476   ,p_enb_attribute23                in  varchar2  default null
477   ,p_enb_attribute24                in  varchar2  default null
478   ,p_enb_attribute25                in  varchar2  default null
479   ,p_enb_attribute26                in  varchar2  default null
480   ,p_enb_attribute27                in  varchar2  default null
481   ,p_enb_attribute28                in  varchar2  default null
482   ,p_enb_attribute29                in  varchar2  default null
483   ,p_enb_attribute30                in  varchar2  default null
484   ,p_request_id                     in  number    default null
485   ,p_program_application_id         in  number    default null
486   ,p_program_id                     in  number    default null
487   ,p_mx_wout_ctfn_val               in  number    default null
488   ,p_mx_wo_ctfn_flag                in  varchar2  default 'N'
489   ,p_program_update_date            in  date      default null
490   ,p_object_version_number          out nocopy number
491   ) is
492 --
493   l_rec	  ben_enb_shd.g_rec_type;
494   l_proc  varchar2(72) := g_package||'ins';
495 --
496 Begin
497   hr_utility.set_location('Entering:'||l_proc, 5);
498   --
499   -- Call conversion function to turn arguments into the
500   -- p_rec structure.
501   --
502   l_rec :=
503   ben_enb_shd.convert_args
504   (
505    null
506   ,p_dflt_flag
507   ,p_val_has_bn_prortd_flag
508   ,p_bndry_perd_cd
509   ,p_val
510   ,p_nnmntry_uom
511   ,p_bnft_typ_cd
512   ,p_entr_val_at_enrt_flag
513   ,p_mn_val
514   ,p_mx_val
515   ,p_incrmt_val
516   ,p_dflt_val
517   ,p_rt_typ_cd
518   ,p_cvg_mlt_cd
519   ,p_ctfn_rqd_flag
520   ,p_ordr_num
521   ,p_crntly_enrld_flag
522   ,p_elig_per_elctbl_chc_id
523   ,p_prtt_enrt_rslt_id
524   ,p_comp_lvl_fctr_id
525   ,p_business_group_id
526   ,p_enb_attribute_category
527   ,p_enb_attribute1
528   ,p_enb_attribute2
529   ,p_enb_attribute3
530   ,p_enb_attribute4
531   ,p_enb_attribute5
532   ,p_enb_attribute6
533   ,p_enb_attribute7
534   ,p_enb_attribute8
535   ,p_enb_attribute9
536   ,p_enb_attribute10
537   ,p_enb_attribute11
538   ,p_enb_attribute12
539   ,p_enb_attribute13
540   ,p_enb_attribute14
541   ,p_enb_attribute15
542   ,p_enb_attribute16
543   ,p_enb_attribute17
544   ,p_enb_attribute18
545   ,p_enb_attribute19
546   ,p_enb_attribute20
547   ,p_enb_attribute21
548   ,p_enb_attribute22
549   ,p_enb_attribute23
550   ,p_enb_attribute24
551   ,p_enb_attribute25
552   ,p_enb_attribute26
553   ,p_enb_attribute27
554   ,p_enb_attribute28
555   ,p_enb_attribute29
556   ,p_enb_attribute30
557   ,p_request_id
558   ,p_program_application_id
559   ,p_program_id
560   ,p_mx_wout_ctfn_val
561   ,p_mx_wo_ctfn_flag
562   ,p_program_update_date
563   ,null
564   );
565   --
566   -- Having converted the arguments into the ben_enb_rec
567   -- plsql record structure we call the corresponding record business process.
568   --
569   ins(
570     p_effective_date,l_rec);
571   --
572   -- As the primary key argument(s)
573   -- are specified as an OUT's we must set these values.
574   --
575   p_enrt_bnft_id := l_rec.enrt_bnft_id;
576   p_object_version_number := l_rec.object_version_number;
577   --
578   hr_utility.set_location(' Leaving:'||l_proc, 10);
579 End ins;
580 --
581 end ben_enb_ins;
582