Monday, February 3, 2014

API to End Date User Responsibility

DECLARE
   CURSOR c1
   IS
      SELECT fu.user_name,
             fa.application_short_name,
             frt.responsibility_name,
             fr.responsibility_key,
             fsg.security_group_key
        FROM fnd_user_resp_groups_all ful,
             fnd_user fu,
             fnd_responsibility_tl frt,
             fnd_responsibility fr,
             fnd_security_groups fsg,
             fnd_application fa
       WHERE     fu.user_id = ful.user_id
             AND frt.responsibility_id = ful.responsibility_id
             AND fr.responsibility_id = frt.responsibility_id
             AND fsg.security_group_id = ful.security_group_id
             AND fa.application_id = ful.responsibility_application_id
             AND frt.language = 'US'
             AND fu.user_name = 'BIJOYJ'
             AND frt.responsibility_name = 'Learning Instructor Self-Service';
BEGIN
   FOR i IN c1
   LOOP
      BEGIN
         fnd_user_pkg.delresp (username         => i.user_name,
                               resp_app         => i.application_short_name,
                               resp_key         => i.responsibility_key,
                               security_group   => i.security_group_key);
         COMMIT;
         DBMS_OUTPUT.
          put_line (
            i.responsibility_name || ' has been End Dated Successfully !!!');
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.
             put_line (
                  'Inner Exception: '
               || ' - '
               || i.responsibility_key
               || ' - '
               || SQLERRM);
      END;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);
END;


No comments:

Post a Comment