Use the below query to add a responsibility to a user. The advantage here is that you donot require system administrator responsibility access to add a responsibility.
declare
v_user_name varchar2(30):=upper('&Enter_User_Name');
v_resp varchar2(30):='&Enter_Responsibility';
v_resp_key varchar2(30);
v_app_short_name varchar2(50);
begin
select
r.responsibility_key ,
a.application_short_name
into v_resp_key,v_app_short_name
from fnd_responsibility_vl r,
fnd_application_vl a
where
r.application_id =a.application_id
and upper(r.responsibility_name) = upper(v_resp);
fnd_user_pkg.AddResp (
username => v_user_name,
resp_app => v_app_short_name,
resp_key => v_resp_key,
security_group => 'STANDARD',
description => null,
start_date => sysdate,
end_date => null
);
commit;
DBMS_OUTPUT.put_line ('Responsibility:'||v_resp||' '||'is added to the User:'||v_user_name);
EXCEPTION
when others then
DBMS_OUTPUT.put_line ('Unable to add the responsibility due to'||SQLCODE||' '||SUBSTR(SQLERRM, 1, 100));
rollback;
end;
No comments:
Post a Comment