DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_RVC_INS

Source


1 Package Body ben_rvc_ins as
2 /* $Header: bervcrhi.pkb 115.2 2002/12/11 11:18:06 hnarayan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_rvc_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_rvc_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_rvc_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ben_prtt_rt_val_ctfn_prvdd
64   --
65   insert into ben_prtt_rt_val_ctfn_prvdd
66   (	prtt_rt_val_ctfn_prvdd_id,
67 	enrt_ctfn_typ_cd,
68         enrt_ctfn_rqd_flag ,
69         enrt_ctfn_recd_dt ,
70         enrt_ctfn_dnd_dt ,
71 	prtt_rt_val_id,
72 	business_group_id,
73 	rvc_attribute_category,
74 	rvc_attribute1,
75 	rvc_attribute2,
76 	rvc_attribute3,
77 	rvc_attribute4,
78 	rvc_attribute5,
79 	rvc_attribute6,
80 	rvc_attribute7,
81 	rvc_attribute8,
82 	rvc_attribute9,
83 	rvc_attribute10,
84 	rvc_attribute11,
85 	rvc_attribute12,
86 	rvc_attribute13,
87 	rvc_attribute14,
88 	rvc_attribute15,
89 	rvc_attribute16,
90 	rvc_attribute17,
91 	rvc_attribute18,
92 	rvc_attribute19,
93 	rvc_attribute20,
94 	rvc_attribute21,
95 	rvc_attribute22,
96 	rvc_attribute23,
97 	rvc_attribute24,
98 	rvc_attribute25,
99 	rvc_attribute26,
100 	rvc_attribute27,
101 	rvc_attribute28,
102 	rvc_attribute29,
103 	rvc_attribute30,
104 	request_id,
105 	program_application_id,
106 	program_id,
107 	program_update_date,
108 	object_version_number
109   )
110   Values
111   (	p_rec.prtt_rt_val_ctfn_prvdd_id,
112 	p_rec.enrt_ctfn_typ_cd,
113         p_rec.enrt_ctfn_rqd_flag,
114         p_rec.enrt_ctfn_recd_dt,
115         p_rec.enrt_ctfn_dnd_dt,
116 	p_rec.prtt_rt_val_id,
117 	p_rec.business_group_id,
118 	p_rec.rvc_attribute_category,
119 	p_rec.rvc_attribute1,
120 	p_rec.rvc_attribute2,
121 	p_rec.rvc_attribute3,
122 	p_rec.rvc_attribute4,
123 	p_rec.rvc_attribute5,
124 	p_rec.rvc_attribute6,
125 	p_rec.rvc_attribute7,
126 	p_rec.rvc_attribute8,
127 	p_rec.rvc_attribute9,
128 	p_rec.rvc_attribute10,
129 	p_rec.rvc_attribute11,
130 	p_rec.rvc_attribute12,
131 	p_rec.rvc_attribute13,
132 	p_rec.rvc_attribute14,
133 	p_rec.rvc_attribute15,
134 	p_rec.rvc_attribute16,
135 	p_rec.rvc_attribute17,
136 	p_rec.rvc_attribute18,
137 	p_rec.rvc_attribute19,
138 	p_rec.rvc_attribute20,
139 	p_rec.rvc_attribute21,
140 	p_rec.rvc_attribute22,
141 	p_rec.rvc_attribute23,
142 	p_rec.rvc_attribute24,
143 	p_rec.rvc_attribute25,
144 	p_rec.rvc_attribute26,
145 	p_rec.rvc_attribute27,
146 	p_rec.rvc_attribute28,
147 	p_rec.rvc_attribute29,
148 	p_rec.rvc_attribute30,
149 	p_rec.request_id,
150 	p_rec.program_application_id,
151 	p_rec.program_id,
152 	p_rec.program_update_date,
153 	p_rec.object_version_number
154   );
155   --
156   ben_rvc_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_rvc_shd.g_api_dml := false;   -- Unset the api dml status
163     ben_rvc_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_rvc_shd.g_api_dml := false;   -- Unset the api dml status
168     ben_rvc_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_rvc_shd.g_api_dml := false;   -- Unset the api dml status
173     ben_rvc_shd.constraint_error
174       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
175   When Others Then
176     ben_rvc_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_rvc_shd.g_rec_type) is
218 --
219   l_proc  varchar2(72) := g_package||'pre_insert';
220 --
221   Cursor C_Sel1 is select ben_prtt_rt_val_ctfn_prvdd_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.prtt_rt_val_ctfn_prvdd_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(
269 p_effective_date in date,p_rec in ben_rvc_shd.g_rec_type) is
270 --
271   l_proc  varchar2(72) := g_package||'post_insert';
272 --
273 Begin
274   hr_utility.set_location('Entering:'||l_proc, 5);
275 --
276   --
277   -- Start of API User Hook for post_insert.
278   --
279   begin
280     --
281     ben_rvc_rki.after_insert
282       (
283   p_prtt_rt_val_ctfn_prvdd_id     =>p_rec.prtt_rt_val_ctfn_prvdd_id
284  ,p_enrt_ctfn_typ_cd              =>p_rec.enrt_ctfn_typ_cd
285  ,p_enrt_ctfn_rqd_flag            =>p_rec.enrt_ctfn_rqd_flag
286  ,p_enrt_ctfn_recd_dt             =>p_rec.enrt_ctfn_recd_dt
287  ,p_enrt_ctfn_dnd_dt              =>p_rec.enrt_ctfn_dnd_dt
288  ,p_prtt_rt_val_id                =>p_rec.prtt_rt_val_id
289  ,p_business_group_id             =>p_rec.business_group_id
290  ,p_rvc_attribute_category        =>p_rec.rvc_attribute_category
291  ,p_rvc_attribute1                =>p_rec.rvc_attribute1
292  ,p_rvc_attribute2                =>p_rec.rvc_attribute2
293  ,p_rvc_attribute3                =>p_rec.rvc_attribute3
294  ,p_rvc_attribute4                =>p_rec.rvc_attribute4
295  ,p_rvc_attribute5                =>p_rec.rvc_attribute5
296  ,p_rvc_attribute6                =>p_rec.rvc_attribute6
297  ,p_rvc_attribute7                =>p_rec.rvc_attribute7
298  ,p_rvc_attribute8                =>p_rec.rvc_attribute8
299  ,p_rvc_attribute9                =>p_rec.rvc_attribute9
300  ,p_rvc_attribute10               =>p_rec.rvc_attribute10
301  ,p_rvc_attribute11               =>p_rec.rvc_attribute11
302  ,p_rvc_attribute12               =>p_rec.rvc_attribute12
303  ,p_rvc_attribute13               =>p_rec.rvc_attribute13
304  ,p_rvc_attribute14               =>p_rec.rvc_attribute14
305  ,p_rvc_attribute15               =>p_rec.rvc_attribute15
306  ,p_rvc_attribute16               =>p_rec.rvc_attribute16
307  ,p_rvc_attribute17               =>p_rec.rvc_attribute17
308  ,p_rvc_attribute18               =>p_rec.rvc_attribute18
309  ,p_rvc_attribute19               =>p_rec.rvc_attribute19
310  ,p_rvc_attribute20               =>p_rec.rvc_attribute20
311  ,p_rvc_attribute21               =>p_rec.rvc_attribute21
312  ,p_rvc_attribute22               =>p_rec.rvc_attribute22
313  ,p_rvc_attribute23               =>p_rec.rvc_attribute23
314  ,p_rvc_attribute24               =>p_rec.rvc_attribute24
315  ,p_rvc_attribute25               =>p_rec.rvc_attribute25
316  ,p_rvc_attribute26               =>p_rec.rvc_attribute26
317  ,p_rvc_attribute27               =>p_rec.rvc_attribute27
318  ,p_rvc_attribute28               =>p_rec.rvc_attribute28
319  ,p_rvc_attribute29               =>p_rec.rvc_attribute29
320  ,p_rvc_attribute30               =>p_rec.rvc_attribute30
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  ,p_object_version_number         =>p_rec.object_version_number
326  ,p_effective_date                =>p_effective_date
327       );
328     --
329   exception
330     --
331     when hr_api.cannot_find_prog_unit then
332       --
333       hr_api.cannot_find_prog_unit_error
334         (p_module_name => 'ben_prv_ctfn_prvdd'
335         ,p_hook_type   => 'AI');
336       --
337   end;
338   --
339   -- End of API User Hook for post_insert.
340   --
341   --
342   hr_utility.set_location(' Leaving:'||l_proc, 10);
343 End post_insert;
344 --
345 -- ----------------------------------------------------------------------------
346 -- |---------------------------------< ins >----------------------------------|
347 -- ----------------------------------------------------------------------------
348 Procedure ins
349   (
350   p_effective_date in date,
351   p_rec        in out nocopy ben_rvc_shd.g_rec_type
352   ) is
353 --
354   l_proc  varchar2(72) := g_package||'ins';
355 --
356 Begin
357   hr_utility.set_location('Entering:'||l_proc, 5);
358   --
359   -- Call the supporting insert validate operations
360   --
361   ben_rvc_bus.insert_validate(p_rec
362   ,p_effective_date);
363   --
364   -- Call the supporting pre-insert operation
365   --
366   pre_insert(p_rec);
367   --
368   -- Insert the row
369   --
370   insert_dml(p_rec);
371   --
372   -- Call the supporting post-insert operation
373   --
374   post_insert(
375 p_effective_date,p_rec);
376 end ins;
377 --
378 -- ----------------------------------------------------------------------------
379 -- |---------------------------------< ins >----------------------------------|
380 -- ----------------------------------------------------------------------------
381 Procedure ins
382   (
383   p_effective_date in date,
384   p_prtt_rt_val_ctfn_prvdd_id   out nocopy number,
385   p_enrt_ctfn_typ_cd             in varchar2,
386   p_enrt_ctfn_rqd_flag           in varchar2,
387   p_enrt_ctfn_recd_dt            in date             default null,
388   p_enrt_ctfn_dnd_dt             in date             default null,
389   p_prtt_rt_val_id               in number           default null,
390   p_business_group_id            in number,
391   p_rvc_attribute_category       in varchar2         default null,
392   p_rvc_attribute1               in varchar2         default null,
393   p_rvc_attribute2               in varchar2         default null,
394   p_rvc_attribute3               in varchar2         default null,
395   p_rvc_attribute4               in varchar2         default null,
396   p_rvc_attribute5               in varchar2         default null,
397   p_rvc_attribute6               in varchar2         default null,
398   p_rvc_attribute7               in varchar2         default null,
399   p_rvc_attribute8               in varchar2         default null,
400   p_rvc_attribute9               in varchar2         default null,
401   p_rvc_attribute10              in varchar2         default null,
402   p_rvc_attribute11              in varchar2         default null,
403   p_rvc_attribute12              in varchar2         default null,
404   p_rvc_attribute13              in varchar2         default null,
405   p_rvc_attribute14              in varchar2         default null,
406   p_rvc_attribute15              in varchar2         default null,
407   p_rvc_attribute16              in varchar2         default null,
408   p_rvc_attribute17              in varchar2         default null,
409   p_rvc_attribute18              in varchar2         default null,
410   p_rvc_attribute19              in varchar2         default null,
411   p_rvc_attribute20              in varchar2         default null,
412   p_rvc_attribute21              in varchar2         default null,
413   p_rvc_attribute22              in varchar2         default null,
414   p_rvc_attribute23              in varchar2         default null,
415   p_rvc_attribute24              in varchar2         default null,
416   p_rvc_attribute25              in varchar2         default null,
417   p_rvc_attribute26              in varchar2         default null,
418   p_rvc_attribute27              in varchar2         default null,
419   p_rvc_attribute28              in varchar2         default null,
420   p_rvc_attribute29              in varchar2         default null,
421   p_rvc_attribute30              in varchar2         default null,
422   p_request_id                   in number           default null,
423   p_program_application_id       in number           default null,
424   p_program_id                   in number           default null,
425   p_program_update_date          in date             default null,
426   p_object_version_number        out nocopy number
427   ) is
428 --
429   l_rec	  ben_rvc_shd.g_rec_type;
430   l_proc  varchar2(72) := g_package||'ins';
431 --
432 Begin
433   hr_utility.set_location('Entering:'||l_proc, 5);
434   --
435   -- Call conversion function to turn arguments into the
436   -- p_rec structure.
437   --
438   l_rec :=
439   ben_rvc_shd.convert_args
440   (
441   null,
442   p_enrt_ctfn_typ_cd,
443   p_enrt_ctfn_rqd_flag,
444   p_enrt_ctfn_recd_dt,
445   p_enrt_ctfn_dnd_dt,
446   p_prtt_rt_val_id,
447   p_business_group_id,
448   p_rvc_attribute_category,
449   p_rvc_attribute1,
450   p_rvc_attribute2,
451   p_rvc_attribute3,
452   p_rvc_attribute4,
453   p_rvc_attribute5,
454   p_rvc_attribute6,
455   p_rvc_attribute7,
456   p_rvc_attribute8,
457   p_rvc_attribute9,
458   p_rvc_attribute10,
459   p_rvc_attribute11,
460   p_rvc_attribute12,
461   p_rvc_attribute13,
462   p_rvc_attribute14,
463   p_rvc_attribute15,
464   p_rvc_attribute16,
465   p_rvc_attribute17,
466   p_rvc_attribute18,
467   p_rvc_attribute19,
468   p_rvc_attribute20,
469   p_rvc_attribute21,
470   p_rvc_attribute22,
471   p_rvc_attribute23,
472   p_rvc_attribute24,
473   p_rvc_attribute25,
474   p_rvc_attribute26,
475   p_rvc_attribute27,
476   p_rvc_attribute28,
477   p_rvc_attribute29,
478   p_rvc_attribute30,
479   p_request_id,
480   p_program_application_id,
481   p_program_id,
482   p_program_update_date,
483   null
484   );
485   --
486   -- Having converted the arguments into the ben_rvc_rec
487   -- plsql record structure we call the corresponding record business process.
488   --
489   ins(
490     p_effective_date,l_rec);
491   --
492   -- As the primary key argument(s)
493   -- are specified as an OUT's we must set these values.
494   --
495   p_prtt_rt_val_ctfn_prvdd_id := l_rec.prtt_rt_val_ctfn_prvdd_id;
496   p_object_version_number := l_rec.object_version_number;
497   --
498   hr_utility.set_location(' Leaving:'||l_proc, 10);
499 End ins;
500 --
501 end ben_rvc_ins;