DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SEU_INS

Source


1 Package Body pay_seu_ins as
2 /* $Header: pyseurhi.pkb 115.3 2003/02/05 17:11:00 arashid noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_seu_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_seu_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_shadow_ele_type_usages
66   --
67   insert into pay_shadow_ele_type_usages
68       (element_type_usage_id
69       ,element_type_id
70       ,inclusion_flag
71       ,run_type_name
72       ,exclusion_rule_id
73       ,object_version_number
74       )
75   Values
76     (p_rec.element_type_usage_id
77     ,p_rec.element_type_id
78     ,p_rec.inclusion_flag
79     ,p_rec.run_type_name
80     ,p_rec.exclusion_rule_id
81     ,p_rec.object_version_number
82     );
83   --
84   --
85   --
86   hr_utility.set_location(' Leaving:'||l_proc, 10);
87 Exception
88   When hr_api.check_integrity_violated Then
89     -- A check constraint has been violated
90     --
91     pay_seu_shd.constraint_error
92       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
93   When hr_api.parent_integrity_violated Then
94     -- Parent integrity has been violated
95     --
96     pay_seu_shd.constraint_error
97       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
98   When hr_api.unique_integrity_violated Then
99     -- Unique integrity has been violated
100     --
101     pay_seu_shd.constraint_error
102       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
103   When Others Then
104     --
105     Raise;
106 End insert_dml;
107 --
108 -- ----------------------------------------------------------------------------
109 -- |------------------------------< pre_insert >------------------------------|
110 -- ----------------------------------------------------------------------------
111 -- {Start Of Comments}
112 --
113 -- Description:
114 --   This private procedure contains any processing which is required before
115 --   the insert dml. Presently, if the entity has a corresponding primary
116 --   key which is maintained by an associating sequence, the primary key for
117 --   the entity will be populated with the next sequence value in
118 --   preparation for the insert dml.
119 --
120 -- Prerequisites:
121 --   This is an internal procedure which is called from the ins procedure.
122 --
123 -- In Parameters:
124 --   A Pl/Sql record structre.
125 --
126 -- Post Success:
127 --   Processing continues.
128 --
129 -- Post Failure:
130 --   If an error has occurred, an error message and exception will be raised
131 --   but not handled.
132 --
133 -- Developer Implementation Notes:
134 --   Any pre-processing required before the insert dml is issued should be
135 --   coded within this procedure. As stated above, a good example is the
136 --   generation of a primary key number via a corresponding sequence.
137 --   It is important to note that any 3rd party maintenance should be reviewed
138 --   before placing in this procedure.
139 --
140 -- Access Status:
141 --   Internal Row Handler Use Only.
142 --
143 -- {End Of Comments}
144 -- ----------------------------------------------------------------------------
145 Procedure pre_insert
146   (p_rec  in out nocopy pay_seu_shd.g_rec_type
147   ) is
148 --
149   l_proc  varchar2(72) := g_package||'pre_insert';
150 --
151   Cursor C_Sel1 is select pay_shadow_ele_type_usages_s.nextval from sys.dual;
152 --
153 Begin
154   hr_utility.set_location('Entering:'||l_proc, 5);
155   --
156   --
157   -- Select the next sequence number
158   --
159   Open C_Sel1;
160   Fetch C_Sel1 Into p_rec.element_type_usage_id;
161   Close C_Sel1;
162   --
163   hr_utility.set_location(' Leaving:'||l_proc, 10);
164 End pre_insert;
165 --
166 -- ----------------------------------------------------------------------------
167 -- |-----------------------------< post_insert >------------------------------|
168 -- ----------------------------------------------------------------------------
169 -- {Start Of Comments}
170 --
171 -- Description:
172 --   This private procedure contains any processing which is required after the
173 --   insert dml.
174 --
175 -- Prerequisites:
176 --   This is an internal procedure which is called from the ins procedure.
177 --
178 -- In Parameters:
179 --   A Pl/Sql record structre.
180 --
181 -- Post Success:
182 --   Processing continues.
183 --
184 -- Post Failure:
185 --   If an error has occurred, an error message and exception will be raised
186 --   but not handled.
187 --
188 -- Developer Implementation Notes:
189 --   Any post-processing required after the insert dml is issued should be
190 --   coded within this procedure. It is important to note that any 3rd party
191 --   maintenance should be reviewed before placing in this procedure.
192 --
193 -- Access Status:
194 --   Internal Row Handler Use Only.
195 --
196 -- {End Of Comments}
197 -- ----------------------------------------------------------------------------
198 Procedure post_insert
199   (p_effective_date               in date
200   ,p_rec                          in pay_seu_shd.g_rec_type
201   ) is
202 --
203   l_proc  varchar2(72) := g_package||'post_insert';
204 --
205 Begin
206   hr_utility.set_location('Entering:'||l_proc, 5);
207   --
208   hr_utility.set_location(' Leaving:'||l_proc, 10);
209 End post_insert;
210 --
211 -- ----------------------------------------------------------------------------
212 -- |---------------------------------< ins >----------------------------------|
213 -- ----------------------------------------------------------------------------
214 Procedure ins
215   (p_effective_date               in date
216   ,p_rec                          in out nocopy pay_seu_shd.g_rec_type
217   ) is
218 --
219   l_proc  varchar2(72) := g_package||'ins';
220 --
221 Begin
222   hr_utility.set_location('Entering:'||l_proc, 5);
223   --
224   -- Call the supporting insert validate operations
225   --
226   pay_seu_bus.insert_validate
227      (p_effective_date
228      ,p_rec
229      );
230   --
231   -- Call the supporting pre-insert operation
232   --
233   pay_seu_ins.pre_insert(p_rec);
234   --
235   -- Insert the row
236   --
237   pay_seu_ins.insert_dml(p_rec);
238   --
239   -- Call the supporting post-insert operation
240   --
241   pay_seu_ins.post_insert
242      (p_effective_date
243      ,p_rec
244      );
245   --
246   hr_utility.set_location('Leaving:'||l_proc, 20);
247 end ins;
248 --
249 -- ----------------------------------------------------------------------------
250 -- |---------------------------------< ins >----------------------------------|
251 -- ----------------------------------------------------------------------------
252 Procedure ins
253   (p_effective_date               in     date
254   ,p_element_type_id                in     number
255   ,p_inclusion_flag                 in     varchar2
256   ,p_run_type_name                  in     varchar2
257   ,p_exclusion_rule_id              in     number   default null
258   ,p_element_type_usage_id             out nocopy number
259   ,p_object_version_number             out nocopy number
260   ) is
261 --
262   l_rec	  pay_seu_shd.g_rec_type;
263   l_proc  varchar2(72) := g_package||'ins';
264 --
265 Begin
266   hr_utility.set_location('Entering:'||l_proc, 5);
267   --
268   -- Call conversion function to turn arguments into the
269   -- p_rec structure.
270   --
271   l_rec :=
272   pay_seu_shd.convert_args
273     (null
274     ,p_element_type_id
275     ,p_inclusion_flag
276     ,p_run_type_name
277     ,p_exclusion_rule_id
278     ,null
279     );
280   --
281   -- Having converted the arguments into the pay_seu_rec
282   -- plsql record structure we call the corresponding record business process.
283   --
284   pay_seu_ins.ins
285      (p_effective_date
286      ,l_rec
287      );
288   --
289   -- As the primary key argument(s)
290   -- are specified as an OUT's we must set these values.
291   --
292   p_element_type_usage_id := l_rec.element_type_usage_id;
293   p_object_version_number := l_rec.object_version_number;
294   --
295   hr_utility.set_location(' Leaving:'||l_proc, 10);
296 End ins;
297 --
298 end pay_seu_ins;