DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CMT_INS

Source


1 Package Body ben_cmt_ins as
2 /* $Header: becmtrhi.pkb 115.14 2002/12/31 23:57:48 mmudigon ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_cmt_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_cmt_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_cmt_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ben_cm_dlvry_mthd_typ
64   --
65   insert into ben_cm_dlvry_mthd_typ
66   (	cm_dlvry_mthd_typ_id,
67 	cm_dlvry_mthd_typ_cd,
68 	business_group_id,
69 	cm_typ_id,
70 	cmt_attribute1,
71 	cmt_attribute10,
72 	cmt_attribute11,
73 	cmt_attribute12,
74 	cmt_attribute13,
75 	cmt_attribute14,
76 	cmt_attribute15,
77 	cmt_attribute16,
78 	cmt_attribute17,
79 	cmt_attribute18,
80 	cmt_attribute19,
81 	cmt_attribute2,
82 	cmt_attribute20,
83 	cmt_attribute21,
84 	cmt_attribute22,
85 	cmt_attribute23,
86 	cmt_attribute24,
87 	cmt_attribute25,
88 	cmt_attribute26,
89 	cmt_attribute27,
90 	cmt_attribute28,
91 	cmt_attribute29,
92 	cmt_attribute3,
93 	cmt_attribute30,
94 	rqd_flag,
95 	cmt_attribute_category,
96 	cmt_attribute4,
97 	cmt_attribute5,
98 	cmt_attribute6,
99 	cmt_attribute7,
100 	cmt_attribute8,
101 	cmt_attribute9,
102 	dflt_flag,
103 	object_version_number
104   )
105   Values
106   (	p_rec.cm_dlvry_mthd_typ_id,
107 	p_rec.cm_dlvry_mthd_typ_cd,
108 	p_rec.business_group_id,
109 	p_rec.cm_typ_id,
110 	p_rec.cmt_attribute1,
111 	p_rec.cmt_attribute10,
112 	p_rec.cmt_attribute11,
113 	p_rec.cmt_attribute12,
114 	p_rec.cmt_attribute13,
115 	p_rec.cmt_attribute14,
116 	p_rec.cmt_attribute15,
117 	p_rec.cmt_attribute16,
118 	p_rec.cmt_attribute17,
119 	p_rec.cmt_attribute18,
120 	p_rec.cmt_attribute19,
121 	p_rec.cmt_attribute2,
122 	p_rec.cmt_attribute20,
123 	p_rec.cmt_attribute21,
124 	p_rec.cmt_attribute22,
125 	p_rec.cmt_attribute23,
126 	p_rec.cmt_attribute24,
127 	p_rec.cmt_attribute25,
128 	p_rec.cmt_attribute26,
129 	p_rec.cmt_attribute27,
130 	p_rec.cmt_attribute28,
131 	p_rec.cmt_attribute29,
132 	p_rec.cmt_attribute3,
133 	p_rec.cmt_attribute30,
134 	p_rec.rqd_flag,
135 	p_rec.cmt_attribute_category,
136 	p_rec.cmt_attribute4,
137 	p_rec.cmt_attribute5,
138 	p_rec.cmt_attribute6,
139 	p_rec.cmt_attribute7,
140 	p_rec.cmt_attribute8,
141 	p_rec.cmt_attribute9,
142 	p_rec.dflt_flag,
143 	p_rec.object_version_number
144   );
145   --
146   ben_cmt_shd.g_api_dml := false;   -- Unset the api dml status
147   --
148   hr_utility.set_location(' Leaving:'||l_proc, 10);
149 Exception
150   When hr_api.check_integrity_violated Then
151     -- A check constraint has been violated
152     ben_cmt_shd.g_api_dml := false;   -- Unset the api dml status
153     ben_cmt_shd.constraint_error
154       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
155   When hr_api.parent_integrity_violated Then
156     -- Parent integrity has been violated
157     ben_cmt_shd.g_api_dml := false;   -- Unset the api dml status
158     ben_cmt_shd.constraint_error
159       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
160   When hr_api.unique_integrity_violated Then
161     -- Unique integrity has been violated
162     ben_cmt_shd.g_api_dml := false;   -- Unset the api dml status
163     ben_cmt_shd.constraint_error
164       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
165   When Others Then
166     ben_cmt_shd.g_api_dml := false;   -- Unset the api dml status
167     Raise;
168 End insert_dml;
169 --
170 -- ----------------------------------------------------------------------------
171 -- |------------------------------< pre_insert >------------------------------|
172 -- ----------------------------------------------------------------------------
173 -- {Start Of Comments}
174 --
175 -- Description:
176 --   This private procedure contains any processing which is required before
177 --   the insert dml. Presently, if the entity has a corresponding primary
178 --   key which is maintained by an associating sequence, the primary key for
179 --   the entity will be populated with the next sequence value in
180 --   preparation for the insert dml.
181 --
182 -- Prerequisites:
183 --   This is an internal procedure which is called from the ins procedure.
184 --
185 -- In Parameters:
186 --   A Pl/Sql record structre.
187 --
188 -- Post Success:
189 --   Processing continues.
190 --
191 -- Post Failure:
192 --   If an error has occurred, an error message and exception will be raised
193 --   but not handled.
194 --
195 -- Developer Implementation Notes:
196 --   Any pre-processing required before the insert dml is issued should be
197 --   coded within this procedure. As stated above, a good example is the
198 --   generation of a primary key number via a corresponding sequence.
199 --   It is important to note that any 3rd party maintenance should be reviewed
200 --   before placing in this procedure.
201 --
202 -- Access Status:
203 --   Internal Row Handler Use Only.
204 --
205 -- {End Of Comments}
206 -- ----------------------------------------------------------------------------
207 Procedure pre_insert(p_rec  in out nocopy ben_cmt_shd.g_rec_type) is
208 --
209   l_proc  varchar2(72) := g_package||'pre_insert';
210 --
211   Cursor C_Sel1 is select ben_cm_dlvry_mthd_typ_s.nextval from sys.dual;
212 --
213 Begin
214   hr_utility.set_location('Entering:'||l_proc, 5);
215   --
216   --
217   -- Select the next sequence number
218   --
219   Open C_Sel1;
220   Fetch C_Sel1 Into p_rec.cm_dlvry_mthd_typ_id;
221   Close C_Sel1;
222   --
223   hr_utility.set_location(' Leaving:'||l_proc, 10);
224 End pre_insert;
225 --
226 -- ----------------------------------------------------------------------------
227 -- |-----------------------------< post_insert >------------------------------|
228 -- ----------------------------------------------------------------------------
229 -- {Start Of Comments}
230 --
231 -- Description:
232 --   This private procedure contains any processing which is required after the
233 --   insert dml.
234 --
235 -- Prerequisites:
236 --   This is an internal procedure which is called from the ins procedure.
237 --
238 -- In Parameters:
239 --   A Pl/Sql record structre.
240 --
241 -- Post Success:
242 --   Processing continues.
243 --
244 -- Post Failure:
245 --   If an error has occurred, an error message and exception will be raised
246 --   but not handled.
247 --
248 -- Developer Implementation Notes:
249 --   Any post-processing required after the insert dml is issued should be
250 --   coded within this procedure. It is important to note that any 3rd party
251 --   maintenance should be reviewed before placing in this procedure.
252 --
253 -- Access Status:
254 --   Internal Row Handler Use Only.
255 --
256 -- {End Of Comments}
257 -- ----------------------------------------------------------------------------
258 Procedure post_insert(
259 p_effective_date in date,p_rec in ben_cmt_shd.g_rec_type) is
260 --
261   l_proc  varchar2(72) := g_package||'post_insert';
262 --
263 Begin
264   hr_utility.set_location('Entering:'||l_proc, 5);
265 --
266   --
267   -- Start of API User Hook for post_insert.
268   --
269   begin
270     --
271     ben_cmt_rki.after_insert
272       (
273   p_cm_dlvry_mthd_typ_id          =>p_rec.cm_dlvry_mthd_typ_id
274  ,p_cm_dlvry_mthd_typ_cd          =>p_rec.cm_dlvry_mthd_typ_cd
275  ,p_business_group_id             =>p_rec.business_group_id
276  ,p_cm_typ_id                     =>p_rec.cm_typ_id
277  ,p_cmt_attribute1                =>p_rec.cmt_attribute1
278  ,p_cmt_attribute10               =>p_rec.cmt_attribute10
279  ,p_cmt_attribute11               =>p_rec.cmt_attribute11
280  ,p_cmt_attribute12               =>p_rec.cmt_attribute12
281  ,p_cmt_attribute13               =>p_rec.cmt_attribute13
282  ,p_cmt_attribute14               =>p_rec.cmt_attribute14
283  ,p_cmt_attribute15               =>p_rec.cmt_attribute15
284  ,p_cmt_attribute16               =>p_rec.cmt_attribute16
285  ,p_cmt_attribute17               =>p_rec.cmt_attribute17
286  ,p_cmt_attribute18               =>p_rec.cmt_attribute18
287  ,p_cmt_attribute19               =>p_rec.cmt_attribute19
288  ,p_cmt_attribute2                =>p_rec.cmt_attribute2
289  ,p_cmt_attribute20               =>p_rec.cmt_attribute20
290  ,p_cmt_attribute21               =>p_rec.cmt_attribute21
291  ,p_cmt_attribute22               =>p_rec.cmt_attribute22
292  ,p_cmt_attribute23               =>p_rec.cmt_attribute23
293  ,p_cmt_attribute24               =>p_rec.cmt_attribute24
294  ,p_cmt_attribute25               =>p_rec.cmt_attribute25
295  ,p_cmt_attribute26               =>p_rec.cmt_attribute26
296  ,p_cmt_attribute27               =>p_rec.cmt_attribute27
297  ,p_cmt_attribute28               =>p_rec.cmt_attribute28
298  ,p_cmt_attribute29               =>p_rec.cmt_attribute29
299  ,p_cmt_attribute3                =>p_rec.cmt_attribute3
300  ,p_cmt_attribute30               =>p_rec.cmt_attribute30
301  ,p_rqd_flag                      =>p_rec.rqd_flag
302  ,p_cmt_attribute_category        =>p_rec.cmt_attribute_category
303  ,p_cmt_attribute4                =>p_rec.cmt_attribute4
304  ,p_cmt_attribute5                =>p_rec.cmt_attribute5
305  ,p_cmt_attribute6                =>p_rec.cmt_attribute6
306  ,p_cmt_attribute7                =>p_rec.cmt_attribute7
307  ,p_cmt_attribute8                =>p_rec.cmt_attribute8
308  ,p_cmt_attribute9                =>p_rec.cmt_attribute9
309  ,p_dflt_flag                     =>p_rec.dflt_flag
310  ,p_object_version_number         =>p_rec.object_version_number
311  ,p_effective_date                =>p_effective_date
312       );
313     --
314   exception
315     --
316     when hr_api.cannot_find_prog_unit then
317       --
318       hr_api.cannot_find_prog_unit_error
319         (p_module_name => 'ben_cm_dlvry_mthd_typ'
320         ,p_hook_type   => 'AI');
321       --
322   end;
323   --
324   -- End of API User Hook for post_insert.
325   --
326   --
327   hr_utility.set_location(' Leaving:'||l_proc, 10);
328 End post_insert;
329 --
330 -- ----------------------------------------------------------------------------
331 -- |---------------------------------< ins >----------------------------------|
332 -- ----------------------------------------------------------------------------
333 Procedure ins
334   (
335   p_effective_date in date,
336   p_rec        in out nocopy ben_cmt_shd.g_rec_type
337   ) is
338 --
339   l_proc  varchar2(72) := g_package||'ins';
340 --
341 Begin
342   hr_utility.set_location('Entering:'||l_proc, 5);
343   --
344   -- Call the supporting insert validate operations
345   --
346   ben_cmt_bus.insert_validate(p_rec
347   ,p_effective_date);
348   --
349   -- Call the supporting pre-insert operation
350   --
351   pre_insert(p_rec);
352   --
353   -- Insert the row
354   --
355   insert_dml(p_rec);
356   --
357   -- Call the supporting post-insert operation
358   --
359   post_insert(
360 p_effective_date,p_rec);
361 end ins;
362 --
363 -- ----------------------------------------------------------------------------
364 -- |---------------------------------< ins >----------------------------------|
365 -- ----------------------------------------------------------------------------
366 Procedure ins
367   (
368   p_effective_date in date,
369   p_cm_dlvry_mthd_typ_id         out nocopy number,
370   p_cm_dlvry_mthd_typ_cd         in varchar2,
371   p_business_group_id            in number,
372   p_cm_typ_id                    in number           default null,
373   p_cmt_attribute1               in varchar2         default null,
374   p_cmt_attribute10              in varchar2         default null,
375   p_cmt_attribute11              in varchar2         default null,
376   p_cmt_attribute12              in varchar2         default null,
377   p_cmt_attribute13              in varchar2         default null,
378   p_cmt_attribute14              in varchar2         default null,
379   p_cmt_attribute15              in varchar2         default null,
380   p_cmt_attribute16              in varchar2         default null,
381   p_cmt_attribute17              in varchar2         default null,
382   p_cmt_attribute18              in varchar2         default null,
383   p_cmt_attribute19              in varchar2         default null,
384   p_cmt_attribute2               in varchar2         default null,
385   p_cmt_attribute20              in varchar2         default null,
386   p_cmt_attribute21              in varchar2         default null,
387   p_cmt_attribute22              in varchar2         default null,
388   p_cmt_attribute23              in varchar2         default null,
389   p_cmt_attribute24              in varchar2         default null,
390   p_cmt_attribute25              in varchar2         default null,
391   p_cmt_attribute26              in varchar2         default null,
392   p_cmt_attribute27              in varchar2         default null,
393   p_cmt_attribute28              in varchar2         default null,
394   p_cmt_attribute29              in varchar2         default null,
395   p_cmt_attribute3               in varchar2         default null,
396   p_cmt_attribute30              in varchar2         default null,
397   p_rqd_flag                     in varchar2,
398   p_cmt_attribute_category       in varchar2         default null,
399   p_cmt_attribute4               in varchar2         default null,
400   p_cmt_attribute5               in varchar2         default null,
401   p_cmt_attribute6               in varchar2         default null,
402   p_cmt_attribute7               in varchar2         default null,
403   p_cmt_attribute8               in varchar2         default null,
404   p_cmt_attribute9               in varchar2         default null,
405   p_dflt_flag                    in varchar2,
406   p_object_version_number        out nocopy number
407   ) is
408 --
409   l_rec	  ben_cmt_shd.g_rec_type;
410   l_proc  varchar2(72) := g_package||'ins';
411 --
412 Begin
413   hr_utility.set_location('Entering:'||l_proc, 5);
414   --
415   -- Call conversion function to turn arguments into the
416   -- p_rec structure.
417   --
418   l_rec :=
419   ben_cmt_shd.convert_args
420   (
421   null,
422   p_cm_dlvry_mthd_typ_cd,
423   p_business_group_id,
424   p_cm_typ_id,
425   p_cmt_attribute1,
426   p_cmt_attribute10,
427   p_cmt_attribute11,
428   p_cmt_attribute12,
429   p_cmt_attribute13,
430   p_cmt_attribute14,
431   p_cmt_attribute15,
432   p_cmt_attribute16,
433   p_cmt_attribute17,
434   p_cmt_attribute18,
435   p_cmt_attribute19,
436   p_cmt_attribute2,
437   p_cmt_attribute20,
438   p_cmt_attribute21,
439   p_cmt_attribute22,
440   p_cmt_attribute23,
441   p_cmt_attribute24,
442   p_cmt_attribute25,
443   p_cmt_attribute26,
444   p_cmt_attribute27,
445   p_cmt_attribute28,
446   p_cmt_attribute29,
447   p_cmt_attribute3,
448   p_cmt_attribute30,
449   p_rqd_flag,
450   p_cmt_attribute_category,
451   p_cmt_attribute4,
452   p_cmt_attribute5,
453   p_cmt_attribute6,
454   p_cmt_attribute7,
455   p_cmt_attribute8,
456   p_cmt_attribute9,
457   p_dflt_flag,
458   null
459   );
460   --
461   -- Having converted the arguments into the ben_cmt_rec
462   -- plsql record structure we call the corresponding record business process.
463   --
464   ins(
465     p_effective_date,l_rec);
466   --
467   -- As the primary key argument(s)
468   -- are specified as an OUT's we must set these values.
469   --
470   p_cm_dlvry_mthd_typ_id := l_rec.cm_dlvry_mthd_typ_id;
471   p_object_version_number := l_rec.object_version_number;
472   --
473   hr_utility.set_location(' Leaving:'||l_proc, 10);
474 End ins;
475 --
476 end ben_cmt_ins;