Pages

Recently Viewed

Wednesday, February 29, 2012

Create FNDUSER From database

Requirement – To create FNDUSER without having access to application.


Solution  - Following API can be used to create a FND USER.
fnd_user_pkg.createuser
                                    ( x_user_name =>lv_user_name,
                                      x_owner        =>lv_owner,
                                      x_unencrypted_password     =>lv_password );


Example – create FNDUSER “Sandeep” using database.
DECLARE
  lv_user_name    VARCHAR2(100):= 'SANDEEP';
  lv_owner        VARCHAR2(10) := 'CUST';
  lv_password     VARCHAR2(20) := 'sandeep'; 
 ln_user_id         NUMBER;
BEGIN
  /*Create FND User*/ 
    fnd_user_pkg.createuser
                                    ( x_user_name                                                =>lv_user_name,
                                      x_owner                                                        =>lv_owner,
                                      x_unencrypted_password                             =>lv_password
                        );
    BEGIN
                          SELECT user_id
                          INTO ln_user_id
                          FROM fnd_user
                          WHERE user_name=lv_user_name;  
    EXCEPTION
                        WHEN no_data_found THEN
                          dbms_output.put_line('Did not create user('||lv_user_name||') : '||sqlerrm);
    END;
    IF ln_user_id IS NOT NULL THEN
      dbms_output.put_line('Successfully created user : '||lv_user_name);
      dbms_output.put_line('user id = '||ln_user_id);
    END IF;
EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('Error in  Create user :'||lv_user_name||'>>'||SQLERRM);
END;


No comments:

Post a Comment