DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PSD_UPD

Source


1 Package Body pay_psd_upd as
2 /* $Header: pypsdrhi.pkb 120.1 2005/12/08 05:08 ssekhar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_psd_upd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_update_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the execution of dml from the datetrack mode
17 --   of CORRECTION only. It is important to note that the object version
18 --   number is only increment by 1 because the datetrack correction is
19 --   soley for one datetracked row.
20 --   This procedure controls the actual dml update logic. The functions of
21 --   this procedure are as follows:
22 --   1) Get the next object_version_number.
23 --   2) To set and unset the g_api_dml status as required (as we are about to
24 --      perform dml).
25 --   3) To update the specified row in the schema using the primary key in
26 --      the predicates.
27 --   4) To trap any constraint violations that may have occurred.
28 --   5) To raise any other errors.
29 --
30 -- Prerequisites:
31 --   This is an internal private procedure which must be called from the
32 --   update_dml procedure.
33 --
34 -- In Parameters:
35 --   A Pl/Sql record structure.
36 --
37 -- Post Success:
38 --   The specified row will be updated in the schema.
39 --
40 -- Post Failure:
41 --   On the update dml failure it is important to note that we always reset the
42 --   g_api_dml status to false.
43 --   If a check or unique integrity constraint violation is raised the
44 --   constraint_error procedure will be called.
45 --   If any other error is reported, the error will be raised after the
46 --   g_api_dml status is reset.
47 --
48 -- Developer Implementation Notes:
49 --   The update 'set' arguments list should be modified if any of your
50 --   attributes are not updateable.
51 --
52 -- Access Status:
53 --   Internal Row Handler Use Only.
54 --
55 -- {End Of Comments}
56 -- ----------------------------------------------------------------------------
57 Procedure dt_update_dml
58   (p_rec                   in out nocopy pay_psd_shd.g_rec_type
59   ,p_effective_date        in date
60   ,p_datetrack_mode        in varchar2
61   ,p_validation_start_date in date
62   ,p_validation_end_date   in date
63   ) is
64 --
65   l_proc        varchar2(72) := g_package||'dt_update_dml';
66 --
67 Begin
68   hr_utility.set_location('Entering:'||l_proc, 5);
69   --
70   If (p_datetrack_mode = hr_api.g_correction) then
71     hr_utility.set_location(l_proc, 10);
72     --
73     -- Because we are updating a row we must get the next object
74     -- version number.
75     --
76     p_rec.object_version_number :=
77       dt_api.get_object_version_number
78         (p_base_table_name => 'pay_pl_sii_details_f'
79         ,p_base_key_column => 'sii_details_id'
80         ,p_base_key_value  => p_rec.sii_details_id
81         );
82     --
83     --
84     --
85     -- Update the pay_pl_sii_details_f Row
86     --
87     update  pay_pl_sii_details_f
88     set
89      sii_details_id                       = p_rec.sii_details_id
90     ,per_or_asg_id                        = p_rec.per_or_asg_id
91     ,business_group_id                    = p_rec.business_group_id
92     ,contract_category                    = p_rec.contract_category
93     ,object_version_number                = p_rec.object_version_number
94     ,emp_social_security_info             = p_rec.emp_social_security_info
95     ,old_age_contribution                 = p_rec.old_age_contribution
96     ,pension_contribution                 = p_rec.pension_contribution
97     ,sickness_contribution                = p_rec.sickness_contribution
98     ,work_injury_contribution             = p_rec.work_injury_contribution
99     ,labor_contribution                   = p_rec.labor_contribution
100     ,health_contribution                  = p_rec.health_contribution
101     ,unemployment_contribution            = p_rec.unemployment_contribution
102     ,old_age_cont_end_reason              = p_rec.old_age_cont_end_reason
103     ,pension_cont_end_reason              = p_rec.pension_cont_end_reason
104     ,sickness_cont_end_reason             = p_rec.sickness_cont_end_reason
105     ,work_injury_cont_end_reason          = p_rec.work_injury_cont_end_reason
106     ,labor_fund_cont_end_reason           = p_rec.labor_fund_cont_end_reason
107     ,health_cont_end_reason               = p_rec.health_cont_end_reason
108     ,unemployment_cont_end_reason         = p_rec.unemployment_cont_end_reason
109     ,program_id                           = p_rec.program_id
110     ,program_login_id                     = p_rec.program_login_id
111     ,program_application_id               = p_rec.program_application_id
112     ,request_id                           = p_rec.request_id
113     where   sii_details_id = p_rec.sii_details_id
114     and     effective_start_date = p_validation_start_date
115     and     effective_end_date   = p_validation_end_date;
116     --
117     --
118     --
119     -- Set the effective start and end dates
120     --
121     p_rec.effective_start_date := p_validation_start_date;
122     p_rec.effective_end_date   := p_validation_end_date;
123   End If;
124 --
125 hr_utility.set_location(' Leaving:'||l_proc, 15);
126 Exception
127   When hr_api.check_integrity_violated Then
128     -- A check constraint has been violated
129     --
130     pay_psd_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     --
135     pay_psd_shd.constraint_error
136       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
137   When Others Then
138     --
139     Raise;
140 End dt_update_dml;
141 --
142 -- ----------------------------------------------------------------------------
143 -- |------------------------------< update_dml >------------------------------|
144 -- ----------------------------------------------------------------------------
145 -- {Start Of Comments}
146 --
147 -- Description:
148 --   This procedure calls the dt_update_dml control logic which handles
149 --   the actual datetrack dml.
150 --
151 -- Prerequisites:
152 --   This is an internal private procedure which must be called from the upd
153 --   procedure.
154 --
155 -- In Parameters:
156 --   A Pl/Sql record structre.
157 --
158 -- Post Success:
159 --   Processing contines.
160 --
161 -- Post Failure:
162 --   No specific error handling is required within this procedure.
163 --
164 -- Developer Implementation Notes:
165 --   The update 'set' arguments list should be modified if any of your
166 --   attributes are not updateable.
167 --
168 -- Access Status:
169 --   Internal Row Handler Use Only.
170 --
171 -- {End Of Comments}
172 -- ----------------------------------------------------------------------------
173 Procedure update_dml
174   (p_rec                      in out nocopy pay_psd_shd.g_rec_type
175   ,p_effective_date           in date
176   ,p_datetrack_mode           in varchar2
177   ,p_validation_start_date    in date
178   ,p_validation_end_date      in date
179   ) is
180 --
181   l_proc        varchar2(72) := g_package||'update_dml';
182 --
183 Begin
184   hr_utility.set_location('Entering:'||l_proc, 5);
185   --
186   pay_psd_upd.dt_update_dml
187     (p_rec                   => p_rec
188     ,p_effective_date        => p_effective_date
189     ,p_datetrack_mode        => p_datetrack_mode
190     ,p_validation_start_date => p_validation_start_date
191     ,p_validation_end_date   => p_validation_end_date
192     );
193   --
194   hr_utility.set_location(' Leaving:'||l_proc, 10);
195 End update_dml;
196 --
197 -- ----------------------------------------------------------------------------
198 -- |----------------------------< dt_pre_update >-----------------------------|
199 -- ----------------------------------------------------------------------------
200 -- {Start Of Comments}
201 --
202 -- Description:
203 --   The dt_pre_update procedure controls the execution
204 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
205 --   and UPDATE_CHANGE_INSERT only. The execution required is as
206 --   follows:
207 --
208 --   1) Providing the datetrack update mode is not 'CORRECTION'
209 --      then set the effective end date of the current row (this
210 --      will be the validation_start_date - 1).
211 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
212 --      corresponding delete_dml process to delete any future rows
213 --      where the effective_start_date is greater than or equal to
214 --      the validation_start_date.
215 --   3) Call the insert_dml process to insert the new updated row
216 --      details.
217 --
218 -- Prerequisites:
219 --   This is an internal procedure which is called from the
220 --   pre_update procedure.
221 --
222 -- In Parameters:
223 --
224 -- Post Success:
225 --   Processing continues.
226 --
227 -- Post Failure:
228 --   If an error has occurred, an error message and exception will be raised
229 --   but not handled.
230 --
231 -- Developer Implementation Notes:
232 --   This is an internal procedure which is required by Datetrack. Don't
233 --   remove or modify.
234 --
235 -- Access Status:
236 --   Internal Row Handler Use Only.
237 --
238 -- {End Of Comments}
239 -- ----------------------------------------------------------------------------
240 Procedure dt_pre_update
241   (p_rec                     in out  nocopy   pay_psd_shd.g_rec_type
242   ,p_effective_date          in date
243   ,p_datetrack_mode          in varchar2
244   ,p_validation_start_date   in date
245   ,p_validation_end_date     in date
246   ) is
247 --
248   l_proc                 varchar2(72) := g_package||'dt_pre_update';
249   l_dummy_version_number number;
250 --
251 Begin
252   hr_utility.set_location('Entering:'||l_proc, 5);
253   If (p_datetrack_mode <> hr_api.g_correction) then
254     --
255     -- Update the current effective end date
256     --
257     pay_psd_shd.upd_effective_end_date
258       (p_effective_date         => p_effective_date
259       ,p_base_key_value         => p_rec.sii_details_id
260       ,p_new_effective_end_date => (p_validation_start_date - 1)
261       ,p_validation_start_date  => p_validation_start_date
262       ,p_validation_end_date    => p_validation_end_date
263       ,p_object_version_number  => l_dummy_version_number
264       );
265     --
266     If (p_datetrack_mode = hr_api.g_update_override) then
267       --
268       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
269       -- delete any future rows
270       --
271       pay_psd_del.delete_dml
272         (p_rec                   => p_rec
273         ,p_effective_date        => p_effective_date
274         ,p_datetrack_mode        => p_datetrack_mode
275         ,p_validation_start_date => p_validation_start_date
276         ,p_validation_end_date   => p_validation_end_date
277         );
278     End If;
279     --
280     -- We must now insert the updated row
281     --
282     pay_psd_ins.insert_dml
283       (p_rec                    => p_rec
284       ,p_effective_date         => p_effective_date
285       ,p_datetrack_mode         => p_datetrack_mode
286       ,p_validation_start_date  => p_validation_start_date
287       ,p_validation_end_date    => p_validation_end_date
288       );
289   End If;
290   hr_utility.set_location(' Leaving:'||l_proc, 20);
291 End dt_pre_update;
292 --
293 -- ----------------------------------------------------------------------------
294 -- |------------------------------< pre_update >------------------------------|
295 -- ----------------------------------------------------------------------------
296 -- {Start Of Comments}
297 --
298 -- Description:
299 --   This private procedure contains any processing which is required before
300 --   the update dml.
301 --
302 -- Prerequisites:
303 --   This is an internal procedure which is called from the upd procedure.
304 --
305 -- In Parameters:
306 --   A Pl/Sql record structure.
307 --
308 -- Post Success:
309 --   Processing continues.
310 --
311 -- Post Failure:
312 --   If an error has occurred, an error message and exception will be raised
313 --   but not handled.
314 -- Developer Implementation Notes:
315 --   Any pre-processing required before the update dml is issued should be
316 --   coded within this procedure. It is important to note that any 3rd party
317 --   maintenance should be reviewed before placing in this procedure. The call
318 --   to the dt_update_dml procedure should NOT be removed.
319 --
320 -- Access Status:
321 --   Internal Row Handler Use Only.
322 --
323 -- {End Of Comments}
324 -- ----------------------------------------------------------------------------
325 Procedure pre_update
326   (p_rec                   in out nocopy pay_psd_shd.g_rec_type
327   ,p_effective_date        in date
328   ,p_datetrack_mode        in varchar2
329   ,p_validation_start_date in date
330   ,p_validation_end_date   in date
331   ) is
332 --
333   l_proc        varchar2(72) := g_package||'pre_update';
334 --
335 Begin
336   hr_utility.set_location('Entering:'||l_proc, 5);
337   --
338   --
339   --
340   dt_pre_update
341     (p_rec                   => p_rec
342     ,p_effective_date        => p_effective_date
343     ,p_datetrack_mode        => p_datetrack_mode
344     ,p_validation_start_date => p_validation_start_date
345     ,p_validation_end_date   => p_validation_end_date
346     );
347   --
348   hr_utility.set_location(' Leaving:'||l_proc, 10);
349 End pre_update;
350 --
351 -- ----------------------------------------------------------------------------
352 -- |----------------------------< post_update >-------------------------------|
353 -- ----------------------------------------------------------------------------
354 -- {Start Of Comments}
355 --
356 -- Description:
357 --   This private procedure contains any processing which is required after
358 --   the update dml.
359 --
360 -- Prerequisites:
361 --   This is an internal procedure which is called from the upd procedure.
362 --
363 -- In Parameters:
364 --   A Pl/Sql record structure.
365 --
366 -- Post Success:
367 --   Processing continues.
368 --
369 -- Post Failure:
370 --   If an error has occurred, an error message and exception will be raised
371 --   but not handled.
372 --
373 -- Developer Implementation Notes:
374 --   Any post-processing required after the update dml is issued should be
375 --   coded within this procedure. It is important to note that any 3rd party
376 --   maintenance should be reviewed before placing in this procedure.
377 --
378 -- Access Status:
379 --   Internal Row Handler Use Only.
380 --
381 -- {End Of Comments}
382 -- ----------------------------------------------------------------------------
383 Procedure post_update
384   (p_rec                   in pay_psd_shd.g_rec_type
385   ,p_effective_date        in date
386   ,p_datetrack_mode        in varchar2
387   ,p_validation_start_date in date
388   ,p_validation_end_date   in date
389   ) is
390 --
391   l_proc        varchar2(72) := g_package||'post_update';
392 --
393 Begin
394   hr_utility.set_location('Entering:'||l_proc, 5);
395   begin
396     --
397     pay_psd_rku.after_update
398       (p_effective_date
399       => p_effective_date
400       ,p_datetrack_mode
401       => p_datetrack_mode
402       ,p_validation_start_date
403       => p_validation_start_date
404       ,p_validation_end_date
405       => p_validation_end_date
406       ,p_sii_details_id
407       => p_rec.sii_details_id
408       ,p_effective_start_date
409       => p_rec.effective_start_date
410       ,p_effective_end_date
411       => p_rec.effective_end_date
412       ,p_object_version_number
413       => p_rec.object_version_number
414       ,p_emp_social_security_info
415       => p_rec.emp_social_security_info
416       ,p_old_age_contribution
417       => p_rec.old_age_contribution
418       ,p_pension_contribution
419       => p_rec.pension_contribution
420       ,p_sickness_contribution
421       => p_rec.sickness_contribution
422       ,p_work_injury_contribution
423       => p_rec.work_injury_contribution
424       ,p_labor_contribution
425       => p_rec.labor_contribution
426       ,p_health_contribution
427       => p_rec.health_contribution
428       ,p_unemployment_contribution
429       => p_rec.unemployment_contribution
430       ,p_old_age_cont_end_reason
431       => p_rec.old_age_cont_end_reason
432       ,p_pension_cont_end_reason
433       => p_rec.pension_cont_end_reason
434       ,p_sickness_cont_end_reason
435       => p_rec.sickness_cont_end_reason
436       ,p_work_injury_cont_end_reason
437       => p_rec.work_injury_cont_end_reason
438       ,p_labor_fund_cont_end_reason
439       => p_rec.labor_fund_cont_end_reason
440       ,p_health_cont_end_reason
441       => p_rec.health_cont_end_reason
442       ,p_unemployment_cont_end_reason
443       => p_rec.unemployment_cont_end_reason
444       ,p_program_id
445       => p_rec.program_id
446       ,p_program_login_id
447       => p_rec.program_login_id
448       ,p_program_application_id
449       => p_rec.program_application_id
450       ,p_request_id
451       => p_rec.request_id
452       ,p_effective_start_date_o
453       => pay_psd_shd.g_old_rec.effective_start_date
454       ,p_effective_end_date_o
455       => pay_psd_shd.g_old_rec.effective_end_date
456       ,p_per_or_asg_id_o
457       => pay_psd_shd.g_old_rec.per_or_asg_id
458       ,p_business_group_id_o
459       => pay_psd_shd.g_old_rec.business_group_id
460       ,p_contract_category_o
461       => pay_psd_shd.g_old_rec.contract_category
462       ,p_object_version_number_o
463       => pay_psd_shd.g_old_rec.object_version_number
464       ,p_emp_social_security_info_o
465       => pay_psd_shd.g_old_rec.emp_social_security_info
466       ,p_old_age_contribution_o
467       => pay_psd_shd.g_old_rec.old_age_contribution
468       ,p_pension_contribution_o
469       => pay_psd_shd.g_old_rec.pension_contribution
470       ,p_sickness_contribution_o
471       => pay_psd_shd.g_old_rec.sickness_contribution
472       ,p_work_injury_contribution_o
473       => pay_psd_shd.g_old_rec.work_injury_contribution
474       ,p_labor_contribution_o
475       => pay_psd_shd.g_old_rec.labor_contribution
476       ,p_health_contribution_o
477       => pay_psd_shd.g_old_rec.health_contribution
478       ,p_unemployment_contribution_o
479       => pay_psd_shd.g_old_rec.unemployment_contribution
480       ,p_old_age_cont_end_reason_o
481       => pay_psd_shd.g_old_rec.old_age_cont_end_reason
482       ,p_pension_cont_end_reason_o
483       => pay_psd_shd.g_old_rec.pension_cont_end_reason
484       ,p_sickness_cont_end_reason_o
485       => pay_psd_shd.g_old_rec.sickness_cont_end_reason
486       ,p_work_injury_cont_end_reaso_o
487       => pay_psd_shd.g_old_rec.work_injury_cont_end_reason
488       ,p_labor_fund_cont_end_reason_o
489       => pay_psd_shd.g_old_rec.labor_fund_cont_end_reason
490       ,p_health_cont_end_reason_o
491       => pay_psd_shd.g_old_rec.health_cont_end_reason
492       ,p_unemployment_cont_end_reas_o
493       => pay_psd_shd.g_old_rec.unemployment_cont_end_reason
494       ,p_program_id_o
495       => pay_psd_shd.g_old_rec.program_id
496       ,p_program_login_id_o
497       => pay_psd_shd.g_old_rec.program_login_id
498       ,p_program_application_id_o
499       => pay_psd_shd.g_old_rec.program_application_id
500       ,p_request_id_o
501       => pay_psd_shd.g_old_rec.request_id
502       );
503     --
504   exception
505     --
506     when hr_api.cannot_find_prog_unit then
507       --
508       hr_api.cannot_find_prog_unit_error
509         (p_module_name => 'PAY_PL_SII_DETAILS_F'
510         ,p_hook_type   => 'AU');
511       --
512   end;
513   --
514   hr_utility.set_location(' Leaving:'||l_proc, 10);
515 End post_update;
516 --
517 -- ----------------------------------------------------------------------------
518 -- |-----------------------------< convert_defs >-----------------------------|
519 -- ----------------------------------------------------------------------------
520 -- {Start Of Comments}
521 --
522 -- Description:
523 --   The Convert_Defs procedure has one very important function:
524 --   It must return the record structure for the row with all system defaulted
525 --   values converted into its corresponding parameter value for update. When
526 --   we attempt to update a row through the Upd process , certain
527 --   parameters can be defaulted which enables flexibility in the calling of
528 --   the upd process (e.g. only attributes which need to be updated need to be
529 --   specified). For the upd process to determine which attributes
530 --   have NOT been specified we need to check if the parameter has a reserved
531 --   system default value. Therefore, for all parameters which have a
532 --   corresponding reserved system default mechanism specified we need to
533 --   check if a system default is being used. If a system default is being
534 --   used then we convert the defaulted value into its corresponding attribute
535 --   value held in the g_old_rec data structure.
536 --
537 -- Prerequisites:
538 --   This private function can only be called from the upd process.
539 --
540 -- In Parameters:
541 --   A Pl/Sql record structure.
542 --
543 -- Post Success:
544 --   The record structure will be returned with all system defaulted parameter
545 --   values converted into its current row attribute value.
546 --
547 -- Post Failure:
548 --   No direct error handling is required within this function. Any possible
549 --   errors within this procedure will be a PL/SQL value error due to
550 --   conversion of datatypes or data lengths.
551 --
552 -- Developer Implementation Notes:
553 --   None.
554 --
555 -- Access Status:
556 --   Internal Row Handler Use Only.
557 --
558 -- {End Of Comments}
559 -- ----------------------------------------------------------------------------
560 Procedure convert_defs
561   (p_rec in out nocopy pay_psd_shd.g_rec_type
562   ) is
563 --
564 Begin
565   --
566   -- We must now examine each argument value in the
567   -- p_rec plsql record structure
568   -- to see if a system default is being used. If a system default
569   -- is being used then we must set to the 'current' argument value.
570   --
571   If (p_rec.per_or_asg_id = hr_api.g_number) then
572     p_rec.per_or_asg_id :=
573     pay_psd_shd.g_old_rec.per_or_asg_id;
574   End If;
575   If (p_rec.business_group_id = hr_api.g_number) then
576     p_rec.business_group_id :=
577     pay_psd_shd.g_old_rec.business_group_id;
578   End If;
579   If (p_rec.contract_category = hr_api.g_varchar2) then
580     p_rec.contract_category :=
581     pay_psd_shd.g_old_rec.contract_category;
582   End If;
583   If (p_rec.emp_social_security_info = hr_api.g_varchar2) then
584     p_rec.emp_social_security_info :=
585     pay_psd_shd.g_old_rec.emp_social_security_info;
586   End If;
587   If (p_rec.old_age_contribution = hr_api.g_varchar2) then
588     p_rec.old_age_contribution :=
589     pay_psd_shd.g_old_rec.old_age_contribution;
590   End If;
591   If (p_rec.pension_contribution = hr_api.g_varchar2) then
592     p_rec.pension_contribution :=
593     pay_psd_shd.g_old_rec.pension_contribution;
594   End If;
595   If (p_rec.sickness_contribution = hr_api.g_varchar2) then
596     p_rec.sickness_contribution :=
597     pay_psd_shd.g_old_rec.sickness_contribution;
598   End If;
599   If (p_rec.work_injury_contribution = hr_api.g_varchar2) then
600     p_rec.work_injury_contribution :=
601     pay_psd_shd.g_old_rec.work_injury_contribution;
602   End If;
603   If (p_rec.labor_contribution = hr_api.g_varchar2) then
604     p_rec.labor_contribution :=
605     pay_psd_shd.g_old_rec.labor_contribution;
606   End If;
607   If (p_rec.health_contribution = hr_api.g_varchar2) then
608     p_rec.health_contribution :=
609     pay_psd_shd.g_old_rec.health_contribution;
610   End If;
611   If (p_rec.unemployment_contribution = hr_api.g_varchar2) then
612     p_rec.unemployment_contribution :=
613     pay_psd_shd.g_old_rec.unemployment_contribution;
614   End If;
615   If (p_rec.old_age_cont_end_reason = hr_api.g_varchar2) then
616     p_rec.old_age_cont_end_reason :=
617     pay_psd_shd.g_old_rec.old_age_cont_end_reason;
618   End If;
619   If (p_rec.pension_cont_end_reason = hr_api.g_varchar2) then
620     p_rec.pension_cont_end_reason :=
621     pay_psd_shd.g_old_rec.pension_cont_end_reason;
622   End If;
623   If (p_rec.sickness_cont_end_reason = hr_api.g_varchar2) then
624     p_rec.sickness_cont_end_reason :=
625     pay_psd_shd.g_old_rec.sickness_cont_end_reason;
626   End If;
627   If (p_rec.work_injury_cont_end_reason = hr_api.g_varchar2) then
628     p_rec.work_injury_cont_end_reason :=
629     pay_psd_shd.g_old_rec.work_injury_cont_end_reason;
630   End If;
631   If (p_rec.labor_fund_cont_end_reason = hr_api.g_varchar2) then
632     p_rec.labor_fund_cont_end_reason :=
633     pay_psd_shd.g_old_rec.labor_fund_cont_end_reason;
634   End If;
635   If (p_rec.health_cont_end_reason = hr_api.g_varchar2) then
636     p_rec.health_cont_end_reason :=
637     pay_psd_shd.g_old_rec.health_cont_end_reason;
638   End If;
639   If (p_rec.unemployment_cont_end_reason = hr_api.g_varchar2) then
640     p_rec.unemployment_cont_end_reason :=
641     pay_psd_shd.g_old_rec.unemployment_cont_end_reason;
642   End If;
643   If (p_rec.program_id = hr_api.g_number) then
644     p_rec.program_id :=
645     pay_psd_shd.g_old_rec.program_id;
646   End If;
647   If (p_rec.program_login_id = hr_api.g_number) then
648     p_rec.program_login_id :=
649     pay_psd_shd.g_old_rec.program_login_id;
650   End If;
651   If (p_rec.program_application_id = hr_api.g_number) then
652     p_rec.program_application_id :=
653     pay_psd_shd.g_old_rec.program_application_id;
654   End If;
655   If (p_rec.request_id = hr_api.g_number) then
656     p_rec.request_id :=
657     pay_psd_shd.g_old_rec.request_id;
658   End If;
659   --
660 End convert_defs;
661 --
662 -- ----------------------------------------------------------------------------
663 -- |---------------------------------< upd >----------------------------------|
664 -- ----------------------------------------------------------------------------
665 Procedure upd
666   (p_effective_date in     date
667   ,p_datetrack_mode in     varchar2
668   ,p_rec            in out nocopy pay_psd_shd.g_rec_type
669   ) is
670 --
671   l_proc                        varchar2(72) := g_package||'upd';
672   l_validation_start_date       date;
673   l_validation_end_date         date;
674 --
675 Begin
676   hr_utility.set_location('Entering:'||l_proc, 5);
677   --
678   -- Ensure that the DateTrack update mode is valid
679   --
680   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
681   --
682   -- We must lock the row which we need to update.
683   --
684   pay_psd_shd.lck
685     (p_effective_date                   => p_effective_date
686     ,p_datetrack_mode                   => p_datetrack_mode
687     ,p_sii_details_id                   => p_rec.sii_details_id
688     ,p_object_version_number            => p_rec.object_version_number
689     ,p_validation_start_date            => l_validation_start_date
690     ,p_validation_end_date              => l_validation_end_date
691     );
692   --
693   -- 1. During an update system defaults are used to determine if
694   --    arguments have been defaulted or not. We must therefore
695   --    derive the full record structure values to be updated.
696   --
697   -- 2. Call the supporting update validate operations.
698   --
699   pay_psd_upd.convert_defs(p_rec);
700   --
701   pay_psd_bus.update_validate
702     (p_rec                              => p_rec
703     ,p_effective_date                   => p_effective_date
704     ,p_datetrack_mode                   => p_datetrack_mode
705     ,p_validation_start_date            => l_validation_start_date
706     ,p_validation_end_date              => l_validation_end_date
707     );
708   --
709   -- Call to raise any errors on multi-message list
710   hr_multi_message.end_validation_set;
711   --
712   -- Call the supporting pre-update operation
713   --
714   pre_update
715     (p_rec                              => p_rec
716     ,p_effective_date                   => p_effective_date
717     ,p_datetrack_mode                   => p_datetrack_mode
718     ,p_validation_start_date            => l_validation_start_date
719     ,p_validation_end_date              => l_validation_end_date
720     );
721   --
722   -- Update the row.
723   --
724   update_dml
725     (p_rec                              => p_rec
726     ,p_effective_date                   => p_effective_date
727     ,p_datetrack_mode                   => p_datetrack_mode
728     ,p_validation_start_date            => l_validation_start_date
729     ,p_validation_end_date                  => l_validation_end_date
730     );
731   --
732   -- Call the supporting post-update operation
733   --
734   post_update
735     (p_rec                              => p_rec
736     ,p_effective_date                   => p_effective_date
737     ,p_datetrack_mode                   => p_datetrack_mode
738     ,p_validation_start_date            => l_validation_start_date
739     ,p_validation_end_date              => l_validation_end_date
740     );
741   --
742   -- Call to raise any errors on multi-message list
743   hr_multi_message.end_validation_set;
744 End upd;
745 --
746 -- ----------------------------------------------------------------------------
747 -- |------------------------------< upd >-------------------------------------|
748 -- ----------------------------------------------------------------------------
749 Procedure upd
750   (p_effective_date               in     date
751   ,p_datetrack_mode               in     varchar2
752   ,p_sii_details_id               in     number
753   ,p_object_version_number        in out nocopy number
754   ,p_emp_social_security_info     in     varchar2  default hr_api.g_varchar2
755   ,p_old_age_contribution         in     varchar2  default hr_api.g_varchar2
756   ,p_pension_contribution         in     varchar2  default hr_api.g_varchar2
757   ,p_sickness_contribution        in     varchar2  default hr_api.g_varchar2
758   ,p_work_injury_contribution     in     varchar2  default hr_api.g_varchar2
759   ,p_labor_contribution           in     varchar2  default hr_api.g_varchar2
760   ,p_health_contribution          in     varchar2  default hr_api.g_varchar2
761   ,p_unemployment_contribution    in     varchar2  default hr_api.g_varchar2
762   ,p_old_age_cont_end_reason      in     varchar2  default hr_api.g_varchar2
763   ,p_pension_cont_end_reason      in     varchar2  default hr_api.g_varchar2
764   ,p_sickness_cont_end_reason     in     varchar2  default hr_api.g_varchar2
765   ,p_work_injury_cont_end_reason  in     varchar2  default hr_api.g_varchar2
766   ,p_labor_fund_cont_end_reason   in     varchar2  default hr_api.g_varchar2
767   ,p_health_cont_end_reason       in     varchar2  default hr_api.g_varchar2
768   ,p_unemployment_cont_end_reason in     varchar2  default hr_api.g_varchar2
769   ,p_program_id                   in     number    default hr_api.g_number
770   ,p_program_login_id             in     number    default hr_api.g_number
771   ,p_program_application_id       in     number    default hr_api.g_number
772   ,p_request_id                   in     number    default hr_api.g_number
773   ,p_effective_start_date            out nocopy date
774   ,p_effective_end_date              out nocopy date
775   ) is
776 --
777   l_rec         pay_psd_shd.g_rec_type;
778   l_proc        varchar2(72) := g_package||'upd';
779 --
780 Begin
781   hr_utility.set_location('Entering:'||l_proc, 5);
782   --
783   -- Call conversion function to turn arguments into the
784   -- l_rec structure.
785   --
786   l_rec :=
787   pay_psd_shd.convert_args
788     (p_sii_details_id
789     ,null
790     ,null
791     ,hr_api.g_number
792     ,hr_api.g_number
793     ,hr_api.g_varchar2
794     ,p_object_version_number
795     ,p_emp_social_security_info
796     ,p_old_age_contribution
797     ,p_pension_contribution
798     ,p_sickness_contribution
799     ,p_work_injury_contribution
800     ,p_labor_contribution
801     ,p_health_contribution
802     ,p_unemployment_contribution
803     ,p_old_age_cont_end_reason
804     ,p_pension_cont_end_reason
805     ,p_sickness_cont_end_reason
806     ,p_work_injury_cont_end_reason
807     ,p_labor_fund_cont_end_reason
808     ,p_health_cont_end_reason
809     ,p_unemployment_cont_end_reason
810     ,p_program_id
811     ,p_program_login_id
812     ,p_program_application_id
813     ,p_request_id
814     );
815   --
816   -- Having converted the arguments into the
817   -- plsql record structure we call the corresponding record
818   -- business process.
819   --
820   pay_psd_upd.upd
821     (p_effective_date
822     ,p_datetrack_mode
823     ,l_rec
824     );
825   --
826   -- Set the out parameters
827   --
828   p_object_version_number            := l_rec.object_version_number;
829   p_effective_start_date             := l_rec.effective_start_date;
830   p_effective_end_date               := l_rec.effective_end_date;
831   --
832   --
833   hr_utility.set_location(' Leaving:'||l_proc, 10);
834 End upd;
835 --
836 end pay_psd_upd;