declare
--
--Common Variables
l_terminate_cwk_flag varchar2(1) := 'N';
l_terminate_msg varchar2(600);
l_person_id number ;
l_le_terminate_cwk_exception exception;
--- DECLARE variables for hr_contingent_worker_api.actual_termination_placement
--- IN variables
l_effective_date date ; --trunc(sysdate)-1
l_termination_reason varchar2(200) := 'NR';
l_person_type_id varchar2(200) := 1140; --Ex-contingent Worker from PER_PERSON_TYPES_V
l_period_of_service_id varchar2(200) ;
l_actual_termination_date date ;--:=trunc(sysdate);
l_last_standard_process_date varchar2(200) ;
l_object_version_number per_all_people_f.object_version_number%type;
l_start_date date;--per_periods_of_placement.date_start%type;
l_notif_term_date date;
--- OUT variables
l_supervisor_warning boolean := false;
l_event_warning boolean := false;
l_interview_warning boolean := false;
l_review_warning boolean := false;
l_recruiter_warning boolean := false;
l_asg_future_changes_warning boolean := false;
l_entries_changed_warning varchar2(300);
l_pay_proposal_warning boolean := false;
l_dod_warning boolean := false;
L_NO_MANAGER_WARNING boolean := false;
L_ADDL_RIGHTS_WARNING boolean := false;
--- DECLARE variables for hr_contingent_worker_api.final_process_placement
--- IN variables
l_final_process_date date;
--- OUT variables
l_org_now_no_manager_warning boolean := false;
--
begin
--
begin
select pos.period_of_placement_id, pos.object_version_number, date_start,papf.person_id, papf.effective_start_date,papf.effective_start_date
into l_period_of_service_id, l_object_version_number, l_start_date,l_person_id, l_actual_termination_date,l_effective_date
from per_periods_of_placement pos
,per_all_people_f papf
where pos.person_id = papf.person_id
and to_number(npw_number) = '9';
exception
when others then
l_terminate_msg := 'Error while selecting cwk details : '||substr(sqlerrm,1,150);
raise l_le_terminate_cwk_exception;
end;
--
savepoint terminate_cwk_s1;
--
begin
/*
This API covers the first step in terminating a period of placement and
all current assignments for a cwk, identified by person_id and date_start.
You can use the API to set the actual termination date, the last standard
process date, the new assignment status and the new person type
*/
HR_CONTINGENT_WORKER_API.TERMINATE_PLACEMENT(
P_VALIDATE => FALSE
,P_EFFECTIVE_DATE => l_effective_date
,P_PERSON_ID => l_person_id
,P_DATE_START => l_start_date
,P_OBJECT_VERSION_NUMBER => l_object_version_number
,P_ACTUAL_TERMINATION_DATE =>l_actual_termination_date
,P_FINAL_PROCESS_DATE =>l_actual_termination_date --— final process date is 3 months after the actual termination date
,p_last_standard_process_date =>l_actual_termination_date
,p_termination_reason => l_termination_reason
,P_SUPERVISOR_WARNING => L_SUPERVISOR_WARNING
,P_EVENT_WARNING => L_EVENT_WARNING
,P_INTERVIEW_WARNING => L_INTERVIEW_WARNING
,P_REVIEW_WARNING => L_REVIEW_WARNING
,P_RECRUITER_WARNING => L_RECRUITER_WARNING
,P_ASG_FUTURE_CHANGES_WARNING => l_asg_future_changes_warning
,P_ENTRIES_CHANGED_WARNING => L_ENTRIES_CHANGED_WARNING
,P_PAY_PROPOSAL_WARNING => L_PAY_PROPOSAL_WARNING
,P_DOD_WARNING => L_DOD_WARNING
,P_ORG_NOW_NO_MANAGER_WARNING => L_NO_MANAGER_WARNING
,P_ADDL_RIGHTS_WARNING => L_ADDL_RIGHTS_WARNING
);
/*hr_contingent_worker_api.terminate_placement
(p_validate => false
,p_effective_date => l_effective_date -1
,p_person_id => l_person_id
,p_date_start => l_start_date
,p_person_type_id => l_person_type_id
,p_actual_termination_date => l_actual_termination_date
,p_termination_reason => l_termination_reason
--In/Out
,p_object_version_number => l_object_version_number
,p_last_standard_process_date => l_actual_termination_date --l_last_standard_process_date
--Out
,p_supervisor_warning => l_supervisor_warning
,p_event_warning => l_event_warning
,p_interview_warning => l_interview_warning
,p_review_warning => l_review_warning
,p_recruiter_warning => l_recruiter_warning
,p_asg_future_changes_warning => l_asg_future_changes_warning
,p_entries_changed_warning => l_entries_changed_warning
,p_pay_proposal_warning => l_pay_proposal_warning
,p_dod_warning => l_dod_warning
);
*/
if l_object_version_number is null then
l_terminate_cwk_flag := 'N';
l_terminate_msg := 'Warning validating API: hr_contingent_worker_api.actual_termination_placement';
raise l_le_terminate_cwk_exception;
end if;
l_terminate_cwk_flag := 'Y';
exception
when others then
l_terminate_msg := 'Error validating API: hr_contingent_worker_api.actual_termination_placement : '||substr(sqlerrm,1,150);
raise l_le_terminate_cwk_exception;
end; --hr_contingent_worker_api.actual_termination_placement
--
commit;
--
exception
when l_le_terminate_cwk_exception then
dbms_output.put_line(l_terminate_msg);
rollback to terminate_cwk_s1;
when others then
dbms_output.put_line('Terminate CWK. Error OTHERS while validating: '||sqlerrm);
rollback to terminate_cwk_s1;
end;
--
--Common Variables
l_terminate_cwk_flag varchar2(1) := 'N';
l_terminate_msg varchar2(600);
l_person_id number ;
l_le_terminate_cwk_exception exception;
--- DECLARE variables for hr_contingent_worker_api.actual_termination_placement
--- IN variables
l_effective_date date ; --trunc(sysdate)-1
l_termination_reason varchar2(200) := 'NR';
l_person_type_id varchar2(200) := 1140; --Ex-contingent Worker from PER_PERSON_TYPES_V
l_period_of_service_id varchar2(200) ;
l_actual_termination_date date ;--:=trunc(sysdate);
l_last_standard_process_date varchar2(200) ;
l_object_version_number per_all_people_f.object_version_number%type;
l_start_date date;--per_periods_of_placement.date_start%type;
l_notif_term_date date;
--- OUT variables
l_supervisor_warning boolean := false;
l_event_warning boolean := false;
l_interview_warning boolean := false;
l_review_warning boolean := false;
l_recruiter_warning boolean := false;
l_asg_future_changes_warning boolean := false;
l_entries_changed_warning varchar2(300);
l_pay_proposal_warning boolean := false;
l_dod_warning boolean := false;
L_NO_MANAGER_WARNING boolean := false;
L_ADDL_RIGHTS_WARNING boolean := false;
--- DECLARE variables for hr_contingent_worker_api.final_process_placement
--- IN variables
l_final_process_date date;
--- OUT variables
l_org_now_no_manager_warning boolean := false;
--
begin
--
begin
select pos.period_of_placement_id, pos.object_version_number, date_start,papf.person_id, papf.effective_start_date,papf.effective_start_date
into l_period_of_service_id, l_object_version_number, l_start_date,l_person_id, l_actual_termination_date,l_effective_date
from per_periods_of_placement pos
,per_all_people_f papf
where pos.person_id = papf.person_id
and to_number(npw_number) = '9';
exception
when others then
l_terminate_msg := 'Error while selecting cwk details : '||substr(sqlerrm,1,150);
raise l_le_terminate_cwk_exception;
end;
--
savepoint terminate_cwk_s1;
--
begin
/*
This API covers the first step in terminating a period of placement and
all current assignments for a cwk, identified by person_id and date_start.
You can use the API to set the actual termination date, the last standard
process date, the new assignment status and the new person type
*/
HR_CONTINGENT_WORKER_API.TERMINATE_PLACEMENT(
P_VALIDATE => FALSE
,P_EFFECTIVE_DATE => l_effective_date
,P_PERSON_ID => l_person_id
,P_DATE_START => l_start_date
,P_OBJECT_VERSION_NUMBER => l_object_version_number
,P_ACTUAL_TERMINATION_DATE =>l_actual_termination_date
,P_FINAL_PROCESS_DATE =>l_actual_termination_date --— final process date is 3 months after the actual termination date
,p_last_standard_process_date =>l_actual_termination_date
,p_termination_reason => l_termination_reason
,P_SUPERVISOR_WARNING => L_SUPERVISOR_WARNING
,P_EVENT_WARNING => L_EVENT_WARNING
,P_INTERVIEW_WARNING => L_INTERVIEW_WARNING
,P_REVIEW_WARNING => L_REVIEW_WARNING
,P_RECRUITER_WARNING => L_RECRUITER_WARNING
,P_ASG_FUTURE_CHANGES_WARNING => l_asg_future_changes_warning
,P_ENTRIES_CHANGED_WARNING => L_ENTRIES_CHANGED_WARNING
,P_PAY_PROPOSAL_WARNING => L_PAY_PROPOSAL_WARNING
,P_DOD_WARNING => L_DOD_WARNING
,P_ORG_NOW_NO_MANAGER_WARNING => L_NO_MANAGER_WARNING
,P_ADDL_RIGHTS_WARNING => L_ADDL_RIGHTS_WARNING
);
/*hr_contingent_worker_api.terminate_placement
(p_validate => false
,p_effective_date => l_effective_date -1
,p_person_id => l_person_id
,p_date_start => l_start_date
,p_person_type_id => l_person_type_id
,p_actual_termination_date => l_actual_termination_date
,p_termination_reason => l_termination_reason
--In/Out
,p_object_version_number => l_object_version_number
,p_last_standard_process_date => l_actual_termination_date --l_last_standard_process_date
--Out
,p_supervisor_warning => l_supervisor_warning
,p_event_warning => l_event_warning
,p_interview_warning => l_interview_warning
,p_review_warning => l_review_warning
,p_recruiter_warning => l_recruiter_warning
,p_asg_future_changes_warning => l_asg_future_changes_warning
,p_entries_changed_warning => l_entries_changed_warning
,p_pay_proposal_warning => l_pay_proposal_warning
,p_dod_warning => l_dod_warning
);
*/
if l_object_version_number is null then
l_terminate_cwk_flag := 'N';
l_terminate_msg := 'Warning validating API: hr_contingent_worker_api.actual_termination_placement';
raise l_le_terminate_cwk_exception;
end if;
l_terminate_cwk_flag := 'Y';
exception
when others then
l_terminate_msg := 'Error validating API: hr_contingent_worker_api.actual_termination_placement : '||substr(sqlerrm,1,150);
raise l_le_terminate_cwk_exception;
end; --hr_contingent_worker_api.actual_termination_placement
--
commit;
--
exception
when l_le_terminate_cwk_exception then
dbms_output.put_line(l_terminate_msg);
rollback to terminate_cwk_s1;
when others then
dbms_output.put_line('Terminate CWK. Error OTHERS while validating: '||sqlerrm);
rollback to terminate_cwk_s1;
end;
No comments:
Post a Comment