/* Grant Particular Responsibility to a User */
SET serveroutput on
DECLARE
v_user_name VARCHAR2 (30) := UPPER ('Oracle FND User');
v_resp VARCHAR2 (255) := 'Application Administrator';
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 apps.fnd_responsibility_vl r
, apps.fnd_application_vl a
WHERE r.application_id = a.application_id
AND UPPER (r.responsibility_name) = UPPER (v_resp);
apps.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;
/
SET serveroutput on
DECLARE
v_user_name VARCHAR2 (30) := UPPER ('Oracle FND User');
v_resp VARCHAR2 (255) := 'Application Administrator';
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 apps.fnd_responsibility_vl r
, apps.fnd_application_vl a
WHERE r.application_id = a.application_id
AND UPPER (r.responsibility_name) = UPPER (v_resp);
apps.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;
/