Tuesday, September 27, 2016

Oracle HRMS- Person, Assignment , Job , Location Conversion Using Api

Workday Integration Process


Description

This blog is used to Creating new Person, Assignment, Job creation, Location creation, and Rehiring Person. This blog includes the updating of Person, Job, and assignment with email notification option the corresponding API will create and update the information Person and Job.



-- This query retrieves the phone_id to create and update phone

SELECT phone_id, object_version_number
  FROM per_phones
 WHERE phone_type = i_ph_type
   AND parent_table = 'PER_ALL_PEOPLE_F'
   AND parent_id = i_person_id
   AND (date_to IS NULL
        OR
        i_eff_date BETWEEN date_from AND NVL (TRUNC (date_to), 
        hr_general.end_of_time)
       );
            

-- This API is used to create the phone details based on the parameters.

      hr_phone_api.create_phone
        (
             p_validate              => FALSE
            ,p_date_from             => i_hire_date
            ,p_phone_type            => l_phone_type
            ,p_phone_number          => i_work_phone
            ,p_parent_id             => i_person_id
            ,p_parent_table          => 'PER_ALL_PEOPLE_F'
            ,p_effective_date        => i_hire_date
            ,p_object_version_number => l_ovn
            ,p_phone_id              => l_phone_id
        );


-- This API is used to update the phone details based on the parameters.


        hr_phone_api.update_phone
        (
            p_phone_id              => l_phone_id -- Phone id from per_phones
            ,p_phone_type           => l_phone_type -- Phone type 'W1'
            ,p_phone_number         => i_work_phone -- Input parameter
            ,p_object_version_number=> l_ovn
            ,p_validate             => FALSE
            ,p_effective_date       => i_hire_date
        );
                    
       



-- This API is used to create employee based on the parameters.
   
   
Hr_Employee_Api.CREATE_EMPLOYEE
(
    p_business_group_id           => g_business_group_id,
    p_person_id                   => v_person_id,
    p_assignment_id               => v_assignment_id,
    p_per_object_version_number   => v_per_object_version_number,
    p_asg_object_version_number   => v_asg_object_version_number,
    p_per_effective_start_date    => v_per_effective_start_date,
--Out Parameter
    p_per_effective_end_date      => v_per_effective_end_date,
    p_full_name                   => v_full_name,
    p_person_type_id              => g_person_type_id,
    p_per_comment_id              => v_per_comment_id,
    p_assignment_sequence         => v_assignment_sequence,
    p_assignment_number           => v_assignment_number,
    p_name_combination_warning    => v_name_combination_warning,
    p_assign_payroll_warning      => v_assign_payroll_warning,
    p_orig_hire_warning           => v_orig_hire_warning,--HEADER DETAILS
    p_last_name                   => l_get_all_per_inserts.per_last_name,
    p_first_name                  => l_get_all_per_inserts.per_first_name,
    p_sex                         => l_get_all_per_inserts.per_gender,
    p_middle_names                => l_get_all_per_inserts.per_middle_names,
    p_employee_number             =>
    l_get_all_per_inserts.per_employee_number,
      --OFFICE DETAILS TAB
    p_email_address               => l_get_all_per_inserts.per_email_address,
    p_hire_date                   =>  
   l_get_all_per_inserts.per_startdate_hiredate
)      

-- This API is used to update person based on the parameters.

Hr_Person_Api.UPDATE_PERSON
(
    p_validate                   => FALSE,
    p_effective_date             =>
l_get_all_per_update.per_effective_start_date,
    p_datetrack_update_mode      => v_datetrack_update_mode,
    p_person_id                  => l_get_all_per_update.person_id,
    p_object_version_number      => l_obj_ver_num,
    p_last_name                  => l_get_all_per_update.per_last_name,
    p_first_name                 => l_get_all_per_update.per_first_name,
    p_sex                        => l_get_all_per_update.per_gender,
    p_middle_names               => l_get_all_per_update.per_middle_names,
    p_employee_number            => l_get_all_per_update.per_employee_number,
    p_email_address              => l_get_all_per_update.per_email_address,
    p_effective_start_date       => v_o_effective_start_date,
    p_effective_end_date         => v_o_effective_end_date,
    p_full_name                  => v_o_full_name,
    p_comment_id                 => v_o_p_comment_id,
    p_name_combination_warning   => v_o_name_combination_warning,
    p_assign_payroll_warning     => v_o_assign_payroll_warning,
    p_orig_hire_warning          => v_o_orig_hire_warning
);
-- This query is used to retrieve the period service id and final process
   Date for person final process.


