Wednesday, April 13, 2016

API to create HR Jobs in oracle apps R12 (PER_JOBS) (HR_JOB_API.CREATE_JOB)

This post is for migrating JOBS. I have prepared a small script which can used to create the JOBS in Oracle Apps R12. 

Before we get into script, let have a brief introduction to related tables.
  1. PER_JOB_GROUPS is used to group records contained in PER_JOBS. Each Job Group has to be within a business group unless the profile option HR: Cross Business Group Profile is set to 'N' in which case a Job Group can have a NULL Business Group (considered to be a Global Job Group). Jobs in Global Job Groups can be viewed across the system. All HR jobs, i.e., those jobs used within the HRMS system, must be defined within a 'Default HR Job Group'. The default HR Job Group is created at the same time a Business Group is created.
  2. PER_JOBS holds jobs that have been defined for a Business Group. The
    NAME is a concatenation of key flexfield segments, held in PER_JOB_DEFINITIONS. Jobs define the role that an employee can perform in the business group, and they are independent of specific organizations. Each Job is contained within a Job Group.
  3. PER_JOBS_TL: Translated columns for per_jobs
  4. PER_JOB_DEFINITIONS is a key flexfield combinations table. It holds
    the segment combinations for jobs that are stored in PER_JOBS. Oracle
    Applications do not support code combinations IDs that exceed 2,000,000,000.

Tested Version: R12.2.4
  lv_group_name            VARCHAR2(200) := 'SHARE_GROUP';
  ln_business_group_id     NUMBER;
  ln_job_group_id          NUMBER; 
  ln_job_id                NUMBER;
  ln_object_version_number NUMBER;
  ln_job_definition_id     NUMBER;
  lv_job_name              VARCHAR2(200);

  -- get group id and business group id
    SELECT business_group_id,
      INTO ln_business_group_id,
      FROM per_job_groups
     WHERE displayed_name = lv_group_name;
      dbms_output.put_line('Unable to get the job group details.Error:'||SQLERRM);

  (p_validate                      => FALSE
  ,p_business_group_id             => ln_business_group_id
  ,p_date_from                     => SYSDATE
  ,p_comments                      => 'Test SCript'
  ,p_date_to                       => NULL
  ,p_job_group_id                  => ln_job_group_id
  ,p_concat_segments               => 'SHARE.ORACLE.APPS'
  ,p_language_code                 => 'ZHS'
  ,p_job_id                        => ln_job_id
  ,p_object_version_number         => ln_object_version_number
  ,p_job_definition_id             => ln_job_definition_id
  ,p_name                          => lv_job_name
  DBMS_OUTPUT.PUT_LINE('JOB ID: '||ln_job_id);
  DBMS_OUTPUT.PUT_LINE('OBJECT_VERSION_NUMBER: '||ln_object_version_number);
  DBMS_OUTPUT.PUT_LINE('JOB_DEFINITION_ID: '||ln_job_definition_id);
  DBMS_OUTPUT.PUT_LINE('JOB_NAME: '||lv_job_name);
      dbms_output.put_line('Unable to create a job.Error:'||SQLERRM);

0 Responses to “API to create HR Jobs in oracle apps R12 (PER_JOBS) (HR_JOB_API.CREATE_JOB)”

Post a Comment


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.