Tuesday, 3 May 2016

Oracle HRMS API – Delete Employee Element Entry

Oracle HRMS API – Delete Employee Element Entry


DECLARE
   l_effective_start_date   DATE := NULL;
   l_effective_end_date     DATE := TO_DATE ('31-MAR-2015');
   l_update_warning         BOOLEAN;
   l_element_type_id        NUMBER := NULL;
   l_input_stop_salary_id   NUMBER := NULL;
   l_business_group_id      NUMBER := 81;
   l_effective_date         DATE := TO_DATE ('31-MAR-2015');
   l_error                  VARCHAR2 (1000);
   l_delete_warning         BOOLEAN;

   CURSOR c1
   IS
      SELECT *
        FROM XX_ELE_ENTRY_DATE_STAG
       WHERE status_Flag IS NULL;
BEGIN
   FOR c1_ee_rec IN c1
   LOOP
      IF TRIM (l_error) IS NULL
      THEN
         BEGIN
            pay_element_entry_api.delete_element_entry (
               p_validate                => FALSE,
               p_datetrack_delete_mode   => 'DELETE',
               p_effective_date          => l_effective_date,
               p_element_entry_id        => c1_ee_rec.element_entry_id,
               p_object_version_number   => c1_ee_rec.object_version_number,
               p_effective_start_date    => l_effective_start_date,
               p_effective_end_date      => l_effective_end_date,
               p_delete_warning          => l_delete_warning);

            COMMIT;
            DBMS_OUTPUT.put_line (
               'Element Entry has been Updated: '
               || c1_ee_rec.element_entry_id);

            UPDATE XX_ELE_ENTRY_DATE_STAG
               SET status_flag = 'S'
             WHERE ID = c1_ee_rec.ID;
         EXCEPTION
            WHEN OTHERS
            THEN
               DBMS_OUTPUT.put_line (
                     'Inner Exception: '
                  || SQLERRM
                  || ' - '
                  || c1_ee_rec.element_entry_id);

               UPDATE XX_ELE_ENTRY_DATE_STAG
                  SET status_flag = 'E', error_message = l_error
                WHERE ID = c1_ee_rec.ID;
         END;
      ELSE
         UPDATE XX_ELE_ENTRY_DATE_STAG
            SET status_flag = 'E', error_message = l_error
          WHERE ID = c1_ee_rec.ID;
      END IF;
   END LOOP;

   COMMIT;
END;

No comments:

Post a Comment