DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_PSF_SHD

Source


1 Package Body hr_psf_shd as
2 /* $Header: hrpsfrhi.pkb 120.14.12020000.5 2013/04/12 18:20:17 pathota ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_psf_shd.';  -- Global package name
9 --
10 function get_availability_status(p_availability_status_id number
11                                 ,p_business_group_id      number)
12 return varchar2 is
13 cursor c1 is select system_type_cd
14              from per_shared_types
15              where shared_type_id = p_availability_status_id
16              and lookup_type ='POSITION_AVAILABILITY_STATUS'
17              and (business_group_id = p_business_group_id or business_group_id is null);
18 l_avail_status varchar2(30);
19 begin
20    open c1;
21    fetch c1 into l_avail_status;
22    if c1%notfound then
23       close c1;
24       return null ;
25    else
26       close c1;
27    end if;
28    return l_avail_status;
29 end;
30 --
31 procedure get_position_job_org(p_position_id number,
32                                p_effective_date date default sysdate,
33                                p_job_id  out nocopy number,
34                                p_organization_id out nocopy number
35                                ) is
36 cursor c1 is select job_id, organization_id
37              from hr_all_positions_f
38              where position_id = p_position_id
39              and p_effective_date
40                   between effective_start_date
41                   and effective_end_date;
42 l_job_id number;
43 l_organization_id number;
44 begin
45    open c1;
46    fetch c1 into p_job_id, p_organization_id;
47    close c1;
48 end;
49 ---
50 ---
51 ---
52 function POS_SYSTEM_AVAILABILITY_STATUS (
53 --
54          p_position_id      number,
55          p_effective_date   date) return varchar2 is
56 --
57 cursor csr_lookup is
58          select    system_type_cd
59          from      per_shared_types sht, hr_all_positions_f psf
60          where     shared_type_id  = psf.availability_status_id
61          and       psf.position_id = p_position_id
62          and       p_effective_date between psf.effective_start_date and psf.effective_end_date;
63 --
64 v_meaning          varchar2(30) := null;
65 --
66 begin
67 --
68 -- Only open the cursor if the parameter is going to retrieve anything
69 --
70 if p_position_id is not null then
71   --
72   open csr_lookup;
73   fetch csr_lookup into v_meaning;
74   close csr_lookup;
75   --
76 end if;
77 return v_meaning;
78 end pos_system_availability_status;
79 --
80 --
81 --
82 function SYSTEM_AVAILABILITY_STATUS (
83 --
84          p_availability_status_id      number) return varchar2 is
85 --
86 cursor csr_lookup is
87          select    system_type_cd
88          from      per_shared_types
89          where     shared_type_id  = p_availability_status_id;
90 --
91 v_meaning          varchar2(30) := null;
92 --
93 begin
94 --
95 -- Only open the cursor if the parameter is going to retrieve anything
96 --
97 if p_availability_status_id is not null then
98   --
99   open csr_lookup;
100   fetch csr_lookup into v_meaning;
101   close csr_lookup;
102   --
103 end if;
104 return v_meaning;
105 end system_availability_status;
106 
107 procedure position_wf_sync(p_position_id number, p_effective_date date,p_action Varchar2,p_eff_start_date date,p_eff_end_date date) is
108        myparms  wf_parameter_list_t;
109        l_future_change  boolean;
110        l_position_id    varchar2(15);
111        l_future_date    date;
112        l_proc           varchar2(30);
113 
114        l_action         varchar2(30);
115        l_eff_start_date date;
116        l_eff_end_date   date;
117 
118 
119   begin
120 g_debug := hr_utility.debug_enabled;
121     if g_debug then
122       l_proc := g_package||'position_wf_sync';
123     end if;
124 
125        l_position_id := p_position_id;
126        l_action      := p_action;
127        l_eff_start_date := p_eff_start_date;
128        l_eff_end_date   := p_eff_end_date;
129        --
130          hr_psf_shd.my_synch_routine(l_position_id,l_action,l_eff_start_date,l_eff_end_date);
131 if g_debug then
132          hr_utility.set_location('After my_synch_routine - '  ||l_proc, 16);
133 end if;
134   end;
135   --
136 --
137 -- ----------------------------------------------------------------------------
138 -- |---------------------------< my_synch_routine >---------------------------|
139 -- ----------------------------------------------------------------------------
140 --
141 procedure my_synch_routine(mykey in varchar2,p_action in varchar2,p_effective_start_date in date, p_effective_end_date in date) is
142         --
143         l_position_id  number := to_number(mykey);
144         l_plist        wf_parameter_list_t;
145         l_proc         varchar2(30);
146         l_dummy        varchar2(10);
147         l_start_date date;
148         l_expiration_date date;
149         cnt number;
150         l_name hr_all_positions_f_tl.name%type;
151         --
152 	l_action                    varchar2(30) := p_action;
153         l_eff_start_date            date;
154         l_date_chk	                varchar2(10);
155         l_start_date_canonical      varchar2(30);
156         l_end_date_canonical        varchar2(30);
157         l_position_id_canonical     varchar2(20);
158 
159       begin
160         --
161 g_debug := hr_utility.debug_enabled;
162           if g_debug then
163               l_proc := g_package||'MY_SYNC_ROUTINE';
164         hr_utility.set_location('Before calling WF_SYNC package:'||l_proc, 30);
165           end if;
166 
167    l_position_id_canonical  := FND_NUMBER.number_to_canonical(l_position_id);
168    l_start_date_canonical   := FND_DATE.date_to_canonical(p_effective_start_date);
169    l_end_date_canonical     := FND_DATE.date_to_canonical(p_effective_end_date);
170 
171    l_date_chk := PER_HRWF_SYNCH.chk_date_status(p_effective_start_date,
172                                                 p_effective_end_date);
173 
174 if ((l_action = 'INSERT' and l_date_chk = 'CURRENT') or l_action is null or (l_action = 'UPDATE' and l_date_chk = 'CURRENT'))
175 then
176 select count(*) into cnt from hr_all_positions_f where position_id = l_position_id and availability_status_id = 1;
177 if cnt = 0 then
178 select hr_general.effective_date into l_expiration_date from dual;
179 
180          wf_event.AddParameterToList( 'USER_NAME', 'POS'||':'||l_position_id, l_plist);
181          wf_event.AddParameterToList( 'DISPLAYNAME', '-', l_plist);
182          wf_event.AddParameterToList( 'DESCRIPTION', '-', l_plist);
183          wf_event.AddParameterToList( 'orclWFOrigSystem','POS',l_plist);
184          wf_event.AddParameterToList( 'orclWFOrigSystemID',l_position_id,l_plist);
185          wf_event.AddParameterToList( 'orclWorkFlowNotificationPref', 'QUERY', l_plist);
186          wf_event.AddParameterToList( 'orclIsEnabled', 'ACTIVE', l_plist);
187          wf_event.AddParameterToList( 'ExpirationDate',to_char(l_expiration_date,wf_engine.date_format), l_plist);
188          wf_event.AddParameterToList( 'WFSYNCH_OVERWRITE','TRUE',l_plist);
189 --         wf_event.AddParameterToList( 'Raiseerrors', 'TRUE', l_plist);
190 
191               WF_LOCAL_SYNCH.propagate_role(
192                                   p_orig_system     => 'POS',
193                                   p_orig_system_id  => l_position_id,
194                                   p_attributes      => l_plist,
195                                   p_expiration_date => l_expiration_date);
196 elsif ((l_action = 'INSERT' and l_date_chk = 'CURRENT') or (l_action = 'UPDATE' and l_date_chk = 'CURRENT'))
197        then
198 select min(effective_start_date), max(effective_end_date)
199 into l_start_date, l_expiration_date from hr_all_positions_f
200 where position_id = l_position_id and availability_status_id = 1;
201 
202 begin
203 select name into l_name from hr_all_positions_f_tl where position_id = l_position_id and language = userenv('LANG');
204 exception when others then
205 null;
206 end;
207 
208          wf_event.AddParameterToList( 'USER_NAME', 'POS'||':'||l_position_id, l_plist);
209          wf_event.AddParameterToList( 'DISPLAYNAME', l_name, l_plist);
210          wf_event.AddParameterToList( 'DESCRIPTION', l_name, l_plist);
211          wf_event.AddParameterToList( 'orclWFOrigSystem','POS',l_plist);
212          wf_event.AddParameterToList( 'orclWFOrigSystemID',l_position_id,l_plist);
213          wf_event.AddParameterToList( 'orclWorkFlowNotificationPref', 'QUERY', l_plist);
214          wf_event.AddParameterToList( 'orclIsEnabled', 'ACTIVE', l_plist);
215          wf_event.AddParameterToList( 'ExpirationDate',to_char(l_expiration_date,wf_engine.date_format), l_plist);
216          wf_event.AddParameterToList( 'WFSYNCH_OVERWRITE','TRUE',l_plist);
217 --         wf_event.AddParameterToList( 'Raiseerrors', 'TRUE', l_plist);
218 
219 if g_debug then
220    hr_utility.set_location('l_start_date is '||l_start_date, 20);
221 end if;
222 
223               WF_LOCAL_SYNCH.propagate_role(
224                                   p_orig_system     => 'POS',
225                                   p_orig_system_id  => l_position_id,
226                                   p_attributes      => l_plist,
227                                   p_start_date      => l_start_date,
228                                   p_expiration_date => l_expiration_date);
229 
230 
231 
232 end if;
233 elsif (l_action = 'UPDATE' and l_date_chk = 'FUTURE') then
234 
235                 wf_event.addparametertolist(p_name          => 'CONTEXT',
236                                             p_value         => 'POSITION',
237                                             p_parameterlist => l_plist);
238 
239                 wf_event.addparametertolist(p_name          => 'POSITIONID',
240                                             p_value         => l_position_id_canonical,
241                                             p_parameterlist => l_plist);
242 
243                 wf_event.addparametertolist(p_name          => 'STARTDATE',
244                                             p_value         => l_start_date_canonical,
245                                             p_parameterlist => l_plist);
246 
247                 wf_event.addparametertolist(p_name          => 'ENDDATE',
248                                             p_value         => l_end_date_canonical,
249                                             p_parameterlist => l_plist);
250 
251 
252                 wf_util.call_me_later(p_callback   => 'hr_psf_shd.call_back',
253                                       p_when       => trunc(p_effective_start_date),
254                                       p_parameters => l_plist);
255 
256 end if;
257 if g_debug then
258         hr_utility.set_location('After calling WF_SYNC package:'||l_proc, 30);
259 end if;
260         --
261 end my_synch_routine;
262 
263 --
264 -- ----------------------------------------------------------------------------
265 -- |---------------------------< constraint_error >---------------------------|
266 -- ----------------------------------------------------------------------------
267 Procedure constraint_error
268             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
269 --
270   l_proc    varchar2(72);
271 --
272 Begin
273 g_debug := hr_utility.debug_enabled;
274 if g_debug then
275   l_proc     := g_package||'constraint_error';
276   hr_utility.set_location('Entering:'||l_proc, 5);
277 end if;
278   --
279   If (p_constraint_name = 'HR_ALL_POSITIONS_F_FK11') Then
280     hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
281     hr_utility.set_message_token('PROCEDURE', l_proc);
282     hr_utility.set_message_token('STEP','5');
283     hr_utility.raise_error;
284   ElsIf (p_constraint_name = 'HR_ALL_POSITIONS_F_FK12') Then
285     hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
286     hr_utility.set_message_token('PROCEDURE', l_proc);
287     hr_utility.set_message_token('STEP','10');
288     hr_utility.raise_error;
289   ElsIf (p_constraint_name = 'HR_ALL_POSITIONS_F_FK4') Then
290     hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
291     hr_utility.set_message_token('PROCEDURE', l_proc);
292     hr_utility.set_message_token('STEP','15');
293     hr_utility.raise_error;
294   ElsIf (p_constraint_name = 'HR_ALL_POSITIONS_F_FK5') Then
295     hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
296     hr_utility.set_message_token('PROCEDURE', l_proc);
297     hr_utility.set_message_token('STEP','20');
298     hr_utility.raise_error;
299   ElsIf (p_constraint_name = 'HR_ALL_POSITIONS_F_FK6') Then
300     hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
301     hr_utility.set_message_token('PROCEDURE', l_proc);
302     hr_utility.set_message_token('STEP','25');
303     hr_utility.raise_error;
304   ElsIf (p_constraint_name = 'HR_ALL_POSITIONS_F_FK7') Then
305     hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
306     hr_utility.set_message_token('PROCEDURE', l_proc);
307     hr_utility.set_message_token('STEP','30');
308     hr_utility.raise_error;
309   ElsIf (p_constraint_name = 'HR_ALL_POSITIONS_F_PK') Then
310     hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
311     hr_utility.set_message_token('PROCEDURE', l_proc);
312     hr_utility.set_message_token('STEP','35');
313     hr_utility.raise_error;
314   Else
315     hr_utility.set_message(800, 'HR_7877_API_INVALID_CONSTRAINT');
316     hr_utility.set_message_token('PROCEDURE', l_proc);
317     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
318     hr_utility.raise_error;
319   End If;
320   --
321 if g_debug then
322   hr_utility.set_location(' Leaving:'||l_proc, 10);
323 end if;
324 End constraint_error;
325 --
326 -- ----------------------------------------------------------------------------
327 -- |-----------------------------< api_updating >-----------------------------|
328 -- ----------------------------------------------------------------------------
329 Function api_updating
330   (p_effective_date     in date,
331    p_position_id     in number,
332    p_object_version_number in number
333   ) Return Boolean Is
334 --
335   --
336   -- Cursor selects the 'current' row from the HR Schema
337   --
338   Cursor C_Sel1 is
339     select
340    position_id,
341    effective_start_date,
342    effective_end_date,
343    availability_status_id,
344    business_group_id,
345    entry_step_id,
346    entry_grade_rule_id,
347    job_id,
348    location_id,
349    organization_id,
350    pay_freq_payroll_id,
351    position_definition_id,
352    position_transaction_id,
353    prior_position_id,
354    relief_position_id,
355    entry_grade_id,
356    successor_position_id,
357    supervisor_position_id,
358    amendment_date,
359    amendment_recommendation,
360    amendment_ref_number,
361    bargaining_unit_cd,
362    null,
363    current_job_prop_end_date,
364    current_org_prop_end_date,
365    avail_status_prop_end_date,
366    date_effective,
367    date_end,
368    earliest_hire_date,
369    fill_by_date,
370    frequency,
371    fte,
372    max_persons,
373    name,
374    overlap_period,
375    overlap_unit_cd,
376    pay_term_end_day_cd,
377    pay_term_end_month_cd,
378    permanent_temporary_flag,
379    permit_recruitment_flag,
380    position_type,
381    posting_description,
382    probation_period,
383    probation_period_unit_cd,
384    replacement_required_flag,
385    review_flag,
386    seasonal_flag,
387    security_requirements,
388    status,
389    term_start_day_cd,
390    term_start_month_cd,
391    time_normal_finish,
392    time_normal_start,
393    update_source_cd,
394    working_hours,
395    works_council_approval_flag,
396    work_period_type_cd,
397    work_term_end_day_cd,
398    work_term_end_month_cd,
399         proposed_fte_for_layoff,
400         proposed_date_for_layoff,
401         pay_basis_id            ,
402         supervisor_id           ,
403         copied_to_old_table_flag,
404 /*
405 position_id               ,
406 effective_start_date      ,
407 effective_end_date        ,
408 availability_status_id    ,
409 business_group_id         ,
410 entry_step_id             ,
411 entry_grade_rule_id       ,
412 job_id                    ,
413 location_id               ,
414 organization_id           ,
415 pay_freq_payroll_id       ,
416 position_definition_id    ,
417 position_transaction_id   ,
418 prior_position_id         ,
419 relief_position_id        ,
420 entry_grade_id            ,
421 successor_position_id     ,
422 supervisor_position_id    ,
423 amendment_date            ,
424 amendment_recommendation  ,
425 amendment_ref_number      ,
426 bargaining_unit_cd        ,
427 comments                  ,
428 current_job_prop_end_date ,
429 current_org_prop_end_date ,
430 avail_status_prop_end_date,
431 date_effective            ,
432 date_end                  ,
433 earliest_hire_date        ,
434 fill_by_date              ,
435 frequency                 ,
436 fte                       ,
437 max_persons               ,
438 name                      ,
439 overlap_period            ,
440 overlap_unit_cd           ,
441 pay_term_end_day_cd       ,
442 pay_term_end_month_cd     ,
443 permanent_temporary_flag  ,
444 permit_recruitment_flag   ,
445 position_type             ,
446 posting_description       ,
447 probation_period          ,
448 probation_period_unit_cd  ,
449 replacement_required_flag ,
450 review_flag               ,
451 seasonal_flag             ,
452 security_requirements     ,
453 status                    ,
454 term_start_day_cd         ,
455 term_start_month_cd       ,
456 time_normal_finish        ,
457 time_normal_start         ,
458 update_source_cd          ,
459 working_hours             ,
460 works_council_approval_flag,
461 work_period_type_cd       ,
462 work_term_end_day_cd      ,
463 work_term_end_month_cd    ,
464 proposed_fte_for_layoff   ,
465 proposed_date_for_layoff  ,
466 pay_basis_id              ,
467 supervisor_id             ,
468 copied_to_old_table_flag  ,
469 */
470    information1,
471    information2,
472    information3,
473    information4,
474    information5,
475    information6,
476    information7,
477    information8,
478    information9,
479    information10,
480    information11,
481    information12,
482    information13,
483    information14,
484    information15,
485    information16,
486    information17,
487    information18,
488    information19,
489    information20,
490    information21,
491    information22,
492    information23,
493    information24,
494    information25,
495    information26,
496    information27,
497    information28,
498    information29,
499    information30,
500    information_category,
501    attribute1,
502    attribute2,
503    attribute3,
504    attribute4,
505    attribute5,
506    attribute6,
507    attribute7,
508    attribute8,
509    attribute9,
510    attribute10,
511    attribute11,
512    attribute12,
513    attribute13,
514    attribute14,
515    attribute15,
516    attribute16,
517    attribute17,
518    attribute18,
519    attribute19,
520    attribute20,
521    attribute21,
522    attribute22,
523    attribute23,
524    attribute24,
525    attribute25,
526    attribute26,
527    attribute27,
528    attribute28,
529    attribute29,
530    attribute30,
531    attribute_category,
532    request_id,
533    program_application_id,
534    program_id,
535    program_update_date,
536    object_version_number,
537    null
538     from hr_all_positions_f
539     where   position_id = p_position_id
540     and     p_effective_date
541     between effective_start_date and effective_end_date;
542 --
543   l_proc varchar2(72);
544   l_fct_ret boolean;
545 --
546 Begin
547 g_debug := hr_utility.debug_enabled;
548 if g_debug then
549 l_proc      := g_package||'api_updating';
550   hr_utility.set_location('Entering:'||l_proc, 5);
551 end if;
552   --
553   If (p_effective_date is null or
554       p_position_id is null or
555       p_object_version_number is null) Then
556     --
557     -- One of the primary key arguments is null therefore we must
558     -- set the returning function value to false
559     --
560     l_fct_ret := false;
561   Else
562     If (p_position_id = g_old_rec.position_id and
563         p_object_version_number = g_old_rec.object_version_number) Then
564 if g_debug then
565       hr_utility.set_location(l_proc, 10);
566 end if;
567       --
568       -- The g_old_rec is current therefore we must
569       -- set the returning function to true
570       --
571       l_fct_ret := true;
572     Else
573       --
574       -- Select the current row
575       --
576       Open C_Sel1;
577       Fetch C_Sel1 Into g_old_rec;
578       If C_Sel1%notfound Then
579         Close C_Sel1;
580         --
581         -- The primary key is invalid therefore we must error
582         --
583         hr_utility.set_message(800, 'HR_7220_INVALID_PRIMARY_KEY');
584         hr_utility.raise_error;
585       End If;
586       Close C_Sel1;
587       If (p_object_version_number <> g_old_rec.object_version_number) Then
588         hr_utility.set_message(800, 'HR_7155_OBJECT_INVALID');
589         hr_utility.raise_error;
590       End If;
591 if g_debug then
592       hr_utility.set_location(l_proc, 15);
593 end if;
594       l_fct_ret := true;
595     End If;
596   End If;
597 if g_debug then
598   hr_utility.set_location(' Leaving:'||l_proc, 20);
599 end if;
600   Return (l_fct_ret);
601 --
602 End api_updating;
603 --
604 -- ----------------------------------------------------------------------------
605 -- |--------------------------< find_dt_del_modes >---------------------------|
606 -- ----------------------------------------------------------------------------
607 Procedure find_dt_del_modes
608    (p_effective_date in  date,
609     p_base_key_value in  number,
610     p_zap       out nocopy boolean,
611     p_delete    out nocopy boolean,
612     p_future_change out nocopy boolean,
613     p_delete_next_change out nocopy boolean) is
614 --
615   l_proc       varchar2(72);
616 --
617   l_parent_key_value1   number;
618   l_parent_key_value2   number;
619   l_parent_key_value3   number;
620 --  l_parent_key_value4 number;
621   --
622   Cursor C_Sel1 Is
623     select  t.supervisor_position_id,
624             t.successor_position_id,
625             t.relief_position_id
626     from    hr_all_positions_f t
627     where   t.position_id = p_base_key_value
628     and     p_effective_date
629     between t.effective_start_date and t.effective_end_date;
630 --
631 Begin
632 g_debug := hr_utility.debug_enabled;
633 if g_debug then
634  l_proc  := g_package||'find_dt_del_modes';
635   hr_utility.set_location('Entering:'||l_proc, 5);
636 end if;
637   Open  C_Sel1;
638   Fetch C_Sel1 Into l_parent_key_value1,
639           l_parent_key_value2,
640           l_parent_key_value3;
641   If C_Sel1%notfound then
642     Close C_Sel1;
643     hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
644     hr_utility.set_message_token('PROCEDURE', l_proc);
645     hr_utility.set_message_token('STEP','10');
646     hr_utility.raise_error;
647   End If;
648   Close C_Sel1;
649   --
650   -- Call the corresponding datetrack api
651   --
652    dt_api.find_dt_del_modes
653    (p_effective_date       =>  p_effective_date,
654     p_base_table_name   => 'hr_all_positions_f',
655     p_base_key_column   => 'position_id',
656     p_base_key_value       =>  p_base_key_value,
657     p_parent_table_name1   => 'hr_all_positions_f',
658     p_parent_key_column1   => 'supervisor_position_id', --fix for bug# 10141151
659     p_parent_key_value1 =>  l_parent_key_value1,
660     p_parent_table_name2   => 'hr_all_positions_f',
661     p_parent_key_column2   => 'successor_position_id',  --fix for bug# 10141151
662     p_parent_key_value2 =>  l_parent_key_value2,
663     p_parent_table_name3   => 'hr_all_positions_f',
664     p_parent_key_column3   => 'relief_position_id',  --fix for bug# 10141151
665     p_parent_key_value3 =>  l_parent_key_value3,
666     p_zap         =>  p_zap,
667     p_delete            =>  p_delete,
668     p_future_change        =>  p_future_change,
669     p_delete_next_change   =>  p_delete_next_change);
670   --
671   p_delete := false ;
672 
673 if g_debug then
674   hr_utility.set_location(' Leaving:'||l_proc, 10);
675 end if;
676 End find_dt_del_modes;
677 --
678 -- ----------------------------------------------------------------------------
679 -- |--------------------------< find_dt_upd_modes >---------------------------|
680 -- ----------------------------------------------------------------------------
681 Procedure find_dt_upd_modes
682    (p_effective_date in  date,
683     p_base_key_value in  number,
684     p_correction   out nocopy boolean,
685     p_update    out nocopy boolean,
686     p_update_override out nocopy boolean,
687     p_update_change_insert out nocopy boolean) is
688 --
689   l_proc    varchar2(72);
690 --
691 Begin
692 g_debug := hr_utility.debug_enabled;
693 if g_debug then
694   l_proc := g_package||'find_dt_upd_modes';
695   hr_utility.set_location('Entering:'||l_proc, 5);
696 end if;
697   --
698   -- Call the corresponding datetrack api
699   --
700   dt_api.find_dt_upd_modes
701    (p_effective_date       => p_effective_date,
702     p_base_table_name   => 'hr_all_positions_f',
703     p_base_key_column   => 'position_id',
704     p_base_key_value    => p_base_key_value,
705     p_correction     => p_correction,
706     p_update            => p_update,
707     p_update_override   => p_update_override,
708     p_update_change_insert => p_update_change_insert);
709   --
710 if g_debug then
711   hr_utility.set_location(' Leaving:'||l_proc, 10);
712 end if;
713 End find_dt_upd_modes;
714 --
715 -- ----------------------------------------------------------------------------
716 -- |------------------------< upd_effective_end_date >------------------------|
717 -- ----------------------------------------------------------------------------
718 Procedure upd_effective_end_date
719    (p_effective_date    in date,
720     p_base_key_value    in number,
721     p_new_effective_end_date  in date,
722     p_validation_start_date   in date,
723     p_validation_end_date     in date,
724          p_object_version_number       out nocopy number) is
725 --
726   l_proc         varchar2(72);
727   l_object_version_number number;
728 --
729 Begin
730 g_debug := hr_utility.debug_enabled;
731 g_debug := hr_utility.debug_enabled;
732 if g_debug then
733   l_proc  := g_package||'upd_effective_end_date';
734   hr_utility.set_location('Entering:'||l_proc, 5);
735 end if;
736   --
737   -- Because we are updating a row we must get the next object
738   -- version number.
739   --
740   l_object_version_number :=
741     dt_api.get_object_version_number
742    (p_base_table_name   => 'hr_all_positions_f',
743     p_base_key_column   => 'position_id',
744     p_base_key_value => p_base_key_value);
745   --
746 if g_debug then
747   hr_utility.set_location(l_proc, 10);
748 end if;
749   --
750   -- Update the specified datetrack row setting the effective
751   -- end date to the specified new effective end date.
752   --
753   update  hr_all_positions_f t
754   set   t.effective_end_date    = p_new_effective_end_date,
755      t.object_version_number = l_object_version_number
756   where    t.position_id     = p_base_key_value
757   and   p_effective_date
758   between t.effective_start_date and t.effective_end_date;
759   --
760   p_object_version_number := l_object_version_number;
761 if g_debug then
762   hr_utility.set_location(' Leaving:'||l_proc, 15);
763 end if;
764 --
765 Exception
766   When Others Then
767     Raise;
768 End upd_effective_end_date;
769 --
770 -- ----------------------------------------------------------------------------
771 -- |---------------------------------< lck >----------------------------------|
772 -- ----------------------------------------------------------------------------
773 Procedure lck
774    (p_effective_date  in  date,
775     p_datetrack_mode  in  varchar2,
776     p_position_id  in  number,
777     p_object_version_number in  number,
778     p_validation_start_date out nocopy date,
779     p_validation_end_date   out nocopy date) is
780 --
781   l_proc      varchar2(72);
782   l_validation_start_date date;
783   l_validation_end_date   date;
784   l_object_invalid     exception;
785   l_argument        varchar2(30);
786   --
787   -- Cursor C_Sel1 selects the current locked row as of session date
788   -- ensuring that the object version numbers match.
789   --
790   Cursor C_Sel1 is
791     select
792    position_id,
793    effective_start_date,
794    effective_end_date,
795    availability_status_id,
796    business_group_id,
797    entry_step_id,
798    entry_grade_rule_id,
799    job_id,
800    location_id,
801    organization_id,
802    pay_freq_payroll_id,
803    position_definition_id,
804    position_transaction_id,
805    prior_position_id,
806    relief_position_id,
807    entry_grade_id,
808    successor_position_id,
809    supervisor_position_id,
810    amendment_date,
811    amendment_recommendation,
812    amendment_ref_number,
813    bargaining_unit_cd,
814    comments,
815    current_job_prop_end_date,
816    current_org_prop_end_date,
817    avail_status_prop_end_date,
818    date_effective,
819    date_end,
820    earliest_hire_date,
821    fill_by_date,
822    frequency,
823    fte,
824    max_persons,
825    name,
826    overlap_period,
827    overlap_unit_cd,
828    pay_term_end_day_cd,
829    pay_term_end_month_cd,
830    permanent_temporary_flag,
831    permit_recruitment_flag,
832    position_type,
833    posting_description,
834    probation_period,
835    probation_period_unit_cd,
836    replacement_required_flag,
837    review_flag,
838    seasonal_flag,
839    security_requirements,
840    status,
841    term_start_day_cd,
842    term_start_month_cd,
843    time_normal_finish,
844    time_normal_start,
845    update_source_cd,
846    working_hours,
847    works_council_approval_flag,
848    work_period_type_cd,
849    work_term_end_day_cd,
850    work_term_end_month_cd,
851       proposed_fte_for_layoff,
852       proposed_date_for_layoff,
853 pay_basis_id              ,
854 supervisor_id             ,
855 copied_to_old_table_flag  ,
856    information1,
857    information2,
858    information3,
859    information4,
860    information5,
861    information6,
862    information7,
863    information8,
864    information9,
865    information10,
866    information11,
867    information12,
868    information13,
869    information14,
870    information15,
871    information16,
872    information17,
873    information18,
874    information19,
875    information20,
876    information21,
877    information22,
878    information23,
879    information24,
880    information25,
881    information26,
882    information27,
883    information28,
884    information29,
885    information30,
886    information_category,
887    attribute1,
888    attribute2,
889    attribute3,
890    attribute4,
891    attribute5,
892    attribute6,
893    attribute7,
894    attribute8,
895    attribute9,
896    attribute10,
897    attribute11,
898    attribute12,
899    attribute13,
900    attribute14,
901    attribute15,
902    attribute16,
903    attribute17,
904    attribute18,
905    attribute19,
906    attribute20,
907    attribute21,
908    attribute22,
909    attribute23,
910    attribute24,
911    attribute25,
912    attribute26,
913    attribute27,
914    attribute28,
915    attribute29,
916    attribute30,
917    attribute_category,
918    request_id,
919    program_application_id,
920    program_id,
921    program_update_date,
922    object_version_number,
923    null
924     from    hr_all_positions_f
925     where   position_id         = p_position_id
926     and      p_effective_date
927     between effective_start_date and effective_end_date
928     for update nowait;
929   --
930   --
931   --
932 Begin
933 g_debug := hr_utility.debug_enabled;
934 if g_debug then
935  l_proc   := g_package||'lck';
936   hr_utility.set_location('Entering:'||l_proc, 5);
937 end if;
938   --
939   -- Ensure that all the mandatory arguments are not null
940   --
941   hr_api.mandatory_arg_error(p_api_name       => l_proc,
942                              p_argument       => 'effective_date',
943                              p_argument_value => p_effective_date);
944   --
945   hr_api.mandatory_arg_error(p_api_name       => l_proc,
946                              p_argument       => 'datetrack_mode',
947                              p_argument_value => p_datetrack_mode);
948   --
949   hr_api.mandatory_arg_error(p_api_name       => l_proc,
950                              p_argument       => 'position_id',
951                              p_argument_value => p_position_id);
952   --
953   hr_api.mandatory_arg_error(p_api_name       => l_proc,
954                              p_argument       => 'object_version_number',
955                              p_argument_value => p_object_version_number);
956   --
957   -- Check to ensure the datetrack mode is not INSERT.
958   --
959   If (p_datetrack_mode <> 'INSERT') then
960     --
961     -- We must select and lock the current row.
962     --
963     Open  C_Sel1;
964     Fetch C_Sel1 Into g_old_rec;
965     If C_Sel1%notfound then
966       Close C_Sel1;
967       --
968       -- The primary key is invalid therefore we must error
969       --
970       hr_utility.set_message(800, 'HR_7220_INVALID_PRIMARY_KEY');
971       hr_utility.raise_error;
972     End If;
973     Close C_Sel1;
974     If (p_object_version_number <> g_old_rec.object_version_number) Then
975         hr_utility.set_message(800, 'HR_7155_OBJECT_INVALID');
976         hr_utility.raise_error;
977     End If;
978 if g_debug then
979     hr_utility.set_location(l_proc, 15);
980 end if;
981     --
982     --
983     -- Validate the datetrack mode mode getting the validation start
984     -- and end dates for the specified datetrack operation.
985     --
986 if g_debug then
987     hr_utility.set_location(' effective date ' || p_Effective_Date || l_proc, 12125);
988 end if;
989 
990     -- Bug 3199913
991     -- Removed refernce to 'per_all_assignments_f' since assignment and position
992     -- do not have parent-child relationship.
993     -- Removed refernce to 'pay_element_links_f' since element links and position
994     -- do not have parent-child relationship.
995     -- Removed reference to 'pay_payrolls_f'
996 
997     dt_api.validate_dt_mode
998    (p_effective_date    => p_effective_date,
999     p_datetrack_mode    => p_datetrack_mode,
1000     p_base_table_name      => 'hr_all_positions_f',
1001     p_base_key_column      => 'position_id',
1002     p_base_key_value       => p_position_id,
1003     p_parent_table_name1      => 'hr_all_positions_f',
1004     p_parent_key_column1      => 'successor_position_id',
1005     p_parent_key_value1       => g_old_rec.successor_position_id,
1006     p_parent_table_name2      => 'hr_all_positions_f',
1007     p_parent_key_column2      => 'relief_position_id',
1008     p_parent_key_value2       => g_old_rec.relief_position_id,
1009     p_parent_table_name3      => 'hr_all_positions_f',
1010     p_parent_key_column3      => 'supervisor_position_id',
1011     p_parent_key_value3       => g_old_rec.supervisor_position_id,
1012 /*
1013     p_child_table_name3       => 'hr_all_positions_f',
1014     p_child_key_column3       => 'position_id',
1015     p_child_table_name4       => 'hr_all_positions_f',
1016     p_child_key_column4       => 'position_id',
1017 */
1018     p_enforce_foreign_locking => true,
1019     p_validation_start_date   => l_validation_start_date,
1020     p_validation_end_date     => l_validation_end_date);
1021   Else
1022     --
1023     -- We are doing a datetrack 'INSERT' which is illegal within this
1024     -- procedure therefore we must error (note: to lck on insert the
1025     -- private procedure ins_lck should be called).
1026     --
1027     hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
1028     hr_utility.set_message_token('PROCEDURE', l_proc);
1029     hr_utility.set_message_token('STEP','20');
1030     hr_utility.raise_error;
1031   End If;
1032   --
1033   -- Set the validation start and end date OUT arguments
1034   --
1035   p_validation_start_date := l_validation_start_date;
1036   p_validation_end_date   := l_validation_end_date;
1037   --
1038 if g_debug then
1039   hr_utility.set_location(' Leaving:'||l_proc, 30);
1040 end if;
1041 --
1042 -- We need to trap the ORA LOCK exception
1043 --
1044 Exception
1045   When HR_Api.Object_Locked then
1046     --
1047     -- The object is locked therefore we need to supply a meaningful
1048     -- error message.
1049     --
1050     hr_utility.set_message(800, 'HR_7165_OBJECT_LOCKED');
1051     hr_utility.set_message_token('TABLE_NAME', 'hr_all_positions_f');
1052     hr_utility.raise_error;
1053   When l_object_invalid then
1054     --
1055     -- The object doesn't exist or is invalid
1056     --
1057     hr_utility.set_message(800, 'HR_7155_OBJECT_INVALID');
1058     hr_utility.set_message_token('TABLE_NAME', 'hr_all_positions_f');
1059     hr_utility.raise_error;
1060 End lck;
1061 --
1062 -- ----------------------------------------------------------------------------
1063 -- |-----------------------------< convert_args >-----------------------------|
1064 -- ----------------------------------------------------------------------------
1065 Function convert_args
1066    (
1067    p_position_id                   in number,
1068    p_effective_start_date          in date,
1069    p_effective_end_date            in date,
1070    p_availability_status_id        in number,
1071    p_business_group_id             in number,
1072    p_entry_step_id                 in number,
1073    p_entry_grade_rule_id           in number,
1074    p_job_id                        in number,
1075    p_location_id                   in number,
1076    p_organization_id               in number,
1077    p_pay_freq_payroll_id           in number,
1078    p_position_definition_id        in number,
1079    p_position_transaction_id       in number,
1080    p_prior_position_id             in number,
1081    p_relief_position_id            in number,
1082    p_entry_grade_id         in number,
1083    p_successor_position_id         in number,
1084    p_supervisor_position_id        in number,
1085    p_amendment_date                in date,
1086    p_amendment_recommendation      in varchar2,
1087    p_amendment_ref_number          in varchar2,
1088    p_bargaining_unit_cd            in varchar2,
1089    p_comments                      in varchar2,
1090    p_current_job_prop_end_date     in date,
1091    p_current_org_prop_end_date     in date,
1092    p_avail_status_prop_end_date    in date,
1093    p_date_effective                in date,
1094    p_date_end                      in date,
1095    p_earliest_hire_date            in date,
1096    p_fill_by_date                  in date,
1097    p_frequency                     in varchar2,
1098    p_fte                           in number,
1099    p_max_persons                   in number,
1100    p_name                          in varchar2,
1101    p_overlap_period                in number,
1102    p_overlap_unit_cd               in varchar2,
1103    p_pay_term_end_day_cd           in varchar2,
1104    p_pay_term_end_month_cd         in varchar2,
1105    p_permanent_temporary_flag      in varchar2,
1106    p_permit_recruitment_flag       in varchar2,
1107    p_position_type                 in varchar2,
1108    p_posting_description           in varchar2,
1109    p_probation_period              in number,
1110    p_probation_period_unit_cd      in varchar2,
1111    p_replacement_required_flag     in varchar2,
1112    p_review_flag                   in varchar2,
1113    p_seasonal_flag                 in varchar2,
1114    p_security_requirements         in varchar2,
1115    p_status                        in varchar2,
1116    p_term_start_day_cd             in varchar2,
1117    p_term_start_month_cd           in varchar2,
1118    p_time_normal_finish            in varchar2,
1119    p_time_normal_start             in varchar2,
1120    p_update_source_cd              in varchar2,
1121    p_working_hours                 in number,
1122    p_works_council_approval_flag   in varchar2,
1123    p_work_period_type_cd           in varchar2,
1124    p_work_term_end_day_cd          in varchar2,
1125    p_work_term_end_month_cd        in varchar2,
1126         p_proposed_fte_for_layoff       in number,
1127         p_proposed_date_for_layoff      in date,
1128         p_pay_basis_id                  in number,
1129         p_supervisor_id                 in number,
1130         p_copied_to_old_table_flag      in varchar2,
1131    p_information1                  in varchar2,
1132    p_information2                  in varchar2,
1133    p_information3                  in varchar2,
1134    p_information4                  in varchar2,
1135    p_information5                  in varchar2,
1136    p_information6                  in varchar2,
1137    p_information7                  in varchar2,
1138    p_information8                  in varchar2,
1139    p_information9                  in varchar2,
1140    p_information10                 in varchar2,
1141    p_information11                 in varchar2,
1142    p_information12                 in varchar2,
1143    p_information13                 in varchar2,
1144    p_information14                 in varchar2,
1145    p_information15                 in varchar2,
1146    p_information16                 in varchar2,
1147    p_information17                 in varchar2,
1148    p_information18                 in varchar2,
1149    p_information19                 in varchar2,
1150    p_information20                 in varchar2,
1151    p_information21                 in varchar2,
1152    p_information22                 in varchar2,
1153    p_information23                 in varchar2,
1154    p_information24                 in varchar2,
1155    p_information25                 in varchar2,
1156    p_information26                 in varchar2,
1157    p_information27                 in varchar2,
1158    p_information28                 in varchar2,
1159    p_information29                 in varchar2,
1160    p_information30                 in varchar2,
1161    p_information_category          in varchar2,
1162    p_attribute1                    in varchar2,
1163    p_attribute2                    in varchar2,
1164    p_attribute3                    in varchar2,
1165    p_attribute4                    in varchar2,
1166    p_attribute5                    in varchar2,
1167    p_attribute6                    in varchar2,
1168    p_attribute7                    in varchar2,
1169    p_attribute8                    in varchar2,
1170    p_attribute9                    in varchar2,
1171    p_attribute10                   in varchar2,
1172    p_attribute11                   in varchar2,
1173    p_attribute12                   in varchar2,
1174    p_attribute13                   in varchar2,
1175    p_attribute14                   in varchar2,
1176    p_attribute15                   in varchar2,
1177    p_attribute16                   in varchar2,
1178    p_attribute17                   in varchar2,
1179    p_attribute18                   in varchar2,
1180    p_attribute19                   in varchar2,
1181    p_attribute20                   in varchar2,
1182    p_attribute21                   in varchar2,
1183    p_attribute22                   in varchar2,
1184    p_attribute23                   in varchar2,
1185    p_attribute24                   in varchar2,
1186    p_attribute25                   in varchar2,
1187    p_attribute26                   in varchar2,
1188    p_attribute27                   in varchar2,
1189    p_attribute28                   in varchar2,
1190    p_attribute29                   in varchar2,
1191    p_attribute30                   in varchar2,
1192    p_attribute_category            in varchar2,
1193    p_request_id                    in number,
1194    p_program_application_id        in number,
1195    p_program_id                    in number,
1196    p_program_update_date           in date,
1197    p_object_version_number         in number,
1198    p_security_profile_id      in number
1199    )
1200    Return g_rec_type is
1201 --
1202   l_rec    g_rec_type;
1203   l_proc  varchar2(72);
1204 --
1205 Begin
1206   --
1207 g_debug := hr_utility.debug_enabled;
1208 if g_debug then
1209  l_proc   := g_package||'convert_args';
1210   hr_utility.set_location('Entering:'||l_proc, 5);
1211 end if;
1212   --
1213   -- Convert arguments into local l_rec structure.
1214   --
1215   l_rec.position_id                      := p_position_id;
1216   l_rec.effective_start_date             := p_effective_start_date;
1217   l_rec.effective_end_date               := p_effective_end_date;
1218   l_rec.availability_status_id           := p_availability_status_id;
1219   l_rec.business_group_id                := p_business_group_id;
1220   l_rec.entry_step_id                    := p_entry_step_id;
1221   l_rec.entry_grade_rule_id              := p_entry_grade_rule_id;
1222   l_rec.job_id                           := p_job_id;
1223   l_rec.location_id                      := p_location_id;
1224   l_rec.organization_id                  := p_organization_id;
1225   l_rec.pay_freq_payroll_id              := p_pay_freq_payroll_id;
1226   l_rec.position_definition_id           := p_position_definition_id;
1227   l_rec.position_transaction_id          := p_position_transaction_id;
1228   l_rec.prior_position_id                := p_prior_position_id;
1229   l_rec.relief_position_id               := p_relief_position_id;
1230   l_rec.entry_grade_id                   := p_entry_grade_id;
1231   l_rec.successor_position_id            := p_successor_position_id;
1232   l_rec.supervisor_position_id           := p_supervisor_position_id;
1233   l_rec.amendment_date                   := p_amendment_date;
1234   l_rec.amendment_recommendation         := p_amendment_recommendation;
1235   l_rec.amendment_ref_number             := p_amendment_ref_number;
1236   l_rec.bargaining_unit_cd               := p_bargaining_unit_cd;
1237   l_rec.comments                         := p_comments;
1238   l_rec.current_job_prop_end_date        := p_current_job_prop_end_date;
1239   l_rec.current_org_prop_end_date        := p_current_org_prop_end_date;
1240   l_rec.avail_status_prop_end_date       := p_avail_status_prop_end_date;
1241   l_rec.date_effective                   := p_date_effective;
1242   l_rec.date_end                         := p_date_end;
1243   l_rec.earliest_hire_date               := p_earliest_hire_date;
1244   l_rec.fill_by_date                     := p_fill_by_date;
1245   l_rec.frequency                        := p_frequency;
1246   l_rec.fte                              := p_fte;
1247   l_rec.max_persons                      := p_max_persons;
1248   l_rec.name                             := p_name;
1249   l_rec.overlap_period                   := p_overlap_period;
1250   l_rec.overlap_unit_cd                  := p_overlap_unit_cd;
1251   l_rec.pay_term_end_day_cd              := p_pay_term_end_day_cd;
1252   l_rec.pay_term_end_month_cd            := p_pay_term_end_month_cd;
1253   l_rec.permanent_temporary_flag         := p_permanent_temporary_flag;
1254   l_rec.permit_recruitment_flag          := p_permit_recruitment_flag;
1255   l_rec.position_type                    := p_position_type;
1256   l_rec.posting_description              := p_posting_description;
1257   l_rec.probation_period                 := p_probation_period;
1258   l_rec.probation_period_unit_cd         := p_probation_period_unit_cd;
1259   l_rec.replacement_required_flag        := p_replacement_required_flag;
1260   l_rec.review_flag                      := p_review_flag;
1261   l_rec.seasonal_flag                    := p_seasonal_flag;
1262   l_rec.security_requirements            := p_security_requirements;
1263   l_rec.status                           := p_status;
1264   l_rec.term_start_day_cd                := p_term_start_day_cd;
1265   l_rec.term_start_month_cd              := p_term_start_month_cd;
1266   l_rec.time_normal_finish               := p_time_normal_finish;
1267   l_rec.time_normal_start                := p_time_normal_start;
1268   l_rec.update_source_cd                 := p_update_source_cd;
1269   l_rec.working_hours                    := p_working_hours;
1270   l_rec.works_council_approval_flag      := p_works_council_approval_flag;
1271   l_rec.work_period_type_cd              := p_work_period_type_cd;
1272   l_rec.work_term_end_day_cd             := p_work_term_end_day_cd;
1273   l_rec.work_term_end_month_cd           := p_work_term_end_month_cd;
1274   l_rec.proposed_fte_for_layoff          := p_proposed_fte_for_layoff;
1275   l_rec.proposed_date_for_layoff         := p_proposed_date_for_layoff;
1276   l_rec.pay_basis_id                     := p_pay_basis_id;
1277   l_rec.supervisor_id                    := p_supervisor_id;
1278   l_rec.copied_to_old_table_flag         := p_copied_to_old_table_flag;
1279   l_rec.information1                     := p_information1;
1280   l_rec.information2                     := p_information2;
1281   l_rec.information3                     := p_information3;
1282   l_rec.information4                     := p_information4;
1283   l_rec.information5                     := p_information5;
1284   l_rec.information6                     := p_information6;
1285   l_rec.information7                     := p_information7;
1286   l_rec.information8                     := p_information8;
1287   l_rec.information9                     := p_information9;
1288   l_rec.information10                    := p_information10;
1289   l_rec.information11                    := p_information11;
1290   l_rec.information12                    := p_information12;
1291   l_rec.information13                    := p_information13;
1292   l_rec.information14                    := p_information14;
1293   l_rec.information15                    := p_information15;
1294   l_rec.information16                    := p_information16;
1295   l_rec.information17                    := p_information17;
1296   l_rec.information18                    := p_information18;
1297   l_rec.information19                    := p_information19;
1298   l_rec.information20                    := p_information20;
1299   l_rec.information21                    := p_information21;
1300   l_rec.information22                    := p_information22;
1301   l_rec.information23                    := p_information23;
1302   l_rec.information24                    := p_information24;
1303   l_rec.information25                    := p_information25;
1304   l_rec.information26                    := p_information26;
1305   l_rec.information27                    := p_information27;
1306   l_rec.information28                    := p_information28;
1307   l_rec.information29                    := p_information29;
1308   l_rec.information30                    := p_information30;
1309   l_rec.information_category             := p_information_category;
1310   l_rec.attribute1                       := p_attribute1;
1311   l_rec.attribute2                       := p_attribute2;
1312   l_rec.attribute3                       := p_attribute3;
1313   l_rec.attribute4                       := p_attribute4;
1314   l_rec.attribute5                       := p_attribute5;
1315   l_rec.attribute6                       := p_attribute6;
1316   l_rec.attribute7                       := p_attribute7;
1317   l_rec.attribute8                       := p_attribute8;
1318   l_rec.attribute9                       := p_attribute9;
1319   l_rec.attribute10                      := p_attribute10;
1320   l_rec.attribute11                      := p_attribute11;
1321   l_rec.attribute12                      := p_attribute12;
1322   l_rec.attribute13                      := p_attribute13;
1323   l_rec.attribute14                      := p_attribute14;
1324   l_rec.attribute15                      := p_attribute15;
1325   l_rec.attribute16                      := p_attribute16;
1326   l_rec.attribute17                      := p_attribute17;
1327   l_rec.attribute18                      := p_attribute18;
1328   l_rec.attribute19                      := p_attribute19;
1329   l_rec.attribute20                      := p_attribute20;
1330   l_rec.attribute21                      := p_attribute21;
1331   l_rec.attribute22                      := p_attribute22;
1332   l_rec.attribute23                      := p_attribute23;
1333   l_rec.attribute24                      := p_attribute24;
1334   l_rec.attribute25                      := p_attribute25;
1335   l_rec.attribute26                      := p_attribute26;
1336   l_rec.attribute27                      := p_attribute27;
1337   l_rec.attribute28                      := p_attribute28;
1338   l_rec.attribute29                      := p_attribute29;
1339   l_rec.attribute30                      := p_attribute30;
1340   l_rec.attribute_category               := p_attribute_category;
1341   l_rec.request_id                       := p_request_id;
1342   l_rec.program_application_id           := p_program_application_id;
1343   l_rec.program_id                       := p_program_id;
1344   l_rec.program_update_date              := p_program_update_date;
1345   l_rec.object_version_number            := p_object_version_number;
1346   l_rec.security_profile_id       := p_security_profile_id;
1347   --
1348   -- Return the plsql record structure.
1349   --
1350 if g_debug then
1351   hr_utility.set_location(' Leaving:'||l_proc, 10);
1352 end if;
1353   Return(l_rec);
1354 --
1355 End convert_args;
1356 --
1357 
1358 procedure call_back(p_parameters in wf_parameter_list_t default null) is
1359 
1360 l_context 	             varchar2(30) := null;
1361 l_position_id            number   :=null;
1362 l_effective_start_date   date;
1363 l_effective_end_date     date;
1364 l_start_date             date;
1365 l_expiration_date        date;
1366 l_entity                 varchar2(10);
1367 l_position_id_canonical  varchar2(20);
1368 l_start_date_canonical   varchar2(30);
1369 l_end_date_canonical     varchar2(30);
1370 l_end_date               date;
1371 
1372 
1373 
1374 Begin
1375     hr_utility.set_location('Entering hr_psf_shd.call_back',10);
1376     l_entity := wf_event.getvalueforparameter(p_name          => 'CONTEXT',
1377                                               p_parameterlist => p_parameters);
1378 
1379     l_position_id_canonical := wf_event.getvalueforparameter(p_name          => 'POSITIONID',
1380                                                             p_parameterlist => p_parameters);
1381 
1382     l_start_date_canonical := wf_event.getvalueforparameter(p_name          => 'STARTDATE',
1383                                                             p_parameterlist => p_parameters);
1384 
1385     l_end_date_canonical := wf_event.getvalueforparameter(p_name          => 'ENDDATE',
1386                                                           p_parameterlist => p_parameters);
1387 
1388     l_start_date := FND_DATE.canonical_to_date(l_start_date_canonical);
1389     l_end_date   := FND_DATE.canonical_to_date(l_end_date_canonical);
1390     l_position_id := FND_NUMBER.canonical_to_number(l_position_id_canonical);
1391     hr_utility.set_location('About to call my_synch_routine in hr_psf_shd.call_back',20);
1392     hr_psf_shd.my_synch_routine(mykey                  => l_position_id,
1393                                 p_action                => null,
1394                                 p_effective_start_date => l_start_date,
1395                                 p_effective_end_date   => l_end_date);
1396 
1397     hr_utility.set_location('Leaving hr_psf_shd.call_back',30);
1398 
1399 End call_back;
1400 --
1401 end hr_psf_shd;