Monday, May 20, 2013

Script to Assign Responsibility in Oracle Applications


Below is the script that can be used to assign responsibility for a user.



DECLARE
   l_user_id   NUMBER;
   l_resp_id   NUMBER;
   l_appl_id   NUMBER;

   CURSOR cur_resp
   IS
      SELECT   responsibility_id, application_id -- INTO   l_resp_id, l_appl_id
        FROM   fnd_responsibility_vl
       WHERE   UPPER (responsibility_name) LIKE UPPER ('XXXXX');
BEGIN
   SELECT   user_id
     INTO   l_user_id
     FROM   fnd_user
    WHERE   user_name = 'UUUU';

   FOR rec_cur IN cur_resp
   LOOP
      fnd_user_resp_groups_api.insert_assignment (
         user_id                         => l_user_id,
         responsibility_id               => rec_cur.responsibility_id,
         responsibility_application_id   => rec_cur.application_id,
         security_group_id               => 0,
         start_date                      => SYSDATE - 1,
         end_date                        => NULL,
         description                     => NULL
      );
      COMMIT;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.Put_Line ('Exception  in the Main');

END;





***Please leave a comment***

1 comment:

Please provide your valuable feedback which helps us to improve the content.