How to create user through back end?
How to assign responsibility to existing user through PL/SQL block?
APIs for creating user from back end and assign responsibility to it?
How to assign responsibility to existing user through PL/SQL block?
APIs for creating user from back end and assign responsibility to it?
Create user through PL/SQL block:
DECLARE
lc_user_name VARCHAR2(100) := 'DIKSHA.GAIKWAD';
lc_user_password VARCHAR2(100) := 'Oracle123';
ld_user_start_date DATE := TO_DATE('31-AUG-2015');
ld_user_end_date VARCHAR2(100) := NULL;
ld_password_date VARCHAR2(100) := NULL;
ld_password_lifespan_days NUMBER := NULL;
ln_person_id NUMBER := NULL;
lc_email_address VARCHAR2(100) := NULL;
BEGIN
fnd_user_pkg.createuser
( x_user_name => lc_user_name,
x_owner => NULL,
x_unencrypted_password => lc_user_password,
x_start_date => ld_user_start_date,
x_end_date => ld_user_end_date,
x_password_date => ld_password_date,
x_password_lifespan_days => ld_password_lifespan_days,
x_employee_id => ln_person_id,
x_email_address => lc_email_address );
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
/
SHOW ERR;
Assign responsibility to User through PL/SQL block:
DECLARE
v_user_name VARCHAR2(30) := upper('DIKSHA.GAIKWAD');
v_resp VARCHAR2(30) :='System 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 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;
COMMENTS