How to Delete Element Entries in Oracle HRMS Payroll

Reason

Sometimes entries are mistakenly attached to the employees, most common reason i come across is that standard element links are created for an employee.

After you have created standard element links, there is a sudden policy change, user says that standard element links are not required.

So you need to delete all element entries of that particular element.

I m providing here the procedure to do so.

NOTE:
This procedure will delete all element entries of all active employees. So please change the query according to your requirement.



PROCEDURE



CREATE OR REPLACE PROCEDURE apps.delete_element_entries
IS
   CURSOR c_comp
   IS
      SELECT ppf.employee_number, peef.element_entry_id,
             peef.effective_start_date
        FROM per_people_f ppf,
             per_assignments_f paf,
             pay_element_entries_f peef
       WHERE peef.entry_type = 'E'
         AND ppf.person_id = paf.person_id
         AND SYSDATE BETWEEN ppf.effective_start_date AND ppf.effective_end_date
         AND SYSDATE BETWEEN paf.effective_start_date AND paf.effective_end_date
         AND paf.assignment_id = peef.assignment_id(+);

   lc_c_comp                c_comp%ROWTYPE;
   l_comp_id                NUMBER;
   l_effective_start_date   DATE;
   l_effective_end_date     DATE;
   l_org_id                 NUMBER;
   l_loc_id                 NUMBER;
   l_basis_id               NUMBER;
   l_ppl_group_id           NUMBER;
   l_entries_warning        BOOLEAN;
BEGIN
   OPEN c_comp;

   LOOP
      FETCH c_comp
       INTO lc_c_comp;

      EXIT WHEN c_comp%NOTFOUND;

      BEGIN
         DBMS_OUTPUT.put_line ('Procedure Ran');
         hr_entry_api.delete_element_entry
                           (p_dt_delete_mode        => 'ZAP',
                            p_session_date          => lc_c_comp.effective_start_date,
                            p_element_entry_id      => lc_c_comp.element_entry_id
                           );
         DBMS_OUTPUT.put_line (l_effective_start_date);
      END;

      l_effective_start_date := NULL;
      l_effective_end_date := NULL;
   END LOOP;

   CLOSE c_comp;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line (SUBSTR (SQLERRM, 1, 254));
END;
/

If Element links were mistakenly created, so you need to delete them. Check

How to delete Element Links

Your feedback is very important. Leave comment for any query.




1 comment:

  1. Hi,

    I want to delete basic salary element entry value, but it cannot be deleted.Basic salary element is attached with salary basis and salary is entered through salary form.how can i delete it?

    Thank You

    ReplyDelete