SELECT period_of_service_id, object_version_number,
       last_standard_process_date, final_process_date
  INTO l_period_of_service_id, l_object_version_number,
       l_last_standard_process_date, l_final_process_date
  FROM per_periods_of_service pps
 WHERE person_id = l_get_all_per_rehire.person_id
   AND pps.date_start = (
                            SELECT MAX (date_start)
                            FROM per_periods_of_service pps2
                            WHERE pps2.person_id = pps.person_id
                        );     
                           


-- This API is used to perform the final process of employee.
                                

Hr_Ex_Employee_Api.final_process_emp
(
    p_validate                     => g_validate,
    p_period_of_service_id         => l_period_of_service_id,
    p_object_version_number        => l_object_version_number,
    p_final_process_date           => l_final_process_date,
    p_org_now_no_manager_warning   => l_supervisor_warning,
    p_asg_future_changes_warning   => l_asg_future_changes_warning,
    p_entries_changed_warning      => l_entries_changed_warning
);                                          
                                           
 

-- This API is used to re-hire the employee’s.
                                 
   
Hr_Employee_Api.re_hire_ex_employee
(
    p_validate                    => FALSE,
    p_hire_date                   =>
   l_get_all_per_rehire.per_startdate_hiredate,
    p_person_id                   => l_get_all_per_rehire.person_id,
    p_per_object_version_number   =>
    l_get_all_per_rehire.object_version_number,
    p_person_type_id              => l_person_type_id,
    p_rehire_reason               => 'REHIRED',
    p_assignment_id               => v_out_assignment_id,
    p_asg_object_version_number   => v_asg_object_version_number,
    p_per_effective_start_date    => v_per_effective_start_date,
    p_per_effective_end_date      => v_per_effective_end_date,
    p_assignment_sequence         => v_asg_sequence,
    p_assignment_number           => v_asg_number,
    p_assign_payroll_warning      => v_asg_payroll_warning
);
   




-- This API is used to process the employee termination.

Hr_Ex_Employee_Api.actual_termination_emp
(
  p_validate                     => l_validate,
  p_effective_date               => NVL (l_actual_termination_date, l_date),
  p_period_of_service_id         => l_period_of_service_id,
  p_object_version_number        => l_object_version_number,
  p_actual_termination_date      => NVL( l_actual_termination_date, l_date ),
  p_last_standard_process_date   => NVL ( l_last_std_process_date, l_date ),
  p_leaving_reason               => NULL,
  p_last_std_process_date_out    => l_last_std_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
);


-- This API is used to update the employee assignment.


Hr_Assignment_Api.update_emp_asg
(
   p_validate                     => FALSE
  ,p_effective_date               => l_get_all_asgn.asg_effective_start_date
  ,p_datetrack_update_mode        => v_datetrack_update_mode
  ,p_assignment_id                => v_in_assignment_id
  ,p_object_version_number        => l_object_version_number
  ,p_supervisor_id                => v_supervisor_id
  ,p_ass_attribute_category       => Hr_Api.g_varchar2
  ,p_default_code_comb_id         => l_expense_account
  ,p_set_of_books_id              => l_set_of_books_id -- Out arguments
  ,p_soft_coding_keyflex_id       => l_soft_coding_keyflex_id     --out
  ,p_effective_start_date         => l_effective_start_date       --out
  ,p_effective_end_date           => l_effective_end_date         --out
  ,p_no_managers_warning          => l_no_mgr_warn                --out
  ,p_other_manager_warning        => l_other_mgr_warng            --out
  ,p_hourly_salaried_warning      => l_salaried_warn              --out
  ,p_gsp_post_process_warning     => l_gsp_post_proc_war          --out
  ,p_cagr_grade_def_id            => l_cagr_grade_def_id          --in out
  ,p_cagr_concatenated_segments   => l_cagr_concatenated_segments --out
  ,p_comment_id                   => l_comment_id               -- out number
  ,p_concatenated_segments        => l_concatenated_segments      --out
);   



