--API to create FND User
BEGIN
fnd_user_pkg.CreateUser (
x_user_name => 'SC_1',
x_owner => NULL,
x_unencrypted_password =>'welcome#1234',
x_start_date => TO_DATE(SYSDATE),
x_end_date => NULL,
x_last_logon_date => NULL,
x_description => 'Ship Console User',
x_password_date => NULL,
x_password_accesses_left => NULL,
x_employee_id => NULL,
x_email_address => NULL,
x_fax => NULL,
x_customer_id => NULL,
x_supplier_id => NULL
);
COMMIT;
END;
/
--API to add responsibilities to a user
-- ----------------------------------------------------------
-- Add Responsibility to Oracle FND User
-- -----------------------------------------------------------
DECLARE
lc_user_name VARCHAR2(100) := 'SC_1';
lc_resp_appl_short_name VARCHAR2(100) ;
lc_responsibility_key VARCHAR2(100) ;
lc_security_group_key VARCHAR2(100) ;
ld_resp_start_date DATE := TO_DATE(SYSDATE);
ld_resp_end_date DATE := NULL;
L_description VARCHAR2(100) := Null;
BEGIN
SELECT fa.application_short_name,fr.responsibility_key,frg.security_group_key
INTO lc_resp_appl_short_name ,lc_responsibility_key,
lc_security_group_key
FROM
fnd_responsibility fr,fnd_application fa,fnd_security_groups frg,fnd_responsibility_tl frt
WHERE
fr.application_id = fa.application_id
AND fr.data_group_id = frg.security_group_id
AND fr.responsibility_id = frt.responsibility_id
AND frt.language = userenv('LANG')
AND frt.responsibility_name ='';
fnd_user_pkg.addresp
(
username => lc_user_name,
resp_app => lc_resp_appl_short_name,
resp_key => lc_responsibility_key,
security_group => lc_security_group_key,
description => L_description,
start_date => ld_resp_start_date,
end_date => ld_resp_end_date
);
DBMS_OUTPUT.PUT_LINE(lc_responsibility_key||' Responsibility is added to employee '||lc_user_name);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
/
SHOW ERR;
--API to remove responsibilities from a user
--This script will end date the assignment of responsibility to user
BEGIN
fnd_user_pkg.delresp(username => 'ABC',
resp_app => 'SYSADMIN',
resp_key => 'SYSTEM_ADMINISTRATOR',
security_group => 'STANDARD' );
COMMIT;
END;
--API to change password
declare
v_user_name varchar2(30):=upper('&Enter_User_Name');
v_new_password varchar2(30):='&Enter_New_Password';
v_status boolean;
begin
v_status:= fnd_user_pkg.ChangePassword (
username => v_user_name,
newpassword => v_new_password
);
if v_status =true then
dbms_output.put_line ('The password reset successfully for the User:'||v_user_name);
commit;
else
DBMS_OUTPUT.put_line ('Unable to reset password due to'||SQLCODE||' '||SUBSTR(SQLERRM, 1, 100));
rollback;
END if;
end;