Tuesday, July 22, 2014

Find The Date Track Mode - HRMS APIs

Hmmm....it's been a long time since I've posted here. Currently I am working on an HRMS project so I shall try to provide the details of HRMS related APIs and try to cover as many as possible.

I have noticed that below three parameters are common and important for these APIs.
1> Date track mode
   >> I won't explain the date track mode in detail, please refer the script below. I hope I have given the enough description above each mode there.
2> Validate mode
   >> It's better to use the API first in the validate mode with passing this parameter as TRUE and then in process mode by passing this parameter as FALSE.
3> Version number
   >> Make sure you pass the correct version number.

I shall start with Organization Management APIs (Org/position/hierarchy) followed by Personal Administration(PA) (Person/Contacts/Assignment/Termination) and at last the User account one (User/Responsibility). - Please refer posts under HRMS lebels.

-----------------------------------------------------------
-- Determine the date track mode
-----------------------------------------------------------
declare
  lv_assignmnet_id    number;
  lv_effective_date   date;
  -- DT_API Output Variables
  lv_correction       boolean;
  lv_update           boolean;
  lv_update_override  boolean;
  lv_update_change_insert boolean;
  lv_mode             varchar2(50);

begin
    -- determine the datetrack mode
    dt_api.find_dt_upd_modes
        (p_effective_date       => lv_effective_date,
         p_base_table_name   => 'PER_ALL_ASSIGNMENTS_F', --'PER_ALL_PEOPLE_F'
         p_base_key_column   => 'ASSIGNMENT_ID',         --'PERSON_ID'
         p_base_key_value      => lv_assignmnet_id,        --lv_person_id
         --Out Variables
         p_correction               => lv_correction,
         p_update                    => lv_update,
         p_update_override      => lv_update_override,
         p_update_change_insert => lv_update_change_insert
        );
 
    if lv_correction then
      --Correction - Over writes the existing record, no history will be maintained
      lv_mode:='CORRECTION';
    elsif lv_update then
      --Inserts a new record effective as of the effective date parameter and keeps the history
      lv_mode:='UPDATE';
    elsif lv_update_override then
      --Future dated changes - do insert then overrides the future record
      lv_mode:='UPDATE_OVERRIDE';
    elsif lv_update_change_insert then
      --Future dated changes - do insert and keeps the future record
      lv_mode:='UPDATE_CHANGE_INSERT';
    end if;    
    --  
exception
   when others then
      dbms_output.put_line('Error: '||sqlerrm);
end;    
       

2 comments: