--
declare
--
--Common Variables
l_sys_person_type varchar2(40);
l_person_id number := 123456;
--- Declare variables for reverse termination API
l_act_term_date per_periods_of_service.actual_termination_date%type;
l_clear_details varchar2(1) := 'Y';
l_fut_actns_exist_warning boolean;
--
begin
--
select ppt.system_person_type
into l_sys_person_type
from per_all_people_f papf
,per_person_types ppt
where papf.person_id = l_person_id
and papf.person_type_id = ppt.person_type_id;
--
if l_sys_person_type like 'EX_EMP%' then
select pos.actual_termination_date
into l_act_term_date
from per_all_people_f papf
,per_periods_of_service pos
where papf.person_id = l_person_id
--AND papf.effective_start_date =
and pos.person_id = papf.person_id ;
/*
* This API is not published, hence not meant for public calls.
*/
hr_ex_employee_api.reverse_terminate_employee
( p_validate => false
, p_person_id => l_person_id
, p_actual_termination_date => l_act_term_date
, p_clear_details => l_clear_details
);
dbms_output.put_line('Employee Reverse Terminated ');
--
commit;
--
else --CWK
select pos.actual_termination_date
into l_act_term_date
from per_all_people_f papf
,per_periods_of_placement pos
where papf.person_id = l_person_id
-- AND papf.effective_start_date =
and pos.person_id = papf.person_id ;
/* This API reverses a contingent worker termination.
* This API removes the end date from the period of placement and the
* contingent worker assignments, and reverts the person type to Contingent Worker
*/
hr_contingent_worker_api.reverse_terminate_placement
( p_validate => false
, p_person_id => l_person_id
, p_actual_termination_date => l_act_term_date
, p_clear_details => l_clear_details
, p_fut_actns_exist_warning => l_fut_actns_exist_warning
);
if l_fut_actns_exist_warning then
dbms_output.put_line('Reverse Termination failed for CWK '||sqlerrm);
rollback;
else
dbms_output.put_line('CWK Reverse Terminated ');
commit;
end if;
end if;
--
exception
when others then
dbms_output.put_line('Reverse Termination failed. Error Others: '||sqlerrm);
rollback;
end;
--
declare
--
--Common Variables
l_sys_person_type varchar2(40);
l_person_id number := 123456;
--- Declare variables for reverse termination API
l_act_term_date per_periods_of_service.actual_termination_date%type;
l_clear_details varchar2(1) := 'Y';
l_fut_actns_exist_warning boolean;
--
begin
--
select ppt.system_person_type
into l_sys_person_type
from per_all_people_f papf
,per_person_types ppt
where papf.person_id = l_person_id
and papf.person_type_id = ppt.person_type_id;
--
if l_sys_person_type like 'EX_EMP%' then
select pos.actual_termination_date
into l_act_term_date
from per_all_people_f papf
,per_periods_of_service pos
where papf.person_id = l_person_id
--AND papf.effective_start_date =
and pos.person_id = papf.person_id ;
/*
* This API is not published, hence not meant for public calls.
*/
hr_ex_employee_api.reverse_terminate_employee
( p_validate => false
, p_person_id => l_person_id
, p_actual_termination_date => l_act_term_date
, p_clear_details => l_clear_details
);
dbms_output.put_line('Employee Reverse Terminated ');
--
commit;
--
else --CWK
select pos.actual_termination_date
into l_act_term_date
from per_all_people_f papf
,per_periods_of_placement pos
where papf.person_id = l_person_id
-- AND papf.effective_start_date =
and pos.person_id = papf.person_id ;
/* This API reverses a contingent worker termination.
* This API removes the end date from the period of placement and the
* contingent worker assignments, and reverts the person type to Contingent Worker
*/
hr_contingent_worker_api.reverse_terminate_placement
( p_validate => false
, p_person_id => l_person_id
, p_actual_termination_date => l_act_term_date
, p_clear_details => l_clear_details
, p_fut_actns_exist_warning => l_fut_actns_exist_warning
);
if l_fut_actns_exist_warning then
dbms_output.put_line('Reverse Termination failed for CWK '||sqlerrm);
rollback;
else
dbms_output.put_line('CWK Reverse Terminated ');
commit;
end if;
end if;
--
exception
when others then
dbms_output.put_line('Reverse Termination failed. Error Others: '||sqlerrm);
rollback;
end;
--
No comments:
Post a Comment