Friday, March 23, 2018

API to create Employee Positions in Oracle Apps R12 – HR_POSITION_API.CREATE_POSITION









 


In this post, we have given a sample script to create a position. 

API: HR_POSITION_API.CREATE_POSITION

Tested Instance: R12.2.4

Version 1: This can be used for instances where HRMS is fully licensed and employee positions can be date tracked

DECLARE
  lv_position_name            VARCHAR2(500);
  ld_effective_start_date     DATE;
  ld_effective_end_date       DATE;
  ln_position_definition_id   NUMBER;
  ln_object_version_number    NUMBER;
  ln_position_id              NUMBER;
BEGIN
  lv_position_name          := NULL;
  ld_effective_start_date   := NULL;
  ld_effective_end_date     := NULL;
  ln_position_definition_id := NULL;
  ln_object_version_number  := NULL;
  ln_position_id            := NULL;
 
  hr_position_api.create_position
        ( p_validate                 => FALSE, -- If it was set as true, only         validation will happen.
          p_job_id                   => 78, -- Job id
          p_organization_id          => 81, -- Business Group id
          p_date_effective           => '01-JAN-2001',
          p_segment1                 => 'TEST',
          p_segment2                 => 'POSITION1',
          p_status                   => 'VALID',
          p_fte                      => NULL,
          p_max_persons              => NULL,
          p_position_id              => ln_position_id,
          p_object_version_number    => ln_object_version_number,
          p_position_definition_id   => ln_position_definition_id,
          p_name                     => lv_position_name,
          p_effective_start_date     => ld_effective_start_date,
          p_effective_end_date       => ld_effective_end_date
         );
END;


Version 2: This can be used for instances where HRMS is available on shared basis. In this case, the employee positions can’t be date tracked. 

SET SERVEROUTPUT ON;
DECLARE
  lv_position_name            VARCHAR2(500);
  ld_effective_start_date     DATE;
  ld_effective_end_date       DATE;
  ln_position_definition_id   NUMBER;
  ln_object_version_number    NUMBER;
  ln_position_id              NUMBER;
BEGIN
  lv_position_name          := 'TEST.POSITION1';
  ld_effective_start_date   := NULL;
  ld_effective_end_date     := NULL;
  ln_position_definition_id := NULL;
  ln_object_version_number  := NULL;
  ln_position_id            := NULL;
  
  hr_position_api.create_position
     ( p_validate                 => FALSE,
       p_job_id                   => 78, -- Job id
       p_organization_id          => 81, -- Business Group id
       p_date_effective           => '01-JAN-1990',
       p_segment1                 => 'TEST', 
       p_segment2                 => 'POSITION3',
       p_status                   => 'VALID',
       p_position_id              => ln_position_id,
       p_object_version_number    => ln_object_version_number,
       p_position_definition_id   => ln_position_definition_id,
       p_name                     => lv_position_name
     );
                                  
  DBMS_OUTPUT.PUT_LINE(ln_position_id);                                  
END;

 Hope this helps!!

1 Responses to “API to create Employee Positions in Oracle Apps R12 – HR_POSITION_API.CREATE_POSITION”

Jennifer N said...
December 29, 2018 at 8:13 PM

Thanks and Regards. Oracle Apps R12 Training Videos at affordable cost. please check oracleappstechnical.com


Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.