Saturday, March 17, 2018

API to add responsibility to a user (FND_USER_PKG.ADDRESP)













In this post, we have provided a sample script to add responsibility to an existing application user. This helps for data conversion or normal support activities

API: FND_USER_PKG.ADDRESP

Script:
DECLARE

   lv_user_name        VARCHAR2 (20) := '123456';
   lv_req_resp_key     VARCHAR2 (50) := 'APPLICATION_DEVELOPER';
   lv_description      VARCHAR2 (100) := 'Adding Responsibility to user using script';
   lv_req_resp_name    VARCHAR2 (200);
   lv_appl_shrt_name   VARCHAR2 (20);
   lv_appl_name        VARCHAR2 (50);
   lv_resp_key         VARCHAR2 (50);
  
BEGIN

   SELECT fav.application_short_name,
          fav.application_name,
          frv.responsibility_name
     INTO lv_appl_shrt_name, lv_appl_name, lv_req_resp_name
     FROM fnd_application_vl fav, fnd_responsibility_vl frv
    WHERE frv.application_id = fav.application_id
      AND frv.responsibility_key = lv_req_resp_key;

   fnd_user_pkg.addresp (username         => lv_user_name,
                         resp_app         => lv_appl_shrt_name,
                         resp_key         => lv_req_resp_key,
                         security_group   => 'STANDARD',
                         description      => lv_description,
                         start_date       => SYSDATE,
                         end_date         => NULL
                                              );
   COMMIT;
  
   DBMS_OUTPUT.put_line ('The responsibility ' || lv_req_resp_name || ' is added to the user ' || lv_user_name);
  
EXCEPTION
   WHEN OTHERS THEN
      DBMS_OUTPUT.put_line ('Responsibility IS NOT added due to ' || SQLCODE || '; ' || SUBSTR (SQLERRM, 1, 250));
      ROLLBACK;
END;

Hope this helps!!

0 Responses to “API to add responsibility to a user (FND_USER_PKG.ADDRESP)”

Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.