Tuesday, May 7, 2013

API to Create Element Entry


DECLARE
   CURSOR fetch_det
   IS
      SELECT   per.person_id,
               paaf.assignment_id,
               paaf.object_version_number,
               paaf.soft_coding_keyflex_id,
               paaf.people_group_id,
               paaf.special_ceiling_step_id
        FROM   per_people_x per, per_assignments_x paaf
       WHERE       per.person_id = paaf.person_id
               AND per.person_type_id IN (1126, 1127)
               AND paaf.assignment_type = 'E'
               AND paaf.assignment_status_type_id IN (1, 2)
               AND paaf.primary_flag = 'Y';

   l_effective_start_date    DATE := NULL;
   l_effective_end_date      DATE := NULL;
   l_object_version_number   NUMBER := NULL;
   l_element_entry_id        NUMBER := NULL;
   l_create_warning          BOOLEAN;
   l_err_msg                 VARCHAR2 (500) := NULL;
BEGIN
   FOR i IN fetch_det
   LOOP
      BEGIN
         pay_element_entry_api.create_element_entry (
            p_validate                => FALSE,
            p_effective_date          => TO_DATE ('01-APR-2013', 'DD-MON-YYYY'), -- Effective Date
            p_business_group_id       => 81, -- Business Group ID
            p_assignment_id           => i.assignment_id,
            p_element_link_id         => 258, -- ELement Link ID of the Element one wants to Upload
            p_entry_type              => 'E',
            p_effective_start_date    => l_effective_start_date,
            p_effective_end_date      => l_effective_end_date,
            p_element_entry_id        => l_element_entry_id,
            p_object_version_number   => l_object_version_number,
            p_create_warning          => l_create_warning
         );
         COMMIT;
         DBMS_OUTPUT.put_line (
            'Element has been uploaded: ' || l_element_entry_id
         );
      EXCEPTION
         WHEN OTHERS
         THEN
            l_err_msg := SQLERRM;
            DBMS_OUTPUT.put_line ('Main Exception: ' || l_err_msg);
      END;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      l_err_msg := SQLERRM;
      DBMS_OUTPUT.put_line ('Main Exception: ' || l_err_msg);
END;

1 comment:

  1. I dont know how should i thank you for your Amazing Blog its Helps Me aloooot in Many ways and different Times.. Thank You Very Much :)

    ReplyDelete