DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_DSQ_INS

Source


1 Package Body ben_dsq_ins as
2 /* $Header: bedsqrhi.pkb 115.7 2002/12/09 12:49:41 lakrish ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_dsq_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_dsq_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_dsq_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ben_ded_sched_py_freq
64   --
65   insert into ben_ded_sched_py_freq
66   (	ded_sched_py_freq_id,
67 	py_freq_cd,
68 	dflt_flag,
69 	acty_rt_ded_sched_id,
70 	business_group_id,
71 	dsq_attribute_category,
72 	dsq_attribute1,
73 	dsq_attribute2,
74 	dsq_attribute3,
75 	dsq_attribute4,
76 	dsq_attribute5,
77 	dsq_attribute6,
78 	dsq_attribute7,
79 	dsq_attribute8,
80 	dsq_attribute9,
81 	dsq_attribute10,
82 	dsq_attribute11,
83 	dsq_attribute12,
84 	dsq_attribute13,
85 	dsq_attribute14,
86 	dsq_attribute15,
87 	dsq_attribute16,
88 	dsq_attribute17,
89 	dsq_attribute18,
90 	dsq_attribute19,
91 	dsq_attribute20,
92 	dsq_attribute21,
93 	dsq_attribute22,
94 	dsq_attribute23,
95 	dsq_attribute24,
96 	dsq_attribute25,
97 	dsq_attribute26,
98 	dsq_attribute27,
99 	dsq_attribute28,
100 	dsq_attribute29,
101 	dsq_attribute30,
102 	object_version_number
103   )
104   Values
105   (	p_rec.ded_sched_py_freq_id,
106 	p_rec.py_freq_cd,
107 	p_rec.dflt_flag,
108 	p_rec.acty_rt_ded_sched_id,
109 	p_rec.business_group_id,
110 	p_rec.dsq_attribute_category,
111 	p_rec.dsq_attribute1,
112 	p_rec.dsq_attribute2,
113 	p_rec.dsq_attribute3,
114 	p_rec.dsq_attribute4,
115 	p_rec.dsq_attribute5,
116 	p_rec.dsq_attribute6,
117 	p_rec.dsq_attribute7,
118 	p_rec.dsq_attribute8,
119 	p_rec.dsq_attribute9,
120 	p_rec.dsq_attribute10,
121 	p_rec.dsq_attribute11,
122 	p_rec.dsq_attribute12,
123 	p_rec.dsq_attribute13,
124 	p_rec.dsq_attribute14,
125 	p_rec.dsq_attribute15,
126 	p_rec.dsq_attribute16,
127 	p_rec.dsq_attribute17,
128 	p_rec.dsq_attribute18,
129 	p_rec.dsq_attribute19,
130 	p_rec.dsq_attribute20,
131 	p_rec.dsq_attribute21,
132 	p_rec.dsq_attribute22,
133 	p_rec.dsq_attribute23,
134 	p_rec.dsq_attribute24,
135 	p_rec.dsq_attribute25,
136 	p_rec.dsq_attribute26,
137 	p_rec.dsq_attribute27,
138 	p_rec.dsq_attribute28,
139 	p_rec.dsq_attribute29,
140 	p_rec.dsq_attribute30,
141 	p_rec.object_version_number
142   );
143   --
144   ben_dsq_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_dsq_shd.g_api_dml := false;   -- Unset the api dml status
151     ben_dsq_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_dsq_shd.g_api_dml := false;   -- Unset the api dml status
156     ben_dsq_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_dsq_shd.g_api_dml := false;   -- Unset the api dml status
161     ben_dsq_shd.constraint_error
162       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
163   When Others Then
164     ben_dsq_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_dsq_shd.g_rec_type) is
206 --
207   l_proc  varchar2(72) := g_package||'pre_insert';
208   cursor c1 is
209          select ben_ded_sched_py_freq_s.nextval
210          from sys.dual;
211 --
212 Begin
213   hr_utility.set_location('Entering:'||l_proc, 5);
214   --
215   open c1;
216   fetch c1 into p_rec.ded_sched_py_freq_id;
217   close c1;
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(
255 p_effective_date in date,p_rec in ben_dsq_shd.g_rec_type) is
256 --
257   l_proc  varchar2(72) := g_package||'post_insert';
258 --
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_dsq_rki.after_insert
268       (
269   p_ded_sched_py_freq_id          =>p_rec.ded_sched_py_freq_id
270  ,p_py_freq_cd                    =>p_rec.py_freq_cd
271  ,p_dflt_flag                     =>p_rec.dflt_flag
272  ,p_acty_rt_ded_sched_id          =>p_rec.acty_rt_ded_sched_id
273  ,p_business_group_id             =>p_rec.business_group_id
274  ,p_dsq_attribute_category        =>p_rec.dsq_attribute_category
275  ,p_dsq_attribute1                =>p_rec.dsq_attribute1
276  ,p_dsq_attribute2                =>p_rec.dsq_attribute2
277  ,p_dsq_attribute3                =>p_rec.dsq_attribute3
278  ,p_dsq_attribute4                =>p_rec.dsq_attribute4
279  ,p_dsq_attribute5                =>p_rec.dsq_attribute5
280  ,p_dsq_attribute6                =>p_rec.dsq_attribute6
281  ,p_dsq_attribute7                =>p_rec.dsq_attribute7
282  ,p_dsq_attribute8                =>p_rec.dsq_attribute8
283  ,p_dsq_attribute9                =>p_rec.dsq_attribute9
284  ,p_dsq_attribute10               =>p_rec.dsq_attribute10
285  ,p_dsq_attribute11               =>p_rec.dsq_attribute11
286  ,p_dsq_attribute12               =>p_rec.dsq_attribute12
287  ,p_dsq_attribute13               =>p_rec.dsq_attribute13
288  ,p_dsq_attribute14               =>p_rec.dsq_attribute14
289  ,p_dsq_attribute15               =>p_rec.dsq_attribute15
290  ,p_dsq_attribute16               =>p_rec.dsq_attribute16
291  ,p_dsq_attribute17               =>p_rec.dsq_attribute17
292  ,p_dsq_attribute18               =>p_rec.dsq_attribute18
293  ,p_dsq_attribute19               =>p_rec.dsq_attribute19
294  ,p_dsq_attribute20               =>p_rec.dsq_attribute20
295  ,p_dsq_attribute21               =>p_rec.dsq_attribute21
296  ,p_dsq_attribute22               =>p_rec.dsq_attribute22
297  ,p_dsq_attribute23               =>p_rec.dsq_attribute23
298  ,p_dsq_attribute24               =>p_rec.dsq_attribute24
299  ,p_dsq_attribute25               =>p_rec.dsq_attribute25
300  ,p_dsq_attribute26               =>p_rec.dsq_attribute26
301  ,p_dsq_attribute27               =>p_rec.dsq_attribute27
302  ,p_dsq_attribute28               =>p_rec.dsq_attribute28
303  ,p_dsq_attribute29               =>p_rec.dsq_attribute29
304  ,p_dsq_attribute30               =>p_rec.dsq_attribute30
305  ,p_object_version_number         =>p_rec.object_version_number
306  ,p_effective_date                =>p_effective_date
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_ded_sched_py_freq'
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_effective_date in date,
331   p_rec        in out nocopy ben_dsq_shd.g_rec_type
332   ) is
333 --
334   l_proc  varchar2(72) := g_package||'ins';
335 --
336 Begin
337   hr_utility.set_location('Entering:'||l_proc, 5);
338   --
339   -- Call the supporting insert validate operations
340   --
341   ben_dsq_bus.insert_validate(p_rec
342   ,p_effective_date);
343   --
344   -- Call the supporting pre-insert operation
345   --
346   pre_insert(p_rec);
347   --
348   -- Insert the row
349   --
350   insert_dml(p_rec);
351   --
352   -- Call the supporting post-insert operation
353   --
354   post_insert(
355 p_effective_date,p_rec);
356 end ins;
357 --
358 -- ----------------------------------------------------------------------------
359 -- |---------------------------------< ins >----------------------------------|
360 -- ----------------------------------------------------------------------------
361 Procedure ins
362   (
363   p_effective_date in date,
364   p_ded_sched_py_freq_id         out nocopy number,
365   p_py_freq_cd                   in varchar2,
366   p_dflt_flag                    in varchar2         default null,
367   p_acty_rt_ded_sched_id         in number,
368   p_business_group_id            in number           default null,
369   p_dsq_attribute_category       in varchar2         default null,
370   p_dsq_attribute1               in varchar2         default null,
371   p_dsq_attribute2               in varchar2         default null,
372   p_dsq_attribute3               in varchar2         default null,
373   p_dsq_attribute4               in varchar2         default null,
374   p_dsq_attribute5               in varchar2         default null,
375   p_dsq_attribute6               in varchar2         default null,
376   p_dsq_attribute7               in varchar2         default null,
377   p_dsq_attribute8               in varchar2         default null,
378   p_dsq_attribute9               in varchar2         default null,
379   p_dsq_attribute10              in varchar2         default null,
380   p_dsq_attribute11              in varchar2         default null,
381   p_dsq_attribute12              in varchar2         default null,
382   p_dsq_attribute13              in varchar2         default null,
383   p_dsq_attribute14              in varchar2         default null,
384   p_dsq_attribute15              in varchar2         default null,
385   p_dsq_attribute16              in varchar2         default null,
386   p_dsq_attribute17              in varchar2         default null,
387   p_dsq_attribute18              in varchar2         default null,
388   p_dsq_attribute19              in varchar2         default null,
389   p_dsq_attribute20              in varchar2         default null,
390   p_dsq_attribute21              in varchar2         default null,
391   p_dsq_attribute22              in varchar2         default null,
392   p_dsq_attribute23              in varchar2         default null,
393   p_dsq_attribute24              in varchar2         default null,
394   p_dsq_attribute25              in varchar2         default null,
395   p_dsq_attribute26              in varchar2         default null,
396   p_dsq_attribute27              in varchar2         default null,
397   p_dsq_attribute28              in varchar2         default null,
398   p_dsq_attribute29              in varchar2         default null,
399   p_dsq_attribute30              in varchar2         default null,
400   p_object_version_number        out nocopy number
401   ) is
402 --
403   l_rec	  ben_dsq_shd.g_rec_type;
404   l_proc  varchar2(72) := g_package||'ins';
405 --
406 Begin
407   hr_utility.set_location('Entering:'||l_proc, 5);
408   --
409   -- Call conversion function to turn arguments into the
410   -- p_rec structure.
411   --
412   l_rec :=
413   ben_dsq_shd.convert_args
414   (
415   null,
416   p_py_freq_cd,
417   p_dflt_flag,
418   p_acty_rt_ded_sched_id,
419   p_business_group_id,
420   p_dsq_attribute_category,
421   p_dsq_attribute1,
422   p_dsq_attribute2,
423   p_dsq_attribute3,
424   p_dsq_attribute4,
425   p_dsq_attribute5,
426   p_dsq_attribute6,
427   p_dsq_attribute7,
428   p_dsq_attribute8,
429   p_dsq_attribute9,
430   p_dsq_attribute10,
431   p_dsq_attribute11,
432   p_dsq_attribute12,
433   p_dsq_attribute13,
434   p_dsq_attribute14,
435   p_dsq_attribute15,
436   p_dsq_attribute16,
437   p_dsq_attribute17,
438   p_dsq_attribute18,
439   p_dsq_attribute19,
440   p_dsq_attribute20,
441   p_dsq_attribute21,
442   p_dsq_attribute22,
443   p_dsq_attribute23,
444   p_dsq_attribute24,
445   p_dsq_attribute25,
446   p_dsq_attribute26,
447   p_dsq_attribute27,
448   p_dsq_attribute28,
449   p_dsq_attribute29,
450   p_dsq_attribute30,
451   null
452   );
453   --
454   -- Having converted the arguments into the ben_dsq_rec
455   -- plsql record structure we call the corresponding record business process.
456   --
457   ins(
458     p_effective_date,l_rec);
459   --
460   -- As the primary key argument(s)
461   -- are specified as an OUT's we must set these values.
462   --
463   p_ded_sched_py_freq_id := l_rec.ded_sched_py_freq_id;
464   p_object_version_number := l_rec.object_version_number;
465   --
466   hr_utility.set_location(' Leaving:'||l_proc, 10);
467 End ins;
468 --
469 end ben_dsq_ins;