DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SBT_INS

Source


1 Package Body pay_sbt_ins as
2 /* $Header: pysbtrhi.pkb 120.0 2005/05/29 08:34:39 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_sbt_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 --      perform dml).
21 --   3) To insert the row into the schema.
22 --   4) To trap any constraint violations that may have occurred.
23 --   5) To raise any other errors.
24 --
25 -- Prerequisites:
26 --   This is an internal private procedure which must be called from the ins
27 --   procedure and must have all mandatory attributes set (except the
28 --   object_version_number which is initialised within this procedure).
29 --
30 -- In Parameters:
31 --   A Pl/Sql record structre.
32 --
33 -- Post Success:
34 --   The specified row will be inserted into the schema.
35 --
36 -- Post Failure:
37 --   On the insert dml failure it is important to note that we always reset the
38 --   If a check, unique or parent integrity constraint violation is raised the
39 --   constraint_error procedure will be called.
40 --   If any other error is reported, the error will be raised after the
41 --
42 -- Developer Implementation Notes:
43 --   None.
44 --
45 -- Access Status:
46 --   Internal Row Handler Use Only.
47 --
48 -- {End Of Comments}
49 -- ----------------------------------------------------------------------------
50 Procedure insert_dml(p_rec in out nocopy pay_sbt_shd.g_rec_type) is
51 --
52   l_proc  varchar2(72) := g_package||'insert_dml';
53 --
54 Begin
55   hr_utility.set_location('Entering:'||l_proc, 5);
56   p_rec.object_version_number := 1;  -- Initialise the object version
57   --
58   --
59   -- Insert the row into: pay_shadow_balance_types
60   --
61   insert into pay_shadow_balance_types
62   (	balance_type_id,
63 	template_id,
64 	assignment_remuneration_flag,
65 	balance_name,
66 	balance_uom,
67 	currency_code,
68 	comments,
69 	reporting_name,
70 	attribute_category,
71 	attribute1,
72 	attribute2,
73 	attribute3,
74 	attribute4,
75 	attribute5,
76 	attribute6,
77 	attribute7,
78 	attribute8,
79 	attribute9,
80 	attribute10,
81 	attribute11,
82 	attribute12,
83 	attribute13,
84 	attribute14,
85 	attribute15,
86 	attribute16,
87 	attribute17,
88 	attribute18,
89 	attribute19,
90 	attribute20,
91 	jurisdiction_level,
92 	tax_type,
93 	exclusion_rule_id,
94         category_name,
95         base_balance_type_id,
96         base_balance_name,
97         input_value_id,
98 	object_version_number
99   )
100   Values
101   (	p_rec.balance_type_id,
102 	p_rec.template_id,
103 	p_rec.assignment_remuneration_flag,
104 	p_rec.balance_name,
105 	p_rec.balance_uom,
106 	p_rec.currency_code,
107 	p_rec.comments,
108 	p_rec.reporting_name,
109 	p_rec.attribute_category,
110 	p_rec.attribute1,
111 	p_rec.attribute2,
112 	p_rec.attribute3,
113 	p_rec.attribute4,
114 	p_rec.attribute5,
115 	p_rec.attribute6,
116 	p_rec.attribute7,
117 	p_rec.attribute8,
118 	p_rec.attribute9,
119 	p_rec.attribute10,
120 	p_rec.attribute11,
121 	p_rec.attribute12,
122 	p_rec.attribute13,
123 	p_rec.attribute14,
124 	p_rec.attribute15,
125 	p_rec.attribute16,
126 	p_rec.attribute17,
127 	p_rec.attribute18,
128 	p_rec.attribute19,
129 	p_rec.attribute20,
130 	p_rec.jurisdiction_level,
131 	p_rec.tax_type,
132 	p_rec.exclusion_rule_id,
133         p_rec.category_name,
134         p_rec.base_balance_type_id,
135         p_rec.base_balance_name,
136         p_rec.input_value_id,
137 	p_rec.object_version_number
138   );
139   --
140   --
141   hr_utility.set_location(' Leaving:'||l_proc, 10);
142 Exception
143   When hr_api.check_integrity_violated Then
144     -- A check constraint has been violated
145     pay_sbt_shd.constraint_error
146       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
147   When hr_api.parent_integrity_violated Then
148     -- Parent integrity has been violated
149     pay_sbt_shd.constraint_error
150       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
151   When hr_api.unique_integrity_violated Then
152     -- Unique integrity has been violated
153     pay_sbt_shd.constraint_error
154       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
155   When Others Then
156     Raise;
157 End insert_dml;
158 --
159 -- ----------------------------------------------------------------------------
160 -- |------------------------------< pre_insert >------------------------------|
161 -- ----------------------------------------------------------------------------
162 -- {Start Of Comments}
163 --
164 -- Description:
165 --   This private procedure contains any processing which is required before
166 --   the insert dml. Presently, if the entity has a corresponding primary
167 --   key which is maintained by an associating sequence, the primary key for
168 --   the entity will be populated with the next sequence value in
169 --   preparation for the insert dml.
170 --
171 -- Prerequisites:
172 --   This is an internal procedure which is called from the ins procedure.
173 --
174 -- In Parameters:
175 --   A Pl/Sql record structre.
176 --
177 -- Post Success:
178 --   Processing continues.
179 --
180 -- Post Failure:
181 --   If an error has occurred, an error message and exception will be raised
182 --   but not handled.
183 --
184 -- Developer Implementation Notes:
185 --   Any pre-processing required before the insert dml is issued should be
186 --   coded within this procedure. As stated above, a good example is the
187 --   generation of a primary key number via a corresponding sequence.
188 --   It is important to note that any 3rd party maintenance should be reviewed
189 --   before placing in this procedure.
190 --
191 -- Access Status:
192 --   Internal Row Handler Use Only.
193 --
194 -- {End Of Comments}
195 -- ----------------------------------------------------------------------------
196 Procedure pre_insert(p_rec  in out nocopy pay_sbt_shd.g_rec_type) is
197 --
198   l_proc  varchar2(72) := g_package||'pre_insert';
199 --
200   Cursor C_Sel1 is select pay_shadow_balance_types_s.nextval from sys.dual;
201 --
202 Begin
203   hr_utility.set_location('Entering:'||l_proc, 5);
204   --
205   --
206   -- Select the next sequence number
207   --
208   Open C_Sel1;
209   Fetch C_Sel1 Into p_rec.balance_type_id;
210   Close C_Sel1;
211   --
212   hr_utility.set_location(' Leaving:'||l_proc, 10);
213 End pre_insert;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |-----------------------------< post_insert >------------------------------|
217 -- ----------------------------------------------------------------------------
218 -- {Start Of Comments}
219 --
220 -- Description:
221 --   This private procedure contains any processing which is required after the
222 --   insert dml.
223 --
224 -- Prerequisites:
225 --   This is an internal procedure which is called from the ins procedure.
226 --
227 -- In Parameters:
228 --   A Pl/Sql record structre.
229 --
230 -- Post Success:
231 --   Processing continues.
232 --
233 -- Post Failure:
234 --   If an error has occurred, an error message and exception will be raised
235 --   but not handled.
236 --
237 -- Developer Implementation Notes:
238 --   Any post-processing required after the insert dml is issued should be
239 --   coded within this procedure. It is important to note that any 3rd party
240 --   maintenance should be reviewed before placing in this procedure.
241 --
242 -- Access Status:
243 --   Internal Row Handler Use Only.
244 --
245 -- {End Of Comments}
246 -- ----------------------------------------------------------------------------
247 Procedure post_insert(p_rec in pay_sbt_shd.g_rec_type) is
248 --
249   l_proc  varchar2(72) := g_package||'post_insert';
250 --
251 Begin
252   hr_utility.set_location('Entering:'||l_proc, 5);
253   --
254   hr_utility.set_location(' Leaving:'||l_proc, 10);
255 End post_insert;
256 --
257 -- ----------------------------------------------------------------------------
258 -- |---------------------------------< ins >----------------------------------|
259 -- ----------------------------------------------------------------------------
260 Procedure ins
261   (
262   p_effective_date in date,
263   p_rec        in out nocopy pay_sbt_shd.g_rec_type
264   ) is
265 --
266   l_proc  varchar2(72) := g_package||'ins';
267 --
268 Begin
269   hr_utility.set_location('Entering:'||l_proc, 5);
270   --
271   -- Call the supporting insert validate operations
272   --
273   pay_sbt_bus.insert_validate(p_effective_date, p_rec);
274   --
275   -- Call the supporting pre-insert operation
276   --
277   pre_insert(p_rec);
278   --
279   -- Insert the row
280   --
281   insert_dml(p_rec);
282   --
283   -- Call the supporting post-insert operation
284   --
285   post_insert(p_rec);
286 end ins;
287 --
288 -- ----------------------------------------------------------------------------
289 -- |---------------------------------< ins >----------------------------------|
290 -- ----------------------------------------------------------------------------
291 Procedure ins
292   (
293   p_effective_date in date,
294   p_balance_type_id              out nocopy number,
295   p_template_id                  in number,
296   p_assignment_remuneration_flag in varchar2,
297   p_balance_name                 in varchar2,
298   p_balance_uom                  in varchar2,
299   p_currency_code                in varchar2         default null,
300   p_comments                     in varchar2         default null,
301   p_reporting_name               in varchar2         default null,
302   p_attribute_category           in varchar2         default null,
303   p_attribute1                   in varchar2         default null,
304   p_attribute2                   in varchar2         default null,
305   p_attribute3                   in varchar2         default null,
306   p_attribute4                   in varchar2         default null,
307   p_attribute5                   in varchar2         default null,
308   p_attribute6                   in varchar2         default null,
309   p_attribute7                   in varchar2         default null,
310   p_attribute8                   in varchar2         default null,
311   p_attribute9                   in varchar2         default null,
312   p_attribute10                  in varchar2         default null,
313   p_attribute11                  in varchar2         default null,
314   p_attribute12                  in varchar2         default null,
315   p_attribute13                  in varchar2         default null,
316   p_attribute14                  in varchar2         default null,
317   p_attribute15                  in varchar2         default null,
318   p_attribute16                  in varchar2         default null,
319   p_attribute17                  in varchar2         default null,
320   p_attribute18                  in varchar2         default null,
321   p_attribute19                  in varchar2         default null,
322   p_attribute20                  in varchar2         default null,
323   p_jurisdiction_level           in number           default null,
324   p_tax_type                     in varchar2         default null,
325   p_exclusion_rule_id            in number           default null,
326   p_category_name                in varchar2         default null,
327   p_base_balance_type_id         in number           default null,
328   p_base_balance_name            in varchar2         default null,
329   p_input_value_id               in number           default null,
330   p_object_version_number        out nocopy number
331   ) is
332 --
333   l_rec	  pay_sbt_shd.g_rec_type;
334   l_proc  varchar2(72) := g_package||'ins';
335 --
336 Begin
337   hr_utility.set_location('Entering:'||l_proc, 5);
338   --
339   -- Call conversion function to turn arguments into the
340   -- p_rec structure.
341   --
342   l_rec :=
343   pay_sbt_shd.convert_args
344   (
345   null,
346   p_template_id,
347   p_assignment_remuneration_flag,
348   p_balance_name,
349   p_balance_uom,
350   p_currency_code,
351   p_comments,
352   p_reporting_name,
353   p_attribute_category,
354   p_attribute1,
355   p_attribute2,
356   p_attribute3,
357   p_attribute4,
358   p_attribute5,
359   p_attribute6,
360   p_attribute7,
361   p_attribute8,
362   p_attribute9,
363   p_attribute10,
364   p_attribute11,
365   p_attribute12,
366   p_attribute13,
367   p_attribute14,
368   p_attribute15,
369   p_attribute16,
370   p_attribute17,
371   p_attribute18,
372   p_attribute19,
373   p_attribute20,
374   p_jurisdiction_level,
375   p_tax_type,
376   p_exclusion_rule_id,
377   null,
378   p_category_name,
379   p_base_balance_type_id,
380   p_base_balance_name,
381   p_input_value_id
382   );
383   --
384   -- Having converted the arguments into the pay_sbt_rec
385   -- plsql record structure we call the corresponding record business process.
386   --
387   ins(p_effective_date, l_rec);
388   --
389   -- As the primary key argument(s)
390   -- are specified as an OUT's we must set these values.
391   --
392   p_balance_type_id := l_rec.balance_type_id;
393   p_object_version_number := l_rec.object_version_number;
394   --
395   hr_utility.set_location(' Leaving:'||l_proc, 10);
396 End ins;
397 --
398 end pay_sbt_ins;