DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_DTE_INS

Source


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