-- This API is used to update the employee assignment criteria.

 
Hr_Assignment_Api.update_emp_asg_criteria
(
    p_effective_date                 => l_get_all_asgn.asg_effective_start_date,
    p_datetrack_update_mode          => 'CORRECTION',
    p_assignment_id                  => v_in_assignment_id,
    p_validate                       => FALSE,
    p_called_from_mass_update        => FALSE,
    p_job_id                         => l_job_id,
    p_location_id                    => l_location_id,-- in out
    p_object_version_number          => l_object_version_number,
    p_special_ceiling_step_id        => l1_special_ceiling,
    p_people_group_id                => l_people_group_id,
    p_soft_coding_keyflex_id         => l1_soft_coding_keyflex_id,-- out
    p_group_name                     => l1_group_name,
    p_effective_start_date           => l1_effective_start_date,
    p_effective_end_date             => l1_effective_end_date,
    p_org_now_no_manager_warning     => l1_org_no_mgr_warning,
    p_other_manager_warning          => l1_other_mgr_warning,
    p_spp_delete_warning             => l1_spp_delete_warning,
    p_entries_changed_warning        => l1_entries_changed_warning,
    p_tax_district_changed_warning   => l1_tax_dist_chng_warn,
    p_concatenated_segments          => l1_concatenated_segments,
    p_gsp_post_process_warning       => l1_gsp_post_warning
);
   
  

-- This API is used to create job.



Hr_Job_Api.CREATE_JOB
(
    p_business_group_id           => g_business_group_id
    ,p_date_from                  => '01-JAN-1900'
    ,p_job_group_id               => v_job_group_id
    ,p_segment1                   => SUBSTR(l_get_insert_jobs.job_name,1,60)
    -- ,p_concat_segments => l_get_insert_jobs.job_division||'.'||
 l_get_insert_jobs.job_discipline||'.'||l_get_insert_jobs.job_name
 --Hr_Api.g_varchar2
    ,p_job_information_category   => v_job_info_cat --in param
    ,p_attribute16                => l_get_insert_jobs.job_wd_profile_id
    ,p_approval_authority         => l_authority_level
    ,p_job_id                     => v_job_id            --OUT
    ,p_object_version_number      => v_obj_ver_num       --OUT
    ,p_job_definition_id          => v_job_definition_id --OUT
    ,p_name                       => v_name              --OUT
);  
 



 
-- This API is used to update job.


Hr_Job_Api.UPDATE_JOB
(
    p_validate                       => FALSE,
    p_job_id                         => l_get_upd_del_jobs.job_id,
    p_object_version_number          =>
l_get_upd_del_jobs.object_version_number,
    p_date_to                        => l_get_upd_del_jobs.job_date_to,
    p_job_information_category       =>
l_get_upd_del_jobs.job_information_category,
    p_segment1                       =>
SUBSTR (l_get_upd_del_jobs.job_name,1,60),
    p_concat_segments                =>
SUBSTR (l_get_upd_del_jobs.job_name,1, 60 ),
    p_attribute16                    => l_get_upd_del_jobs.job_wd_profile_id,
    p_approval_authority             => l_authority_level,
    p_language_code                  => Hr_Api.userenv_lang,
    p_job_definition_id              => v_job_definition_id,       -- out
    p_name                           => v_name,                    --out
    p_valid_grades_changed_warning   => v_valid_grd_ch_warning,    --out
    p_effective_date                 => l_get_upd_del_jobs.date_from
);

                     

-- By 
-- Eswaramoorthi M

No comments:

Post a Comment