Sei sulla pagina 1di 2

FND_USER_PKG.ADDRESP API is used to attach a responsibility to a User in r12.

We are going to attach System Administrator responsibility to OPERATIONS user using below
script.
DECLARE
v_application_short_nameVARCHAR2(100):=NULL;
v_responsibility_keyVARCHAR2(100):=NULL;
v_security_groupVARCHAR2(100):=NULL;
v_descriptionVARCHAR2(100):=NULL;
v_user_nameVARCHAR2(100):='OPERATIONS';
v_responsibility_nameVARCHAR2(100):='SystemAdministrator';
BEGIN
SELECTfap.application_short_name,
frp.responsibility_key,
frg.security_group_key,
frt.description
INTOv_application_short_name,
v_responsibility_key,
v_security_group,
v_description
FROMfnd_responsibilityfrp,
fnd_applicationfap,
fnd_security_groupsfrg,
fnd_responsibility_tlfrt
WHEREfrp.application_id=fap.application_id
ANDfrp.responsibility_id=frt.responsibility_id
ANDfrp.data_group_id=frg.security_group_id
ANDfrt.LANGUAGE=USERENV('LANG')
ANDfrt.responsibility_name=v_responsibility_name;
fnd_user_pkg.addresp(username=>v_user_name,
resp_app=>v_application_short_name,
resp_key=>v_responsibility_key,
security_group=>v_security_group,
description=>v_description,
start_date=>SYSDATE,
end_date=>NULL

);

COMMIT;
DBMS_OUTPUT.put_line(v_responsibility_name
||'ResponsibilityAddedSuccessfullytouser'
||v_user_name
);
EXCEPTION
WHENOTHERS
THEN
DBMS_OUTPUT.put_line('Failedtoattachresponsibilitytouser'
||SQLCODE
||SUBSTR(SQLERRM,1,100)
);
ROLLBACK;

END;

To cross verify if the responsibility is attached to the user OPERATIONS use the following query

SELECTfu.user_name,
frt.responsibility_name
FROMfnd_userfu,
fnd_user_resp_groupsfurg,
fnd_responsibility_tlfrt
WHEREfu.user_id=furg.user_id
ANDfurg.responsibility_id=frt.responsibility_id
ANDfu.user_name='OPERATIONS'

Potrebbero piacerti anche