API to Re Hire Contingent Worker

API to re hire Ex contingent Worker

 

 

Procedure XXHR_CWK_REHIRE
as
/* =====================================================================
— NAME : XXHR_CWK_REHIRE

— PROGRAM TYPE : Procedure

— DESCRIPTION : This is used to rehire an CWK
— INPUTS : None
— OUTPUTS : None
— ===================================================================*/
l_dat_actual_term_date DATE;
l_bool_warn BOOLEAN;
lv_err varchar2(3000);
l_num_person_id NUMBER;

cursor c_cwk_rehire
IS
select *
from
XXHR_EUREH_GEOS_PERSONAL
where
process_flag = ‘EX-CWK REHIRE’;
BEGIN
for r_cwk_rehire in c_cwk_rehire
loop

 

begin
select person_id
into l_num_person_id
from per_all_people_f
where npw_number = r_cwk_rehire.euhreka_employee_number
and sysdate between effective_start_date and effective_end_date
and business_group_id = fnd_profile.value(‘PER_BUSINESS_GROUP_ID’);
exception when others then
update xxhr_eureh_geos_personal
set error_msg =’CWK person_id not found’,
process_flag = ‘E’
where process_id = r_cwk_rehire.process_id;
dbms_output.put_line(‘person id not found’);
fnd_file.put_line(fnd_file.LOG,’CWK person_id not found’||r_cwk_rehire.process_id);
end;

 

BEGIN
SELECT pp.actual_termination_date
INTO l_dat_actual_term_date
FROM PER_PERIODS_OF_PLACEMENT_V pp,
per_all_people_f pf
WHERE pp.PERSON_ID = pf.person_id
AND pf.business_group_id = FND_PROFILE.value(‘PER_BUSINESS_GROUP_ID’)
and pf.person_id = l_num_person_id
and sysdate between pf.effective_start_date and pf.effective_end_date;

exception when others then
lv_err:= sqlerrm;
update xxhr_eureh_geos_personal
set error_msg =’termination date not found’,
process_flag = ‘E’
where process_id = r_cwk_rehire.process_id;
fnd_file.put_line(fnd_file.LOG,’CWK termionation date not found’||r_cwk_rehire.process_id || lv_err);
END;

dbms_output.put_line(‘actual term date ‘||l_dat_actual_term_date);
BEGIN
Hr_Contingent_Worker_Api.reverse_terminate_placement
(
p_validate => false,
p_person_id =>l_num_person_id,
p_actual_termination_date => l_dat_actual_term_date,
p_clear_details =>’Y’,
p_fut_actns_exist_warning => l_bool_warn

);
UPDATE xxhr_eureh_geos_personal
set process_flag = ‘S’
WHERE Process_id = r_cwk_rehire.process_id;

exception when others then
lv_err := sqlerrm;
UPDATE xxhr_eureh_geos_personal
set process_flag = ‘E’,
error_msg = error_msg ||’–‘||’Unable to terminatte CWK’ ||lv_err
WHERE Process_id = r_cwk_rehire.process_id;

fnd_file.put_line(fnd_file.LOG,’Unable to terminatte CWK for record_number’||r_cwk_rehire.process_id);

END;
end loop;
commit;
end XXHR_CWK_REHIRE;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s