Monday, May 11, 2015

API to Change Assignment Status - Activate Employee Assignment

DECLARE
   CURSOR c1
   IS
      SELECT *
        FROM per_all_assignments_f paaf
       WHERE assignment_number = '6047';

   l_effective_start_date   DATE := NULL;
   l_effective_end_date     DATE := NULL;
BEGIN
   FOR i IN c1
   LOOP
      BEGIN
         l_effective_start_date := NULL;
         l_effective_end_date := NULL;
         hr_assignment_api.
          activate_emp_asg (
            p_validate                    => FALSE,
            p_effective_date              => SYSDATE,
            p_datetrack_update_mode       => 'CORRECTION',
            p_assignment_id               => i.assignment_id,
            p_change_reason               => NULL,
            p_object_version_number       => i.object_version_number,
            p_assignment_status_type_id   => 5095,           -- Salary on Hold
            p_effective_start_date        => l_effective_start_date,
            p_effective_end_date          => l_effective_end_date);

         DBMS_OUTPUT.
          put_line (i.assignment_id || ' assignment Status Changed !!!');
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.put_line ('Inner Exception: ' || i.assignment_id);
      END;
   END LOOP;

END;

No comments:

Post a Comment