Loading

Tuesday, October 19, 2010

FND_USER_PKG.CREATEUSER ( Create Applications User via PLSQL)


Below script will be used for creating a Oracle Applications user via PLSQL. The api being used is FND_USER_PKG.

Script:

DECLARE
  P_USER_NAME                  VARCHAR2(200)     := 'SYSCNTEST' ;
  P_OWNER                      VARCHAR2(200)     := NULL;
  P_UNENCRYPTED_PASSWORD       VARCHAR2(200)     := 'oracle123';
  P_SESSION_NUMBER             NUMBER            := userenv('sessionid');
  P_START_DATE                 DATE              := SYSDATE;
  P_END_DATE                   DATE              := NULL;
  P_LAST_LOGON_DATE            DATE              := NULL;
  P_DESCRIPTION                VARCHAR2(200)     := 'teamsearch';
  P_PASSWORD_DATE              DATE              := SYSDATE - 1;
  P_PASSWORD_ACCESSES_LEFT     NUMBER            := 1000;
  P_PASSWORD_LIFESPAN_ACCESSES NUMBER            := 1000;
  P_PASSWORD_LIFESPAN_DAYS     NUMBER            := 1000;
  P_EMPLOYEE_ID                NUMBER            := NULL;
  P_EMAIL_ADDRESS              VARCHAR2(200)     := NULL;
  P_FAX                        VARCHAR2(200)     := NULL;
  P_CUSTOMER_ID                NUMBER            := NULL;
  P_SUPPLIER_ID                NUMBER            := NULL;
 
  v_user_id                    NUMBER;
BEGIN
FND_USER_PKG.CREATEUSER(
      x_USER_NAME                  => P_USER_NAME,
      x_OWNER                      => P_OWNER,
      x_UNENCRYPTED_PASSWORD       => P_UNENCRYPTED_PASSWORD,
      x_SESSION_NUMBER             => P_SESSION_NUMBER,
      x_START_DATE                 => P_START_DATE,
      x_END_DATE                   => P_END_DATE,
      x_LAST_LOGON_DATE            => P_LAST_LOGON_DATE,
      x_DESCRIPTION                => P_DESCRIPTION,
      x_PASSWORD_DATE              => P_PASSWORD_DATE,
      x_PASSWORD_ACCESSES_LEFT     => P_PASSWORD_ACCESSES_LEFT,
      x_PASSWORD_LIFESPAN_ACCESSES => P_PASSWORD_LIFESPAN_ACCESSES,
      x_PASSWORD_LIFESPAN_DAYS     => P_PASSWORD_LIFESPAN_DAYS,
      x_EMPLOYEE_ID                => P_EMPLOYEE_ID,
      x_EMAIL_ADDRESS              => P_EMAIL_ADDRESS,
      x_FAX                        => P_FAX,
      x_CUSTOMER_ID                => P_CUSTOMER_ID,
      x_SUPPLIER_ID                => P_SUPPLIER_ID
      );

  SELECT user_id
  INTO v_user_id
  FROM fnd_user
  WHERE user_name = P_USER_NAME;
 
  DBMS_OUTPUT.PUT_LINE ('User_id : ' ||v_user_id);
 
  EXCEPTION
  WHEN OTHERS THEN
  dbms_output.put_line('Error while creating a user: '||sqlerrm);
END;


0 Responses to “FND_USER_PKG.CREATEUSER ( Create Applications User via PLSQL)”

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.