DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PEV_INS

Source


1 Package Body pay_pev_ins as
2 /* $Header: pypperhi.pkb 120.1.12010000.1 2008/07/27 23:25:17 appldev ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_pev_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
54   (p_rec in out nocopy pay_pev_shd.g_rec_type
55   ) is
56 --
57   l_proc  varchar2(72) := g_package||'insert_dml';
58 --
59 Begin
60   hr_utility.set_location('Entering:'||l_proc, 5);
61   p_rec.object_version_number := 1;  -- Initialise the object version
62   --
63   pay_pev_shd.g_api_dml := true;  -- Set the api dml status
64   --
65   -- Insert the row into: pay_process_events
66   --
67   insert into pay_process_events
68       (process_event_id
69       ,assignment_id
70       ,effective_date
71       ,change_type
72       ,status
73       ,description
74       ,event_update_id
75       ,business_group_id
76       ,org_process_event_group_id
77       ,surrogate_key
78       ,object_version_number
79       ,calculation_date
80       ,retroactive_status
81       ,noted_value
82       )
83   Values
84     (p_rec.process_event_id
85     ,p_rec.assignment_id
86     ,p_rec.effective_date
87     ,p_rec.change_type
88     ,p_rec.status
89     ,p_rec.description
90     ,p_rec.event_update_id
91     ,p_rec.business_group_id
92     ,p_rec.org_process_event_group_id
93     ,p_rec.surrogate_key
94     ,p_rec.object_version_number
95     ,p_rec.calculation_date
96     ,p_rec.retroactive_status
97     ,p_rec.noted_value
98     );
99   --
100   pay_pev_shd.g_api_dml := false;   -- Unset the api dml status
101   --
102   hr_utility.set_location(' Leaving:'||l_proc, 10);
103 Exception
104   When hr_api.check_integrity_violated Then
105     -- A check constraint has been violated
106     pay_pev_shd.g_api_dml := false;   -- Unset the api dml status
107     pay_pev_shd.constraint_error
108       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
109   When hr_api.parent_integrity_violated Then
110     -- Parent integrity has been violated
111     pay_pev_shd.g_api_dml := false;   -- Unset the api dml status
112     pay_pev_shd.constraint_error
113       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
114   When hr_api.unique_integrity_violated Then
115     -- Unique integrity has been violated
116     pay_pev_shd.g_api_dml := false;   -- Unset the api dml status
117     pay_pev_shd.constraint_error
118       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
119   When Others Then
120     pay_pev_shd.g_api_dml := false;   -- Unset the api dml status
121     Raise;
122 End insert_dml;
123 --
124 -- ----------------------------------------------------------------------------
125 -- |------------------------------< pre_insert >------------------------------|
126 -- ----------------------------------------------------------------------------
127 -- {Start Of Comments}
128 --
129 -- Description:
130 --   This private procedure contains any processing which is required before
131 --   the insert dml. Presently, if the entity has a corresponding primary
132 --   key which is maintained by an associating sequence, the primary key for
133 --   the entity will be populated with the next sequence value in
134 --   preparation for the insert dml.
135 --
136 -- Prerequisites:
137 --   This is an internal procedure which is called from the ins procedure.
138 --
139 -- In Parameters:
140 --   A Pl/Sql record structre.
141 --
142 -- Post Success:
143 --   Processing continues.
144 --
145 -- Post Failure:
146 --   If an error has occurred, an error message and exception will be raised
147 --   but not handled.
148 --
149 -- Developer Implementation Notes:
150 --   Any pre-processing required before the insert dml is issued should be
151 --   coded within this procedure. As stated above, a good example is the
152 --   generation of a primary key number via a corresponding sequence.
153 --   It is important to note that any 3rd party maintenance should be reviewed
154 --   before placing in this procedure.
155 --
156 -- Access Status:
157 --   Internal Row Handler Use Only.
158 --
159 -- {End Of Comments}
160 -- ----------------------------------------------------------------------------
161 Procedure pre_insert
162   (p_rec  in out nocopy pay_pev_shd.g_rec_type
163   ) is
164 --
165   l_proc  varchar2(72) := g_package||'pre_insert';
166 --
167   Cursor C_Sel1 is select pay_process_events_s.nextval from sys.dual;
168 --
169 Begin
170   hr_utility.set_location('Entering:'||l_proc, 5);
171   --
172   --
173   -- Select the next sequence number
174   --
175   Open C_Sel1;
176   Fetch C_Sel1 Into p_rec.process_event_id;
177   Close C_Sel1;
178   --
179   hr_utility.set_location(' Leaving:'||l_proc, 10);
180 End pre_insert;
181 --
182 -- ----------------------------------------------------------------------------
183 -- |-----------------------------< post_insert >------------------------------|
184 -- ----------------------------------------------------------------------------
185 -- {Start Of Comments}
186 --
187 -- Description:
188 --   This private procedure contains any processing which is required after the
189 --   insert dml.
190 --
191 -- Prerequisites:
192 --   This is an internal procedure which is called from the ins procedure.
193 --
194 -- In Parameters:
195 --   A Pl/Sql record structre.
196 --
197 -- Post Success:
198 --   Processing continues.
199 --
200 -- Post Failure:
201 --   If an error has occurred, an error message and exception will be raised
202 --   but not handled.
203 --
204 -- Developer Implementation Notes:
205 --   Any post-processing required after the insert dml is issued should be
206 --   coded within this procedure. It is important to note that any 3rd party
207 --   maintenance should be reviewed before placing in this procedure.
208 --
209 -- Access Status:
210 --   Internal Row Handler Use Only.
211 --
212 -- {End Of Comments}
213 -- ----------------------------------------------------------------------------
214 Procedure post_insert
215   (p_rec                          in pay_pev_shd.g_rec_type
216   ) is
217 --
218   l_proc  varchar2(72) := g_package||'post_insert';
219 --
220 Begin
221   hr_utility.set_location('Entering:'||l_proc, 5);
222   begin
223     --
224     pay_pev_rki.after_insert
225       (p_process_event_id
226       => p_rec.process_event_id
227       ,p_assignment_id
228       => p_rec.assignment_id
229       ,p_effective_date
230       => p_rec.effective_date
231       ,p_change_type
232       => p_rec.change_type
233       ,p_status
234       => p_rec.status
235       ,p_description
236       => p_rec.description
237       ,p_event_update_id
238       => p_rec.event_update_id
239       ,p_business_group_id
240       => p_rec.business_group_id
241       ,p_org_process_event_group_id
242       => p_rec.org_process_event_group_id
243       ,p_surrogate_key
244       => p_rec.surrogate_key
245       ,p_object_version_number
246       => p_rec.object_version_number
247       ,p_calculation_date
248       => p_rec.calculation_date
249       ,p_retroactive_status
250       => p_rec.retroactive_status
251       ,p_noted_value
252       => p_rec.noted_value
253       );
254     --
255   exception
256     --
257     when hr_api.cannot_find_prog_unit then
258       --
259       hr_api.cannot_find_prog_unit_error
260         (p_module_name => 'PAY_PROCESS_EVENTS'
261         ,p_hook_type   => 'AI');
262       --
263   end;
264   --
265   hr_utility.set_location(' Leaving:'||l_proc, 10);
266 End post_insert;
267 --
268 -- ----------------------------------------------------------------------------
269 -- |---------------------------------< ins >----------------------------------|
270 -- ----------------------------------------------------------------------------
271 Procedure ins
272   (p_rec                          in out nocopy pay_pev_shd.g_rec_type
273   ) is
274 --
275   l_proc  varchar2(72) := g_package||'ins';
276 --
277 Begin
278   hr_utility.set_location('Entering:'||l_proc, 5);
279   --
280   -- Call the supporting insert validate operations
281   --
282   pay_pev_bus.insert_validate
283      (p_rec
284      );
285   --
286   -- Call the supporting pre-insert operation
287   --
288   pay_pev_ins.pre_insert(p_rec);
289   --
290   -- Insert the row
291   --
292   pay_pev_ins.insert_dml(p_rec);
293   --
294   -- Call the supporting post-insert operation
295   --
296   pay_pev_ins.post_insert
297      (p_rec
298      );
299   --
300   hr_utility.set_location('Leaving:'||l_proc, 20);
301 end ins;
302 --
303 -- ----------------------------------------------------------------------------
304 -- |---------------------------------< ins >----------------------------------|
305 -- ----------------------------------------------------------------------------
306 Procedure ins
307   (p_assignment_id                  in     number   default null
308   ,p_effective_date                 in     date
309   ,p_change_type                    in     varchar2
310   ,p_status                         in     varchar2
311   ,p_description                    in     varchar2 default null
312   ,p_process_event_id                  out nocopy   number
313   ,p_object_version_number             out nocopy   number
314   ,p_event_update_id                in     number   default null
315   ,p_business_group_id              in     number   default null
316   ,p_org_process_event_group_id     in     number   default null
317   ,p_surrogate_key                  in     varchar2 default null
318   ,p_calculation_date               in     date     default null
319   ,p_retroactive_status             in     varchar2 default null
320   ,p_noted_value                    in     varchar2 default null
321   ) is
322 --
323   l_rec	  pay_pev_shd.g_rec_type;
324   l_proc  varchar2(72) := g_package||'ins';
325 --
326 Begin
327   hr_utility.set_location('Entering:'||l_proc, 5);
328   --
329   -- Call conversion function to turn arguments into the
330   -- p_rec structure.
331   --
332   l_rec :=
333   pay_pev_shd.convert_args
334     (null
335     ,p_assignment_id
336     ,p_effective_date
337     ,p_change_type
338     ,p_status
339     ,p_description
340     ,p_event_update_id
341     ,p_business_group_id
342     ,p_org_process_event_group_id
343     ,p_surrogate_key
344     ,null
345     ,p_calculation_date
346     ,p_retroactive_status
347     ,p_noted_value
348     );
349   --
350   -- Having converted the arguments into the pay_pev_rec
351   -- plsql record structure we call the corresponding record business process.
352   --
353   pay_pev_ins.ins
354      (l_rec
355      );
356   --
357   -- As the primary key argument(s)
358   -- are specified as an OUT's we must set these values.
359   --
360   p_process_event_id := l_rec.process_event_id;
361   p_object_version_number := l_rec.object_version_number;
362   --
363   hr_utility.set_location(' Leaving:'||l_proc, 10);
364 End ins;
365 --
366 end pay_pev_ins;