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!!

Friday, March 23, 2018 by Team search · 0

Monday, March 19, 2018

API to end date the User in Oracle Apps - FND_USER_PKG.UPDATEUSER











In this post, we shared a script for another common production support activity. 

Action: To end date an existing application user.

Instance: R12.2.4

API: FND_USER_PKG.UPDATEUSER

Script:


DECLARE
    lc_user_name       VARCHAR2(100)  := 'SYSADMIN';
    ld_user_end_date   DATE  := SYSDATE;


BEGIN
   fnd_user_pkg.updateuser
   (  x_user_name               => lc_user_name,
      x_owner                   => NULL,
      x_unencrypted_password    => NULL,
      x_start_date              => NULL,
      x_end_date                => ld_user_end_date,
      x_password_date           => NULL,
      x_password_lifespan_days  => NULL,
      x_employee_id             => NULL,
      x_email_address           => NULL
   );

 COMMIT;


EXCEPTION
  WHEN OTHERS THEN
    ROLLBACK;
    DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
/

 



Monday, March 19, 2018 by Team search · 0

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.