DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_EGC_INS

Source


1 Package Body hxc_egc_ins as
2 /* $Header: hxcegcrhi.pkb 120.2 2005/09/23 10:39:50 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_egc_ins.';  -- Global package name
9 g_debug    boolean	:= hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------------< insert_dml >------------------------------|
13 -- ----------------------------------------------------------------------------
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 -- ----------------------------------------------------------------------------
52 Procedure insert_dml
53   (p_rec in out nocopy hxc_egc_shd.g_rec_type
54   ) is
55 --
56   l_proc  varchar2(72);
57 --
58 Begin
59   if g_debug then
60 	l_proc := g_package||'insert_dml';
61 	hr_utility.set_location('Entering:'||l_proc, 5);
62   end if;
63   p_rec.object_version_number := 1;  -- Initialise the object version
64   --
65   hxc_egc_shd.g_api_dml := true;  -- Set the api dml status
66   --
67   -- Insert the row into: hxc_entity_group_comps
68   --
69   insert into hxc_entity_group_comps
70       (entity_group_comp_id
71       ,entity_group_id
72       ,entity_id
73       ,entity_type
74       ,attribute_category
75       ,attribute1
76       ,attribute2
77       ,attribute3
78       ,attribute4
79       ,attribute5
80       ,attribute6
81       ,attribute7
82       ,attribute8
83       ,attribute9
84       ,attribute10
85       ,attribute11
86       ,attribute12
87       ,attribute13
88       ,attribute14
89       ,attribute15
90       ,attribute16
91       ,attribute17
92       ,attribute18
93       ,attribute19
94       ,attribute20
95       ,attribute21
96       ,attribute22
97       ,attribute23
98       ,attribute24
99       ,attribute25
100       ,attribute26
101       ,attribute27
102       ,attribute28
103       ,attribute29
104       ,attribute30
105       ,object_version_number
106       ,creation_date
107 ,created_by
108 ,last_updated_by
109 ,last_update_date
110 ,last_update_login
111       )
112   Values
113     (p_rec.entity_group_comp_id
114     ,p_rec.entity_group_id
115     ,p_rec.entity_id
116     ,p_rec.entity_type
117     ,p_rec.attribute_category
118     ,p_rec.attribute1
119     ,p_rec.attribute2
120     ,p_rec.attribute3
121     ,p_rec.attribute4
122     ,p_rec.attribute5
123     ,p_rec.attribute6
124     ,p_rec.attribute7
125     ,p_rec.attribute8
126     ,p_rec.attribute9
127     ,p_rec.attribute10
128     ,p_rec.attribute11
129     ,p_rec.attribute12
130     ,p_rec.attribute13
131     ,p_rec.attribute14
132     ,p_rec.attribute15
133     ,p_rec.attribute16
134     ,p_rec.attribute17
135     ,p_rec.attribute18
136     ,p_rec.attribute19
137     ,p_rec.attribute20
138     ,p_rec.attribute21
139     ,p_rec.attribute22
140     ,p_rec.attribute23
141     ,p_rec.attribute24
142     ,p_rec.attribute25
143     ,p_rec.attribute26
144     ,p_rec.attribute27
145     ,p_rec.attribute28
146     ,p_rec.attribute29
147     ,p_rec.attribute30
148     ,p_rec.object_version_number
149      ,sysdate
150  ,fnd_global.user_id
151  ,fnd_global.user_id
152  ,sysdate
153  ,fnd_global.login_id
154     );
155   --
156   hxc_egc_shd.g_api_dml := false;   -- Unset the api dml status
157   --
158   if g_debug then
159 	hr_utility.set_location(' Leaving:'||l_proc, 10);
160   end if;
161 Exception
162   When hr_api.check_integrity_violated Then
163     -- A check constraint has been violated
164     hxc_egc_shd.g_api_dml := false;   -- Unset the api dml status
165     hxc_egc_shd.constraint_error
166       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
167   When hr_api.parent_integrity_violated Then
168     -- Parent integrity has been violated
169     hxc_egc_shd.g_api_dml := false;   -- Unset the api dml status
170     hxc_egc_shd.constraint_error
171       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
172   When hr_api.unique_integrity_violated Then
173     -- Unique integrity has been violated
174     hxc_egc_shd.g_api_dml := false;   -- Unset the api dml status
175     hxc_egc_shd.constraint_error
176       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
177   When Others Then
178     hxc_egc_shd.g_api_dml := false;   -- Unset the api dml status
179     Raise;
180 End insert_dml;
181 --
182 -- ----------------------------------------------------------------------------
183 -- |------------------------------< pre_insert >------------------------------|
184 -- ----------------------------------------------------------------------------
185 --
186 -- Description:
187 --   This private procedure contains any processing which is required before
188 --   the insert dml. Presently, if the entity has a corresponding primary
189 --   key which is maintained by an associating sequence, the primary key for
190 --   the entity will be populated with the next sequence value in
191 --   preparation for the insert dml.
192 --
193 -- Prerequisites:
197 --   A Pl/Sql record structre.
194 --   This is an internal procedure which is called from the ins procedure.
195 --
196 -- In Parameters:
198 --
199 -- Post Success:
200 --   Processing continues.
201 --
202 -- Post Failure:
203 --   If an error has occurred, an error message and exception will be raised
204 --   but not handled.
205 --
206 -- Developer Implementation Notes:
207 --   Any pre-processing required before the insert dml is issued should be
208 --   coded within this procedure. As stated above, a good example is the
209 --   generation of a primary key number via a corresponding sequence.
210 --   It is important to note that any 3rd party maintenance should be reviewed
211 --   before placing in this procedure.
212 --
213 -- Access Status:
214 --   Internal Row Handler Use Only.
215 --
216 -- ----------------------------------------------------------------------------
217 Procedure pre_insert
218   (p_rec  in out nocopy hxc_egc_shd.g_rec_type
219   ) is
220 --
221   l_proc  varchar2(72) ;
222 --
223   Cursor C_Sel1 is select hxc_entity_group_comps_s.nextval from sys.dual;
224 --
225 Begin
226   if g_debug then
227 	l_proc:= g_package||'pre_insert';
228 	hr_utility.set_location('Entering:'||l_proc, 5);
229   end if;
230   --
231   --
232   -- Select the next sequence number
233   --
234   Open C_Sel1;
235   Fetch C_Sel1 Into p_rec.entity_group_comp_id;
236   Close C_Sel1;
237   --
238   if g_debug then
239 	hr_utility.set_location(' Leaving:'||l_proc, 10);
240   end if;
241 End pre_insert;
242 --
243 -- ----------------------------------------------------------------------------
244 -- |-----------------------------< post_insert >------------------------------|
245 -- ----------------------------------------------------------------------------
246 --
247 -- Description:
248 --   This private procedure contains any processing which is required after the
249 --   insert dml.
250 --
251 -- Prerequisites:
252 --   This is an internal procedure which is called from the ins procedure.
253 --
254 -- In Parameters:
255 --   A Pl/Sql record structre.
256 --
257 -- Post Success:
258 --   Processing continues.
259 --
260 -- Post Failure:
261 --   If an error has occurred, an error message and exception will be raised
262 --   but not handled.
263 --
264 -- Developer Implementation Notes:
265 --   Any post-processing required after the insert dml is issued should be
266 --   coded within this procedure. It is important to note that any 3rd party
267 --   maintenance should be reviewed before placing in this procedure.
268 --
269 -- Access Status:
270 --   Internal Row Handler Use Only.
271 --
272 -- ----------------------------------------------------------------------------
273 Procedure post_insert
274   (p_effective_date               in date
275   ,p_rec                          in hxc_egc_shd.g_rec_type
276   ) is
277 --
278   l_proc  varchar2(72);
279 --
280 Begin
281   if g_debug then
282 	l_proc := g_package||'post_insert';
283 	hr_utility.set_location('Entering:'||l_proc, 5);
284   end if;
285   begin
286     --
287     hxc_egc_rki.after_insert
288       (p_effective_date              => p_effective_date
289       ,p_entity_group_comp_id
290       => p_rec.entity_group_comp_id
291       ,p_entity_group_id
292       => p_rec.entity_group_id
293       ,p_entity_id
294       => p_rec.entity_id
295       ,p_entity_type
296       => p_rec.entity_type
297       ,p_attribute_category
298       => p_rec.attribute_category
299       ,p_attribute1
300       => p_rec.attribute1
301       ,p_attribute2
302       => p_rec.attribute2
303       ,p_attribute3
304       => p_rec.attribute3
305       ,p_attribute4
306       => p_rec.attribute4
307       ,p_attribute5
308       => p_rec.attribute5
309       ,p_attribute6
310       => p_rec.attribute6
311       ,p_attribute7
312       => p_rec.attribute7
313       ,p_attribute8
314       => p_rec.attribute8
315       ,p_attribute9
316       => p_rec.attribute9
317       ,p_attribute10
318       => p_rec.attribute10
319       ,p_attribute11
320       => p_rec.attribute11
321       ,p_attribute12
322       => p_rec.attribute12
323       ,p_attribute13
324       => p_rec.attribute13
325       ,p_attribute14
326       => p_rec.attribute14
327       ,p_attribute15
328       => p_rec.attribute15
329       ,p_attribute16
330       => p_rec.attribute16
331       ,p_attribute17
332       => p_rec.attribute17
333       ,p_attribute18
334       => p_rec.attribute18
335       ,p_attribute19
336       => p_rec.attribute19
337       ,p_attribute20
338       => p_rec.attribute20
339       ,p_attribute21
340       => p_rec.attribute21
341       ,p_attribute22
342       => p_rec.attribute22
343       ,p_attribute23
344       => p_rec.attribute23
345       ,p_attribute24
346       => p_rec.attribute24
347       ,p_attribute25
348       => p_rec.attribute25
349       ,p_attribute26
350       => p_rec.attribute26
351       ,p_attribute27
352       => p_rec.attribute27
353       ,p_attribute28
354       => p_rec.attribute28
355       ,p_attribute29
356       => p_rec.attribute29
357       ,p_attribute30
358       => p_rec.attribute30
359       ,p_object_version_number
360       => p_rec.object_version_number
361       );
362     --
363   exception
364     --
365     when hr_api.cannot_find_prog_unit then
366       --
367       hr_api.cannot_find_prog_unit_error
368         (p_module_name => 'HXC_ENTITY_GROUP_COMPS'
369         ,p_hook_type   => 'AI');
370       --
371   end;
372   --
373   if g_debug then
374 	hr_utility.set_location(' Leaving:'||l_proc, 10);
375   end if;
376 End post_insert;
377 --
378 -- ----------------------------------------------------------------------------
379 -- |---------------------------------< ins >----------------------------------|
380 -- ----------------------------------------------------------------------------
381 Procedure ins
382   (p_effective_date               in date
383   ,p_rec                          in out nocopy hxc_egc_shd.g_rec_type
384   ,p_called_from_form             in     varchar2
385   ) is
386 --
387   l_proc  varchar2(72);
388 --
389 Begin
390   g_debug:=hr_utility.debug_enabled;
391   if g_debug then
392 	l_proc := g_package||'ins';
393 	hr_utility.set_location('Entering:'||l_proc, 5);
394   end if;
395 
396   -- Bug Fix for 2500562 start
397   -- Call the supporting insert validate operations
398   -- validation is not needed SS date formats.
399 
400   if (p_rec.entity_type <> 'HXC_SS_TC_DATE_FORMATS' )
401   then
402   hxc_egc_bus.insert_validate
403      (p_effective_date
404      ,p_rec
405      ,p_called_from_form => p_called_from_form
406      );
407    end if ;
408 
409   -- Bug Fix for 2500562 End
410   --
411   -- Call the supporting pre-insert operation
412   --
413   hxc_egc_ins.pre_insert(p_rec);
414   --
415   -- Insert the row
416   --
417   hxc_egc_ins.insert_dml(p_rec);
418   --
419   -- Call the supporting post-insert operation
420   --
421   hxc_egc_ins.post_insert
422      (p_effective_date
423      ,p_rec
424      );
425   --
426   if g_debug then
427 	hr_utility.set_location('Leaving:'||l_proc, 20);
428   end if;
429 end ins;
430 --
431 -- ----------------------------------------------------------------------------
432 -- |---------------------------------< ins >----------------------------------|
433 -- ----------------------------------------------------------------------------
434 Procedure ins
435   (p_effective_date               in     date
436   ,p_entity_group_id                in     number
437   ,p_entity_id                      in     number
438   ,p_entity_type                    in     varchar2
439   ,p_attribute_category             in     varchar2 default null
440   ,p_attribute1                     in     varchar2 default null
441   ,p_attribute2                     in     varchar2 default null
442   ,p_attribute3                     in     varchar2 default null
443   ,p_attribute4                     in     varchar2 default null
444   ,p_attribute5                     in     varchar2 default null
445   ,p_attribute6                     in     varchar2 default null
446   ,p_attribute7                     in     varchar2 default null
447   ,p_attribute8                     in     varchar2 default null
448   ,p_attribute9                     in     varchar2 default null
449   ,p_attribute10                    in     varchar2 default null
450   ,p_attribute11                    in     varchar2 default null
451   ,p_attribute12                    in     varchar2 default null
452   ,p_attribute13                    in     varchar2 default null
453   ,p_attribute14                    in     varchar2 default null
454   ,p_attribute15                    in     varchar2 default null
455   ,p_attribute16                    in     varchar2 default null
456   ,p_attribute17                    in     varchar2 default null
457   ,p_attribute18                    in     varchar2 default null
458   ,p_attribute19                    in     varchar2 default null
459   ,p_attribute20                    in     varchar2 default null
460   ,p_attribute21                    in     varchar2 default null
461   ,p_attribute22                    in     varchar2 default null
462   ,p_attribute23                    in     varchar2 default null
463   ,p_attribute24                    in     varchar2 default null
464   ,p_attribute25                    in     varchar2 default null
465   ,p_attribute26                    in     varchar2 default null
466   ,p_attribute27                    in     varchar2 default null
467   ,p_attribute28                    in     varchar2 default null
468   ,p_attribute29                    in     varchar2 default null
469   ,p_attribute30                    in     varchar2 default null
470   ,p_entity_group_comp_id              out nocopy number
471   ,p_object_version_number             out nocopy number
472   ,p_called_from_form               in     varchar2
473   ) is
474 --
475   l_rec	  hxc_egc_shd.g_rec_type;
476   l_proc  varchar2(72);
477 --
478 Begin
479   g_debug:=hr_utility.debug_enabled;
480   if g_debug then
481 	l_proc := g_package||'ins';
482 	hr_utility.set_location('Entering:'||l_proc, 5);
483   end if;
484   --
485   -- Call conversion function to turn arguments into the
486   -- p_rec structure.
487   --
488   l_rec :=
489   hxc_egc_shd.convert_args
490     (null
491     ,p_entity_group_id
492     ,p_entity_id
493     ,p_entity_type
494     ,p_attribute_category
495     ,p_attribute1
496     ,p_attribute2
497     ,p_attribute3
498     ,p_attribute4
499     ,p_attribute5
500     ,p_attribute6
501     ,p_attribute7
502     ,p_attribute8
503     ,p_attribute9
504     ,p_attribute10
505     ,p_attribute11
506     ,p_attribute12
507     ,p_attribute13
508     ,p_attribute14
509     ,p_attribute15
510     ,p_attribute16
511     ,p_attribute17
512     ,p_attribute18
513     ,p_attribute19
514     ,p_attribute20
515     ,p_attribute21
516     ,p_attribute22
517     ,p_attribute23
518     ,p_attribute24
519     ,p_attribute25
520     ,p_attribute26
521     ,p_attribute27
522     ,p_attribute28
523     ,p_attribute29
524     ,p_attribute30
525     ,null
526     );
527   --
528   -- Having converted the arguments into the hxc_egc_rec
529   -- plsql record structure we call the corresponding record business process.
530   --
531   hxc_egc_ins.ins
532      (p_effective_date
533      ,l_rec
534      ,p_called_from_form => p_called_from_form
535      );
536   --
537   -- As the primary key argument(s)
538   -- are specified as an OUT's we must set these values.
539   --
540   p_entity_group_comp_id := l_rec.entity_group_comp_id;
541   p_object_version_number := l_rec.object_version_number;
542   --
543   if g_debug then
544 	hr_utility.set_location(' Leaving:'||l_proc, 10);
545   end if;
546 End ins;
547 --
548 end hxc_egc_ins;