Friday, November 15, 2013

API to Upload Programs in Request Group

DECLARE
   CURSOR get_details
   IS
      SELECT b.concurrent_program_name programname,
             c.application_name appname
        FROM fnd_request_group_units a,
             fnd_concurrent_programs b,
             fnd_application_tl c,
             fnd_request_groups d
       WHERE     a.request_group_id = d.request_group_id
             AND a.request_unit_id = b.concurrent_program_id
             AND b.application_id = c.application_id
             AND d.request_group_name = 'All Reports'
             AND c.application_name = 'Payables';
BEGIN
   FOR fetch_details IN get_details
   LOOP
      BEGIN
         apps.fnd_program.
          add_to_group (program_short_name    => fetch_details.programname,
                        program_application   => fetch_details.appname,
                        request_group         => 'XXX_SRACCOUNTANT_PAYABLES',
                        group_application     => 'Payables');

         COMMIT;
         DBMS_OUTPUT.
          put_line ('Program Added: ' || fetch_details.programname);
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.
             put_line (
                  'Inner Exception: '
               || SQLERRM
               || ' - '
               || fetch_details.programname);
      END;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);

END;

No comments:

Post a Comment