Tuesday 15 May 2012

Add Responsibility to a Given User in Oracle Apps

Once a User has been created in the Oracle system, the system administrator needs to assign responsibilities to the user so that he/she can perform the required tasks.By default when a user is created no responsibility is attached to the user, the system administrator needs to assign responsibilities to the user.

There are 2 methods to assign responsibilities to the user


1. Oracle Apps Front End: The user can be queried from the System Administrator Responsibility and the required responsibilities can be added and then save the details. This is a manual process which will require a lot of effort and time in case a number of responsibilities need to be added to a set of users created in the system.

2. Via Oracle API
Moreover method 1 does not seem to be a viable option for large scale business requiring recurring creation of a large number of users. In Order to solve the problem Oracle has provided the users with an API to acheive the functionality

API: fnd_user_pkg.addresp

Given below is a sample code for the API usage
DECLARE

  v_session_id INTEGER := userenv('sessionid');
  v_user_name  VARCHAR2(30) := upper('Ashwini');

BEGIN
fnd_user_pkg.addresp(username       => v_user_name
                      ,resp_app       => 'SYSADMIN'
                      ,resp_key       => 'SYSTEM_ADMINISTRATOR'
                      ,security_group => 'STANDARD'
                      ,description    => 'Auto Assignment'
                      ,start_date     => SYSDATE - 10
                      ,end_date       => SYSDATE + 1000);

COMMIT;

  EXCEPTION
  WHEN OTHERS
  THEN
     dbms_output.put_line('Exception Occurred in Processing ');
     dbms_output.put_line('Oracle Error '||SQLERRM);
END;

If all the details provided are correct , the responsibility System Administrator in the above case gets assigned to the user 'Ashwini' with the for a specified period, since in the API we have populated the end date for the responsibility assignment.



1 comment: