Thursday, April 14, 2016

Re hire employee using api hr_employee_api.re_hire_ex_employee

create or replace procedure xx_re_hire_emp
 (
   p_person_id number,
   p_hire_date date;
 )
 is   
  lp_assignment_id                     per_all_assignments_f.assignment_id%type;
  lp_asg_object_version_number         number;
  lp_per_effective_start_date          date;
  lp_per_effective_end_date            date;
  lp_assignment_sequence               per_all_assignments_f.assignment_sequence%type;
  lp_assignment_number                 per_all_assignments_f.assignment_number%type;
  lp_assign_payroll_warning            boolean;
  lp_object_version_number             per_all_people_f.object_version_number%TYPE ;
 
  cursor cur_get_ovn is
    SELECT object_version_number
      FROM apps.per_people_x
     WHERE person_id= p_person_id;
 
begin

 open  cur_get_ovn;
  fetch cur_get_ovn into lp_object_version_number;
 close cur_get_ovn;

hr_employee_api.re_hire_ex_employee
(

  --input data --
 
   p_validate                      => false
  ,p_hire_date                     => p_hire_date
  ,p_person_id                     => p_person_id
  ,p_rehire_reason                 => 'Hire'
 
  --output data --
 
  ,p_assignment_id                 => lp_assignment_id
  ,p_asg_object_version_number     => lp_asg_object_version_number
  ,p_per_effective_start_date      => lp_per_effective_start_date
  ,p_per_effective_end_date        => lp_per_effective_end_date
  ,p_assignment_sequence           => lp_assignment_sequence
  ,p_assignment_number             => lp_assignment_number
  ,p_assign_payroll_warning        => lp_assign_payroll_warning
  ,p_per_object_version_number     => lp_object_version_number 

);
commit;

end;

No comments:

Post a Comment