Wednesday, July 29, 2015

Delete/End Date Element Entry - HRMS APIs

--
declare
--
   ld_effective_start_date      date;
   ld_effective_end_date       date;
   lb_delete_warning             boolean;
   ln_element_entry_id          number;
   ln_object_version_number number;
   ln_assin_id                          number;
   --  
   lc_element_name       pay_element_types_f.element_name%type := 'AK Element';
   lc_emp_num               per_all_people_f.employee_number := '123425';

begin
--
     select pee.element_entry_id
           ,pee.object_version_number
           ,paf.assignment_id
       into ln_element_entry_id
           ,ln_object_version_number
           ,ln_assin_id
       from per_all_people_f        per
           ,per_all_assignments_f   paf
           ,pay_element_entries_f   pee
           ,pay_element_types_f_tl  petl
           ,pay_element_types_f     pet
      where per.employee_number = lc_emp_num
        and trunc(sysdate) between per.effective_start_date and per.effective_end_date
        and paf.person_id       = per.person_id
        and trunc(sysdate) between paf.effective_start_date and paf.effective_end_date
        and pee.assignment_id   = paf.assignment_id
        and pee.element_type_id = pet.element_type_id
        and trunc(sysdate) between pee.effective_start_date and pee.effective_end_date
        and petl.element_name   = lc_element_name
        and petl.language       = 'US'
        and pet.element_type_id = petl.element_type_id;
       
   /* Date Track modes
    DELETE             >> end date element entry
    DELETE_NEXT_CHANGE >> delete next changes
    FUTURE_CHANGE      >> delete future changes
    ZAP                >> completely remove element entry from the database
   */      

    pay_element_entry_api.delete_element_entry
      (p_validate                     => false
      ,p_datetrack_delete_mode        => 'DELETE'
      ,p_effective_date               => trunc(sysdate)
      ,p_element_entry_id             => ln_element_entry_id
      ,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_delete_warning               => lb_delete_warning
      ) ;
 
--
commit;
--
exception
   when others then
      dbms_output.put_line('Error: '||sqlerrm);
      rollback;
end;

No comments:

Post a Comment