Tuesday 7 January 2014

HRMS APIs

API to update fields of PER_ALL_PEOPLE_F like email, first name, last name:
      hr_person_api.update_person
                 (p_email_address               => p_email,
                  p_effective_date              => TRUNC(SYSDATE),
                  p_datetrack_update_mode       => 'UPDATE',
                  p_person_id                   => ln_person_id,
                  p_employee_number             => lc_employee_number,
                  p_object_version_number       => ln_object_version_number,
                  p_effective_start_date        => ld_effective_start_date,
                  p_effective_end_date          => ld_effective_end_date,
                  p_full_name                   => lc_full_name,
                  p_comment_id                  => ln_comment_id,
                  p_name_combination_warning    => lb_name_combination_warning,
                  p_assign_payroll_warning      => lb_assign_payroll_warning,
                  p_orig_hire_warning           => lb_orig_hire_warning
                 );
Points to consider while firing the above API:
  • You should pass correct person_id(PER_ALL_PEOPLE_F) of which you want to update the details
  • Also pick the object_version_number for the same person_id and pass it in the above API.
  • Pass effective_start_date
  • Update Mode should be UPDATE/INSERT/CORRECTION, based on the requirement
  • Rest are mandatory OUT parameters

API to update fields of PER_ALL_ASSIGNMENTS_F like location:
      hr_assignment_api.update_emp_asg_criteria
                (  p_validate                     => FALSE
                 ,p_effective_date               => TRUNC(SYSDATE)
                 ,p_datetrack_update_mode        => 'UPDATE'
                 ,p_assignment_id                => l_assign_id
                 ,p_object_version_number        => l_obj
                 ,p_location_id                  => 1096
                 ,p_special_ceiling_step_id      => ln_special_ceiling_step_id
                 ,p_effective_start_date         => ld_effective_start_date
                 ,p_effective_end_date           => ld_effective_end_date
                 ,p_people_group_id              => ln_people_group_id 
                 ,p_group_name                   => lc_group_name
                 ,p_org_now_no_manager_warning   => lb_org_now_no_manager_warning
                 ,p_other_manager_warning        => lb_other_manager_warning
                 ,p_spp_delete_warning           => lb_spp_delete_warning
                 ,p_entries_changed_warning      => lc_entries_changed_warning
                 ,p_tax_district_changed_warning => lb_tax_district_chg_warning
                );

Points to consider while firing the above API:
  • You should pass correct assignment_id(PER_ALL_ASSIGNMENTS_F) of which you want to update the details
  • Also pick the object_version_number for the same assignment_id and pass it in the above API.
  • Pass effective_start_date
  • Update Mode should be UPDATE/INSERT/CORRECTION, based on the requirement
  • Rest are mandatory OUT parameters
API to create Positions in Assignments Tables:

         hr_position_api.create_position(p_validate                 => FALSE
                                        ,p_job_id                   => 62
                                        ,p_organization_id          => 10204
                                        ,p_date_effective           => TRUNC(SYSDATE)
                                        ,p_segment1                 => 'WTR1-0000-00000' -- Mandatory Segment Fields
                                        ,p_segment2                 => ln_position_name  -- Mandatory Segment Fields
                                        ,p_segment3                 => 'REQ1'  -- Mandatory Segment Fields
                                        ,p_position_id              => ln_position_id
                                        ,p_object_version_number    => ln_obj_version
                                        ,p_position_definition_id   => ln_pos_def_id
                                        ,p_name                     => ln_position_name); 


Points to consider while firing the above API:
  • You should pass correct job_id(PER_JOBS)
  • Also pick the organization_id
  • Pass effective_start_date
  • Rest are mandatory OUT parameters
  • Also check whether there is any KFF on PER_POSITION_DEFINITIONS
 table, if yes check which all segments are mandatory and accordingly pass the value.

Queries required to check the API result:

--Query to Fetch the Employee Details
SELECT ppf.person_id
, ppf.employee_number
FROM per_all_people_f ppf
WHERE ppf.employee_number IN ('71402799', '71732497')AND ( (TRUNC (SYSDATE) BETWEEN ppf.effective_start_date
AND ppf.effective_end_date)OR ppf.person_id IS NULL);

--Query to Fetch the Employee Assignment Details
SELECT person_id
, organization_id
, assignment_id
, location_id
, job_id
, object_version_number
, position_idFROM per_all_assignments_f WHERE assignment_id = 129745and ((TRUNC (SYSDATE) BETWEEN effective_start_date
AND effective_end_date)OR assignment_id IS NULL)

--Query to Fetch the Existing Locations
SELECT location_id
FROM hr_locations_all
WHERE location_id = 143
SELECT hp.position_id, hp.organization_id
FROM hr_positions_f hp, per_shared_types ps
WHERE hp.position_id = 2126
AND :p_validation_start_date BETWEEN hp.effective_start_dateAND hp.effective_end_date
AND hp.organization_id = 81
AND :p_validation_start_dateBETWEEN hp.date_effectiveAND NVL(hp.date_end, hr_api.g_eot)AND ps.shared_type_id = hp.availability_status_id
AND ps.system_type_cd = 'ACTIVE';

--Query to Fetch the Existing Positions
SELECT *
FROM PER_ALL_POSITIONS
WHERE ORGANIZATION_ID = 6204

--Query to Fetch the Existing Jobs
SELECT *
FROM PER_JOBS

--Query to Fetch mandatory segment values on Positions table
 SELECT segment1, segment2FROM PER_POSITION_DEFINITIONS

No comments:

Post a Comment