DECLARE
v_username fnd_user.user_name%TYPE;
v_resp_key fnd_responsibility.responsibility_key%TYPE;
v_apps_short_name fnd_application.application_short_name%TYPE;
v_resp_name fnd_responsibility_tl.responsibility_name%TYPE;
BEGIN
v_username := '&USER_NAME'; -- eg. 'AMOHSIN'
v_resp_name := '&RESP_NAME'; -- eg. 'System Administrator'
-------------------------------------------------------------
-- find APPLICATION_SHORT_NAME and RESPONSIBILITY_KEY for
-- the Responsibility that need to be added
-------------------------------------------------------------
SELECT fr.responsibility_key,
fa.application_short_name
INTO v_resp_key,
v_apps_short_name
FROM applsys.fnd_responsibility_tl frt,
applsys.fnd_responsibility fr,
applsys.fnd_application_tl fat,
applsys.fnd_application fa
WHERE fr.responsibility_id = frt.responsibility_id
AND fa.application_id = fat.application_id
AND fr.application_id = fat.application_id
AND frt.language = USERENV('LANG')
AND fat.language = USERENV('LANG')
AND frt.responsibility_name = v_resp_name;
-------------------------------------------------------------
-- if found, then add it to the user; else jump into exception
-------------------------------------------------------------
FND_USER_PKG.ADDRESP(
USERNAME => UPPER(v_username), -- User Name
RESP_APP => v_apps_short_name, -- Apps Short Name
RESP_KEY => v_resp_key, -- Resp Key
SECURITY_GROUP => 'STANDARD',
DESCRIPTION => NULL,
START_DATE => SYSDATE,
END_DATE => NULL);
COMMIT;
DBMS_OUTPUT.PUT_LINE(v_resp_name || ' responsibility added successfully for ' || v_username);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(v_resp_name || ' responsibility not added for ' || v_username);
DBMS_OUTPUT.PUT_LINE('SQLERRM: ' || SUBSTR(SQLERRM, 1, 100));
ROLLBACK;
END;
v_username fnd_user.user_name%TYPE;
v_resp_key fnd_responsibility.responsibility_key%TYPE;
v_apps_short_name fnd_application.application_short_name%TYPE;
v_resp_name fnd_responsibility_tl.responsibility_name%TYPE;
BEGIN
v_username := '&USER_NAME'; -- eg. 'AMOHSIN'
v_resp_name := '&RESP_NAME'; -- eg. 'System Administrator'
-------------------------------------------------------------
-- find APPLICATION_SHORT_NAME and RESPONSIBILITY_KEY for
-- the Responsibility that need to be added
-------------------------------------------------------------
SELECT fr.responsibility_key,
fa.application_short_name
INTO v_resp_key,
v_apps_short_name
FROM applsys.fnd_responsibility_tl frt,
applsys.fnd_responsibility fr,
applsys.fnd_application_tl fat,
applsys.fnd_application fa
WHERE fr.responsibility_id = frt.responsibility_id
AND fa.application_id = fat.application_id
AND fr.application_id = fat.application_id
AND frt.language = USERENV('LANG')
AND fat.language = USERENV('LANG')
AND frt.responsibility_name = v_resp_name;
-------------------------------------------------------------
-- if found, then add it to the user; else jump into exception
-------------------------------------------------------------
FND_USER_PKG.ADDRESP(
USERNAME => UPPER(v_username), -- User Name
RESP_APP => v_apps_short_name, -- Apps Short Name
RESP_KEY => v_resp_key, -- Resp Key
SECURITY_GROUP => 'STANDARD',
DESCRIPTION => NULL,
START_DATE => SYSDATE,
END_DATE => NULL);
COMMIT;
DBMS_OUTPUT.PUT_LINE(v_resp_name || ' responsibility added successfully for ' || v_username);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(v_resp_name || ' responsibility not added for ' || v_username);
DBMS_OUTPUT.PUT_LINE('SQLERRM: ' || SUBSTR(SQLERRM, 1, 100));
ROLLBACK;
END;
No comments:
Post a Comment