Sunday, April 10, 2016

API to create application user in Oracle Apps R12 (FND_USER.CREATEUSER)















Recently, we had a requirement to create a user programmatically. We used the API FND_USER.CREATEUSER.
 
Tested Instance: R12.2.4

Script:
DECLARE
  lv_user_name  VARCHAR2(30) := upper('SHAREORACLEAPPS');
  lv_password   VARCHAR2(30) := 'SHARE123';
  lv_session_id INTEGER      := userenv('sessionid');
BEGIN
  fnd_user_pkg.createuser(x_user_name            => lv_user_name,
                          x_owner                => NULL,
                          x_unencrypted_password => lv_password,
                          x_session_number       => lv_session_id,
                          x_start_date           => sysdate,
                          x_end_date             => NULL,
                          x_email_address        => NULL
                         );
  COMMIT;
  DBMS_OUTPUT.put_line('User:' || v_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;

Test Results:
  

 

Hope its useful!! Enjoy Sharing and Learning!!

 

1 Responses to “API to create application user in Oracle Apps R12 (FND_USER.CREATEUSER)”

Anonymous said...
October 7, 2019 at 7:24 AM

Incorrect variable reference in the code snippet:
DBMS_OUTPUT.put_line('User:' || v_user_name || 'Created Successfully');
Should be "lv_user_name" (not v_user_name).
Other than that, perfect!


Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.