DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_PSF_UPD

Source


1 Package Body hr_psf_upd as
2 /* $Header: hrpsfrhi.pkb 120.5.12000000.2 2007/02/06 06:59:04 ande ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_psf_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 this
21 --   procedure are as follows:
22 --   1) Get the next object_version_number.
23 --   2) To update the specified row in the schema using the primary key in
24 --      the predicates.
25 --   3) To trap any constraint violations that may have occurred.
26 --   4) To raise any other errors.
27 --
28 -- Prerequisites:
29 --   This is an internal private procedure which must be called from the
30 --   update_dml procedure.
31 --
32 -- In Parameters:
33 --   A Pl/Sql record structre.
34 --
35 -- Post Success:
36 --   The specified row will be updated in the schema.
37 --
38 -- Post Failure:
39 --   If a check or unique integrity constraint violation is raised the
40 --   constraint_error procedure will be called.
41 --
42 -- Developer Implementation Notes:
43 --   The update 'set' arguments list should be modified if any of your
44 --   attributes are not updateable.
45 --
46 -- Access Status:
47 --   Internal Row Handler Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure dt_update_dml
52    (p_rec          in out nocopy hr_psf_shd.g_rec_type,
53     p_effective_date  in   date,
54     p_datetrack_mode  in   varchar2,
55     p_validation_start_date in   date,
56     p_validation_end_date   in   date) is
57 --
58   l_proc varchar2(72)  ;
59 --
60 Begin
61 if g_debug then
62 l_proc    := g_package||'dt_update_dml';
63   hr_utility.set_location('Entering:'||l_proc, 5);
64 end if;
65   --
66   -- Added by Anirban for bug #5855944
67 
68     update per_all_positions
69     set
70   	position_id 			= p_rec.position_id,
71 	business_group_id 		= p_rec.business_group_id,
72 	job_id 				= p_rec.job_id,
73 	organization_id 		= p_rec.organization_id,
74 	successor_position_id 		= p_rec.successor_position_id,
75 	relief_position_id 		= p_rec.relief_position_id,
76 	location_id 			= p_rec.location_id,
77 	position_definition_id 		= p_rec.position_definition_id,
78 	date_effective 			= p_rec.date_effective,
79 	comments 			= p_rec.comments,
80 	date_end 			= p_rec.date_end,
81 	frequency 			= p_rec.frequency,
82 	name 				= p_rec.name,
83 	probation_period 		= p_rec.probation_period,
84 	probation_period_units 		= p_rec.probation_period_unit_cd,
85 	replacement_required_flag 	= p_rec.replacement_required_flag,
86 	time_normal_finish 		= p_rec.time_normal_finish,
87 	time_normal_start 		= p_rec.time_normal_start,
88         status 				= p_rec.status,
89 	working_hours 			= p_rec.working_hours,
90 	request_id 			= p_rec.request_id,
91 	program_application_id 		= p_rec.program_application_id,
92 	program_id 			= p_rec.program_id,
93 	program_update_date 		= p_rec.program_update_date,
94 	attribute_category 		= p_rec.attribute_category,
95 	attribute1                      = p_rec.attribute1,
96 	attribute2                      = p_rec.attribute2,
97 	attribute3                      = p_rec.attribute3,
98 	attribute4                      = p_rec.attribute4,
99 	attribute5                      = p_rec.attribute5,
100 	attribute6                      = p_rec.attribute6,
101 	attribute7                      = p_rec.attribute7,
102 	attribute8                      = p_rec.attribute8,
103 	attribute9                      = p_rec.attribute9,
104 	attribute10                     = p_rec.attribute10,
105 	attribute11                     = p_rec.attribute11,
106 	attribute12                     = p_rec.attribute12,
107 	attribute13                     = p_rec.attribute13,
108 	attribute14                     = p_rec.attribute14,
109 	attribute15                     = p_rec.attribute15,
110 	attribute16                     = p_rec.attribute16,
111 	attribute17                     = p_rec.attribute17,
112 	attribute18                     = p_rec.attribute18,
113 	attribute19                     = p_rec.attribute19,
114 	attribute20                     = p_rec.attribute20,
115 	object_version_number           = p_rec.object_version_number
116 
117    where   position_id = p_rec.position_id ;
118 
119     -- End Addition by Anirban
120   If (p_datetrack_mode = 'CORRECTION') then
121 if g_debug then
122     hr_utility.set_location(l_proc, 10);
123 end if;
124     --
125     -- Because we are updating a row we must get the next object
126     -- version number.
127     --
128     p_rec.object_version_number :=
129       dt_api.get_object_version_number
130      (p_base_table_name => 'hr_all_positions_f',
131       p_base_key_column => 'position_id',
132       p_base_key_value  => p_rec.position_id);
133     --
134     --
135     -- Update the hr_all_positions_f Row
136     --
137     update  hr_all_positions_f
138     set
139     position_id                     = p_rec.position_id,
140     availability_status_id          = p_rec.availability_status_id,
141     business_group_id               = p_rec.business_group_id,
142     entry_step_id                   = p_rec.entry_step_id,
143     entry_grade_rule_id             = p_rec.entry_grade_rule_id,
144     job_id                          = p_rec.job_id,
145     location_id                     = p_rec.location_id,
146     organization_id                 = p_rec.organization_id,
147     pay_freq_payroll_id             = p_rec.pay_freq_payroll_id,
148     position_definition_id          = p_rec.position_definition_id,
149     position_transaction_id         = p_rec.position_transaction_id,
150     prior_position_id               = p_rec.prior_position_id,
151     relief_position_id              = p_rec.relief_position_id,
152     entry_grade_id           = p_rec.entry_grade_id,
153     successor_position_id           = p_rec.successor_position_id,
154     supervisor_position_id          = p_rec.supervisor_position_id,
155     amendment_date                  = p_rec.amendment_date,
156     amendment_recommendation        = p_rec.amendment_recommendation,
157     amendment_ref_number            = p_rec.amendment_ref_number,
158     bargaining_unit_cd              = p_rec.bargaining_unit_cd,
159     current_job_prop_end_date       = p_rec.current_job_prop_end_date,
160     current_org_prop_end_date       = p_rec.current_org_prop_end_date,
161     avail_status_prop_end_date      = p_rec.avail_status_prop_end_date,
162     date_effective                  = p_rec.date_effective,
163     date_end                        = p_rec.date_end,
164     earliest_hire_date              = p_rec.earliest_hire_date,
165     fill_by_date                    = p_rec.fill_by_date,
166     frequency                       = p_rec.frequency,
167     fte                             = p_rec.fte,
168     max_persons                     = p_rec.max_persons,
169     name                            = p_rec.name,
170     overlap_period                  = p_rec.overlap_period,
171     overlap_unit_cd                 = p_rec.overlap_unit_cd,
172     pay_term_end_day_cd             = p_rec.pay_term_end_day_cd,
173     pay_term_end_month_cd           = p_rec.pay_term_end_month_cd,
174     permanent_temporary_flag        = p_rec.permanent_temporary_flag,
175     permit_recruitment_flag         = p_rec.permit_recruitment_flag,
176     position_type                   = p_rec.position_type,
177     posting_description             = p_rec.posting_description,
178     probation_period                = p_rec.probation_period,
179     probation_period_unit_cd        = p_rec.probation_period_unit_cd,
180     replacement_required_flag       = p_rec.replacement_required_flag,
181     review_flag                     = p_rec.review_flag,
182     seasonal_flag                   = p_rec.seasonal_flag,
183     security_requirements           = p_rec.security_requirements,
184     status                          = p_rec.status,
185     term_start_day_cd               = p_rec.term_start_day_cd,
186     term_start_month_cd             = p_rec.term_start_month_cd,
187     time_normal_finish              = p_rec.time_normal_finish,
188     time_normal_start               = p_rec.time_normal_start,
189     update_source_cd                = p_rec.update_source_cd,
190     working_hours                   = p_rec.working_hours,
191     works_council_approval_flag     = p_rec.works_council_approval_flag,
192     work_period_type_cd             = p_rec.work_period_type_cd,
193     work_term_end_day_cd            = p_rec.work_term_end_day_cd,
194     work_term_end_month_cd          = p_rec.work_term_end_month_cd,
195     comments                        = p_rec.comments,
196     proposed_fte_for_layoff         = p_rec.proposed_fte_for_layoff,
197     proposed_date_for_layoff        = p_rec.proposed_date_for_layoff,
198     pay_basis_id                    = p_rec.pay_basis_id,
199     supervisor_id                   = p_rec.supervisor_id,
200     copied_to_old_table_flag        = p_rec.copied_to_old_table_flag,
201     information1                    = p_rec.information1,
202     information2                    = p_rec.information2,
203     information3                    = p_rec.information3,
204     information4                    = p_rec.information4,
205     information5                    = p_rec.information5,
206     information6                    = p_rec.information6,
207     information7                    = p_rec.information7,
208     information8                    = p_rec.information8,
209     information9                    = p_rec.information9,
210     information10                   = p_rec.information10,
211     information11                   = p_rec.information11,
212     information12                   = p_rec.information12,
213     information13                   = p_rec.information13,
214     information14                   = p_rec.information14,
215     information15                   = p_rec.information15,
216     information16                   = p_rec.information16,
217     information17                   = p_rec.information17,
218     information18                   = p_rec.information18,
219     information19                   = p_rec.information19,
220     information20                   = p_rec.information20,
221     information21                   = p_rec.information21,
222     information22                   = p_rec.information22,
223     information23                   = p_rec.information23,
224     information24                   = p_rec.information24,
225     information25                   = p_rec.information25,
226     information26                   = p_rec.information26,
227     information27                   = p_rec.information27,
228     information28                   = p_rec.information28,
229     information29                   = p_rec.information29,
230     information30                   = p_rec.information30,
231     information_category            = p_rec.information_category,
232     attribute1                      = p_rec.attribute1,
233     attribute2                      = p_rec.attribute2,
234     attribute3                      = p_rec.attribute3,
235     attribute4                      = p_rec.attribute4,
236     attribute5                      = p_rec.attribute5,
237     attribute6                      = p_rec.attribute6,
238     attribute7                      = p_rec.attribute7,
239     attribute8                      = p_rec.attribute8,
240     attribute9                      = p_rec.attribute9,
241     attribute10                     = p_rec.attribute10,
242     attribute11                     = p_rec.attribute11,
243     attribute12                     = p_rec.attribute12,
244     attribute13                     = p_rec.attribute13,
245     attribute14                     = p_rec.attribute14,
246     attribute15                     = p_rec.attribute15,
247     attribute16                     = p_rec.attribute16,
248     attribute17                     = p_rec.attribute17,
249     attribute18                     = p_rec.attribute18,
250     attribute19                     = p_rec.attribute19,
251     attribute20                     = p_rec.attribute20,
252     attribute21                     = p_rec.attribute21,
253     attribute22                     = p_rec.attribute22,
254     attribute23                     = p_rec.attribute23,
255     attribute24                     = p_rec.attribute24,
256     attribute25                     = p_rec.attribute25,
257     attribute26                     = p_rec.attribute26,
258     attribute27                     = p_rec.attribute27,
259     attribute28                     = p_rec.attribute28,
260     attribute29                     = p_rec.attribute29,
261     attribute30                     = p_rec.attribute30,
262     attribute_category              = p_rec.attribute_category,
263     request_id                      = p_rec.request_id,
264     program_application_id          = p_rec.program_application_id,
265     program_id                      = p_rec.program_id,
266     program_update_date             = p_rec.program_update_date,
267     object_version_number           = p_rec.object_version_number
268     where   position_id = p_rec.position_id
269     and     effective_start_date = p_validation_start_date
270     and     effective_end_date   = p_validation_end_date;
271     --
272     --
273     -- Set the effective start and end dates
274     --
275     p_rec.effective_start_date := p_validation_start_date;
276     p_rec.effective_end_date   := p_validation_end_date;
277   End If;
278 --
279 if g_debug then
280 hr_utility.set_location(' Leaving:'||l_proc, 15);
281 end if;
282 Exception
283   When hr_api.check_integrity_violated Then
284     -- A check constraint has been violated
285     hr_psf_shd.constraint_error
286       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
287   When hr_api.unique_integrity_violated Then
288     -- Unique integrity has been violated
289     hr_psf_shd.constraint_error
290       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
291   When Others Then
292     Raise;
293 End dt_update_dml;
294 --
295 -- ----------------------------------------------------------------------------
296 -- |------------------------------< update_dml >------------------------------|
297 -- ----------------------------------------------------------------------------
298 -- {Start Of Comments}
299 --
300 -- Description:
301 --   This procedure calls the dt_update_dml control logic which handles
302 --   the actual datetrack dml.
303 --
304 -- Prerequisites:
305 --   This is an internal private procedure which must be called from the upd
306 --   procedure.
307 --
308 -- In Parameters:
309 --   A Pl/Sql record structre.
310 --
311 -- Post Success:
312 --   Processing contines.
313 --
314 -- Post Failure:
315 --   No specific error handling is required within this procedure.
316 --
317 -- Developer Implementation Notes:
318 --   The update 'set' arguments list should be modified if any of your
319 --   attributes are not updateable.
320 --
321 -- Access Status:
322 --   Internal Row Handler Use Only.
323 --
324 -- {End Of Comments}
325 -- ----------------------------------------------------------------------------
326 Procedure update_dml
327    (p_rec          in out nocopy hr_psf_shd.g_rec_type,
328     p_effective_date  in   date,
329     p_datetrack_mode  in   varchar2,
330     p_validation_start_date in   date,
331     p_validation_end_date   in   date) is
332 --
333   l_proc varchar2(72);
334 --
335 Begin
336 g_debug := hr_utility.debug_enabled;
337 if g_debug then
338  l_proc   := g_package||'update_dml';
339   hr_utility.set_location('Entering:'||l_proc, 5);
340 end if;
341   --
342   dt_update_dml(p_rec         => p_rec,
343       p_effective_date  => p_effective_date,
344       p_datetrack_mode  => p_datetrack_mode,
345             p_validation_start_date => p_validation_start_date,
346       p_validation_end_date   => p_validation_end_date);
347   --
348 if g_debug then
349   hr_utility.set_location(' Leaving:'||l_proc, 10);
350 end if;
351 End update_dml;
352 --
353 -- ----------------------------------------------------------------------------
354 -- |----------------------------< dt_pre_update >-----------------------------|
355 -- ----------------------------------------------------------------------------
356 -- {Start Of Comments}
357 --
358 -- Description:
359 --   The dt_pre_update procedure controls the execution
360 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
361 --   and UPDATE_CHANGE_INSERT only. The execution required is as
362 --   follows:
363 --
364 --   1) Providing the datetrack update mode is not 'CORRECTION'
365 --      then set the effective end date of the current row (this
366 --      will be the validation_start_date - 1).
367 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
368 --      corresponding delete_dml process to delete any future rows
369 --      where the effective_start_date is greater than or equal to
370 -- the validation_start_date.
371 --   3) Call the insert_dml process to insert the new updated row
372 --      details..
373 --
374 -- Prerequisites:
375 --   This is an internal procedure which is called from the
376 --   pre_update procedure.
377 --
378 -- In Parameters:
379 --
380 -- Post Success:
381 --   Processing continues.
382 --
383 -- Post Failure:
384 --   If an error has occurred, an error message and exception will be raised
385 --   but not handled.
386 --
387 -- Developer Implementation Notes:
388 --   This is an internal procedure which is required by Datetrack. Don't
389 --   remove or modify.
390 --
391 -- Access Status:
392 --   Internal Row Handler Use Only.
393 --
394 -- {End Of Comments}
395 -- ----------------------------------------------------------------------------
396 Procedure dt_pre_update
397    (p_rec          in out nocopy hr_psf_shd.g_rec_type,
398     p_effective_date  in   date,
399     p_datetrack_mode  in   varchar2,
400     p_validation_start_date in   date,
401     p_validation_end_date   in   date) is
402 --
403   l_proc          varchar2(72) ;
404   l_dummy_version_number number;
405 --
406 Begin
407 if g_debug then
408  l_proc            := g_package||'dt_pre_update';
409   hr_utility.set_location('Entering:'||l_proc, 5);
410 end if;
411   If (p_datetrack_mode <> 'CORRECTION') then
412 if g_debug then
413     hr_utility.set_location(l_proc, 10);
414 end if;
415     --
416     -- Update the current effective end date
417     --
418     hr_psf_shd.upd_effective_end_date
419      (p_effective_date         => p_effective_date,
420       p_base_key_value         => p_rec.position_id,
421       p_new_effective_end_date => (p_validation_start_date - 1),
422       p_validation_start_date  => p_validation_start_date,
423       p_validation_end_date    => p_validation_end_date,
424       p_object_version_number  => l_dummy_version_number);
425     --
426     If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
427 if g_debug then
428       hr_utility.set_location(l_proc, 15);
429 end if;
430       --
431       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
432       -- delete any future rows,
433       --
434       hr_psf_del.delete_dml
435         (p_rec        => p_rec,
436     p_effective_date  => p_effective_date,
437     p_datetrack_mode  => p_datetrack_mode,
438     p_validation_start_date => p_validation_start_date,
439     p_validation_end_date   => p_validation_end_date);
440     End If;
441 if g_debug then
442     hr_utility.set_location(l_proc, 20);
443 end if;
444     --
445     -- We must now insert the updated row
446     --
447     hr_psf_ins.insert_dml
448       (p_rec         => p_rec,
449        p_effective_date    => p_effective_date,
450        p_datetrack_mode    => p_datetrack_mode,
451        p_validation_start_date   => p_validation_start_date,
452        p_validation_end_date  => p_validation_end_date);
453   End If;
454 End dt_pre_update;
455 --
456 -- This procedure is called before checking any validation trigger
457 -- because many validations are dependent on date_effective and when date_effective
458 -- is going to be changed then validation should happen later only.
459 --
460 procedure update_date_effective
461 (p_rec          in out nocopy hr_psf_shd.g_rec_type
462 ,p_datetrack_mode        in varchar2
463 ,p_effective_date        in date
464 ,p_validation_start_date in out nocopy date
465 ,p_validation_end_date   in date)
466 is
467 l_min_esd date;
468 l_esd date;
469 l_prev_eed date;
470 l_present_stat varchar2(30);
471 l_prev_stat varchar2(30);
472 l_next_esd date;
473 -- cursor to fetch all rows of the position for update
474   cursor pos_all is
475       select date_effective
476       from hr_all_positions_f
477       where position_id  = p_rec.position_id
478       for update of date_effective;
479 
480  -- cursor to fetch minimum effective_start_date
481     cursor pos_min_esd is
482       select min(effective_start_date)
483       from hr_all_positions_f
484       where position_id = p_rec.position_id ;
485 
486 -- cursor to fetch the first row
487      cursor pos_first_row(min_esd date) is
488        select effective_start_date
489        from hr_All_positions_f
490        where position_id = p_rec.position_id and
491              effective_start_date = l_min_esd
492        for update of effective_start_date ;
493 
494 -- cursor to fetch the previous row from database current row
495      cursor pos_prev_row is
496        select effective_end_date
497        from hr_All_positions_f
498        where position_id = p_rec.position_id and
499              effective_end_date = p_validation_start_date -1
500        for update of effective_end_date ;
501 
502 -- cursor to fetch the next active row from database
503      cursor next_active_row(p_effective_date date) is
504        select effective_start_date
505        from hr_All_positions_f pos
506        where position_id = p_rec.position_id
507              and effective_start_date > p_effective_date
508         and hr_psf_shd.get_availability_status(pos.availability_status_id
509         ,p_rec.business_group_id ) = 'ACTIVE'
510        order by effective_start_date ;
511 -- cursor to update the current row in database as effective start date is not passed to api
512      cursor current_row (p_effective_start_date date) is
513         select effective_start_date
514         from hr_all_positions_f
515         where position_id = p_rec.position_id
516         and effective_start_date = p_effective_start_date
517    for update of effective_start_date ;
518 l_chg_date_effective boolean;
519 l_new_date_effective date;
520 l_old_esd date;
521 l_ll  date;
522 l_ul  date;
523 l_updateable boolean;
524 l_proc               varchar2(72) ;
525 begin
526 if g_debug then
527 l_proc                := g_package||'update_date_effective' ;
528    hr_utility.set_location('entering'||l_proc,5);
529 end if;
530    if p_rec.date_effective <> hr_psf_shd.g_old_rec.date_effective then
531       -- user has changed date effective in this record
532 if g_debug then
533       hr_utility.set_location('date effective has been changed'||l_proc,10);
534 end if;
535       if p_datetrack_mode ='CORRECTION' then
536 if g_debug then
537          hr_utility.set_location('datetrack mode correction '||l_proc,20);
538 end if;
539          hr_psf_bus.DE_Update_properties(
540           p_position_id           => p_rec.position_id,
541           p_effective_Start_Date  => hr_psf_shd.g_old_rec.effective_start_date,
542           p_updateable            => l_updateable,
543           p_lower_limit           => l_ll,
544           p_upper_limit           => l_ul);
545          if l_updateable and p_rec.date_effective between l_ll and l_ul then
546             -- and the date effective is between the allowed limits
547             -- change date effective for all records
548 if g_debug then
549             hr_utility.set_location('date effective change valid '||l_proc,30);
550 end if;
551             for i in pos_all loop
552                update hr_all_positions_f
553                set date_effective = p_rec.date_effective
554                where current of pos_all ;
555             end loop;
556             if hr_psf_bus.all_proposed_only_position(p_rec.position_id) then
557 if g_debug then
558                hr_utility.set_location('all_proposed only_position '||l_proc,40);
559 end if;
560                open pos_min_esd;
561                fetch pos_min_esd into l_min_esd;
562                close pos_min_esd;
563                if p_rec.date_effective < l_min_esd then
564              if l_min_esd = p_validation_start_date then
565            -- current row is the first row
566            p_validation_start_date := p_rec.date_effective;
567              end if;
568                   -- date effective is less than esd of first row change the esd of first row
569                   open pos_first_row(l_min_esd);
570                   fetch pos_first_row into l_esd;
571                   update hr_all_positions_f
572                   set effective_start_date = p_rec.date_effective
573         where current of pos_first_row;
574                   close pos_first_row;
575                end if;
576             elsif hr_psf_bus.first_active_position_row(p_rec.position_id,p_validation_start_date) then
577           -- change effective end_date of previous row
578 if g_debug then
579                hr_utility.set_location('first_active_position_row '||l_proc,50);
580 end if;
581           open pos_prev_row;
582           fetch pos_prev_row into l_prev_eed;
583                if l_prev_eed is not null then
584 if g_debug then
585                   hr_utility.set_location('first_active_position_row '||l_proc,55);
586 end if;
587              update hr_all_positions_f
588              set effective_end_date = p_rec.date_effective - 1
589              where current of pos_prev_row;
590                end if;
591           close pos_prev_row;
592 
593           -- current row effective_start_date is changed to date_effective
594                open current_row(hr_psf_shd.g_old_rec.effective_start_date);
595                fetch current_row into l_old_esd;
596                if l_old_esd is not null then
597              p_rec.effective_start_date := p_rec.date_effective;
598                   update hr_all_positions_f
599                   set effective_start_date = p_rec.date_effective
600                   where current of current_row;
601                end if;
602           close current_row;
603           -- form values are also updated to reflect the change
604           p_validation_start_date := p_rec.date_effective;
605             end if;
606 if g_debug then
607             hr_utility.set_location('p_rec.date_effective:'||to_char(p_rec.date_effective)||l_proc, 90);
608 end if;
609          else
610 if g_debug then
611             hr_utility.set_location('DE changed but either non doable or wrong limits'||l_proc,15);
612 end if;
613          end if;
614       else
615          -- raise the error that date_effective cannot be changed in
616          -- any other datetrack mode
617          hr_utility.set_message(800, 'PER_DE_CHANGE_ONLY_CORRECTION');
618          hr_utility.raise_error;
619       end if;
620    else
621 if g_debug then
622       hr_utility.set_location('user has not changed date effective'||l_proc,164);
623 end if;
624    end if;
625    if p_rec.availability_status_id <> hr_psf_shd.g_old_rec.availability_status_id then
626       -- user has changed availability_status_id in this record
627 if g_debug then
628       hr_utility.set_location('Avail_stat changed '||l_proc,60);
629 end if;
630       hr_psf_bus.chk_availability_status_id(p_position_id            => p_rec.position_id
631                                            ,p_business_group_id      => p_rec.business_group_id
632                                            ,p_datetrack_mode         => p_datetrack_mode
633                                            ,p_validation_start_date  => p_validation_start_date
634                                            ,p_availability_status_id => p_rec.availability_status_id
635                                            ,p_effective_date         => p_effective_date
636                                            ,p_date_effective         => p_rec.date_effective
637                                            ,p_object_version_number  => p_rec.object_version_number
638                                            ,p_old_avail_status_id    => hr_psf_shd.g_old_rec.availability_status_id
639                              );
640 if g_debug then
641       hr_utility.set_location('after chk_avail_stat '||l_proc, 70);
642 end if;
643       l_present_stat := hr_psf_shd.get_availability_status(p_rec.availability_status_id,
644                                          p_rec.business_group_id);
645       l_prev_stat := hr_psf_shd.get_availability_status(
646                                          hr_psf_shd.g_old_rec.availability_status_id,
647                                          p_rec.business_group_id);
648       if (hr_psf_bus.all_proposed_only_position(p_rec.position_id))
649     and l_present_stat = 'ACTIVE' then
650 if g_debug then
651          hr_utility.set_location('all_proposed_position'||l_proc, 90);
652 end if;
653     -- all_proposed row changed into first active
654     if p_datetrack_mode ='CORRECTION' then
655 if g_debug then
656             hr_utility.set_location('correction'||l_proc, 95);
657 end if;
658        -- all proposed position chnaged in correction mode to active
659        -- then date_effective should be equal to effective_start_date of current row
660        if p_rec.date_effective <> p_validation_start_date then
661           hr_utility.set_message(800,'PER_DE_EQ_ESD_CORR');
662           hr_utility.raise_error;
663        end if;
664     end if;
665     if p_datetrack_mode ='UPDATE' then
666        -- all proposed position chnaged in correction mode to active
667        -- then date_effective should be equal to effective_start_date of current row
668 if g_debug then
669             hr_utility.set_location('correction'||l_proc, 97);
670 end if;
671        if p_rec.date_effective <> p_effective_date then
672           hr_utility.set_message(800,'PER_DE_EQ_ED_UPD');
673           hr_utility.raise_error;
674        end if;
675     end if;
676       elsif (hr_psf_bus.first_active_position_row(p_rec.position_id,hr_psf_shd.g_old_rec.effective_start_date)) then
677     -- find out the ESD of next active row  and make that as Date_effective and the same
678     -- is to be done for all the records of that position
679 if g_debug then
680          hr_utility.set_location('first_active_position'||l_proc, 80);
681 end if;
682 
683    -- Bug Fix : 3381555
684    if (hr_psf_shd.get_availability_status(p_rec.availability_status_id
685         ,p_rec.business_group_id ) <> 'ELIMINATED' ) then
686         --
687         -- Proposed change is not for eliminate, then get the next active row's esd for the
688         -- given validation_start_date.
689         --
690     open next_active_row(p_validation_start_date);
691     fetch next_active_row into l_next_esd;
692     close next_active_row;
693      --
694     End if;
695 
696     if l_next_esd is not null then
697        -- There exists an active row after the current row
698 if g_debug then
699             hr_utility.set_location('first_active_position'||l_proc, 85);
700 end if;
701             p_rec.date_effective := l_next_esd;
702             for i in pos_all loop
703                update hr_all_positions_f
704                set date_effective = p_rec.date_effective
705                where current of pos_all ;
706             end loop;
707     end if;
708       elsif l_present_stat = 'ACTIVE' and l_prev_stat ='PROPOSED' then
709       -- neither first active nor all proposed but current row becoming first active
710 if g_debug then
711          hr_utility.set_location('making first_active_row'||l_proc, 100);
712 end if;
713     if p_datetrack_mode ='CORRECTION' then
714 if g_debug then
715             hr_utility.set_location('mode correction'||l_proc, 102);
716 end if;
717        -- a proposed position changed in correction mode to active
718        -- then date_effective should be equal to effective_start_date of current row
719        p_rec.date_effective := p_validation_start_date ;
720             for i in pos_all loop
721                update hr_all_positions_f
722                set date_effective = p_rec.date_effective
723                where current of pos_all ;
724             end loop;
725     end if;
726     if p_datetrack_mode ='UPDATE_CHANGE_INSERT'
727             or p_datetrack_mode ='UPDATE_OVERRIDE'
728             or p_datetrack_mode ='UPDATE' then
729 if g_debug then
730             hr_utility.set_location('mode update_change_insert'||l_proc, 112);
731 end if;
732        p_rec.date_effective := p_effective_date ;
733             for i in pos_all loop
734                update hr_all_positions_f
735                set date_effective = p_rec.date_effective
736                where current of pos_all ;
737             end loop;
738     end if;
739       end if;
740    end if;
741 if g_debug then
742    hr_utility.set_location('leaving '||l_proc, 200);
743 end if;
744 end update_date_effective;
745 -- ----------------------------------------------------------------------------
746 -- |------------------------------< pre_update >------------------------------|
747 -- ----------------------------------------------------------------------------
748 -- {Start Of Comments}
749 --
750 -- Description:
751 --   This private procedure contains any processing which is required before
752 --   the update dml.
753 --
754 -- Prerequisites:
755 --   This is an internal procedure which is called from the upd procedure.
756 --
757 -- In Parameters:
758 --   A Pl/Sql record structre.
759 --
760 -- Post Success:
761 --   Processing continues.
762 --
763 -- Post Failure:
764 --   If an error has occurred, an error message and exception will be raised
765 --   but not handled.
766 --
767 -- Developer Implementation Notes:
768 --   Any pre-processing required before the update dml is issued should be
769 --   coded within this procedure. It is important to note that any 3rd party
770 --   maintenance should be reviewed before placing in this procedure. The call
771 --   to the dt_update_dml procedure should NOT be removed.
772 --
773 -- Access Status:
774 --   Internal Row Handler Use Only.
775 --
776 -- {End Of Comments}
777 -- ----------------------------------------------------------------------------
778 Procedure pre_update
779    (p_rec          in out nocopy hr_psf_shd.g_rec_type,
780     p_effective_date  in   date,
781     p_datetrack_mode  in   varchar2,
782     p_validation_start_date in out nocopy date,
783     p_validation_end_date   in out nocopy date) is
784 --
785   l_proc varchar2(72);
786   l_min_esd     date;
787   l_proposed    boolean ;
788   l_active_rows      number ;
789   l_current_row_stat varchar2(30) ;
790   l_new_date_effective date ;
791   l_chg_date_effective boolean ;
792   cursor c1 is
793   select min(effective_start_date)
794   from hr_all_positions_f
795   where position_id = p_rec.position_id;
796 
797 -- cursor to fetch all rows of the position for update
798   cursor pos_all is
799       select date_effective
800       from hr_all_positions_f
801       where position_id  = p_rec.position_id
802       for update of date_effective;
803 
804 -- cursor to fetch the previous row
805   cursor pos_prev is
806     select effective_start_date,effective_end_date
807     from hr_all_positions_f
808     where position_id = p_rec.position_id and
809           effective_end_date = hr_psf_shd.g_old_rec.effective_start_date - 1
810     for update of effective_start_date,effective_end_date;
811 
812 -- cursor to fetch the first row
813      cursor pos_first(p_min_esd date) is
814        select effective_start_date, effective_end_date
815        from hr_All_positions_f
816        where position_id = p_rec.position_id and
817              effective_start_date = p_min_esd
818        for update of effective_start_date ;
819 -- cursor to fetch ESD from current row
820      cursor pos_current(p_effective_date date) is
821        select effective_start_date
822        from hr_All_positions_f
823        where position_id = p_rec.position_id and
824              p_effective_date between effective_start_date and effective_end_date;
825 -- cursor to check active rows for the position prior to the effective_start_date of their row
826     cursor pos_active_rows(p_position_id number,p_effective_start_date date) is
827        select count(*)
828        from hr_all_positions_f pos
829        where pos.position_id = p_position_id
830        and pos.effective_start_date < p_effective_start_date
831        and hr_psf_shd.get_availability_status(pos.availability_status_id
832         ,p_rec.business_group_id ) = 'ACTIVE';
833 Begin
834 
835 if g_debug then
836  l_proc  :=    g_package||'pre_update';
837   hr_utility.set_location('Entering:'|| l_proc, 5);
838 end if;
839 
840   --
841   --
842   --
843   dt_pre_update
844     (p_rec          => p_rec,
845      p_effective_date        => p_effective_date,
846      p_datetrack_mode        => p_datetrack_mode,
847      p_validation_start_date => p_validation_start_date,
848      p_validation_end_date   => p_validation_end_date);
849   --
850   -- Logic to update date_effective on all the position rows
851   -- if date_effective has changed
852   -- if effective_date is changed prior to effective_Start_Date of
853   -- first row, effective_start_Date also moves to the same date
854   --
855   if g_debug then
856   hr_utility.set_location('performing validation '||l_proc, 10);
857   end if;
858 /*
859   if p_rec.date_effective <> hr_psf_shd.g_old_rec.date_effective then
860    --
861    -- check the date_track mode, if it is not correction then
862    -- change in date_effective is not allowed
863    --
864       if p_datetrack_mode <> 'CORRECTION' then
865          -- raise the error that date_effective cannot be changed in
866          -- any other datetrack mode
867          hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
868          hr_utility.set_message_token('PROCEDURE', l_proc);
869          hr_utility.set_message_token('STEP','15');
870          hr_utility.raise_error;
871       end if;
872    --
873    -- update date_effective of the all rows of the position for the
874    -- date_effective
875    --
876     open pos_current(p_effective_date);
877     fetch pos_current into p_rec.effective_start_date;
878     close pos_current;
879 
880     for i in pos_all loop
881         update hr_all_positions_f
882           set date_effective = p_rec.date_effective
883           where current of pos_all ;
884     end loop;
885 
886    -- If the current position is all_proposed then no change in
887    -- start date or end date is performed while first record's start
888    -- is to be changed which is outside the condition
889 
890    l_proposed := hr_psf_bus.all_proposed_only_position(p_rec.position_id);
891 
892    if l_proposed = false then
893        l_current_row_stat := hr_psf_shd.get_availability_status(p_rec.availability_status_id
894         ,p_rec.business_group_id ) ;
895       if l_current_row_stat = 'ACTIVE' then
896        --
897        -- update effective start date of current row
898        --
899         update hr_all_positions_f
900         set effective_Start_date = p_rec.date_effective
901         where position_id = p_rec.position_id and
902               effective_start_date = hr_psf_shd.g_old_rec.effective_start_date;
903         if sql%rowcount = 0 then
904           hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
905           hr_utility.set_message_token('PROCEDURE', l_proc);
906           hr_utility.set_message_token('STEP','5');
907           hr_utility.raise_error;
908         end if;
909         p_validation_start_date    := p_rec.date_effective;
910         p_rec.effective_start_date := p_rec.date_effective;
911         --
912         -- update previous row's effective_end_date
913         for j in pos_prev loop
914             update hr_all_positions_f
915             set effective_end_date = p_rec.date_effective - 1
916             where current of pos_prev ;
917         end loop;
918       end if;
919     end if;
920 
921     --
922     --
923     -- Find effective_start_date of the first row
924     --
925     open c1;
926     fetch c1 into l_min_esd;
927     close c1;
928     if g_debug then
929     hr_utility.set_location('l_min_esd = ' || to_char(l_min_esd) || l_proc, 100);
930     end if;
931     --
932     -- if esd for the first row is later than new date_Effective
933     if l_min_esd > p_rec.date_effective then
934       --
935       -- move esd of the first row to date_Effective
936       --
937       for k in pos_first(l_min_esd) loop
938       if g_debug then
939           hr_utility.set_location('k.effective_start_date = ' ||
940                            to_char(k.effective_start_date) || l_proc, 110);
941           hr_utility.set_location('p_rec.effective_start_date = ' ||
942                            to_char(p_rec.effective_start_date) || l_proc, 110);
943       end if;
944           update hr_All_positions_f
945           set effective_Start_Date = p_rec.date_effective
946           where current of pos_first ;
947 
948           if p_rec.effective_start_date = k.effective_start_date then
949           if g_debug then
950              hr_utility.set_location('In Current Row = First Row ' || l_proc, 115);
951           end if;
952              p_validation_start_date    := p_rec.date_effective;
953              p_rec.effective_start_date := p_rec.date_effective;
954           end if;
955           if g_debug then
956           hr_utility.set_location('p_rec.effective_start_date = ' ||
957                            to_char(p_rec.effective_start_date) || l_proc, 150);
958           end if;
959         end loop;
960 
961       --
962     end if;
963 
964   end if;
965 */
966 if g_debug then
967   hr_utility.set_location('p_validation_start_date '
968             || to_char(p_validation_start_date) || ' ' || l_proc, 100);
969   hr_utility.set_location(' Leaving:'||l_proc, 20);
970   end if;
971 End pre_update;
972 --
973 -- ----------------------------------------------------------------------------
974 -- |-----------------------------< post_update >------------------------------|
975 -- ----------------------------------------------------------------------------
976 -- {Start Of Comments}
977 --
978 -- Description:
979 --   This private procedure contains any processing which is required after the
980 --   update dml.
981 --
982 -- Prerequisites:
983 --   This is an internal procedure which is called from the upd procedure.
984 --
985 -- In Parameters:
986 --   A Pl/Sql record structre.
987 --
988 -- Post Success:
989 --   Processing continues.
990 --
991 -- Post Failure:
992 --   If an error has occurred, an error message and exception will be raised
993 --   but not handled.
994 --
995 -- Developer Implementation Notes:
996 --   Any post-processing required after the update dml is issued should be
997 --   coded within this procedure. It is important to note that any 3rd party
998 --   maintenance should be reviewed before placing in this procedure.
999 --
1000 -- Access Status:
1001 --   Internal Row Handler Use Only.
1002 --
1003 -- {End Of Comments}
1004 -- ----------------------------------------------------------------------------
1005 Procedure post_update
1006    (p_rec          in hr_psf_shd.g_rec_type,
1007     p_effective_date  in date,
1008     p_datetrack_mode  in varchar2,
1009     p_validation_start_date in date,
1010     p_validation_end_date   in date) is
1011 --
1012   l_proc varchar2(72);
1013 --
1014 Begin
1015 if g_debug then
1016 l_proc    := g_package||'post_update';
1017   hr_utility.set_location('Entering:'||l_proc, 5);
1018 end if;
1019   --
1020   -- User Hook
1021   Begin
1022   hr_psf_rku.after_update(
1023   p_position_id                  => p_rec.position_id                 ,
1024   p_effective_start_date         => p_rec.effective_start_date        ,
1025   p_effective_end_date           => p_rec.effective_end_date          ,
1026   p_availability_status_id       => p_rec.availability_status_id      ,
1027 --  p_business_group_id            => p_rec.business_group_id           ,
1028   p_entry_step_id                => p_rec.entry_step_id               ,
1029   p_entry_grade_rule_id          => p_rec.entry_grade_rule_id         ,
1030 --  p_job_id                       => p_rec.job_id                      ,
1031   p_location_id                  => p_rec.location_id                 ,
1032 --  p_organization_id              => p_rec.organization_id             ,
1033   p_pay_freq_payroll_id          => p_rec.pay_freq_payroll_id         ,
1034   p_position_definition_id       => p_rec.position_definition_id      ,
1035   p_position_transaction_id      => p_rec.position_transaction_id     ,
1036   p_prior_position_id            => p_rec.prior_position_id           ,
1037   p_relief_position_id           => p_rec.relief_position_id          ,
1038   p_entry_grade_id               => p_rec.entry_grade_id              ,
1039   p_successor_position_id        => p_rec.successor_position_id       ,
1040   p_supervisor_position_id       => p_rec.supervisor_position_id      ,
1041   p_amendment_date               => p_rec.amendment_date              ,
1042   p_amendment_recommendation     => p_rec.amendment_recommendation    ,
1043   p_amendment_ref_number         => p_rec.amendment_ref_number        ,
1044   p_bargaining_unit_cd           => p_rec.bargaining_unit_cd          ,
1045   p_comments                     => p_rec.comments                    ,
1046   p_current_job_prop_end_date    => p_rec.current_job_prop_end_date   ,
1047   p_current_org_prop_end_date    => p_rec.current_org_prop_end_date   ,
1048   p_avail_status_prop_end_date   => p_rec.avail_status_prop_end_date  ,
1049   p_date_effective               => p_rec.date_effective              ,
1050   p_date_end                     => p_rec.date_end                    ,
1051   p_earliest_hire_date           => p_rec.earliest_hire_date          ,
1052   p_fill_by_date                 => p_rec.fill_by_date                ,
1053   p_frequency                    => p_rec.frequency                   ,
1054   p_fte                          => p_rec.fte                         ,
1055   p_max_persons                  => p_rec.max_persons                 ,
1056   p_name                         => p_rec.name                        ,
1057   p_overlap_period               => p_rec.overlap_period              ,
1058   p_overlap_unit_cd              => p_rec.overlap_unit_cd             ,
1059   p_pay_term_end_day_cd          => p_rec.pay_term_end_day_cd         ,
1060   p_pay_term_end_month_cd        => p_rec.pay_term_end_month_cd       ,
1061   p_permanent_temporary_flag     => p_rec.permanent_temporary_flag    ,
1062   p_permit_recruitment_flag      => p_rec.permit_recruitment_flag     ,
1063   p_position_type                => p_rec.position_type               ,
1064   p_posting_description          => p_rec.posting_description         ,
1065   p_probation_period             => p_rec.probation_period            ,
1066   p_probation_period_unit_cd     => p_rec.probation_period_unit_cd    ,
1067   p_replacement_required_flag    => p_rec.replacement_required_flag   ,
1068   p_review_flag                  => p_rec.review_flag                 ,
1069   p_seasonal_flag                => p_rec.seasonal_flag               ,
1070   p_security_requirements        => p_rec.security_requirements       ,
1071   p_status                       => p_rec.status                      ,
1072   p_term_start_day_cd            => p_rec.term_start_day_cd           ,
1073   p_term_start_month_cd          => p_rec.term_start_month_cd         ,
1074   p_time_normal_finish           => p_rec.time_normal_finish          ,
1075   p_time_normal_start            => p_rec.time_normal_start           ,
1076   p_update_source_cd             => p_rec.update_source_cd            ,
1077   p_working_hours                => p_rec.working_hours               ,
1078   p_works_council_approval_flag  => p_rec.works_council_approval_flag ,
1079   p_work_period_type_cd          => p_rec.work_period_type_cd         ,
1080   p_work_term_end_day_cd         => p_rec.work_term_end_day_cd        ,
1081   p_work_term_end_month_cd       => p_rec.work_term_end_month_cd      ,
1082   p_proposed_fte_for_layoff      => p_rec.proposed_fte_for_layoff     ,
1083   p_proposed_date_for_layoff     => p_rec.proposed_date_for_layoff    ,
1084   p_pay_basis_id                 => p_rec.pay_basis_id                ,
1085   p_supervisor_id                => p_rec.supervisor_id               ,
1086   p_copied_to_old_table_flag     => p_rec.copied_to_old_table_flag    ,
1087   p_information1                 => p_rec.information1                ,
1088   p_information2                 => p_rec.information2                ,
1089   p_information3                 => p_rec.information3                ,
1090   p_information4                 => p_rec.information4                ,
1091   p_information5                 => p_rec.information5                ,
1092   p_information6                 => p_rec.information6                ,
1093   p_information7                 => p_rec.information7                ,
1094   p_information8                 => p_rec.information8                ,
1095   p_information9                 => p_rec.information9                ,
1096   p_information10                => p_rec.information10               ,
1097   p_information11                => p_rec.information11               ,
1098   p_information12                => p_rec.information12               ,
1099   p_information13                => p_rec.information13               ,
1100   p_information14                => p_rec.information14               ,
1101   p_information15                => p_rec.information15               ,
1102   p_information16                => p_rec.information16               ,
1103   p_information17                => p_rec.information17               ,
1104   p_information18                => p_rec.information18               ,
1105   p_information19                => p_rec.information19               ,
1106   p_information20                => p_rec.information20               ,
1107   p_information21                => p_rec.information21               ,
1108   p_information22                => p_rec.information22               ,
1109   p_information23                => p_rec.information23               ,
1110   p_information24                => p_rec.information24               ,
1111   p_information25                => p_rec.information25               ,
1112   p_information26                => p_rec.information26               ,
1113   p_information27                => p_rec.information27               ,
1114   p_information28                => p_rec.information28               ,
1115   p_information29                => p_rec.information29               ,
1116   p_information30                => p_rec.information30               ,
1117   p_information_category         => p_rec.information_category        ,
1118   p_attribute1                   => p_rec.attribute1                  ,
1119   p_attribute2                   => p_rec.attribute2                  ,
1120   p_attribute3                   => p_rec.attribute3                  ,
1121   p_attribute4                   => p_rec.attribute4                  ,
1122   p_attribute5                   => p_rec.attribute5                  ,
1123   p_attribute6                   => p_rec.attribute6                  ,
1124   p_attribute7                   => p_rec.attribute7                  ,
1125   p_attribute8                   => p_rec.attribute8                  ,
1126   p_attribute9                   => p_rec.attribute9                  ,
1127   p_attribute10                  => p_rec.attribute10                 ,
1128   p_attribute11                  => p_rec.attribute11                 ,
1129   p_attribute12                  => p_rec.attribute12                 ,
1130   p_attribute13                  => p_rec.attribute13                 ,
1131   p_attribute14                  => p_rec.attribute14                 ,
1132   p_attribute15                  => p_rec.attribute15                 ,
1133   p_attribute16                  => p_rec.attribute16                 ,
1134   p_attribute17                  => p_rec.attribute17                 ,
1135   p_attribute18                  => p_rec.attribute18                 ,
1136   p_attribute19                  => p_rec.attribute19                 ,
1137   p_attribute20                  => p_rec.attribute20                 ,
1138   p_attribute21                  => p_rec.attribute21                 ,
1139   p_attribute22                  => p_rec.attribute22                 ,
1140   p_attribute23                  => p_rec.attribute23                 ,
1141   p_attribute24                  => p_rec.attribute24                 ,
1142   p_attribute25                  => p_rec.attribute25                 ,
1143   p_attribute26                  => p_rec.attribute26                 ,
1144   p_attribute27                  => p_rec.attribute27                 ,
1145   p_attribute28                  => p_rec.attribute28                 ,
1146   p_attribute29                  => p_rec.attribute29                 ,
1147   p_attribute30                  => p_rec.attribute30                 ,
1148   p_attribute_category           => p_rec.attribute_category          ,
1149   p_request_id                   => p_rec.request_id                  ,
1150   p_program_application_id       => p_rec.program_application_id      ,
1151   p_program_id                   => p_rec.program_id                  ,
1152   p_program_update_date          => p_rec.program_update_date         ,
1153   p_object_version_number        => p_rec.object_version_number       ,
1154   p_effective_date       => p_effective_date          ,
1155   p_datetrack_mode               => p_datetrack_mode                  ,
1156   p_effective_start_date_o       => hr_psf_shd.g_old_rec.effective_start_date      ,
1157   p_effective_end_date_o         => hr_psf_shd.g_old_rec.effective_end_date        ,
1158   p_availability_status_id_o     => hr_psf_shd.g_old_rec.availability_status_id    ,
1159   p_business_group_id_o          => hr_psf_shd.g_old_rec.business_group_id         ,
1160   p_entry_step_id_o              => hr_psf_shd.g_old_rec.entry_step_id             ,
1161   p_entry_grade_rule_id_o        => hr_psf_shd.g_old_rec.entry_grade_rule_id       ,
1162   p_job_id_o                     => hr_psf_shd.g_old_rec.job_id                    ,
1163   p_location_id_o                => hr_psf_shd.g_old_rec.location_id               ,
1164   p_organization_id_o            => hr_psf_shd.g_old_rec.organization_id             ,
1165   p_pay_freq_payroll_id_o        => hr_psf_shd.g_old_rec.pay_freq_payroll_id       ,
1166   p_position_definition_id_o     => hr_psf_shd.g_old_rec.position_definition_id    ,
1167   p_position_transaction_id_o    => hr_psf_shd.g_old_rec.position_transaction_id   ,
1168   p_prior_position_id_o          => hr_psf_shd.g_old_rec.prior_position_id         ,
1169   p_relief_position_id_o         => hr_psf_shd.g_old_rec.relief_position_id        ,
1170   p_entry_grade_id_o             => hr_psf_shd.g_old_rec.entry_grade_id            ,
1171   p_successor_position_id_o      => hr_psf_shd.g_old_rec.successor_position_id     ,
1172   p_supervisor_position_id_o     => hr_psf_shd.g_old_rec.supervisor_position_id    ,
1173   p_amendment_date_o             => hr_psf_shd.g_old_rec.amendment_date            ,
1174   p_amendment_recommendation_o   => hr_psf_shd.g_old_rec.amendment_recommendation  ,
1175   p_amendment_ref_number_o       => hr_psf_shd.g_old_rec.amendment_ref_number      ,
1176   p_bargaining_unit_cd_o         => hr_psf_shd.g_old_rec.bargaining_unit_cd        ,
1177   p_comments_o                   => hr_psf_shd.g_old_rec.comments                  ,
1178   p_current_job_prop_end_date_o  => hr_psf_shd.g_old_rec.current_job_prop_end_date ,
1179   p_current_org_prop_end_date_o  => hr_psf_shd.g_old_rec.current_org_prop_end_date ,
1180   p_avail_status_prop_end_date_o => hr_psf_shd.g_old_rec.avail_status_prop_end_date,
1181   p_date_effective_o             => hr_psf_shd.g_old_rec.date_effective            ,
1182   p_date_end_o                   => hr_psf_shd.g_old_rec.date_end                  ,
1183   p_earliest_hire_date_o         => hr_psf_shd.g_old_rec.earliest_hire_date        ,
1184   p_fill_by_date_o               => hr_psf_shd.g_old_rec.fill_by_date              ,
1185   p_frequency_o                  => hr_psf_shd.g_old_rec.frequency                 ,
1186   p_fte_o                        => hr_psf_shd.g_old_rec.fte                       ,
1187   p_max_persons_o                => hr_psf_shd.g_old_rec.max_persons               ,
1188   p_name_o                       => hr_psf_shd.g_old_rec.name                      ,
1189   p_overlap_period_o             => hr_psf_shd.g_old_rec.overlap_period            ,
1190   p_overlap_unit_cd_o            => hr_psf_shd.g_old_rec.overlap_unit_cd           ,
1191   p_pay_term_end_day_cd_o        => hr_psf_shd.g_old_rec.pay_term_end_day_cd       ,
1192   p_pay_term_end_month_cd_o      => hr_psf_shd.g_old_rec.pay_term_end_month_cd     ,
1193   p_permanent_temporary_flag_o   => hr_psf_shd.g_old_rec.permanent_temporary_flag  ,
1194   p_permit_recruitment_flag_o    => hr_psf_shd.g_old_rec.permit_recruitment_flag   ,
1195   p_position_type_o              => hr_psf_shd.g_old_rec.position_type             ,
1196   p_posting_description_o        => hr_psf_shd.g_old_rec.posting_description       ,
1197   p_probation_period_o           => hr_psf_shd.g_old_rec.probation_period          ,
1198   p_probation_period_unit_cd_o   => hr_psf_shd.g_old_rec.probation_period_unit_cd  ,
1199   p_replacement_required_flag_o  => hr_psf_shd.g_old_rec.replacement_required_flag ,
1200   p_review_flag_o                => hr_psf_shd.g_old_rec.review_flag               ,
1201   p_seasonal_flag_o              => hr_psf_shd.g_old_rec.seasonal_flag             ,
1202   p_security_requirements_o      => hr_psf_shd.g_old_rec.security_requirements     ,
1203   p_status_o                     => hr_psf_shd.g_old_rec.status                    ,
1204   p_term_start_day_cd_o          => hr_psf_shd.g_old_rec.term_start_day_cd         ,
1205   p_term_start_month_cd_o        => hr_psf_shd.g_old_rec.term_start_month_cd       ,
1206   p_time_normal_finish_o         => hr_psf_shd.g_old_rec.time_normal_finish        ,
1207   p_time_normal_start_o          => hr_psf_shd.g_old_rec.time_normal_start         ,
1208   p_update_source_cd_o           => hr_psf_shd.g_old_rec.update_source_cd          ,
1209   p_working_hours_o              => hr_psf_shd.g_old_rec.working_hours             ,
1210   p_works_council_approval_fla_o => hr_psf_shd.g_old_rec.works_council_approval_flag,
1211   p_work_period_type_cd_o        => hr_psf_shd.g_old_rec.work_period_type_cd       ,
1212   p_work_term_end_day_cd_o       => hr_psf_shd.g_old_rec.work_term_end_day_cd      ,
1213   p_work_term_end_month_cd_o     => hr_psf_shd.g_old_rec.work_term_end_month_cd    ,
1214   p_proposed_fte_for_layoff_o    => hr_psf_shd.g_old_rec.proposed_fte_for_layoff   ,
1215   p_proposed_date_for_layoff_o   => hr_psf_shd.g_old_rec.proposed_date_for_layoff  ,
1216   p_pay_basis_id_o               => hr_psf_shd.g_old_rec.pay_basis_id              ,
1217   p_supervisor_id_o              => hr_psf_shd.g_old_rec.supervisor_id             ,
1218   p_copied_to_old_table_flag_o   => hr_psf_shd.g_old_rec.copied_to_old_table_flag  ,
1219   p_information1_o               => hr_psf_shd.g_old_rec.information1              ,
1220   p_information2_o               => hr_psf_shd.g_old_rec.information2              ,
1221   p_information3_o               => hr_psf_shd.g_old_rec.information3              ,
1222   p_information4_o               => hr_psf_shd.g_old_rec.information4              ,
1223   p_information5_o               => hr_psf_shd.g_old_rec.information5              ,
1224   p_information6_o               => hr_psf_shd.g_old_rec.information6              ,
1225   p_information7_o               => hr_psf_shd.g_old_rec.information7              ,
1226   p_information8_o               => hr_psf_shd.g_old_rec.information8              ,
1227   p_information9_o               => hr_psf_shd.g_old_rec.information9              ,
1228   p_information10_o              => hr_psf_shd.g_old_rec.information10             ,
1229   p_information11_o              => hr_psf_shd.g_old_rec.information11             ,
1230   p_information12_o              => hr_psf_shd.g_old_rec.information12             ,
1231   p_information13_o              => hr_psf_shd.g_old_rec.information13             ,
1232   p_information14_o              => hr_psf_shd.g_old_rec.information14             ,
1233   p_information15_o              => hr_psf_shd.g_old_rec.information15             ,
1234   p_information16_o              => hr_psf_shd.g_old_rec.information16             ,
1235   p_information17_o              => hr_psf_shd.g_old_rec.information17             ,
1236   p_information18_o              => hr_psf_shd.g_old_rec.information18             ,
1237   p_information19_o              => hr_psf_shd.g_old_rec.information19             ,
1238   p_information20_o              => hr_psf_shd.g_old_rec.information20             ,
1239   p_information21_o              => hr_psf_shd.g_old_rec.information21             ,
1240   p_information22_o              => hr_psf_shd.g_old_rec.information22             ,
1241   p_information23_o              => hr_psf_shd.g_old_rec.information23             ,
1242   p_information24_o              => hr_psf_shd.g_old_rec.information24             ,
1243   p_information25_o              => hr_psf_shd.g_old_rec.information25             ,
1244   p_information26_o              => hr_psf_shd.g_old_rec.information26             ,
1245   p_information27_o              => hr_psf_shd.g_old_rec.information27             ,
1246   p_information28_o              => hr_psf_shd.g_old_rec.information28             ,
1247   p_information29_o              => hr_psf_shd.g_old_rec.information29             ,
1248   p_information30_o              => hr_psf_shd.g_old_rec.information30             ,
1249   p_information_category_o       => hr_psf_shd.g_old_rec.information_category      ,
1250   p_attribute1_o                 => hr_psf_shd.g_old_rec.attribute1                ,
1251   p_attribute2_o                 => hr_psf_shd.g_old_rec.attribute2                ,
1252   p_attribute3_o                 => hr_psf_shd.g_old_rec.attribute3                ,
1253   p_attribute4_o                 => hr_psf_shd.g_old_rec.attribute4                ,
1254   p_attribute5_o                 => hr_psf_shd.g_old_rec.attribute5                ,
1255   p_attribute6_o                 => hr_psf_shd.g_old_rec.attribute6                ,
1256   p_attribute7_o                 => hr_psf_shd.g_old_rec.attribute7                ,
1257   p_attribute8_o                 => hr_psf_shd.g_old_rec.attribute8                ,
1258   p_attribute9_o                 => hr_psf_shd.g_old_rec.attribute9                ,
1259   p_attribute10_o                => hr_psf_shd.g_old_rec.attribute10               ,
1260   p_attribute11_o                => hr_psf_shd.g_old_rec.attribute11               ,
1261   p_attribute12_o                => hr_psf_shd.g_old_rec.attribute12               ,
1262   p_attribute13_o                => hr_psf_shd.g_old_rec.attribute13               ,
1263   p_attribute14_o                => hr_psf_shd.g_old_rec.attribute14               ,
1264   p_attribute15_o                => hr_psf_shd.g_old_rec.attribute15               ,
1265   p_attribute16_o                => hr_psf_shd.g_old_rec.attribute16               ,
1266   p_attribute17_o                => hr_psf_shd.g_old_rec.attribute17               ,
1267   p_attribute18_o                => hr_psf_shd.g_old_rec.attribute18               ,
1268   p_attribute19_o                => hr_psf_shd.g_old_rec.attribute19               ,
1269   p_attribute20_o                => hr_psf_shd.g_old_rec.attribute20               ,
1270   p_attribute21_o                => hr_psf_shd.g_old_rec.attribute21               ,
1271   p_attribute22_o                => hr_psf_shd.g_old_rec.attribute22               ,
1272   p_attribute23_o                => hr_psf_shd.g_old_rec.attribute23               ,
1273   p_attribute24_o                => hr_psf_shd.g_old_rec.attribute24               ,
1274   p_attribute25_o                => hr_psf_shd.g_old_rec.attribute25               ,
1275   p_attribute26_o                => hr_psf_shd.g_old_rec.attribute26               ,
1276   p_attribute27_o                => hr_psf_shd.g_old_rec.attribute27               ,
1277   p_attribute28_o                => hr_psf_shd.g_old_rec.attribute28               ,
1278   p_attribute29_o                => hr_psf_shd.g_old_rec.attribute29               ,
1279   p_attribute30_o                => hr_psf_shd.g_old_rec.attribute30               ,
1280   p_attribute_category_o         => hr_psf_shd.g_old_rec.attribute_category        ,
1281   p_request_id_o                 => hr_psf_shd.g_old_rec.request_id                ,
1282   p_program_application_id_o     => hr_psf_shd.g_old_rec.program_application_id    ,
1283   p_program_id_o                 => hr_psf_shd.g_old_rec.program_id                ,
1284   p_program_update_date_o        => hr_psf_shd.g_old_rec.program_update_date       ,
1285   p_object_version_number_o      => hr_psf_shd.g_old_rec.object_version_number     );
1286   --
1287   exception
1288     when hr_api.cannot_find_prog_unit then
1289       hr_api.cannot_find_prog_unit_error
1290         (p_module_name => 'HR_ALL_POSITIONS'
1291         ,p_hook_type   => 'AU'
1292         );
1293   End;
1294   --
1295   hr_psf_shd.position_wf_sync(p_rec.position_id , p_validation_start_date);
1296   --
1297 if g_debug then
1298   hr_utility.set_location(' Leaving:'||l_proc, 10);
1299 end if;
1300 End post_update;
1301 --
1302 -- ----------------------------------------------------------------------------
1303 -- |-----------------------------< convert_defs >-----------------------------|
1304 -- ----------------------------------------------------------------------------
1305 -- {Start Of Comments}
1306 --
1307 -- Description:
1308 --   The Convert_Defs procedure has one very important function:
1309 --   It must return the record structure for the row with all system defaulted
1310 --   values converted into its corresponding parameter value for update. When
1311 --   we attempt to update a row through the Upd process , certain
1312 --   parameters can be defaulted which enables flexibility in the calling of
1313 --   the upd process (e.g. only attributes which need to be updated need to be
1314 --   specified). For the upd process to determine which attributes
1315 --   have NOT been specified we need to check if the parameter has a reserved
1316 --   system default value. Therefore, for all parameters which have a
1317 --   corresponding reserved system default mechanism specified we need to
1318 --   check if a system default is being used. If a system default is being
1319 --   used then we convert the defaulted value into its corresponding attribute
1320 --   value held in the g_old_rec data structure.
1321 --
1322 -- Prerequisites:
1323 --   This private function can only be called from the upd process.
1324 --
1325 -- In Parameters:
1326 --   A Pl/Sql record structre.
1327 --
1328 -- Post Success:
1329 --   The record structure will be returned with all system defaulted parameter
1330 --   values converted into its current row attribute value.
1331 --
1332 -- Post Failure:
1333 --   No direct error handling is required within this function. Any possible
1334 --   errors within this procedure will be a PL/SQL value error due to conversion
1335 
1336 --   of datatypes or data lengths.
1337 --
1338 -- Developer Implementation Notes:
1339 --   None.
1340 --
1341 -- Access Status:
1342 --   Internal Row Handler Use Only.
1343 --
1344 -- {End Of Comments}
1345 -- ----------------------------------------------------------------------------
1346 Procedure convert_defs(p_rec in out nocopy hr_psf_shd.g_rec_type) is
1347 --
1348   l_proc  varchar2(72) ;
1349 --
1350 Begin
1351   --
1352 if g_debug then
1353  l_proc   := g_package||'convert_defs';
1354   hr_utility.set_location('Entering:'||l_proc, 5);
1355 end if;
1356   --
1357   -- We must now examine each argument value in the
1358   -- p_rec plsql record structure
1359   -- to see if a system default is being used. If a system default
1360   -- is being used then we must set to the 'current' argument value.
1361   --
1362   If (p_rec.availability_status_id = hr_api.g_number) then
1363     p_rec.availability_status_id :=
1364     hr_psf_shd.g_old_rec.availability_status_id;
1365   End If;
1366   If (p_rec.business_group_id = hr_api.g_number) then
1367     p_rec.business_group_id :=
1368     hr_psf_shd.g_old_rec.business_group_id;
1369   End If;
1370   If (p_rec.entry_step_id = hr_api.g_number) then
1371     p_rec.entry_step_id :=
1372     hr_psf_shd.g_old_rec.entry_step_id;
1373   End If;
1374   If (p_rec.entry_grade_rule_id = hr_api.g_number) then
1375     p_rec.entry_grade_rule_id :=
1376     hr_psf_shd.g_old_rec.entry_grade_rule_id;
1377   End If;
1378   If (p_rec.job_id = hr_api.g_number) then
1379     p_rec.job_id :=
1380     hr_psf_shd.g_old_rec.job_id;
1381   End If;
1382   If (p_rec.location_id = hr_api.g_number) then
1383     p_rec.location_id :=
1384     hr_psf_shd.g_old_rec.location_id;
1385   End If;
1386   If (p_rec.organization_id = hr_api.g_number) then
1387     p_rec.organization_id :=
1388     hr_psf_shd.g_old_rec.organization_id;
1389   End If;
1390   If (p_rec.pay_freq_payroll_id = hr_api.g_number) then
1391     p_rec.pay_freq_payroll_id :=
1392     hr_psf_shd.g_old_rec.pay_freq_payroll_id;
1393   End If;
1394   If (p_rec.position_definition_id = hr_api.g_number) then
1395     p_rec.position_definition_id :=
1396     hr_psf_shd.g_old_rec.position_definition_id;
1397   End If;
1398   If (p_rec.position_transaction_id = hr_api.g_number) then
1399     p_rec.position_transaction_id :=
1400     hr_psf_shd.g_old_rec.position_transaction_id;
1401   End If;
1402   If (p_rec.prior_position_id = hr_api.g_number) then
1403     p_rec.prior_position_id :=
1404     hr_psf_shd.g_old_rec.prior_position_id;
1405   End If;
1406   If (p_rec.relief_position_id = hr_api.g_number) then
1407     p_rec.relief_position_id :=
1408     hr_psf_shd.g_old_rec.relief_position_id;
1409   End If;
1410   If (p_rec.entry_grade_id = hr_api.g_number) then
1411     p_rec.entry_grade_id :=
1412     hr_psf_shd.g_old_rec.entry_grade_id;
1413   End If;
1414   If (p_rec.successor_position_id = hr_api.g_number) then
1415     p_rec.successor_position_id :=
1416     hr_psf_shd.g_old_rec.successor_position_id;
1417   End If;
1418   If (p_rec.supervisor_position_id = hr_api.g_number) then
1419     p_rec.supervisor_position_id :=
1420     hr_psf_shd.g_old_rec.supervisor_position_id;
1421   End If;
1422   If (p_rec.amendment_date = hr_api.g_date) then
1423     p_rec.amendment_date :=
1424     hr_psf_shd.g_old_rec.amendment_date;
1425   End If;
1426   If (p_rec.amendment_recommendation = hr_api.g_varchar2) then
1427     p_rec.amendment_recommendation :=
1428     hr_psf_shd.g_old_rec.amendment_recommendation;
1429   End If;
1430   If (p_rec.amendment_ref_number = hr_api.g_varchar2) then
1431     p_rec.amendment_ref_number :=
1432     hr_psf_shd.g_old_rec.amendment_ref_number;
1433   End If;
1434   If (p_rec.bargaining_unit_cd = hr_api.g_varchar2) then
1435     p_rec.bargaining_unit_cd :=
1436     hr_psf_shd.g_old_rec.bargaining_unit_cd;
1437   End If;
1438   If (p_rec.comments = hr_api.g_varchar2) then
1439     p_rec.comments :=
1440     hr_psf_shd.g_old_rec.comments;
1441   End If;
1442   If (p_rec.current_job_prop_end_date = hr_api.g_date) then
1443     p_rec.current_job_prop_end_date :=
1444     hr_psf_shd.g_old_rec.current_job_prop_end_date;
1445   End If;
1446   If (p_rec.current_org_prop_end_date = hr_api.g_date) then
1447     p_rec.current_org_prop_end_date :=
1448     hr_psf_shd.g_old_rec.current_org_prop_end_date;
1449   End If;
1450   If (p_rec.avail_status_prop_end_date = hr_api.g_date) then
1451     p_rec.avail_status_prop_end_date :=
1452     hr_psf_shd.g_old_rec.avail_status_prop_end_date;
1453   End If;
1454   If (p_rec.date_effective = hr_api.g_date) then
1455     p_rec.date_effective :=
1456     hr_psf_shd.g_old_rec.date_effective;
1457   End If;
1458   If (p_rec.date_end = hr_api.g_date) then
1459     p_rec.date_end :=
1460     hr_psf_shd.g_old_rec.date_end;
1461   End If;
1462   If (p_rec.earliest_hire_date = hr_api.g_date) then
1463     p_rec.earliest_hire_date :=
1464     hr_psf_shd.g_old_rec.earliest_hire_date;
1465   End If;
1466   If (p_rec.fill_by_date = hr_api.g_date) then
1467     p_rec.fill_by_date :=
1468     hr_psf_shd.g_old_rec.fill_by_date;
1469   End If;
1470   If (p_rec.frequency = hr_api.g_varchar2) then
1471     p_rec.frequency :=
1472     hr_psf_shd.g_old_rec.frequency;
1473   End If;
1474   If (p_rec.fte = hr_api.g_number) then
1475     p_rec.fte :=
1476     hr_psf_shd.g_old_rec.fte;
1477   End If;
1478   If (p_rec.max_persons = hr_api.g_number) then
1479     p_rec.max_persons :=
1480     hr_psf_shd.g_old_rec.max_persons;
1481   End If;
1482   If (p_rec.name = hr_api.g_varchar2) then
1483     p_rec.name :=
1484     hr_psf_shd.g_old_rec.name;
1485   End If;
1486   If (p_rec.overlap_period = hr_api.g_number) then
1487     p_rec.overlap_period :=
1488     hr_psf_shd.g_old_rec.overlap_period;
1489   End If;
1490   If (p_rec.overlap_unit_cd = hr_api.g_varchar2) then
1491     p_rec.overlap_unit_cd :=
1492     hr_psf_shd.g_old_rec.overlap_unit_cd;
1493   End If;
1494   If (p_rec.pay_term_end_day_cd = hr_api.g_varchar2) then
1495     p_rec.pay_term_end_day_cd :=
1496     hr_psf_shd.g_old_rec.pay_term_end_day_cd;
1497   End If;
1498   If (p_rec.pay_term_end_month_cd = hr_api.g_varchar2) then
1499     p_rec.pay_term_end_month_cd :=
1500     hr_psf_shd.g_old_rec.pay_term_end_month_cd;
1501   End If;
1502   If (p_rec.permanent_temporary_flag = hr_api.g_varchar2) then
1503     p_rec.permanent_temporary_flag :=
1504     hr_psf_shd.g_old_rec.permanent_temporary_flag;
1505   End If;
1506   If (p_rec.permit_recruitment_flag = hr_api.g_varchar2) then
1507     p_rec.permit_recruitment_flag :=
1508     hr_psf_shd.g_old_rec.permit_recruitment_flag;
1509   End If;
1510   If (p_rec.position_type = hr_api.g_varchar2) then
1511     p_rec.position_type :=
1512     hr_psf_shd.g_old_rec.position_type;
1513   End If;
1514   If (p_rec.posting_description = hr_api.g_varchar2) then
1515     p_rec.posting_description :=
1516     hr_psf_shd.g_old_rec.posting_description;
1517   End If;
1518   If (p_rec.probation_period = hr_api.g_number) then
1519     p_rec.probation_period :=
1520     hr_psf_shd.g_old_rec.probation_period;
1521   End If;
1522   If (p_rec.probation_period_unit_cd = hr_api.g_varchar2) then
1523     p_rec.probation_period_unit_cd :=
1524     hr_psf_shd.g_old_rec.probation_period_unit_cd;
1525   End If;
1526   If (p_rec.replacement_required_flag = hr_api.g_varchar2) then
1527     p_rec.replacement_required_flag :=
1528     hr_psf_shd.g_old_rec.replacement_required_flag;
1529   End If;
1530   If (p_rec.review_flag = hr_api.g_varchar2) then
1531     p_rec.review_flag :=
1532     hr_psf_shd.g_old_rec.review_flag;
1533   End If;
1534   If (p_rec.seasonal_flag = hr_api.g_varchar2) then
1535     p_rec.seasonal_flag :=
1536     hr_psf_shd.g_old_rec.seasonal_flag;
1537   End If;
1538   If (p_rec.security_requirements = hr_api.g_varchar2) then
1539     p_rec.security_requirements :=
1540     hr_psf_shd.g_old_rec.security_requirements;
1541   End If;
1542   If (p_rec.status = hr_api.g_varchar2) then
1543     p_rec.status :=
1544     hr_psf_shd.g_old_rec.status;
1545   End If;
1546   If (p_rec.term_start_day_cd = hr_api.g_varchar2) then
1547     p_rec.term_start_day_cd :=
1548     hr_psf_shd.g_old_rec.term_start_day_cd;
1549   End If;
1550   If (p_rec.term_start_month_cd = hr_api.g_varchar2) then
1551     p_rec.term_start_month_cd :=
1552     hr_psf_shd.g_old_rec.term_start_month_cd;
1553   End If;
1554   If (p_rec.time_normal_finish = hr_api.g_varchar2) then
1555     p_rec.time_normal_finish :=
1556     hr_psf_shd.g_old_rec.time_normal_finish;
1557   End If;
1558   If (p_rec.time_normal_start = hr_api.g_varchar2) then
1559     p_rec.time_normal_start :=
1560     hr_psf_shd.g_old_rec.time_normal_start;
1561   End If;
1562   If (p_rec.update_source_cd = hr_api.g_varchar2) then
1563     p_rec.update_source_cd :=
1564     hr_psf_shd.g_old_rec.update_source_cd;
1565   End If;
1566   If (p_rec.working_hours = hr_api.g_number) then
1567     p_rec.working_hours :=
1568     hr_psf_shd.g_old_rec.working_hours;
1569   End If;
1570   If (p_rec.works_council_approval_flag = hr_api.g_varchar2) then
1571     p_rec.works_council_approval_flag :=
1572     hr_psf_shd.g_old_rec.works_council_approval_flag;
1573   End If;
1574   If (p_rec.work_period_type_cd = hr_api.g_varchar2) then
1575     p_rec.work_period_type_cd :=
1576     hr_psf_shd.g_old_rec.work_period_type_cd;
1577   End If;
1578   If (p_rec.work_term_end_day_cd = hr_api.g_varchar2) then
1579     p_rec.work_term_end_day_cd :=
1580     hr_psf_shd.g_old_rec.work_term_end_day_cd;
1581   End If;
1582   If (p_rec.work_term_end_month_cd = hr_api.g_varchar2) then
1583     p_rec.work_term_end_month_cd :=
1584     hr_psf_shd.g_old_rec.work_term_end_month_cd;
1585   End If;
1586   If (p_rec.proposed_fte_for_layoff = hr_api.g_number) then
1587     p_rec.proposed_fte_for_layoff :=
1588     hr_psf_shd.g_old_rec.proposed_fte_for_layoff;
1589   End If;
1590   If (p_rec.proposed_date_for_layoff = hr_api.g_date) then
1591     p_rec.proposed_date_for_layoff :=
1592     hr_psf_shd.g_old_rec.proposed_date_for_layoff;
1593   End If;
1594   If (p_rec.pay_basis_id = hr_api.g_number) then
1595     p_rec.pay_basis_id :=
1596     hr_psf_shd.g_old_rec.pay_basis_id;
1597   End If;
1598   If (p_rec.supervisor_id = hr_api.g_number) then
1599     p_rec.supervisor_id :=
1600     hr_psf_shd.g_old_rec.supervisor_id;
1601   End If;
1602   If (p_rec.copied_to_old_table_flag = hr_api.g_varchar2) then
1603     p_rec.copied_to_old_table_flag :=
1604     hr_psf_shd.g_old_rec.copied_to_old_table_flag;
1605   End If;
1606   If (p_rec.information1 = hr_api.g_varchar2) then
1607     p_rec.information1 :=
1608     hr_psf_shd.g_old_rec.information1;
1609   End If;
1610   If (p_rec.information2 = hr_api.g_varchar2) then
1611     p_rec.information2 :=
1612     hr_psf_shd.g_old_rec.information2;
1613   End If;
1614   If (p_rec.information3 = hr_api.g_varchar2) then
1615     p_rec.information3 :=
1616     hr_psf_shd.g_old_rec.information3;
1617   End If;
1618   If (p_rec.information4 = hr_api.g_varchar2) then
1619     p_rec.information4 :=
1620     hr_psf_shd.g_old_rec.information4;
1621   End If;
1622   If (p_rec.information5 = hr_api.g_varchar2) then
1623     p_rec.information5 :=
1624     hr_psf_shd.g_old_rec.information5;
1625   End If;
1626   If (p_rec.information6 = hr_api.g_varchar2) then
1627     p_rec.information6 :=
1628     hr_psf_shd.g_old_rec.information6;
1629   End If;
1630   If (p_rec.information7 = hr_api.g_varchar2) then
1631     p_rec.information7 :=
1632     hr_psf_shd.g_old_rec.information7;
1633   End If;
1634   If (p_rec.information8 = hr_api.g_varchar2) then
1635     p_rec.information8 :=
1636     hr_psf_shd.g_old_rec.information8;
1637   End If;
1638   If (p_rec.information9 = hr_api.g_varchar2) then
1639     p_rec.information9 :=
1640     hr_psf_shd.g_old_rec.information9;
1641   End If;
1642   If (p_rec.information10 = hr_api.g_varchar2) then
1643     p_rec.information10 :=
1644     hr_psf_shd.g_old_rec.information10;
1645   End If;
1646   If (p_rec.information11 = hr_api.g_varchar2) then
1647     p_rec.information11 :=
1648     hr_psf_shd.g_old_rec.information11;
1649   End If;
1650   If (p_rec.information12 = hr_api.g_varchar2) then
1651     p_rec.information12 :=
1652     hr_psf_shd.g_old_rec.information12;
1653   End If;
1654   If (p_rec.information13 = hr_api.g_varchar2) then
1655     p_rec.information13 :=
1656     hr_psf_shd.g_old_rec.information13;
1657   End If;
1658   If (p_rec.information14 = hr_api.g_varchar2) then
1659     p_rec.information14 :=
1660     hr_psf_shd.g_old_rec.information14;
1661   End If;
1662   If (p_rec.information15 = hr_api.g_varchar2) then
1663     p_rec.information15 :=
1664     hr_psf_shd.g_old_rec.information15;
1665   End If;
1666   If (p_rec.information16 = hr_api.g_varchar2) then
1667     p_rec.information16 :=
1668     hr_psf_shd.g_old_rec.information16;
1669   End If;
1670   If (p_rec.information17 = hr_api.g_varchar2) then
1671     p_rec.information17 :=
1672     hr_psf_shd.g_old_rec.information17;
1673   End If;
1674   If (p_rec.information18 = hr_api.g_varchar2) then
1675     p_rec.information18 :=
1676     hr_psf_shd.g_old_rec.information18;
1677   End If;
1678   If (p_rec.information19 = hr_api.g_varchar2) then
1679     p_rec.information19 :=
1680     hr_psf_shd.g_old_rec.information19;
1681   End If;
1682   If (p_rec.information20 = hr_api.g_varchar2) then
1683     p_rec.information20 :=
1684     hr_psf_shd.g_old_rec.information20;
1685   End If;
1686   If (p_rec.information21 = hr_api.g_varchar2) then
1687     p_rec.information21 :=
1688     hr_psf_shd.g_old_rec.information21;
1689   End If;
1690   If (p_rec.information22 = hr_api.g_varchar2) then
1691     p_rec.information22 :=
1692     hr_psf_shd.g_old_rec.information22;
1693   End If;
1694   If (p_rec.information23 = hr_api.g_varchar2) then
1695     p_rec.information23 :=
1696     hr_psf_shd.g_old_rec.information23;
1697   End If;
1698   If (p_rec.information24 = hr_api.g_varchar2) then
1699     p_rec.information24 :=
1700     hr_psf_shd.g_old_rec.information24;
1701   End If;
1702   If (p_rec.information25 = hr_api.g_varchar2) then
1703     p_rec.information25 :=
1704     hr_psf_shd.g_old_rec.information25;
1705   End If;
1706   If (p_rec.information26 = hr_api.g_varchar2) then
1707     p_rec.information26 :=
1708     hr_psf_shd.g_old_rec.information26;
1709   End If;
1710   If (p_rec.information27 = hr_api.g_varchar2) then
1711     p_rec.information27 :=
1712     hr_psf_shd.g_old_rec.information27;
1713   End If;
1714   If (p_rec.information28 = hr_api.g_varchar2) then
1715     p_rec.information28 :=
1716     hr_psf_shd.g_old_rec.information28;
1717   End If;
1718   If (p_rec.information29 = hr_api.g_varchar2) then
1719     p_rec.information29 :=
1720     hr_psf_shd.g_old_rec.information29;
1721   End If;
1722   If (p_rec.information30 = hr_api.g_varchar2) then
1723     p_rec.information30 :=
1724     hr_psf_shd.g_old_rec.information30;
1725   End If;
1726   If (p_rec.information_category = hr_api.g_varchar2) then
1727     p_rec.information_category :=
1728     hr_psf_shd.g_old_rec.information_category;
1729   End If;
1730   If (p_rec.attribute1 = hr_api.g_varchar2) then
1731     p_rec.attribute1 :=
1732     hr_psf_shd.g_old_rec.attribute1;
1733   End If;
1734   If (p_rec.attribute2 = hr_api.g_varchar2) then
1735     p_rec.attribute2 :=
1736     hr_psf_shd.g_old_rec.attribute2;
1737   End If;
1738   If (p_rec.attribute3 = hr_api.g_varchar2) then
1739     p_rec.attribute3 :=
1740     hr_psf_shd.g_old_rec.attribute3;
1741   End If;
1742   If (p_rec.attribute4 = hr_api.g_varchar2) then
1743     p_rec.attribute4 :=
1744     hr_psf_shd.g_old_rec.attribute4;
1745   End If;
1746   If (p_rec.attribute5 = hr_api.g_varchar2) then
1747     p_rec.attribute5 :=
1748     hr_psf_shd.g_old_rec.attribute5;
1749   End If;
1750   If (p_rec.attribute6 = hr_api.g_varchar2) then
1751     p_rec.attribute6 :=
1752     hr_psf_shd.g_old_rec.attribute6;
1753   End If;
1754   If (p_rec.attribute7 = hr_api.g_varchar2) then
1755     p_rec.attribute7 :=
1756     hr_psf_shd.g_old_rec.attribute7;
1757   End If;
1758   If (p_rec.attribute8 = hr_api.g_varchar2) then
1759     p_rec.attribute8 :=
1760     hr_psf_shd.g_old_rec.attribute8;
1761   End If;
1762   If (p_rec.attribute9 = hr_api.g_varchar2) then
1763     p_rec.attribute9 :=
1764     hr_psf_shd.g_old_rec.attribute9;
1765   End If;
1766   If (p_rec.attribute10 = hr_api.g_varchar2) then
1767     p_rec.attribute10 :=
1768     hr_psf_shd.g_old_rec.attribute10;
1769   End If;
1770   If (p_rec.attribute11 = hr_api.g_varchar2) then
1771     p_rec.attribute11 :=
1772     hr_psf_shd.g_old_rec.attribute11;
1773   End If;
1774   If (p_rec.attribute12 = hr_api.g_varchar2) then
1775     p_rec.attribute12 :=
1776     hr_psf_shd.g_old_rec.attribute12;
1777   End If;
1778   If (p_rec.attribute13 = hr_api.g_varchar2) then
1779     p_rec.attribute13 :=
1780     hr_psf_shd.g_old_rec.attribute13;
1781   End If;
1782   If (p_rec.attribute14 = hr_api.g_varchar2) then
1783     p_rec.attribute14 :=
1784     hr_psf_shd.g_old_rec.attribute14;
1785   End If;
1786   If (p_rec.attribute15 = hr_api.g_varchar2) then
1787     p_rec.attribute15 :=
1788     hr_psf_shd.g_old_rec.attribute15;
1789   End If;
1790   If (p_rec.attribute16 = hr_api.g_varchar2) then
1791     p_rec.attribute16 :=
1792     hr_psf_shd.g_old_rec.attribute16;
1793   End If;
1794   If (p_rec.attribute17 = hr_api.g_varchar2) then
1795     p_rec.attribute17 :=
1796     hr_psf_shd.g_old_rec.attribute17;
1797   End If;
1798   If (p_rec.attribute18 = hr_api.g_varchar2) then
1799     p_rec.attribute18 :=
1800     hr_psf_shd.g_old_rec.attribute18;
1801   End If;
1802   If (p_rec.attribute19 = hr_api.g_varchar2) then
1803     p_rec.attribute19 :=
1804     hr_psf_shd.g_old_rec.attribute19;
1805   End If;
1806   If (p_rec.attribute20 = hr_api.g_varchar2) then
1807     p_rec.attribute20 :=
1808     hr_psf_shd.g_old_rec.attribute20;
1809   End If;
1810   If (p_rec.attribute21 = hr_api.g_varchar2) then
1811     p_rec.attribute21 :=
1812     hr_psf_shd.g_old_rec.attribute21;
1813   End If;
1814   If (p_rec.attribute22 = hr_api.g_varchar2) then
1815     p_rec.attribute22 :=
1816     hr_psf_shd.g_old_rec.attribute22;
1817   End If;
1818   If (p_rec.attribute23 = hr_api.g_varchar2) then
1819     p_rec.attribute23 :=
1820     hr_psf_shd.g_old_rec.attribute23;
1821   End If;
1822   If (p_rec.attribute24 = hr_api.g_varchar2) then
1823     p_rec.attribute24 :=
1824     hr_psf_shd.g_old_rec.attribute24;
1825   End If;
1826   If (p_rec.attribute25 = hr_api.g_varchar2) then
1827     p_rec.attribute25 :=
1828     hr_psf_shd.g_old_rec.attribute25;
1829   End If;
1830   If (p_rec.attribute26 = hr_api.g_varchar2) then
1831     p_rec.attribute26 :=
1832     hr_psf_shd.g_old_rec.attribute26;
1833   End If;
1834   If (p_rec.attribute27 = hr_api.g_varchar2) then
1835     p_rec.attribute27 :=
1836     hr_psf_shd.g_old_rec.attribute27;
1837   End If;
1838   If (p_rec.attribute28 = hr_api.g_varchar2) then
1839     p_rec.attribute28 :=
1840     hr_psf_shd.g_old_rec.attribute28;
1841   End If;
1842   If (p_rec.attribute29 = hr_api.g_varchar2) then
1843     p_rec.attribute29 :=
1844     hr_psf_shd.g_old_rec.attribute29;
1845   End If;
1846   If (p_rec.attribute30 = hr_api.g_varchar2) then
1847     p_rec.attribute30 :=
1848     hr_psf_shd.g_old_rec.attribute30;
1849   End If;
1850   If (p_rec.attribute_category = hr_api.g_varchar2) then
1851     p_rec.attribute_category :=
1852     hr_psf_shd.g_old_rec.attribute_category;
1853   End If;
1854   If (p_rec.request_id = hr_api.g_number) then
1855     p_rec.request_id :=
1856     hr_psf_shd.g_old_rec.request_id;
1857   End If;
1858   If (p_rec.program_application_id = hr_api.g_number) then
1859     p_rec.program_application_id :=
1860     hr_psf_shd.g_old_rec.program_application_id;
1861   End If;
1862   If (p_rec.program_id = hr_api.g_number) then
1863     p_rec.program_id :=
1864     hr_psf_shd.g_old_rec.program_id;
1865   End If;
1866   If (p_rec.program_update_date = hr_api.g_date) then
1867     p_rec.program_update_date :=
1868     hr_psf_shd.g_old_rec.program_update_date;
1869   End If;
1870 
1871   --
1872 if g_debug then
1873   hr_utility.set_location(' Leaving:'||l_proc, 10);
1874 end if;
1875 --
1876 End convert_defs;
1877 --
1878 -- ----------------------------------------------------------------------------
1879 -- |---------------------------------< upd >----------------------------------|
1880 -- ----------------------------------------------------------------------------
1881 Procedure upd
1882   (
1883   p_rec        in out nocopy  hr_psf_shd.g_rec_type,
1884   p_effective_date   in    date,
1885   p_datetrack_mode   in    varchar2,
1886   p_validate            in      boolean  default false
1887   ) is
1888 --
1889   l_proc       varchar2(72) ;
1890   l_validation_start_date  date;
1891   l_validation_end_date    date;
1892 --
1893 Begin
1894 g_debug := hr_utility.debug_enabled;
1895  if g_debug then
1896  l_proc         := g_package||'upd (rec)';
1897   hr_utility.set_location('Entering:'||l_proc, 5);
1898   hr_utility.set_location('ovn 1is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1899 end if;
1900   --
1901   -- Ensure that the DateTrack update mode is valid
1902   --
1903   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
1904   --
1905   If p_validate then
1906     --
1907     -- Issue the savepoint.
1908     --
1909     SAVEPOINT upd_per_per;
1910   End If;
1911   --
1912   --
1913   -- We must lock the row which we need to update.
1914   --
1915   hr_psf_shd.lck
1916    (p_effective_date  => p_effective_date,
1917           p_datetrack_mode  => p_datetrack_mode,
1918           p_position_id  => p_rec.position_id,
1919           p_object_version_number => p_rec.object_version_number,
1920           p_validation_start_date => l_validation_start_date,
1921           p_validation_end_date   => l_validation_end_date);
1922 if g_debug then
1923   hr_utility.set_location('ovn 2 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1924 end if;
1925   --
1926   -- 1. During an update system defaults are used to determine if
1927   --    arguments have been defaulted or not. We must therefore
1928   --    derive the full record structure values to be updated.
1929   --
1930   -- 2. Call the supporting update validate operations.
1931   --
1932   convert_defs(p_rec);
1933   -- hr_utility.set_location('ovn 3 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1934   --
1935   -- date effective is changed based on the status change
1936   --
1937   update_date_effective
1938    (p_rec                   => p_rec
1939    ,p_datetrack_mode        => p_datetrack_mode
1940    ,p_effective_date        => p_effective_date
1941    ,p_validation_start_date => l_validation_start_date
1942    ,p_validation_end_date   => l_validation_end_date);
1943 if g_debug then
1944   hr_utility.set_location('ovn 4 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1945 end if;
1946   if (not per_refresh_position.refreshing_position) then
1947     if g_debug then
1948       hr_utility.set_location('VALIDATING POSITION :'||l_proc, 5);
1949     end if;
1950     --
1951     -- validations are performed based on the new date effective
1952     --
1953     hr_psf_bus.update_validate
1954     (p_rec          => p_rec,
1955      p_effective_date  => p_effective_date,
1956      p_datetrack_mode     => p_datetrack_mode,
1957      p_validation_start_date => l_validation_start_date,
1958      p_validation_end_date   => l_validation_end_date);
1959   end if;
1960 if g_debug then
1961   hr_utility.set_location('ovn 5 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1962 end if;
1963   --
1964   -- Call the supporting pre-update operation
1965   --
1966   pre_update
1967    (p_rec          => p_rec,
1968     p_effective_date  => p_effective_date,
1969     p_datetrack_mode  => p_datetrack_mode,
1970     p_validation_start_date => l_validation_start_date,
1971     p_validation_end_date   => l_validation_end_date);
1972 if g_debug then
1973   hr_utility.set_location('ovn 6 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1974 
1975   hr_utility.set_location('p_validation_start_date '
1976             || to_char(l_validation_start_date) || ' ' || l_proc, 100);
1977 end if;
1978   --
1979   -- Update the row.
1980   --
1981   update_dml
1982    (p_rec          => p_rec,
1983     p_effective_date  => p_effective_date,
1984     p_datetrack_mode  => p_datetrack_mode,
1985     p_validation_start_date => l_validation_start_date,
1986     p_validation_end_date   => l_validation_end_date);
1987 if g_debug then
1988   hr_utility.set_location('ovn 7 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1989   hr_utility.set_location('p_validation_start_date '
1990             || to_char(l_validation_start_date) || ' ' || l_proc, 110);
1991 end if;
1992   --
1993   -- Call the supporting post-update operation
1994   --
1995   post_update
1996    (p_rec          => p_rec,
1997     p_effective_date  => p_effective_date,
1998     p_datetrack_mode  => p_datetrack_mode,
1999     p_validation_start_date => l_validation_start_date,
2000     p_validation_end_date   => l_validation_end_date);
2001 if g_debug then
2002   hr_utility.set_location('p_validation_start_date '
2003             || to_char(l_validation_start_date) || ' ' || l_proc, 120);
2004   hr_utility.set_location('ovn 8 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
2005   end if;
2006   --
2007   -- If we are validating then raise the Validate_Enabled exception
2008   --
2009   If p_validate then
2010   if g_debug then
2011      hr_utility.set_location('p_validation_start_date '
2012             || to_char(l_validation_start_date) || ' ' || l_proc, 120);
2013 end if;
2014     Raise HR_Api.Validate_Enabled;
2015   else
2016   if g_debug then
2017      hr_utility.set_location('p_validation_start_date '
2018             || to_char(l_validation_start_date) || ' ' || l_proc, 120);
2019 end if;
2020   End If;
2021   --
2022   if g_debug then
2023   hr_utility.set_location(' Leaving:'||l_proc, 10);
2024   end if;
2025 Exception
2026   When HR_Api.Validate_Enabled Then
2027     --
2028     -- As the Validate_Enabled exception has been raised
2029     -- we must rollback to the savepoint
2030     --
2031     ROLLBACK TO upd_per_per;
2032 
2033 End upd;
2034 -- ----------------------------------------------------------------------------
2035 -- |---------------------------------< upd >----------------------------------|
2036 -- ----------------------------------------------------------------------------
2037 Procedure upd
2038   (
2039   p_position_id                  in number,
2040   p_effective_start_date         out nocopy date,
2041   p_effective_end_date           out nocopy date,
2042   p_availability_status_id       in number           default hr_api.g_number,
2043 --  p_business_group_id            in number           default hr_api.g_number,
2044   p_entry_step_id                in number           default hr_api.g_number,
2045   p_entry_grade_rule_id          in number           default hr_api.g_number,
2046 --  p_job_id                       in number           default hr_api.g_number,
2047   p_location_id                  in number           default hr_api.g_number,
2048 --  p_organization_id              in number           default hr_api.g_number,
2049   p_pay_freq_payroll_id          in number           default hr_api.g_number,
2050   p_position_definition_id       in number           default hr_api.g_number,
2051   p_position_transaction_id      in number           default hr_api.g_number,
2052   p_prior_position_id            in number           default hr_api.g_number,
2053   p_relief_position_id           in number           default hr_api.g_number,
2054   p_entry_grade_id               in number           default hr_api.g_number,
2055   p_successor_position_id        in number           default hr_api.g_number,
2056   p_supervisor_position_id       in number           default hr_api.g_number,
2057   p_amendment_date               in date             default hr_api.g_date,
2058   p_amendment_recommendation     in varchar2         default hr_api.g_varchar2,
2059   p_amendment_ref_number         in varchar2         default hr_api.g_varchar2,
2060   p_bargaining_unit_cd           in varchar2         default hr_api.g_varchar2,
2061   p_comments                     in varchar2         default hr_api.g_varchar2,
2062   p_current_job_prop_end_date    in date             default hr_api.g_date,
2063   p_current_org_prop_end_date    in date             default hr_api.g_date,
2064   p_avail_status_prop_end_date   in date             default hr_api.g_date,
2065   p_date_effective               in date             default hr_api.g_date,
2066   p_date_end                     in date             default hr_api.g_date,
2067   p_earliest_hire_date           in date             default hr_api.g_date,
2068   p_fill_by_date                 in date             default hr_api.g_date,
2069   p_frequency                    in varchar2         default hr_api.g_varchar2,
2070   p_fte                          in number           default hr_api.g_number,
2071   p_max_persons                  in number           default hr_api.g_number,
2072   p_name                         in varchar2         default hr_api.g_varchar2,
2073   p_overlap_period               in number           default hr_api.g_number,
2074   p_overlap_unit_cd              in varchar2         default hr_api.g_varchar2,
2075   p_pay_term_end_day_cd          in varchar2         default hr_api.g_varchar2,
2076   p_pay_term_end_month_cd        in varchar2         default hr_api.g_varchar2,
2077   p_permanent_temporary_flag     in varchar2         default hr_api.g_varchar2,
2078   p_permit_recruitment_flag      in varchar2         default hr_api.g_varchar2,
2079   p_position_type                in varchar2         default hr_api.g_varchar2,
2080   p_posting_description          in varchar2         default hr_api.g_varchar2,
2081   p_probation_period             in number           default hr_api.g_number,
2082   p_probation_period_unit_cd     in varchar2         default hr_api.g_varchar2,
2083   p_replacement_required_flag    in varchar2         default hr_api.g_varchar2,
2084   p_review_flag                  in varchar2         default hr_api.g_varchar2,
2085   p_seasonal_flag                in varchar2         default hr_api.g_varchar2,
2086   p_security_requirements        in varchar2         default hr_api.g_varchar2,
2087   p_status                       in varchar2         default hr_api.g_varchar2,
2088   p_term_start_day_cd            in varchar2         default hr_api.g_varchar2,
2089   p_term_start_month_cd          in varchar2         default hr_api.g_varchar2,
2090   p_time_normal_finish           in varchar2         default hr_api.g_varchar2,
2091   p_time_normal_start            in varchar2         default hr_api.g_varchar2,
2092   p_update_source_cd             in varchar2         default hr_api.g_varchar2,
2093   p_working_hours                in number           default hr_api.g_number,
2094   p_works_council_approval_flag  in varchar2         default hr_api.g_varchar2,
2095   p_work_period_type_cd          in varchar2         default hr_api.g_varchar2,
2096   p_work_term_end_day_cd         in varchar2         default hr_api.g_varchar2,
2097   p_work_term_end_month_cd       in varchar2         default hr_api.g_varchar2,
2098   p_proposed_fte_for_layoff      in number           default hr_api.g_number,
2099   p_proposed_date_for_layoff     in date             default hr_api.g_date,
2100   p_pay_basis_id                 in  number          default hr_api.g_number,
2101   p_supervisor_id                in  number          default hr_api.g_number,
2102   p_copied_to_old_table_flag     in  varchar2         default hr_api.g_varchar2,
2103   p_information1                 in varchar2         default hr_api.g_varchar2,
2104   p_information2                 in varchar2         default hr_api.g_varchar2,
2105   p_information3                 in varchar2         default hr_api.g_varchar2,
2106   p_information4                 in varchar2         default hr_api.g_varchar2,
2107   p_information5                 in varchar2         default hr_api.g_varchar2,
2108   p_information6                 in varchar2         default hr_api.g_varchar2,
2109   p_information7                 in varchar2         default hr_api.g_varchar2,
2110   p_information8                 in varchar2         default hr_api.g_varchar2,
2111   p_information9                 in varchar2         default hr_api.g_varchar2,
2112   p_information10                in varchar2         default hr_api.g_varchar2,
2113   p_information11                in varchar2         default hr_api.g_varchar2,
2114   p_information12                in varchar2         default hr_api.g_varchar2,
2115   p_information13                in varchar2         default hr_api.g_varchar2,
2116   p_information14                in varchar2         default hr_api.g_varchar2,
2117   p_information15                in varchar2         default hr_api.g_varchar2,
2118   p_information16                in varchar2         default hr_api.g_varchar2,
2119   p_information17                in varchar2         default hr_api.g_varchar2,
2120   p_information18                in varchar2         default hr_api.g_varchar2,
2121   p_information19                in varchar2         default hr_api.g_varchar2,
2122   p_information20                in varchar2         default hr_api.g_varchar2,
2123   p_information21                in varchar2         default hr_api.g_varchar2,
2124   p_information22                in varchar2         default hr_api.g_varchar2,
2125   p_information23                in varchar2         default hr_api.g_varchar2,
2126   p_information24                in varchar2         default hr_api.g_varchar2,
2127   p_information25                in varchar2         default hr_api.g_varchar2,
2128   p_information26                in varchar2         default hr_api.g_varchar2,
2129   p_information27                in varchar2         default hr_api.g_varchar2,
2130   p_information28                in varchar2         default hr_api.g_varchar2,
2131   p_information29                in varchar2         default hr_api.g_varchar2,
2132   p_information30                in varchar2         default hr_api.g_varchar2,
2133   p_information_category         in varchar2         default hr_api.g_varchar2,
2134   p_attribute1                   in varchar2         default hr_api.g_varchar2,
2135   p_attribute2                   in varchar2         default hr_api.g_varchar2,
2136   p_attribute3                   in varchar2         default hr_api.g_varchar2,
2137   p_attribute4                   in varchar2         default hr_api.g_varchar2,
2138   p_attribute5                   in varchar2         default hr_api.g_varchar2,
2139   p_attribute6                   in varchar2         default hr_api.g_varchar2,
2140   p_attribute7                   in varchar2         default hr_api.g_varchar2,
2141   p_attribute8                   in varchar2         default hr_api.g_varchar2,
2142   p_attribute9                   in varchar2         default hr_api.g_varchar2,
2143   p_attribute10                  in varchar2         default hr_api.g_varchar2,
2144   p_attribute11                  in varchar2         default hr_api.g_varchar2,
2145   p_attribute12                  in varchar2         default hr_api.g_varchar2,
2146   p_attribute13                  in varchar2         default hr_api.g_varchar2,
2147   p_attribute14                  in varchar2         default hr_api.g_varchar2,
2148   p_attribute15                  in varchar2         default hr_api.g_varchar2,
2149   p_attribute16                  in varchar2         default hr_api.g_varchar2,
2150   p_attribute17                  in varchar2         default hr_api.g_varchar2,
2151   p_attribute18                  in varchar2         default hr_api.g_varchar2,
2152   p_attribute19                  in varchar2         default hr_api.g_varchar2,
2153   p_attribute20                  in varchar2         default hr_api.g_varchar2,
2154   p_attribute21                  in varchar2         default hr_api.g_varchar2,
2155   p_attribute22                  in varchar2         default hr_api.g_varchar2,
2156   p_attribute23                  in varchar2         default hr_api.g_varchar2,
2157   p_attribute24                  in varchar2         default hr_api.g_varchar2,
2158   p_attribute25                  in varchar2         default hr_api.g_varchar2,
2159   p_attribute26                  in varchar2         default hr_api.g_varchar2,
2160   p_attribute27                  in varchar2         default hr_api.g_varchar2,
2161   p_attribute28                  in varchar2         default hr_api.g_varchar2,
2162   p_attribute29                  in varchar2         default hr_api.g_varchar2,
2163   p_attribute30                  in varchar2         default hr_api.g_varchar2,
2164   p_attribute_category           in varchar2         default hr_api.g_varchar2,
2165   p_request_id                   in number           default hr_api.g_number,
2166   p_program_application_id       in number           default hr_api.g_number,
2167   p_program_id                   in number           default hr_api.g_number,
2168   p_program_update_date          in date             default hr_api.g_date,
2169   p_object_version_number        in out nocopy number,
2170   p_effective_date       in date,
2171   p_datetrack_mode       in varchar2,
2172   p_validate                     in boolean  default false
2173   ) is
2174 --
2175   l_rec     hr_psf_shd.g_rec_type;
2176   l_proc varchar2(72) ;
2177 --
2178 Begin
2179 if g_debug then
2180    l_proc    :=  g_package||'upd';
2181    hr_utility.set_location('Entering:'||l_proc, 5);
2182 end if;
2183 
2184   --
2185   -- Call conversion function to turn arguments into the
2186   -- l_rec structure.
2187   --
2188   l_rec :=
2189   hr_psf_shd.convert_args
2190   (
2191   p_position_id,
2192   null,
2193   null,
2194   p_availability_status_id,
2195   hr_api.g_number,                          -- p_business_group_id,
2196   p_entry_step_id,
2197   p_entry_grade_rule_id,
2198   hr_api.g_number,                          -- p_job_id,
2199   p_location_id,
2200   hr_api.g_number ,                         -- p_organization_id,
2201   p_pay_freq_payroll_id,
2202   p_position_definition_id,
2203   p_position_transaction_id,
2204   p_prior_position_id,
2205   p_relief_position_id,
2206   p_entry_grade_id,
2207   p_successor_position_id,
2208   p_supervisor_position_id,
2209   p_amendment_date,
2210   p_amendment_recommendation,
2211   p_amendment_ref_number,
2212   p_bargaining_unit_cd,
2213   p_comments,
2214   p_current_job_prop_end_date,
2215   p_current_org_prop_end_date,
2216   p_avail_status_prop_end_date,
2217   p_date_effective,
2218   p_date_end,
2219   p_earliest_hire_date,
2220   p_fill_by_date,
2221   p_frequency,
2222   p_fte,
2223   p_max_persons,
2224   p_name,
2225   p_overlap_period,
2226   p_overlap_unit_cd,
2227   p_pay_term_end_day_cd,
2228   p_pay_term_end_month_cd,
2229   p_permanent_temporary_flag,
2230   p_permit_recruitment_flag,
2231   p_position_type,
2232   p_posting_description,
2233   p_probation_period,
2234   p_probation_period_unit_cd,
2235   p_replacement_required_flag,
2236   p_review_flag,
2237   p_seasonal_flag,
2238   p_security_requirements,
2239   p_status,
2240   p_term_start_day_cd,
2241   p_term_start_month_cd,
2242   p_time_normal_finish,
2243   p_time_normal_start,
2244   p_update_source_cd,
2245   p_working_hours,
2246   p_works_council_approval_flag,
2247   p_work_period_type_cd,
2248   p_work_term_end_day_cd,
2249   p_work_term_end_month_cd,
2250   p_proposed_fte_for_layoff,
2251   p_proposed_date_for_layoff,
2252   p_pay_basis_id,
2253   p_supervisor_id,
2254   p_copied_to_old_table_flag,
2255   p_information1,
2256   p_information2,
2257   p_information3,
2258   p_information4,
2259   p_information5,
2260   p_information6,
2261   p_information7,
2262   p_information8,
2263   p_information9,
2264   p_information10,
2265   p_information11,
2266   p_information12,
2267   p_information13,
2268   p_information14,
2269   p_information15,
2270   p_information16,
2271   p_information17,
2272   p_information18,
2273   p_information19,
2274   p_information20,
2275   p_information21,
2276   p_information22,
2277   p_information23,
2278   p_information24,
2279   p_information25,
2280   p_information26,
2281   p_information27,
2282   p_information28,
2283   p_information29,
2284   p_information30,
2285   p_information_category,
2286   p_attribute1,
2287   p_attribute2,
2288   p_attribute3,
2289   p_attribute4,
2290   p_attribute5,
2291   p_attribute6,
2292   p_attribute7,
2293   p_attribute8,
2294   p_attribute9,
2295   p_attribute10,
2296   p_attribute11,
2297   p_attribute12,
2298   p_attribute13,
2299   p_attribute14,
2300   p_attribute15,
2301   p_attribute16,
2302   p_attribute17,
2303   p_attribute18,
2304   p_attribute19,
2305   p_attribute20,
2306   p_attribute21,
2307   p_attribute22,
2308   p_attribute23,
2309   p_attribute24,
2310   p_attribute25,
2311   p_attribute26,
2312   p_attribute27,
2313   p_attribute28,
2314   p_attribute29,
2315   p_attribute30,
2316   p_attribute_category,
2317   p_request_id,
2318   p_program_application_id,
2319   p_program_id,
2320   p_program_update_date,
2321   p_object_version_number,
2322   null
2323   );
2324   --
2325   -- Having converted the arguments into the
2326   -- plsql record structure we call the corresponding record
2327   -- business process.
2328   --
2329   upd(l_rec, p_effective_date, p_datetrack_mode, p_validate);
2330   if g_debug then
2331   hr_utility.set_location('l_rec.effective_start_date '  || to_char(l_rec.effective_start_date) || ' ' || l_proc, 100);
2332  end if;
2333   p_object_version_number       := l_rec.object_version_number;
2334   p_effective_start_date        := l_rec.effective_start_date;
2335   p_effective_end_date          := l_rec.effective_end_date;
2336    if g_debug then
2337   hr_utility.set_location('p_effective_start_date ' || to_char(p_effective_start_date) || ' ' || l_proc, 100);
2338    hr_utility.set_location(' Leaving:'||l_proc, 10);
2339    end if;
2340   --
2341   --
2342 End upd;
2343 --
2344 end hr_psf_upd;