DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_DRR_INS

Source


1 Package Body ben_drr_ins as
2 /* $Header: bedrrrhi.pkb 120.0 2005/05/28 01:40:22 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_drr_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_drr_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_drr_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ben_dsgn_rqmt_rlshp_typ
64   --
65   insert into ben_dsgn_rqmt_rlshp_typ
66   (	dsgn_rqmt_rlshp_typ_id,
67 	rlshp_typ_cd,
68 	dsgn_rqmt_id,
69 	business_group_id,
70 	drr_attribute_category,
71 	drr_attribute1,
72 	drr_attribute2,
73 	drr_attribute3,
74 	drr_attribute4,
75 	drr_attribute5,
76 	drr_attribute6,
77 	drr_attribute7,
78 	drr_attribute8,
79 	drr_attribute9,
80 	drr_attribute10,
81 	drr_attribute11,
82 	drr_attribute12,
83 	drr_attribute13,
84 	drr_attribute14,
85 	drr_attribute15,
86 	drr_attribute16,
87 	drr_attribute17,
88 	drr_attribute18,
89 	drr_attribute19,
90 	drr_attribute20,
91 	drr_attribute21,
92 	drr_attribute22,
93 	drr_attribute23,
94 	drr_attribute24,
95 	drr_attribute25,
96 	drr_attribute26,
97 	drr_attribute27,
98 	drr_attribute28,
99 	drr_attribute29,
100 	drr_attribute30,
101 	object_version_number
102   )
103   Values
107 	p_rec.business_group_id,
104   (	p_rec.dsgn_rqmt_rlshp_typ_id,
105 	p_rec.rlshp_typ_cd,
106 	p_rec.dsgn_rqmt_id,
108 	p_rec.drr_attribute_category,
109 	p_rec.drr_attribute1,
110 	p_rec.drr_attribute2,
111 	p_rec.drr_attribute3,
112 	p_rec.drr_attribute4,
113 	p_rec.drr_attribute5,
114 	p_rec.drr_attribute6,
115 	p_rec.drr_attribute7,
116 	p_rec.drr_attribute8,
117 	p_rec.drr_attribute9,
118 	p_rec.drr_attribute10,
119 	p_rec.drr_attribute11,
120 	p_rec.drr_attribute12,
121 	p_rec.drr_attribute13,
122 	p_rec.drr_attribute14,
123 	p_rec.drr_attribute15,
124 	p_rec.drr_attribute16,
125 	p_rec.drr_attribute17,
126 	p_rec.drr_attribute18,
127 	p_rec.drr_attribute19,
128 	p_rec.drr_attribute20,
129 	p_rec.drr_attribute21,
130 	p_rec.drr_attribute22,
131 	p_rec.drr_attribute23,
132 	p_rec.drr_attribute24,
133 	p_rec.drr_attribute25,
134 	p_rec.drr_attribute26,
135 	p_rec.drr_attribute27,
136 	p_rec.drr_attribute28,
137 	p_rec.drr_attribute29,
138 	p_rec.drr_attribute30,
139 	p_rec.object_version_number
140   );
141   --
142   ben_drr_shd.g_api_dml := false;   -- Unset the api dml status
143   --
144   hr_utility.set_location(' Leaving:'||l_proc, 10);
145 Exception
146   When hr_api.check_integrity_violated Then
147     -- A check constraint has been violated
148     ben_drr_shd.g_api_dml := false;   -- Unset the api dml status
149     ben_drr_shd.constraint_error
150       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
151   When hr_api.parent_integrity_violated Then
152     -- Parent integrity has been violated
153     ben_drr_shd.g_api_dml := false;   -- Unset the api dml status
154     ben_drr_shd.constraint_error
155       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
156   When hr_api.unique_integrity_violated Then
157     -- Unique integrity has been violated
158     ben_drr_shd.g_api_dml := false;   -- Unset the api dml status
159     ben_drr_shd.constraint_error
160       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
161   When Others Then
162     ben_drr_shd.g_api_dml := false;   -- Unset the api dml status
163     Raise;
164 End insert_dml;
165 --
166 -- ----------------------------------------------------------------------------
167 -- |------------------------------< pre_insert >------------------------------|
168 -- ----------------------------------------------------------------------------
169 -- {Start Of Comments}
170 --
171 -- Description:
172 --   This private procedure contains any processing which is required before
173 --   the insert dml. Presently, if the entity has a corresponding primary
174 --   key which is maintained by an associating sequence, the primary key for
175 --   the entity will be populated with the next sequence value in
176 --   preparation for the insert dml.
177 --
178 -- Prerequisites:
179 --   This is an internal procedure which is called from the ins procedure.
180 --
181 -- In Parameters:
182 --   A Pl/Sql record structre.
183 --
184 -- Post Success:
185 --   Processing continues.
186 --
187 -- Post Failure:
188 --   If an error has occurred, an error message and exception will be raised
189 --   but not handled.
190 --
191 -- Developer Implementation Notes:
192 --   Any pre-processing required before the insert dml is issued should be
193 --   coded within this procedure. As stated above, a good example is the
194 --   generation of a primary key number via a corresponding sequence.
195 --   It is important to note that any 3rd party maintenance should be reviewed
196 --   before placing in this procedure.
197 --
198 -- Access Status:
199 --   Internal Row Handler Use Only.
200 --
201 -- {End Of Comments}
202 -- ----------------------------------------------------------------------------
203 Procedure pre_insert(p_rec  in out nocopy ben_drr_shd.g_rec_type) is
204 --
205   l_proc  varchar2(72) := g_package||'pre_insert';
206 --
207   Cursor C_Sel1 is select ben_dsgn_rqmt_rlshp_typ_s.nextval from sys.dual;
208 --
209 Begin
210   hr_utility.set_location('Entering:'||l_proc, 5);
211   --
212   --
213   -- Select the next sequence number
214   --
215   Open C_Sel1;
216   Fetch C_Sel1 Into p_rec.dsgn_rqmt_rlshp_typ_id;
217   Close C_Sel1;
218   --
219   hr_utility.set_location(' Leaving:'||l_proc, 10);
220 End pre_insert;
221 --
222 -- ----------------------------------------------------------------------------
223 -- |-----------------------------< post_insert >------------------------------|
224 -- ----------------------------------------------------------------------------
225 -- {Start Of Comments}
226 --
227 -- Description:
228 --   This private procedure contains any processing which is required after the
229 --   insert dml.
230 --
231 -- Prerequisites:
232 --   This is an internal procedure which is called from the ins procedure.
233 --
234 -- In Parameters:
235 --   A Pl/Sql record structre.
236 --
237 -- Post Success:
238 --   Processing continues.
239 --
240 -- Post Failure:
241 --   If an error has occurred, an error message and exception will be raised
242 --   but not handled.
243 --
244 -- Developer Implementation Notes:
245 --   Any post-processing required after the insert dml is issued should be
246 --   coded within this procedure. It is important to note that any 3rd party
247 --   maintenance should be reviewed before placing in this procedure.
248 --
249 -- Access Status:
250 --   Internal Row Handler Use Only.
251 --
252 -- {End Of Comments}
253 -- ----------------------------------------------------------------------------
254 Procedure post_insert(
258 --
255 p_effective_date in date,p_rec in ben_drr_shd.g_rec_type) is
256 --
257   l_proc  varchar2(72) := g_package||'post_insert';
259 Begin
260   hr_utility.set_location('Entering:'||l_proc, 5);
261 --
262   --
263   -- Start of API User Hook for post_insert.
264   --
265   begin
266     --
267     ben_drr_rki.after_insert
268       (
269   p_dsgn_rqmt_rlshp_typ_id        =>p_rec.dsgn_rqmt_rlshp_typ_id
270  ,p_rlshp_typ_cd                  =>p_rec.rlshp_typ_cd
271  ,p_dsgn_rqmt_id                  =>p_rec.dsgn_rqmt_id
272  ,p_business_group_id             =>p_rec.business_group_id
273  ,p_drr_attribute_category        =>p_rec.drr_attribute_category
274  ,p_drr_attribute1                =>p_rec.drr_attribute1
275  ,p_drr_attribute2                =>p_rec.drr_attribute2
276  ,p_drr_attribute3                =>p_rec.drr_attribute3
277  ,p_drr_attribute4                =>p_rec.drr_attribute4
278  ,p_drr_attribute5                =>p_rec.drr_attribute5
279  ,p_drr_attribute6                =>p_rec.drr_attribute6
280  ,p_drr_attribute7                =>p_rec.drr_attribute7
281  ,p_drr_attribute8                =>p_rec.drr_attribute8
282  ,p_drr_attribute9                =>p_rec.drr_attribute9
283  ,p_drr_attribute10               =>p_rec.drr_attribute10
284  ,p_drr_attribute11               =>p_rec.drr_attribute11
285  ,p_drr_attribute12               =>p_rec.drr_attribute12
286  ,p_drr_attribute13               =>p_rec.drr_attribute13
287  ,p_drr_attribute14               =>p_rec.drr_attribute14
288  ,p_drr_attribute15               =>p_rec.drr_attribute15
289  ,p_drr_attribute16               =>p_rec.drr_attribute16
290  ,p_drr_attribute17               =>p_rec.drr_attribute17
291  ,p_drr_attribute18               =>p_rec.drr_attribute18
292  ,p_drr_attribute19               =>p_rec.drr_attribute19
293  ,p_drr_attribute20               =>p_rec.drr_attribute20
294  ,p_drr_attribute21               =>p_rec.drr_attribute21
295  ,p_drr_attribute22               =>p_rec.drr_attribute22
296  ,p_drr_attribute23               =>p_rec.drr_attribute23
297  ,p_drr_attribute24               =>p_rec.drr_attribute24
298  ,p_drr_attribute25               =>p_rec.drr_attribute25
299  ,p_drr_attribute26               =>p_rec.drr_attribute26
300  ,p_drr_attribute27               =>p_rec.drr_attribute27
301  ,p_drr_attribute28               =>p_rec.drr_attribute28
302  ,p_drr_attribute29               =>p_rec.drr_attribute29
303  ,p_drr_attribute30               =>p_rec.drr_attribute30
304  ,p_object_version_number         =>p_rec.object_version_number
305  ,p_effective_date                =>p_effective_date
306       );
307     --
308   exception
309     --
310     when hr_api.cannot_find_prog_unit then
311       --
312       hr_api.cannot_find_prog_unit_error
313         (p_module_name => 'ben_dsgn_rqmt_rlshp_typ'
314         ,p_hook_type   => 'AI');
315       --
316   end;
317   --
318   -- End of API User Hook for post_insert.
319   --
320   --
321   hr_utility.set_location(' Leaving:'||l_proc, 10);
322 End post_insert;
323 --
324 -- ----------------------------------------------------------------------------
325 -- |---------------------------------< ins >----------------------------------|
326 -- ----------------------------------------------------------------------------
327 Procedure ins
328   (
329   p_effective_date in date,
330   p_rec        in out nocopy ben_drr_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_drr_bus.insert_validate(p_rec
341   ,p_effective_date);
342   --
343   -- Call the supporting pre-insert operation
344   --
345   pre_insert(p_rec);
346   --
347   -- Insert the row
348   --
349   insert_dml(p_rec);
350   --
351   -- Call the supporting post-insert operation
352   --
353   post_insert(
354 p_effective_date,p_rec);
355 end ins;
356 --
357 -- ----------------------------------------------------------------------------
358 -- |---------------------------------< ins >----------------------------------|
359 -- ----------------------------------------------------------------------------
360 Procedure ins
361   (
362   p_effective_date in date,
363   p_dsgn_rqmt_rlshp_typ_id       out nocopy number,
364   p_rlshp_typ_cd                 in varchar2         default null,
365   p_dsgn_rqmt_id                 in number           default null,
366   p_business_group_id            in number,
367   p_drr_attribute_category       in varchar2         default null,
368   p_drr_attribute1               in varchar2         default null,
369   p_drr_attribute2               in varchar2         default null,
370   p_drr_attribute3               in varchar2         default null,
371   p_drr_attribute4               in varchar2         default null,
372   p_drr_attribute5               in varchar2         default null,
373   p_drr_attribute6               in varchar2         default null,
374   p_drr_attribute7               in varchar2         default null,
375   p_drr_attribute8               in varchar2         default null,
376   p_drr_attribute9               in varchar2         default null,
377   p_drr_attribute10              in varchar2         default null,
378   p_drr_attribute11              in varchar2         default null,
379   p_drr_attribute12              in varchar2         default null,
380   p_drr_attribute13              in varchar2         default null,
381   p_drr_attribute14              in varchar2         default null,
385   p_drr_attribute18              in varchar2         default null,
382   p_drr_attribute15              in varchar2         default null,
383   p_drr_attribute16              in varchar2         default null,
384   p_drr_attribute17              in varchar2         default null,
386   p_drr_attribute19              in varchar2         default null,
387   p_drr_attribute20              in varchar2         default null,
388   p_drr_attribute21              in varchar2         default null,
389   p_drr_attribute22              in varchar2         default null,
390   p_drr_attribute23              in varchar2         default null,
391   p_drr_attribute24              in varchar2         default null,
392   p_drr_attribute25              in varchar2         default null,
393   p_drr_attribute26              in varchar2         default null,
394   p_drr_attribute27              in varchar2         default null,
395   p_drr_attribute28              in varchar2         default null,
396   p_drr_attribute29              in varchar2         default null,
397   p_drr_attribute30              in varchar2         default null,
398   p_object_version_number        out nocopy number
399   ) is
400 --
401   l_rec	  ben_drr_shd.g_rec_type;
402   l_proc  varchar2(72) := g_package||'ins';
403 --
404 Begin
405   hr_utility.set_location('Entering:'||l_proc, 5);
406   --
407   -- Call conversion function to turn arguments into the
408   -- p_rec structure.
409   --
410   l_rec :=
411   ben_drr_shd.convert_args
412   (
413   null,
414   p_rlshp_typ_cd,
415   p_dsgn_rqmt_id,
416   p_business_group_id,
417   p_drr_attribute_category,
418   p_drr_attribute1,
419   p_drr_attribute2,
420   p_drr_attribute3,
421   p_drr_attribute4,
422   p_drr_attribute5,
423   p_drr_attribute6,
424   p_drr_attribute7,
425   p_drr_attribute8,
426   p_drr_attribute9,
427   p_drr_attribute10,
428   p_drr_attribute11,
429   p_drr_attribute12,
430   p_drr_attribute13,
431   p_drr_attribute14,
432   p_drr_attribute15,
433   p_drr_attribute16,
434   p_drr_attribute17,
435   p_drr_attribute18,
436   p_drr_attribute19,
437   p_drr_attribute20,
438   p_drr_attribute21,
439   p_drr_attribute22,
440   p_drr_attribute23,
441   p_drr_attribute24,
442   p_drr_attribute25,
443   p_drr_attribute26,
444   p_drr_attribute27,
445   p_drr_attribute28,
446   p_drr_attribute29,
447   p_drr_attribute30,
448   null
449   );
450   --
451   -- Having converted the arguments into the ben_drr_rec
452   -- plsql record structure we call the corresponding record business process.
453   --
454   ins(
455     p_effective_date,l_rec);
456   --
457   -- As the primary key argument(s)
458   -- are specified as an OUT's we must set these values.
459   --
460   p_dsgn_rqmt_rlshp_typ_id := l_rec.dsgn_rqmt_rlshp_typ_id;
461   p_object_version_number := l_rec.object_version_number;
462   --
463   hr_utility.set_location(' Leaving:'||l_proc, 10);
464 End ins;
465 --
466 end ben_drr_ins;