12 June 2013

Orace Application Adding User and Adding Responsibility



User following PL/SQL to achieve the same,




DECLARE
l_user_id NUMBER;
l_resp_id NUMBER;
l_app_id NUMBER;
BEGIN
FND_USER_PKG.CreateUser (x_user_name => 'DEVUSER',
x_owner => NULL,
x_unencrypted_password => 'WELCOME123',
x_email_address => 'devuser@domain.com');

SELECT user_id
INTO l_user_id
FROM fnd_user
WHERE user_name = 'DEVUSER';

SELECT responsibility_id, application_id
INTO l_resp_id, l_app_id
FROM fnd_responsibility
WHERE responsibility_key = 'SYSTEM_ADMINISTRATOR';

FND_USER_RESP_GROUPS_API.
insert_assignment (user_id => l_user_id,
responsibility_id => l_resp_id,
responsibility_application_id => l_app_id,
security_group_id => NULL,
start_date => SYSDATE,
end_date => NULL,
description => NULL);

COMMIT;
EXCEPTION
WHEN OTHERS THEN
raise_application_error ( -20001, 'An error was encountered - ' || SQLCODE || ' -ERROR- ' || SQLERRM);
END;

No comments: