Sample code to create a user (FND_USER) from backend and add responsibility.
Related blog: Oracle Apps: Reset FND User password from backend
Feel free to point out if anything is missing/wrong in this blog.
declarev_user_namevarchar2(30) :='AJ_TEST';-- User Namev_passwordvarchar2(30) :='johnytips';-- Password-- List of responsibilities to be added automaticallycursorcur_get_responsibilitiesisselectresp.responsibility_key ,resp.responsibility_name ,app.application_short_namefromfnd_responsibility_vl resp ,fnd_application appwhereresp.application_id = app.application_idandresp.responsibility_name in ('System Administrator','Application Developer','Functional Administrator') ;beginfnd_user_pkg.createuser ( x_user_name =>upper(v_user_name) ,x_owner =>null,x_unencrypted_password => v_password ,x_session_number =>userenv('sessionid') ,x_start_date =>sysdate,x_end_date =>null);dbms_output.put_line('User '||v_user_name||' created !!!!!');forc_get_respincur_get_responsibilitiesloopfnd_user_pkg.addresp ( username => v_user_name ,resp_app => c_get_resp.application_short_name ,resp_key => c_get_resp.responsibility_key ,security_group =>'STANDARD',description =>null,start_date => sysdate ,end_date =>null);dbms_output.put_line('Responsibility '||c_get_resp.responsibility_name||' added !!!!!!');endloop;commit;exceptionwhen others then dbms_output.put_line('Exception : '||SUBSTR(SQLERRM,1,500));rollback;end;
Related blog: Oracle Apps: Reset FND User password from backend
Feel free to point out if anything is missing/wrong in this blog.
ERROR at line 5:
ReplyDeleteORA-06550: line 5, column 12:
PLS-00103: Encountered the symbol "," when expecting one of the following:
:= . ( @ % ; not null range default character
ORA-06550: line 7, column 6:
PLS-00103: Encountered the symbol "FROM" when expecting one of the following:
. ( ) , * @ % & = - + < / > at in is mod remainder not rem =>
<> or != or ~= >= <= <> and or like like2
like4 likec between || multiset member submultiset
ORA-06550: line 13, column 2:
PLS-00103: Encountered the symbol "BEGIN"
ORA-06550: line 35, column 16:
PLS-00103: Encountered the symbol "OTHERS" when expecting one of the following:
:= . ( @ % ;
ORA-06550: line 38, column 5:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
if