Tuesday, 11 February 2020

Hrms Technical API's (API to Update Assignment level Payroll)

***The following API used to update the payroll at assignment level.

/* Formatted on 2020/02/12 11:29 (Formatter Plus v4.8.8) */
DECLARE
   v_datetrack_update_mode          VARCHAR2 (200);
   v_assignment_id                  NUMBER (20);
   v_assignment_number              NUMBER;
   v_object_version_number          NUMBER (2);
   v_people_group_id                NUMBER (20);
   v_special_ceiling_step_id        NUMBER;
   v_group_name                     VARCHAR2 (200);
   v_effective_start_date           DATE           := NULL;
   v_effective_date                 DATE;
   v_effective_end_date             DATE           := NULL;
   v_org_now_no_manager_warning     BOOLEAN;
   v_other_manager_warning          BOOLEAN;
   v_spp_delete_warning             BOOLEAN;
   v_entries_changed_warning        VARCHAR2 (200);
   v_tax_district_changed_warning   BOOLEAN;
   v_soft_coding_keyflex_id         NUMBER (20);
   v_concatenated_segments          VARCHAR2 (200);
   v_api_error                      VARCHAR (4000);
   v_org_id                         NUMBER;

   --
   CURSOR c1
   IS
      SELECT pam.*
        FROM per_all_people_f ppf, per_all_assignments_f pam
       WHERE 1 = 1
         AND SYSDATE BETWEEN ppf.effective_start_date AND ppf.effective_end_date
         AND ppf.person_id = pam.person_id
         AND SYSDATE BETWEEN pam.effective_start_date AND pam.effective_end_date
         AND ppf.employee_number IN
                ('1000016', '1001094');
BEGIN
   FOR i IN c1
   LOOP
      v_special_ceiling_step_id := NULL;

      BEGIN
         SELECT a.assignment_id, a.assignment_number,
                a.effective_start_date, a.object_version_number,
                a.people_group_id, a.organization_id,
                a.soft_coding_keyflex_id
           INTO v_assignment_id, v_assignment_number,
                v_effective_date, v_object_version_number,
                v_people_group_id, v_org_id,
                v_soft_coding_keyflex_id
           FROM per_all_assignments_f a
          WHERE assignment_id = i.assignment_id;
      EXCEPTION
         WHEN OTHERS
         THEN
            NULL;
      END;

      BEGIN
         v_datetrack_update_mode := 'UPDATE';
         hr_assignment_api.update_emp_asg_criteria
            (                                                            --in
             p_effective_date                    => '01-Dec-2019',
             p_datetrack_update_mode             => v_datetrack_update_mode,
             p_assignment_id                     => v_assignment_id,
             p_validate                          => FALSE,
             p_called_from_mass_update           => NULL,
             p_organization_id                   => v_org_id,
             p_payroll_id                        => 621,
--            p_segment18                         => 'ORAASK',
             p_people_group_id                   => v_people_group_id,
             p_object_version_number             => v_object_version_number,
             p_special_ceiling_step_id           => v_special_ceiling_step_id,
             --out
             p_group_name                        => v_group_name,
             p_effective_start_date              => v_effective_start_date,
             p_effective_end_date                => v_effective_end_date,
             p_org_now_no_manager_warning        => v_org_now_no_manager_warning,
             p_other_manager_warning             => v_other_manager_warning,
             p_spp_delete_warning                => v_spp_delete_warning,
             p_entries_changed_warning           => v_entries_changed_warning,
             p_tax_district_changed_warning      => v_tax_district_changed_warning,
             p_soft_coding_keyflex_id            => v_soft_coding_keyflex_id,
             p_concatenated_segments             => v_concatenated_segments
            );
         COMMIT;
         DBMS_OUTPUT.put_line ('*************************************');
         DBMS_OUTPUT.put_line
                  (   'Payroll Updated Successfully for assignment no : '
                   || v_assignment_number
                  );
         DBMS_OUTPUT.put_line ('*************************************');
      EXCEPTION
         WHEN OTHERS
         THEN
            v_api_error := SQLERRM;
            DBMS_OUTPUT.put_line ('*************************************');
            DBMS_OUTPUT.put_line
               (   'There is exception has been raised from API for assignment No : '
                || v_assignment_number
                || ' with error message '
                || v_api_error
               );
            DBMS_OUTPUT.put_line ('*************************************');
            --just if you use cursor
            v_api_error := NULL;
            v_people_group_id := NULL;
      END;
   END LOOP;
END;

No comments:

Post a Comment

API to Delete Assignment Set

*** Before going to Delete Assignment Set first we have to delete the Assignment Amendments after that only we have to delete the Assignmen...