DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_BPR_INS

Source


1 Package Body per_bpr_ins as
2 /* $Header: pebprrhi.pkb 115.6 2002/12/02 14:33:23 apholt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_bpr_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.
36 --
33 --
34 -- Post Success:
35 --   The specified row will be inserted into the schema.
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 per_bpr_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   --
62   hr_utility.set_location(to_char(p_rec.payroll_run_id),99);
63   -- Insert the row into: per_bf_payroll_runs
64   --
65   insert into per_bf_payroll_runs
66   (   payroll_run_id,
67       payroll_id,
68       business_group_id,
69       payroll_identifier,
70       period_start_date,
71       period_end_date,
72       processing_date,
73       object_version_number,
74       bpr_attribute_category,
75       bpr_attribute1,
76       bpr_attribute2,
77       bpr_attribute3,
78       bpr_attribute4,
79       bpr_attribute5,
80       bpr_attribute6,
81       bpr_attribute7,
82       bpr_attribute8,
83       bpr_attribute9,
84       bpr_attribute10,
85       bpr_attribute11,
86       bpr_attribute12,
87       bpr_attribute13,
88       bpr_attribute14,
89       bpr_attribute15,
90       bpr_attribute16,
91       bpr_attribute17,
92       bpr_attribute18,
93       bpr_attribute19,
94       bpr_attribute20,
95       bpr_attribute21,
96       bpr_attribute22,
97       bpr_attribute23,
98       bpr_attribute24,
99       bpr_attribute25,
100       bpr_attribute26,
101       bpr_attribute27,
102       bpr_attribute28,
103       bpr_attribute29,
104       bpr_attribute30
105   )
106   Values
107   (      p_rec.payroll_run_id,
108       p_rec.payroll_id,
109       p_rec.business_group_id,
110       p_rec.payroll_identifier,
111       p_rec.period_start_date,
112       p_rec.period_end_date,
113       p_rec.processing_date,
114       p_rec.object_version_number,
115       p_rec.bpr_attribute_category,
116       p_rec.bpr_attribute1,
117       p_rec.bpr_attribute2,
118       p_rec.bpr_attribute3,
119       p_rec.bpr_attribute4,
120       p_rec.bpr_attribute5,
121       p_rec.bpr_attribute6,
122       p_rec.bpr_attribute7,
123       p_rec.bpr_attribute8,
124       p_rec.bpr_attribute9,
125       p_rec.bpr_attribute10,
126       p_rec.bpr_attribute11,
127       p_rec.bpr_attribute12,
128       p_rec.bpr_attribute13,
129       p_rec.bpr_attribute14,
130       p_rec.bpr_attribute15,
131       p_rec.bpr_attribute16,
132       p_rec.bpr_attribute17,
133       p_rec.bpr_attribute18,
134       p_rec.bpr_attribute19,
135       p_rec.bpr_attribute20,
136       p_rec.bpr_attribute21,
137       p_rec.bpr_attribute22,
138       p_rec.bpr_attribute23,
139       p_rec.bpr_attribute24,
140       p_rec.bpr_attribute25,
141       p_rec.bpr_attribute26,
142       p_rec.bpr_attribute27,
143       p_rec.bpr_attribute28,
144       p_rec.bpr_attribute29,
145       p_rec.bpr_attribute30
146   );
147   --
148   --
149   hr_utility.set_location(' Leaving:'||l_proc, 10);
150 Exception
151   When hr_api.check_integrity_violated Then
152     -- A check constraint has been violated
153     per_bpr_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     per_bpr_shd.constraint_error
158       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
159   When hr_api.unique_integrity_violated Then
160     -- Unique integrity has been violated
161     per_bpr_shd.constraint_error
162       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
163   When Others Then
164     Raise;
165 End insert_dml;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |------------------------------< pre_insert >------------------------------|
169 -- ----------------------------------------------------------------------------
170 -- {Start Of Comments}
171 --
172 -- Description:
173 --   This private procedure contains any processing which is required before
174 --   the insert dml. Presently, if the entity has a corresponding primary
175 --   key which is maintained by an associating sequence, the primary key for
176 --   the entity will be populated with the next sequence value in
177 --   preparation for the insert dml.
178 --
179 -- Prerequisites:
180 --   This is an internal procedure which is called from the ins procedure.
181 --
182 -- In Parameters:
183 --   A Pl/Sql record structre.
184 --
185 -- Post Success:
186 --   Processing continues.
187 --
188 -- Post Failure:
189 --   If an error has occurred, an error message and exception will be raised
190 --   but not handled.
191 --
192 -- Developer Implementation Notes:
193 --   Any pre-processing required before the insert dml is issued should be
194 --   coded within this procedure. As stated above, a good example is the
195 --   generation of a primary key number via a corresponding sequence.
196 --   It is important to note that any 3rd party maintenance should be reviewed
197 --   before placing in this procedure.
198 --
199 -- Access Status:
200 --   Internal Row Handler Use Only.
201 --
202 -- {End Of Comments}
203 -- ----------------------------------------------------------------------------
204 Procedure pre_insert(p_rec  in out nocopy per_bpr_shd.g_rec_type) is
205 --
206   l_proc  varchar2(72) := g_package||'pre_insert';
207 --
208 Cursor C_Sel1 is select per_bf_payroll_runs_s.nextval from sys.dual;
209 --
210 --
211 Begin
212   hr_utility.set_location('Entering:'||l_proc, 5);
213   --
214   -- Select the next sequence number
215   --
216   Open C_Sel1;
217   Fetch C_Sel1 Into p_rec.payroll_run_id;
218   Close C_Sel1;
219   --
220   --
221   hr_utility.set_location(' Leaving:'||l_proc, 10);
222 End pre_insert;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |-----------------------------< post_insert >------------------------------|
226 -- ----------------------------------------------------------------------------
227 -- {Start Of Comments}
228 --
229 -- Description:
230 --   This private procedure contains any processing which is required after the
231 --   insert dml.
232 --
233 -- Prerequisites:
234 --   This is an internal procedure which is called from the ins procedure.
235 --
236 -- In Parameters:
237 --   A Pl/Sql record structre.
238 --
239 -- Post Success:
240 --   Processing continues.
241 --
242 -- Post Failure:
243 --   If an error has occurred, an error message and exception will be raised
244 --   but not handled.
245 --
246 -- Developer Implementation Notes:
247 --   Any post-processing required after the insert dml is issued should be
248 --   coded within this procedure. It is important to note that any 3rd party
249 --   maintenance should be reviewed before placing in this procedure.
250 --
251 -- Access Status:
252 --   Internal Row Handler Use Only.
253 --
254 -- {End Of Comments}
255 -- ----------------------------------------------------------------------------
256 Procedure post_insert(p_effective_date   in  date,
257                       p_rec in per_bpr_shd.g_rec_type) is
258 --
259   l_proc  varchar2(72) := g_package||'post_insert';
260 --
261 Begin
262   hr_utility.set_location('Entering:'||l_proc, 5);
263   begin
264     --
265     per_bpr_rki.after_insert
266       (p_effective_date              => p_effective_date,
267       p_payroll_run_id             => p_rec.payroll_run_id,
268       p_payroll_id                 => p_rec.payroll_id,
269       p_business_group_id          => p_rec.business_group_id,
270       p_payroll_identifier         => p_rec.payroll_identifier,
271       p_period_start_date          => p_rec.period_start_date,
272       p_period_end_date            => p_rec.period_end_date,
273       p_processing_date            => p_rec.processing_date,
274       p_object_version_number      => p_rec.object_version_number,
275       p_bpr_attribute_category         => p_rec.bpr_attribute_category,
276       p_bpr_attribute1                 => p_rec.bpr_attribute1,
277       p_bpr_attribute2                 => p_rec.bpr_attribute2,
278       p_bpr_attribute3                 => p_rec.bpr_attribute3,
279       p_bpr_attribute4                 => p_rec.bpr_attribute4,
280       p_bpr_attribute5                 => p_rec.bpr_attribute5,
281       p_bpr_attribute6                 => p_rec.bpr_attribute6,
282       p_bpr_attribute7                 => p_rec.bpr_attribute7,
283       p_bpr_attribute8                 => p_rec.bpr_attribute8,
284       p_bpr_attribute9                 => p_rec.bpr_attribute9,
285       p_bpr_attribute10                => p_rec.bpr_attribute10,
286       p_bpr_attribute11                => p_rec.bpr_attribute11,
287       p_bpr_attribute12                => p_rec.bpr_attribute12,
288       p_bpr_attribute13                => p_rec.bpr_attribute13,
289       p_bpr_attribute14                => p_rec.bpr_attribute14,
290       p_bpr_attribute15                => p_rec.bpr_attribute15,
291       p_bpr_attribute16                => p_rec.bpr_attribute16,
292       p_bpr_attribute17                => p_rec.bpr_attribute17,
293       p_bpr_attribute18                => p_rec.bpr_attribute18,
294       p_bpr_attribute19                => p_rec.bpr_attribute19,
298       p_bpr_attribute23                => p_rec.bpr_attribute23,
295       p_bpr_attribute20                => p_rec.bpr_attribute20,
296       p_bpr_attribute21                => p_rec.bpr_attribute21,
297       p_bpr_attribute22                => p_rec.bpr_attribute22,
299       p_bpr_attribute24                => p_rec.bpr_attribute24,
300       p_bpr_attribute25                => p_rec.bpr_attribute25,
301       p_bpr_attribute26                => p_rec.bpr_attribute26,
302       p_bpr_attribute27                => p_rec.bpr_attribute27,
303       p_bpr_attribute28                => p_rec.bpr_attribute28,
304       p_bpr_attribute29                => p_rec.bpr_attribute29,
305       p_bpr_attribute30                => p_rec.bpr_attribute30
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 => 'PER_BF_PAYROLL_RUNS'
314         ,p_hook_type   => 'AI');
315       --
316   end;
317   --
318   hr_utility.set_location(' Leaving:'||l_proc, 10);
319 End post_insert;
320 --
321 -- ----------------------------------------------------------------------------
322 -- |---------------------------------< ins >----------------------------------|
323 -- ----------------------------------------------------------------------------
324 Procedure ins
325   (
326   p_effective_date   in  date,
327   p_rec        in out nocopy per_bpr_shd.g_rec_type
328   ) is
329 --
330   l_proc  varchar2(72) := g_package||'ins';
331 --
332 Begin
333   hr_utility.set_location('Entering:'||l_proc, 5);
334   --
335   -- Call the supporting insert validate operations
336   --
337   per_bpr_bus.insert_validate(p_effective_date,
338                              p_rec
339                              );
340   --
341   -- Call the supporting pre-insert operation
342   --
343   pre_insert(p_rec);
344   --
345   -- Insert the row
346   --
347   insert_dml(p_rec);
348   --
349   -- Call the supporting post-insert operation
350   --
351   post_insert(p_effective_date
352 	     ,p_rec);
353   --
354   hr_utility.set_location('Leaving:'||l_proc, 20);
355 end ins;
356 --
357 -- ----------------------------------------------------------------------------
358 -- |---------------------------------< ins >----------------------------------|
359 -- ----------------------------------------------------------------------------
360 Procedure ins
361   (
362   p_effective_date   in  date,
363   p_payroll_run_id               out nocopy number,
364   p_payroll_id                   in number,
365   p_business_group_id            in number,
366   p_payroll_identifier           in varchar2,
367   p_period_start_date            in date             default null,
368   p_period_end_date              in date             default null,
369   p_processing_date              in date             default null,
370   p_object_version_number        out nocopy number,
371   p_bpr_attribute_category           in varchar2         default null,
372   p_bpr_attribute1                  in varchar2         default null,
373   p_bpr_attribute2                  in varchar2         default null,
374   p_bpr_attribute3                  in varchar2         default null,
375   p_bpr_attribute4                  in varchar2         default null,
376   p_bpr_attribute5                  in varchar2         default null,
377   p_bpr_attribute6                  in varchar2         default null,
378   p_bpr_attribute7                  in varchar2         default null,
379   p_bpr_attribute8                  in varchar2         default null,
380   p_bpr_attribute9                  in varchar2         default null,
381   p_bpr_attribute10                 in varchar2         default null,
382   p_bpr_attribute11                 in varchar2         default null,
383   p_bpr_attribute12                 in varchar2         default null,
384   p_bpr_attribute13                 in varchar2         default null,
385   p_bpr_attribute14                 in varchar2         default null,
386   p_bpr_attribute15                 in varchar2         default null,
387   p_bpr_attribute16                 in varchar2         default null,
388   p_bpr_attribute17                 in varchar2         default null,
389   p_bpr_attribute18                 in varchar2         default null,
390   p_bpr_attribute19                 in varchar2         default null,
391   p_bpr_attribute20                 in varchar2         default null,
392   p_bpr_attribute21                 in varchar2         default null,
393   p_bpr_attribute22                 in varchar2         default null,
394   p_bpr_attribute23                 in varchar2         default null,
395   p_bpr_attribute24                 in varchar2         default null,
396   p_bpr_attribute25                 in varchar2         default null,
397   p_bpr_attribute26                 in varchar2         default null,
398   p_bpr_attribute27                 in varchar2         default null,
399   p_bpr_attribute28                 in varchar2         default null,
400   p_bpr_attribute29                 in varchar2         default null,
401   p_bpr_attribute30                 in varchar2         default null
402   ) is
403 --
404   l_rec	  per_bpr_shd.g_rec_type;
405   l_proc  varchar2(72) := g_package||'ins';
406 --
407 Begin
408   hr_utility.set_location('Entering:'||l_proc, 5);
409   --
410   -- Call conversion function to turn arguments into the
411   -- p_rec structure.
412   --
413   l_rec :=
414   per_bpr_shd.convert_args
415   (
416   null,
417   p_payroll_id,
418   p_business_group_id,
419   p_payroll_identifier,
420   p_period_start_date,
421   p_period_end_date,
422   p_processing_date,
423   null,
424   p_bpr_attribute_category,
425   p_bpr_attribute1,
426   p_bpr_attribute2,
427   p_bpr_attribute3,
428   p_bpr_attribute4,
429   p_bpr_attribute5,
430   p_bpr_attribute6,
431   p_bpr_attribute7,
432   p_bpr_attribute8,
433   p_bpr_attribute9,
434   p_bpr_attribute10,
435   p_bpr_attribute11,
436   p_bpr_attribute12,
437   p_bpr_attribute13,
438   p_bpr_attribute14,
439   p_bpr_attribute15,
440   p_bpr_attribute16,
441   p_bpr_attribute17,
442   p_bpr_attribute18,
443   p_bpr_attribute19,
444   p_bpr_attribute20,
445   p_bpr_attribute21,
446   p_bpr_attribute22,
447   p_bpr_attribute23,
448   p_bpr_attribute24,
449   p_bpr_attribute25,
450   p_bpr_attribute26,
451   p_bpr_attribute27,
452   p_bpr_attribute28,
453   p_bpr_attribute29,
454   p_bpr_attribute30
455   );
456   --
457   -- Having converted the arguments into the per_bpr_rec
458   -- plsql record structure we call the corresponding record business process.
459   --
460   ins(p_effective_date,
461       l_rec
462      );
463   --
464   -- As the primary key argument(s)
465   -- are specified as an OUT's we must set these values.
466   --
467   p_payroll_run_id := l_rec.payroll_run_id;
468   p_object_version_number := l_rec.object_version_number;
469   --
470   hr_utility.set_location(' Leaving:'||l_proc, 10);
471 End ins;
472 --
473 end per_bpr_ins;