Oracle apps technical tutorial

Oracle apps API to CREATE user and assign responsibility from Back-end

API to create user and assign responsibility from Back-end


  1. PL/SQL Script to create user with the help of fnd_user_pkg.createuser API
DECLARE
  lc_user_name  VARCHAR2(30):=UPPER('&Enter_User_Name');
  lc_password   VARCHAR2(30):='&Enter_Password';
  lc_session_id INTEGER     := USERENV('sessionid');
BEGIN
  fnd_user_pkg.createuser (
    x_user_name => lc_user_name,
    x_owner => NULL,
    x_unencrypted_password => lc_password,
    x_session_number => lc_session_id,
    x_start_date => SYSDATE,
    x_end_date => NULL
  );
  COMMIT;
  DBMS_OUTPUT.put_line ('User:'||lc_user_name||'Created Successfully');
EXCEPTION
  WHEN OTHERS THEN
    DBMS_OUTPUT.put_line ('Unable to create User due to'||SQLCODE||' '||SUBSTR(SQLERRM, 1, 100));
    ROLLBACK;
END;

Script to ADD Responsibility

BEGIN
fnd_user_pkg.addresp ('&Enter_User_Name','SYSADMIN','SYSTEM_ADMINISTRATOR','STANDARD','Add Responsibility to USER using pl/sql',SYSDATE,SYSDATE + 100);
commit;
dbms_output.put_line('Responsibility Added Successfully');
exception
        WHEN others THEN
                dbms_output.put_line(' Responsibility is not added due to ' || SQLCODE || substr(SQLERRM, 1, 100));
                ROLLBACK;
END;

 

Leave a Reply