DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EPR_INS

Source


1 Package Body ben_epr_ins as
2 /* $Header: beeprrhi.pkb 115.5 2002/12/09 12:52:58 lakrish ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_epr_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_epr_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_epr_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ben_enrt_prem
64   --
65   insert into ben_enrt_prem
66   (	enrt_prem_id,
67 	val,
68 	uom,
69 	elig_per_elctbl_chc_id,
70 	enrt_bnft_id,
71 	actl_prem_id,
72 	business_group_id,
73 	epr_attribute_category,
74 	epr_attribute1,
75 	epr_attribute2,
76 	epr_attribute3,
77 	epr_attribute4,
78 	epr_attribute5,
79 	epr_attribute6,
80 	epr_attribute7,
81 	epr_attribute8,
82 	epr_attribute9,
83 	epr_attribute10,
84 	epr_attribute11,
85 	epr_attribute12,
86 	epr_attribute13,
87 	epr_attribute14,
88 	epr_attribute15,
89 	epr_attribute16,
90 	epr_attribute17,
91 	epr_attribute18,
92 	epr_attribute19,
93 	epr_attribute20,
94 	epr_attribute21,
95 	epr_attribute22,
96 	epr_attribute23,
97 	epr_attribute24,
98 	epr_attribute25,
99 	epr_attribute26,
100 	epr_attribute27,
101 	epr_attribute28,
102 	epr_attribute29,
103 	epr_attribute30,
104 	object_version_number,
105 	request_id,
106 	program_application_id,
107 	program_id,
108 	program_update_date
109   )
110   Values
111   (	p_rec.enrt_prem_id,
112 	p_rec.val,
113 	p_rec.uom,
114 	p_rec.elig_per_elctbl_chc_id,
115 	p_rec.enrt_bnft_id,
116 	p_rec.actl_prem_id,
117 	p_rec.business_group_id,
118 	p_rec.epr_attribute_category,
119 	p_rec.epr_attribute1,
120 	p_rec.epr_attribute2,
121 	p_rec.epr_attribute3,
122 	p_rec.epr_attribute4,
123 	p_rec.epr_attribute5,
124 	p_rec.epr_attribute6,
125 	p_rec.epr_attribute7,
126 	p_rec.epr_attribute8,
127 	p_rec.epr_attribute9,
128 	p_rec.epr_attribute10,
129 	p_rec.epr_attribute11,
130 	p_rec.epr_attribute12,
131 	p_rec.epr_attribute13,
132 	p_rec.epr_attribute14,
133 	p_rec.epr_attribute15,
134 	p_rec.epr_attribute16,
135 	p_rec.epr_attribute17,
136 	p_rec.epr_attribute18,
137 	p_rec.epr_attribute19,
138 	p_rec.epr_attribute20,
139 	p_rec.epr_attribute21,
140 	p_rec.epr_attribute22,
141 	p_rec.epr_attribute23,
142 	p_rec.epr_attribute24,
143 	p_rec.epr_attribute25,
144 	p_rec.epr_attribute26,
145 	p_rec.epr_attribute27,
146 	p_rec.epr_attribute28,
147 	p_rec.epr_attribute29,
148 	p_rec.epr_attribute30,
149 	p_rec.object_version_number,
150 	p_rec.request_id,
151 	p_rec.program_application_id,
152 	p_rec.program_id,
153 	p_rec.program_update_date
154   );
155   --
156   ben_epr_shd.g_api_dml := false;   -- Unset the api dml status
157   --
158   hr_utility.set_location(' Leaving:'||l_proc, 10);
159 Exception
160   When hr_api.check_integrity_violated Then
161     -- A check constraint has been violated
162     ben_epr_shd.g_api_dml := false;   -- Unset the api dml status
163     ben_epr_shd.constraint_error
164       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
165   When hr_api.parent_integrity_violated Then
166     -- Parent integrity has been violated
167     ben_epr_shd.g_api_dml := false;   -- Unset the api dml status
168     ben_epr_shd.constraint_error
169       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
170   When hr_api.unique_integrity_violated Then
171     -- Unique integrity has been violated
172     ben_epr_shd.g_api_dml := false;   -- Unset the api dml status
173     ben_epr_shd.constraint_error
174       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
175   When Others Then
176     ben_epr_shd.g_api_dml := false;   -- Unset the api dml status
177     Raise;
178 End insert_dml;
179 --
180 -- ----------------------------------------------------------------------------
181 -- |------------------------------< pre_insert >------------------------------|
182 -- ----------------------------------------------------------------------------
183 -- {Start Of Comments}
184 --
185 -- Description:
186 --   This private procedure contains any processing which is required before
187 --   the insert dml. Presently, if the entity has a corresponding primary
188 --   key which is maintained by an associating sequence, the primary key for
189 --   the entity will be populated with the next sequence value in
190 --   preparation for the insert dml.
191 --
192 -- Prerequisites:
193 --   This is an internal procedure which is called from the ins procedure.
194 --
195 -- In Parameters:
196 --   A Pl/Sql record structre.
197 --
198 -- Post Success:
199 --   Processing continues.
200 --
201 -- Post Failure:
202 --   If an error has occurred, an error message and exception will be raised
203 --   but not handled.
204 --
205 -- Developer Implementation Notes:
206 --   Any pre-processing required before the insert dml is issued should be
207 --   coded within this procedure. As stated above, a good example is the
208 --   generation of a primary key number via a corresponding sequence.
209 --   It is important to note that any 3rd party maintenance should be reviewed
210 --   before placing in this procedure.
211 --
212 -- Access Status:
213 --   Internal Row Handler Use Only.
214 --
215 -- {End Of Comments}
216 -- ----------------------------------------------------------------------------
217 Procedure pre_insert(p_rec  in out nocopy ben_epr_shd.g_rec_type) is
218 --
219   l_proc  varchar2(72) := g_package||'pre_insert';
220 --
221   Cursor C_Sel1 is select ben_enrt_prem_s.nextval from sys.dual;
222 --
223 Begin
224   hr_utility.set_location('Entering:'||l_proc, 5);
225   --
226   --
227   -- Select the next sequence number
228   --
229   Open C_Sel1;
230   Fetch C_Sel1 Into p_rec.enrt_prem_id;
231   Close C_Sel1;
232   --
233   hr_utility.set_location(' Leaving:'||l_proc, 10);
234 End pre_insert;
235 --
236 -- ----------------------------------------------------------------------------
237 -- |-----------------------------< post_insert >------------------------------|
238 -- ----------------------------------------------------------------------------
239 -- {Start Of Comments}
240 --
241 -- Description:
242 --   This private procedure contains any processing which is required after the
243 --   insert dml.
244 --
245 -- Prerequisites:
246 --   This is an internal procedure which is called from the ins procedure.
247 --
248 -- In Parameters:
249 --   A Pl/Sql record structre.
250 --
251 -- Post Success:
252 --   Processing continues.
253 --
254 -- Post Failure:
255 --   If an error has occurred, an error message and exception will be raised
256 --   but not handled.
257 --
258 -- Developer Implementation Notes:
259 --   Any post-processing required after the insert dml is issued should be
260 --   coded within this procedure. It is important to note that any 3rd party
261 --   maintenance should be reviewed before placing in this procedure.
262 --
263 -- Access Status:
264 --   Internal Row Handler Use Only.
265 --
266 -- {End Of Comments}
267 -- ----------------------------------------------------------------------------
268 Procedure post_insert(p_rec in ben_epr_shd.g_rec_type) is
269 --
270   l_proc  varchar2(72) := g_package||'post_insert';
271 --
272 Begin
273   hr_utility.set_location('Entering:'||l_proc, 5);
274 --
275   --
276   -- Start of API User Hook for post_insert.
277   --
278   begin
279     --
280     ben_epr_rki.after_insert
281       (
282   p_enrt_prem_id                  =>p_rec.enrt_prem_id
283  ,p_val                           =>p_rec.val
284  ,p_uom                           =>p_rec.uom
285  ,p_elig_per_elctbl_chc_id        =>p_rec.elig_per_elctbl_chc_id
286  ,p_enrt_bnft_id                  =>p_rec.enrt_bnft_id
287  ,p_actl_prem_id                  =>p_rec.actl_prem_id
288  ,p_business_group_id             =>p_rec.business_group_id
289  ,p_epr_attribute_category        =>p_rec.epr_attribute_category
290  ,p_epr_attribute1                =>p_rec.epr_attribute1
291  ,p_epr_attribute2                =>p_rec.epr_attribute2
292  ,p_epr_attribute3                =>p_rec.epr_attribute3
293  ,p_epr_attribute4                =>p_rec.epr_attribute4
294  ,p_epr_attribute5                =>p_rec.epr_attribute5
295  ,p_epr_attribute6                =>p_rec.epr_attribute6
296  ,p_epr_attribute7                =>p_rec.epr_attribute7
297  ,p_epr_attribute8                =>p_rec.epr_attribute8
298  ,p_epr_attribute9                =>p_rec.epr_attribute9
299  ,p_epr_attribute10               =>p_rec.epr_attribute10
300  ,p_epr_attribute11               =>p_rec.epr_attribute11
301  ,p_epr_attribute12               =>p_rec.epr_attribute12
302  ,p_epr_attribute13               =>p_rec.epr_attribute13
303  ,p_epr_attribute14               =>p_rec.epr_attribute14
304  ,p_epr_attribute15               =>p_rec.epr_attribute15
305  ,p_epr_attribute16               =>p_rec.epr_attribute16
306  ,p_epr_attribute17               =>p_rec.epr_attribute17
307  ,p_epr_attribute18               =>p_rec.epr_attribute18
308  ,p_epr_attribute19               =>p_rec.epr_attribute19
309  ,p_epr_attribute20               =>p_rec.epr_attribute20
310  ,p_epr_attribute21               =>p_rec.epr_attribute21
311  ,p_epr_attribute22               =>p_rec.epr_attribute22
312  ,p_epr_attribute23               =>p_rec.epr_attribute23
313  ,p_epr_attribute24               =>p_rec.epr_attribute24
314  ,p_epr_attribute25               =>p_rec.epr_attribute25
315  ,p_epr_attribute26               =>p_rec.epr_attribute26
316  ,p_epr_attribute27               =>p_rec.epr_attribute27
317  ,p_epr_attribute28               =>p_rec.epr_attribute28
318  ,p_epr_attribute29               =>p_rec.epr_attribute29
319  ,p_epr_attribute30               =>p_rec.epr_attribute30
320  ,p_object_version_number         =>p_rec.object_version_number
321  ,p_request_id                    =>p_rec.request_id
322  ,p_program_application_id        =>p_rec.program_application_id
323  ,p_program_id                    =>p_rec.program_id
324  ,p_program_update_date           =>p_rec.program_update_date
325       );
326     --
327   exception
328     --
329     when hr_api.cannot_find_prog_unit then
330       --
331       hr_api.cannot_find_prog_unit_error
332         (p_module_name => 'ben_enrt_prem'
333         ,p_hook_type   => 'AI');
334       --
335   end;
336   --
337   -- End of API User Hook for post_insert.
338   --
339   --
340   hr_utility.set_location(' Leaving:'||l_proc, 10);
341 End post_insert;
342 --
343 -- ----------------------------------------------------------------------------
344 -- |---------------------------------< ins >----------------------------------|
345 -- ----------------------------------------------------------------------------
346 Procedure ins
347   (
348   p_rec        in out nocopy ben_epr_shd.g_rec_type
349   ) is
350 --
351   l_proc  varchar2(72) := g_package||'ins';
352 --
353 Begin
354   hr_utility.set_location('Entering:'||l_proc, 5);
355   --
356   -- Call the supporting insert validate operations
357   --
358   ben_epr_bus.insert_validate(p_rec);
359   --
360   -- Call the supporting pre-insert operation
361   --
362   pre_insert(p_rec);
363   --
364   -- Insert the row
365   --
366   insert_dml(p_rec);
367   --
368   -- Call the supporting post-insert operation
369   --
370   post_insert(p_rec);
371 end ins;
372 --
373 -- ----------------------------------------------------------------------------
374 -- |---------------------------------< ins >----------------------------------|
375 -- ----------------------------------------------------------------------------
376 Procedure ins
377   (
378   p_enrt_prem_id                 out nocopy number,
379   p_val                          in number           default null,
380   p_uom                          in varchar2         default null,
381   p_elig_per_elctbl_chc_id       in number           default null,
382   p_enrt_bnft_id                 in number           default null,
383   p_actl_prem_id                 in number,
384   p_business_group_id            in number,
385   p_epr_attribute_category       in varchar2         default null,
386   p_epr_attribute1               in varchar2         default null,
387   p_epr_attribute2               in varchar2         default null,
388   p_epr_attribute3               in varchar2         default null,
389   p_epr_attribute4               in varchar2         default null,
390   p_epr_attribute5               in varchar2         default null,
391   p_epr_attribute6               in varchar2         default null,
392   p_epr_attribute7               in varchar2         default null,
393   p_epr_attribute8               in varchar2         default null,
394   p_epr_attribute9               in varchar2         default null,
395   p_epr_attribute10              in varchar2         default null,
396   p_epr_attribute11              in varchar2         default null,
397   p_epr_attribute12              in varchar2         default null,
398   p_epr_attribute13              in varchar2         default null,
399   p_epr_attribute14              in varchar2         default null,
400   p_epr_attribute15              in varchar2         default null,
401   p_epr_attribute16              in varchar2         default null,
402   p_epr_attribute17              in varchar2         default null,
403   p_epr_attribute18              in varchar2         default null,
404   p_epr_attribute19              in varchar2         default null,
405   p_epr_attribute20              in varchar2         default null,
406   p_epr_attribute21              in varchar2         default null,
407   p_epr_attribute22              in varchar2         default null,
408   p_epr_attribute23              in varchar2         default null,
409   p_epr_attribute24              in varchar2         default null,
410   p_epr_attribute25              in varchar2         default null,
411   p_epr_attribute26              in varchar2         default null,
412   p_epr_attribute27              in varchar2         default null,
413   p_epr_attribute28              in varchar2         default null,
414   p_epr_attribute29              in varchar2         default null,
415   p_epr_attribute30              in varchar2         default null,
416   p_object_version_number        out nocopy number,
417   p_request_id                   in number           default null,
418   p_program_application_id       in number           default null,
419   p_program_id                   in number           default null,
420   p_program_update_date          in date             default null
421   ) is
422 --
423   l_rec	  ben_epr_shd.g_rec_type;
424   l_proc  varchar2(72) := g_package||'ins';
425 --
426 Begin
427   hr_utility.set_location('Entering:'||l_proc, 5);
428   --
429   -- Call conversion function to turn arguments into the
430   -- p_rec structure.
431   --
432   l_rec :=
433   ben_epr_shd.convert_args
434   (
435   null,
436   p_val,
437   p_uom,
438   p_elig_per_elctbl_chc_id,
439   p_enrt_bnft_id,
440   p_actl_prem_id,
441   p_business_group_id,
442   p_epr_attribute_category,
443   p_epr_attribute1,
444   p_epr_attribute2,
445   p_epr_attribute3,
446   p_epr_attribute4,
447   p_epr_attribute5,
448   p_epr_attribute6,
449   p_epr_attribute7,
450   p_epr_attribute8,
451   p_epr_attribute9,
452   p_epr_attribute10,
453   p_epr_attribute11,
454   p_epr_attribute12,
455   p_epr_attribute13,
456   p_epr_attribute14,
457   p_epr_attribute15,
458   p_epr_attribute16,
459   p_epr_attribute17,
460   p_epr_attribute18,
461   p_epr_attribute19,
462   p_epr_attribute20,
463   p_epr_attribute21,
464   p_epr_attribute22,
465   p_epr_attribute23,
466   p_epr_attribute24,
467   p_epr_attribute25,
468   p_epr_attribute26,
469   p_epr_attribute27,
470   p_epr_attribute28,
471   p_epr_attribute29,
472   p_epr_attribute30,
473   null,
474   p_request_id,
475   p_program_application_id,
476   p_program_id,
477   p_program_update_date
478   );
479   --
480   -- Having converted the arguments into the ben_epr_rec
481   -- plsql record structure we call the corresponding record business process.
482   --
483   ins(l_rec);
484   --
485   -- As the primary key argument(s)
486   -- are specified as an OUT's we must set these values.
487   --
488   p_enrt_prem_id := l_rec.enrt_prem_id;
489   p_object_version_number := l_rec.object_version_number;
490   --
491   hr_utility.set_location(' Leaving:'||l_proc, 10);
492 End ins;
493 --
494 end ben_epr_ins;