DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_TCT_INS

Source


1 Package Body pqh_tct_ins as
2 /* $Header: pqtctrhi.pkb 120.7 2011/04/28 09:34:04 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pqh_tct_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 insert the row into the schema.
21 --   3) To trap any constraint violations that may have occurred.
22 --   4) To raise any other errors.
23 --
24 -- Prerequisites:
25 --   This is an internal private procedure which must be called from the ins
26 --   procedure and must have all mandatory attributes set (except the
27 --   object_version_number which is initialised within this procedure).
28 --
29 -- In Parameters:
30 --   A Pl/Sql record structre.
31 --
32 -- Post Success:
33 --   The specified row will be inserted into the schema.
34 --
35 -- Post Failure:
36 --   If a check, unique or parent integrity constraint violation is raised the
37 --   constraint_error procedure will be called.
38 --
39 -- Developer Implementation Notes:
40 --   None.
41 --
42 -- Access Status:
43 --   Internal Row Handler Use Only.
44 --
45 -- {End Of Comments}
46 -- ----------------------------------------------------------------------------
47 Procedure insert_dml(p_rec in out nocopy pqh_tct_shd.g_rec_type) is
48 --
49   l_proc  varchar2(72) := g_package||'insert_dml';
50 --
51 Begin
52   hr_utility.set_location('Entering:'||l_proc, 5);
53   p_rec.object_version_number := 1;  -- Initialise the object version
54   --
55   --
56   -- Added the following code as a part of Zero Downtime Patching Project.
57   -- Code Starts Here.
58   --
59   PER_RIC_PKG.chk_integrity (
60     p_entity_name=>'PQH_TRANSACTION_CATEGORIES',
61     p_ref_entity_info=>
62       PER_RIC_PKG.ref_entity_tbl(
63         PER_RIC_PKG.ref_info_rec('PQH_TABLE_ROUTE',PER_RIC_PKG.column_info_tbl(
64           PER_RIC_PKG.col_info_rec('TABLE_ROUTE_ID',NULL,p_rec.consolidated_table_route_id, NULL))),
65         PER_RIC_PKG.ref_info_rec('PQH_TABLE_ROUTE',PER_RIC_PKG.column_info_tbl(
66           PER_RIC_PKG.col_info_rec('TABLE_ROUTE_ID',NULL,p_rec.master_table_route_id, NULL)))),
67     p_ref_type=>'INS');
68   --
69   --
70   -- Code Ends Here
71   --
72   -- Insert the row into: pqh_transaction_categories
73   --
74   insert into pqh_transaction_categories
75   (	transaction_category_id,
76 	custom_wf_process_name,
77 	custom_workflow_name,
78 	form_name,
79 	freeze_status_cd,
80 	future_action_cd,
81 	member_cd,
82 	name,
83         short_name,
84 	post_style_cd,
85 	post_txn_function,
86 	route_validated_txn_flag,
87 	prevent_approver_skip,
88         workflow_enable_flag,
89         enable_flag,
90 	timeout_days,
91 	object_version_number,
92 	consolidated_table_route_id ,
93         business_group_id,
94         setup_type_cd,
95 	Master_table_route_id
96   )
97   Values
98   (	p_rec.transaction_category_id,
99 	p_rec.custom_wf_process_name,
100 	p_rec.custom_workflow_name,
101 	p_rec.form_name,
102 	p_rec.freeze_status_cd,
103 	p_rec.future_action_cd,
104 	p_rec.member_cd,
105 	p_rec.name,
106         p_rec.short_name,
107 	p_rec.post_style_cd,
108 	p_rec.post_txn_function,
109 	p_rec.route_validated_txn_flag,
110 	p_rec.prevent_approver_skip,
111         p_rec.workflow_enable_flag,
112         p_rec.enable_flag,
113 	p_rec.timeout_days,
114 	p_rec.object_version_number,
115 	p_rec.consolidated_table_route_id ,
116         p_rec.business_group_id,
117         p_rec.setup_type_cd,
118 	p_rec.master_table_route_id
119   );
120   --
121   --
122   hr_utility.set_location(' Leaving:'||l_proc, 10);
123 Exception
124   When hr_api.check_integrity_violated Then
125     -- A check constraint has been violated
126     pqh_tct_shd.constraint_error
127       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
128   When hr_api.parent_integrity_violated Then
129     -- Parent integrity has been violated
130     pqh_tct_shd.constraint_error
131       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
132   When hr_api.unique_integrity_violated Then
133     -- Unique integrity has been violated
134     pqh_tct_shd.constraint_error
135       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
136   When Others Then
137     Raise;
138 End insert_dml;
139 --
140 -- ----------------------------------------------------------------------------
141 -- |------------------------------< pre_insert >------------------------------|
142 -- ----------------------------------------------------------------------------
143 -- {Start Of Comments}
144 --
145 -- Description:
146 --   This private procedure contains any processing which is required before
147 --   the insert dml. Presently, if the entity has a corresponding primary
148 --   key which is maintained by an associating sequence, the primary key for
149 --   the entity will be populated with the next sequence value in
150 --   preparation for the insert dml.
151 --
152 -- Prerequisites:
153 --   This is an internal procedure which is called from the ins procedure.
154 --
155 -- In Parameters:
156 --   A Pl/Sql record structre.
157 --
158 -- Post Success:
159 --   Processing continues.
160 --
161 -- Post Failure:
162 --   If an error has occurred, an error message and exception will be raised
163 --   but not handled.
164 --
165 -- Developer Implementation Notes:
166 --   Any pre-processing required before the insert dml is issued should be
167 --   coded within this procedure. As stated above, a good example is the
168 --   generation of a primary key number via a corresponding sequence.
169 --   It is important to note that any 3rd party maintenance should be reviewed
170 --   before placing in this procedure.
171 --
172 -- Access Status:
173 --   Internal Row Handler Use Only.
174 --
175 -- {End Of Comments}
176 -- ----------------------------------------------------------------------------
177 Procedure pre_insert(p_rec  in out nocopy pqh_tct_shd.g_rec_type) is
178 --
179   l_proc  varchar2(72) := g_package||'pre_insert';
180 --
181   Cursor C_Sel1 is select pqh_transaction_categories_s.nextval from sys.dual;
182 --
183 Begin
184   hr_utility.set_location('Entering:'||l_proc, 5);
185   --
186   --
187   -- Select the next sequence number
188   --
189   Open C_Sel1;
190   Fetch C_Sel1 Into p_rec.transaction_category_id;
191   Close C_Sel1;
192   --
193   hr_utility.set_location(' Leaving:'||l_proc, 10);
194 End pre_insert;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |-----------------------------< post_insert >------------------------------|
198 -- ----------------------------------------------------------------------------
199 -- {Start Of Comments}
200 --
201 -- Description:
202 --   This private procedure contains any processing which is required after the
203 --   insert dml.
204 --
205 -- Prerequisites:
206 --   This is an internal procedure which is called from the ins procedure.
207 --
208 -- In Parameters:
209 --   A Pl/Sql record structre.
210 --
211 -- Post Success:
212 --   Processing continues.
213 --
214 -- Post Failure:
215 --   If an error has occurred, an error message and exception will be raised
216 --   but not handled.
217 --
218 -- Developer Implementation Notes:
219 --   Any post-processing required after the insert dml is issued should be
220 --   coded within this procedure. It is important to note that any 3rd party
221 --   maintenance should be reviewed before placing in this procedure.
222 --
223 -- Access Status:
224 --   Internal Row Handler Use Only.
225 --
226 -- {End Of Comments}
227 -- ----------------------------------------------------------------------------
228 Procedure post_insert(
229 p_effective_date in date,p_rec in pqh_tct_shd.g_rec_type) is
230 --
231   l_proc  varchar2(72) := g_package||'post_insert';
232 --
233 Begin
234   hr_utility.set_location('Entering:'||l_proc, 5);
235 --
236   --
237   -- Start of API User Hook for post_insert.
238   --
239   begin
240     --
241     pqh_tct_rki.after_insert
242       (
243   p_transaction_category_id       =>p_rec.transaction_category_id
244  ,p_custom_wf_process_name        =>p_rec.custom_wf_process_name
245  ,p_custom_workflow_name          =>p_rec.custom_workflow_name
246  ,p_form_name                     =>p_rec.form_name
247  ,p_freeze_status_cd              =>p_rec.freeze_status_cd
248  ,p_future_action_cd              =>p_rec.future_action_cd
249  ,p_member_cd                     =>p_rec.member_cd
250  ,p_name                          =>p_rec.name
251  ,p_short_name                          =>p_rec.short_name
252  ,p_post_style_cd                 =>p_rec.post_style_cd
253  ,p_post_txn_function             =>p_rec.post_txn_function
254  ,p_route_validated_txn_flag      =>p_rec.route_validated_txn_flag
255  ,p_prevent_approver_skip         =>p_rec.prevent_approver_skip
256  ,p_workflow_enable_flag      =>p_rec.workflow_enable_flag
257  ,p_enable_flag      =>p_rec.enable_flag
258  ,p_timeout_days                  =>p_rec.timeout_days
259  ,p_object_version_number         =>p_rec.object_version_number
260  ,p_consolidated_table_route_id   =>p_rec.consolidated_table_route_id
261  ,p_business_group_id             => p_rec.business_group_id
262  ,p_setup_type_cd                 => p_rec.setup_type_cd
263  ,p_master_table_route_id   =>p_rec.master_table_route_id
264  ,p_effective_date                =>p_effective_date
265       );
266     --
267   exception
268     --
269     when hr_api.cannot_find_prog_unit then
270       --
271       hr_api.cannot_find_prog_unit_error
272         (p_module_name => 'pqh_transaction_categories'
273         ,p_hook_type   => 'AI');
274       --
275   end;
276   --
277   -- End of API User Hook for post_insert.
278   --
279   --
280   hr_utility.set_location(' Leaving:'||l_proc, 10);
281 End post_insert;
282 --
283 -- ----------------------------------------------------------------------------
284 -- |---------------------------------< ins >----------------------------------|
285 -- ----------------------------------------------------------------------------
286 Procedure ins
287   (
288   p_effective_date in date,
289   p_rec        in out nocopy pqh_tct_shd.g_rec_type
290   ) is
291 --
292   l_proc  varchar2(72) := g_package||'ins';
293 --
294 Begin
295   hr_utility.set_location('Entering:'||l_proc, 5);
296   --
297   -- Call the supporting insert validate operations
298   --
299   pqh_tct_bus.insert_validate(p_rec
300   ,p_effective_date);
301   --
302   -- Call the supporting pre-insert operation
303   --
304   pre_insert(p_rec);
305   --
306   -- Insert the row
307   --
308   insert_dml(p_rec);
309   --
310   -- Call the supporting post-insert operation
311   --
312   post_insert(
313 p_effective_date,p_rec);
314 end ins;
315 --
316 -- ----------------------------------------------------------------------------
317 -- |---------------------------------< ins >----------------------------------|
318 -- ----------------------------------------------------------------------------
319 Procedure ins
320   (
321   p_effective_date in date,
322   p_transaction_category_id      out nocopy number,
323   p_custom_wf_process_name       in varchar2         default null,
324   p_custom_workflow_name         in varchar2         default null,
325   p_form_name                    in varchar2,
326   p_freeze_status_cd             in varchar2         default null,
327   p_future_action_cd             in varchar2,
328   p_member_cd                    in varchar2,
329   p_name                         in varchar2,
330   p_short_name                   in varchar2,
331   p_post_style_cd                in varchar2,
332   p_post_txn_function            in varchar2,
333   p_route_validated_txn_flag     in varchar2,
334   p_prevent_approver_skip        in varchar2,
335   p_workflow_enable_flag         in varchar2,
336   p_enable_flag         in varchar2,
337   p_timeout_days                 in number           default null,
338   p_object_version_number        out nocopy number,
339   p_consolidated_table_route_id  in number,
340   p_business_group_id            in number           ,
341   p_setup_type_cd                in varchar2         ,
342   p_master_table_route_id  in number
343   ) is
344 --
345   l_rec	  pqh_tct_shd.g_rec_type;
346   l_proc  varchar2(72) := g_package||'ins';
347 --
348 Begin
349   hr_utility.set_location('Entering:'||l_proc, 5);
350   --
351   -- Call conversion function to turn arguments into the
352   -- p_rec structure.
353   --
354   l_rec :=
355   pqh_tct_shd.convert_args
356   (
357   null,
358   p_custom_wf_process_name,
359   p_custom_workflow_name,
360   p_form_name,
361   p_freeze_status_cd,
362   p_future_action_cd,
363   p_member_cd,
364   p_name,
365   p_short_name,
366   p_post_style_cd,
367   p_post_txn_function,
368   p_route_validated_txn_flag,
369   p_prevent_approver_skip,
370   p_workflow_enable_flag,
371   p_enable_flag,
372   p_timeout_days,
373   null,
374   p_consolidated_table_route_id,
375   p_business_group_id,
376   p_setup_type_cd,
377   p_master_table_route_id
378   );
379   --
380   -- Having converted the arguments into the pqh_tct_rec
381   -- plsql record structure we call the corresponding record business process.
382   --
383   ins(
384     p_effective_date,l_rec);
385   --
386   -- As the primary key argument(s)
387   -- are specified as an OUT's we must set these values.
388   --
389   p_transaction_category_id := l_rec.transaction_category_id;
390   p_object_version_number := l_rec.object_version_number;
391   --
392   hr_utility.set_location(' Leaving:'||l_proc, 10);
393 End ins;
394 --
395 end pqh_tct_ins;