DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PCG_INS

Source


1 Package Body ben_pcg_ins as
2 /* $Header: bepcgrhi.pkb 115.8 2002/12/16 11:58:08 vsethi ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_pcg_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_pcg_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_pcg_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ben_prtt_clm_gd_or_svc_typ
64   --
65   insert into ben_prtt_clm_gd_or_svc_typ
66   (	prtt_clm_gd_or_svc_typ_id,
67 	prtt_reimbmt_rqst_id,
68 	gd_or_svc_typ_id,
69 	business_group_id,
70 	pcg_attribute_category,
71 	pcg_attribute1,
72 	pcg_attribute2,
73 	pcg_attribute3,
74 	pcg_attribute4,
75 	pcg_attribute5,
76 	pcg_attribute6,
77 	pcg_attribute7,
78 	pcg_attribute8,
79 	pcg_attribute9,
80 	pcg_attribute10,
81 	pcg_attribute11,
82 	pcg_attribute12,
83 	pcg_attribute13,
84 	pcg_attribute14,
85 	pcg_attribute15,
86 	pcg_attribute16,
87 	pcg_attribute17,
88 	pcg_attribute18,
89 	pcg_attribute19,
90 	pcg_attribute20,
91 	pcg_attribute21,
92 	pcg_attribute22,
93 	pcg_attribute23,
94 	pcg_attribute24,
95 	pcg_attribute25,
96 	pcg_attribute26,
97 	pcg_attribute27,
98 	pcg_attribute28,
99 	pcg_attribute29,
100 	pcg_attribute30,
101 	object_version_number,
102         pl_gd_or_svc_id
103   )
104   Values
105   (	p_rec.prtt_clm_gd_or_svc_typ_id,
106 	p_rec.prtt_reimbmt_rqst_id,
107 	p_rec.gd_or_svc_typ_id,
108 	p_rec.business_group_id,
109 	p_rec.pcg_attribute_category,
110 	p_rec.pcg_attribute1,
111 	p_rec.pcg_attribute2,
112 	p_rec.pcg_attribute3,
113 	p_rec.pcg_attribute4,
114 	p_rec.pcg_attribute5,
115 	p_rec.pcg_attribute6,
116 	p_rec.pcg_attribute7,
117 	p_rec.pcg_attribute8,
118 	p_rec.pcg_attribute9,
119 	p_rec.pcg_attribute10,
120 	p_rec.pcg_attribute11,
121 	p_rec.pcg_attribute12,
122 	p_rec.pcg_attribute13,
123 	p_rec.pcg_attribute14,
124 	p_rec.pcg_attribute15,
125 	p_rec.pcg_attribute16,
126 	p_rec.pcg_attribute17,
127 	p_rec.pcg_attribute18,
128 	p_rec.pcg_attribute19,
129 	p_rec.pcg_attribute20,
130 	p_rec.pcg_attribute21,
131 	p_rec.pcg_attribute22,
132 	p_rec.pcg_attribute23,
133 	p_rec.pcg_attribute24,
134 	p_rec.pcg_attribute25,
135 	p_rec.pcg_attribute26,
136 	p_rec.pcg_attribute27,
137 	p_rec.pcg_attribute28,
138 	p_rec.pcg_attribute29,
139 	p_rec.pcg_attribute30,
140 	p_rec.object_version_number ,
141         p_rec.pl_gd_or_svc_id
142   );
143   --
144   ben_pcg_shd.g_api_dml := false;   -- Unset the api dml status
145   --
146   hr_utility.set_location(' Leaving:'||l_proc, 10);
147 Exception
148   When hr_api.check_integrity_violated Then
149     -- A check constraint has been violated
150     ben_pcg_shd.g_api_dml := false;   -- Unset the api dml status
151     ben_pcg_shd.constraint_error
152       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
153   When hr_api.parent_integrity_violated Then
154     -- Parent integrity has been violated
155     ben_pcg_shd.g_api_dml := false;   -- Unset the api dml status
156     ben_pcg_shd.constraint_error
157       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
158   When hr_api.unique_integrity_violated Then
159     -- Unique integrity has been violated
160     ben_pcg_shd.g_api_dml := false;   -- Unset the api dml status
161     ben_pcg_shd.constraint_error
162       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
163   When Others Then
164     ben_pcg_shd.g_api_dml := false;   -- Unset the api dml status
165     Raise;
166 End insert_dml;
167 --
168 -- ----------------------------------------------------------------------------
169 -- |------------------------------< pre_insert >------------------------------|
170 -- ----------------------------------------------------------------------------
171 -- {Start Of Comments}
172 --
173 -- Description:
174 --   This private procedure contains any processing which is required before
175 --   the insert dml. Presently, if the entity has a corresponding primary
176 --   key which is maintained by an associating sequence, the primary key for
177 --   the entity will be populated with the next sequence value in
178 --   preparation for the insert dml.
179 --
180 -- Prerequisites:
181 --   This is an internal procedure which is called from the ins procedure.
182 --
183 -- In Parameters:
184 --   A Pl/Sql record structre.
185 --
186 -- Post Success:
187 --   Processing continues.
188 --
189 -- Post Failure:
190 --   If an error has occurred, an error message and exception will be raised
191 --   but not handled.
192 --
193 -- Developer Implementation Notes:
194 --   Any pre-processing required before the insert dml is issued should be
195 --   coded within this procedure. As stated above, a good example is the
196 --   generation of a primary key number via a corresponding sequence.
197 --   It is important to note that any 3rd party maintenance should be reviewed
198 --   before placing in this procedure.
199 --
200 -- Access Status:
201 --   Internal Row Handler Use Only.
202 --
203 -- {End Of Comments}
204 -- ----------------------------------------------------------------------------
205 Procedure pre_insert(p_rec  in out nocopy ben_pcg_shd.g_rec_type) is
206 --
207   l_proc  varchar2(72) := g_package||'pre_insert';
208 --
209   Cursor C_Sel1 is select ben_prtt_clm_gd_or_svc_typ_s.nextval from sys.dual;
210 --
211 Begin
212   hr_utility.set_location('Entering:'||l_proc, 5);
213   --
214   --
215   -- Select the next sequence number
216   --
217   Open C_Sel1;
218   Fetch C_Sel1 Into p_rec.prtt_clm_gd_or_svc_typ_id;
219   Close C_Sel1;
220   --
221   hr_utility.set_location(' Leaving:'||l_proc, 10);
222 End pre_insert;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |-----------------------------< post_insert >------------------------------|
226 -- ----------------------------------------------------------------------------
227 -- {Start Of Comments}
228 --
229 -- Description:
230 --   This private procedure contains any processing which is required after the
231 --   insert dml.
232 --
233 -- Prerequisites:
234 --   This is an internal procedure which is called from the ins procedure.
235 --
236 -- In Parameters:
237 --   A Pl/Sql record structre.
238 --
239 -- Post Success:
240 --   Processing continues.
241 --
242 -- Post Failure:
243 --   If an error has occurred, an error message and exception will be raised
244 --   but not handled.
245 --
246 -- Developer Implementation Notes:
247 --   Any post-processing required after the insert dml is issued should be
248 --   coded within this procedure. It is important to note that any 3rd party
249 --   maintenance should be reviewed before placing in this procedure.
250 --
251 -- Access Status:
252 --   Internal Row Handler Use Only.
253 --
254 -- {End Of Comments}
255 -- ----------------------------------------------------------------------------
256 Procedure post_insert(p_rec in ben_pcg_shd.g_rec_type) is
257 --
258   l_proc  varchar2(72) := g_package||'post_insert';
259 --
260 Begin
261   hr_utility.set_location('Entering:'||l_proc, 5);
262 --
263   --
264   -- Start of API User Hook for post_insert.
265   --
266   begin
267     --
268     ben_pcg_rki.after_insert
269       (
270   p_prtt_clm_gd_or_svc_typ_id     =>p_rec.prtt_clm_gd_or_svc_typ_id
271  ,p_prtt_reimbmt_rqst_id          =>p_rec.prtt_reimbmt_rqst_id
272  ,p_gd_or_svc_typ_id              =>p_rec.gd_or_svc_typ_id
273  ,p_business_group_id             =>p_rec.business_group_id
274  ,p_pcg_attribute_category        =>p_rec.pcg_attribute_category
275  ,p_pcg_attribute1                =>p_rec.pcg_attribute1
276  ,p_pcg_attribute2                =>p_rec.pcg_attribute2
277  ,p_pcg_attribute3                =>p_rec.pcg_attribute3
278  ,p_pcg_attribute4                =>p_rec.pcg_attribute4
279  ,p_pcg_attribute5                =>p_rec.pcg_attribute5
280  ,p_pcg_attribute6                =>p_rec.pcg_attribute6
281  ,p_pcg_attribute7                =>p_rec.pcg_attribute7
282  ,p_pcg_attribute8                =>p_rec.pcg_attribute8
283  ,p_pcg_attribute9                =>p_rec.pcg_attribute9
284  ,p_pcg_attribute10               =>p_rec.pcg_attribute10
285  ,p_pcg_attribute11               =>p_rec.pcg_attribute11
286  ,p_pcg_attribute12               =>p_rec.pcg_attribute12
287  ,p_pcg_attribute13               =>p_rec.pcg_attribute13
288  ,p_pcg_attribute14               =>p_rec.pcg_attribute14
289  ,p_pcg_attribute15               =>p_rec.pcg_attribute15
290  ,p_pcg_attribute16               =>p_rec.pcg_attribute16
291  ,p_pcg_attribute17               =>p_rec.pcg_attribute17
292  ,p_pcg_attribute18               =>p_rec.pcg_attribute18
293  ,p_pcg_attribute19               =>p_rec.pcg_attribute19
294  ,p_pcg_attribute20               =>p_rec.pcg_attribute20
295  ,p_pcg_attribute21               =>p_rec.pcg_attribute21
296  ,p_pcg_attribute22               =>p_rec.pcg_attribute22
297  ,p_pcg_attribute23               =>p_rec.pcg_attribute23
298  ,p_pcg_attribute24               =>p_rec.pcg_attribute24
299  ,p_pcg_attribute25               =>p_rec.pcg_attribute25
300  ,p_pcg_attribute26               =>p_rec.pcg_attribute26
301  ,p_pcg_attribute27               =>p_rec.pcg_attribute27
302  ,p_pcg_attribute28               =>p_rec.pcg_attribute28
303  ,p_pcg_attribute29               =>p_rec.pcg_attribute29
304  ,p_pcg_attribute30               =>p_rec.pcg_attribute30
305  ,p_object_version_number         =>p_rec.object_version_number
306  ,p_pl_gd_or_svc_id               =>p_rec.pl_gd_or_svc_id
307       );
308     --
309   exception
310     --
311     when hr_api.cannot_find_prog_unit then
312       --
313       hr_api.cannot_find_prog_unit_error
314         (p_module_name => 'ben_prtt_clm_gd_or_svc_typ'
315         ,p_hook_type   => 'AI');
316       --
317   end;
318   --
319   -- End of API User Hook for post_insert.
320   --
321   --
322   hr_utility.set_location(' Leaving:'||l_proc, 10);
323 End post_insert;
324 --
325 -- ----------------------------------------------------------------------------
326 -- |---------------------------------< ins >----------------------------------|
327 -- ----------------------------------------------------------------------------
328 Procedure ins
329   (
330   p_rec        in out nocopy ben_pcg_shd.g_rec_type
331   ) is
332 --
333   l_proc  varchar2(72) := g_package||'ins';
334 --
335 Begin
336   hr_utility.set_location('Entering:'||l_proc, 5);
337   --
338   -- Call the supporting insert validate operations
339   --
340   ben_pcg_bus.insert_validate(p_rec);
341   --
342   -- Call the supporting pre-insert operation
343   --
344   pre_insert(p_rec);
345   --
346   -- Insert the row
347   --
348   insert_dml(p_rec);
349   --
350   -- Call the supporting post-insert operation
351   --
352   post_insert(p_rec);
353 end ins;
354 --
355 -- ----------------------------------------------------------------------------
356 -- |---------------------------------< ins >----------------------------------|
357 -- ----------------------------------------------------------------------------
358 Procedure ins
359   (
360   p_prtt_clm_gd_or_svc_typ_id    out nocopy number,
361   p_prtt_reimbmt_rqst_id         in number,
362   p_gd_or_svc_typ_id             in number           default null,
363   p_business_group_id            in number,
364   p_pcg_attribute_category       in varchar2         default null,
365   p_pcg_attribute1               in varchar2         default null,
366   p_pcg_attribute2               in varchar2         default null,
367   p_pcg_attribute3               in varchar2         default null,
368   p_pcg_attribute4               in varchar2         default null,
369   p_pcg_attribute5               in varchar2         default null,
370   p_pcg_attribute6               in varchar2         default null,
371   p_pcg_attribute7               in varchar2         default null,
372   p_pcg_attribute8               in varchar2         default null,
373   p_pcg_attribute9               in varchar2         default null,
374   p_pcg_attribute10              in varchar2         default null,
375   p_pcg_attribute11              in varchar2         default null,
376   p_pcg_attribute12              in varchar2         default null,
377   p_pcg_attribute13              in varchar2         default null,
378   p_pcg_attribute14              in varchar2         default null,
379   p_pcg_attribute15              in varchar2         default null,
380   p_pcg_attribute16              in varchar2         default null,
381   p_pcg_attribute17              in varchar2         default null,
382   p_pcg_attribute18              in varchar2         default null,
383   p_pcg_attribute19              in varchar2         default null,
384   p_pcg_attribute20              in varchar2         default null,
385   p_pcg_attribute21              in varchar2         default null,
386   p_pcg_attribute22              in varchar2         default null,
387   p_pcg_attribute23              in varchar2         default null,
388   p_pcg_attribute24              in varchar2         default null,
389   p_pcg_attribute25              in varchar2         default null,
390   p_pcg_attribute26              in varchar2         default null,
391   p_pcg_attribute27              in varchar2         default null,
392   p_pcg_attribute28              in varchar2         default null,
393   p_pcg_attribute29              in varchar2         default null,
394   p_pcg_attribute30              in varchar2         default null,
395   p_object_version_number        out nocopy number ,
396   p_pl_gd_or_svc_id              in number           default null
397   ) is
398 --
399   l_rec	  ben_pcg_shd.g_rec_type;
400   l_proc  varchar2(72) := g_package||'ins';
401 --
402 Begin
403   hr_utility.set_location('Entering:'||l_proc, 5);
404   --
405   -- Call conversion function to turn arguments into the
406   -- p_rec structure.
407   --
408   l_rec :=
409   ben_pcg_shd.convert_args
410   (
411   null,
412   p_prtt_reimbmt_rqst_id,
413   p_gd_or_svc_typ_id,
414   p_business_group_id,
415   p_pcg_attribute_category,
416   p_pcg_attribute1,
417   p_pcg_attribute2,
418   p_pcg_attribute3,
419   p_pcg_attribute4,
420   p_pcg_attribute5,
421   p_pcg_attribute6,
422   p_pcg_attribute7,
423   p_pcg_attribute8,
424   p_pcg_attribute9,
425   p_pcg_attribute10,
426   p_pcg_attribute11,
427   p_pcg_attribute12,
428   p_pcg_attribute13,
429   p_pcg_attribute14,
430   p_pcg_attribute15,
431   p_pcg_attribute16,
432   p_pcg_attribute17,
433   p_pcg_attribute18,
434   p_pcg_attribute19,
435   p_pcg_attribute20,
436   p_pcg_attribute21,
437   p_pcg_attribute22,
438   p_pcg_attribute23,
439   p_pcg_attribute24,
440   p_pcg_attribute25,
441   p_pcg_attribute26,
442   p_pcg_attribute27,
443   p_pcg_attribute28,
444   p_pcg_attribute29,
445   p_pcg_attribute30,
446   null ,
447   p_pl_gd_or_svc_id
448   );
449   --
450   -- Having converted the arguments into the ben_pcg_rec
451   -- plsql record structure we call the corresponding record business process.
452   --
453   ins(l_rec);
454   --
455   -- As the primary key argument(s)
456   -- are specified as an OUT's we must set these values.
457   --
458   p_prtt_clm_gd_or_svc_typ_id := l_rec.prtt_clm_gd_or_svc_typ_id;
459   p_object_version_number := l_rec.object_version_number;
460   --
461   hr_utility.set_location(' Leaving:'||l_proc, 10);
462 End ins;
463 --
464 end ben_pcg_ins;