Wednesday, 13 May 2015

Create User from backend

/* Formatted on 5/13/2015 10:58:26 AM (QP5 v5.163.1008.3004) */
DECLARE
   l_user_id   NUMBER;
   l_resp_id   NUMBER;
   l_app_id    NUMBER;
BEGIN
   fnd_user_pkg.createuser (x_user_name              => 'DHEERAZ',--LOKANADHAM
                            x_owner                  => NULL,
                            x_unencrypted_password   => 'welcome123',
                            x_email_address          => 'devuser@gmail.com');

   SELECT user_id
     INTO l_user_id
     FROM fnd_user
    WHERE user_name = 'DHEERAZ';

   SELECT responsibility_id, application_id
     INTO l_resp_id, l_app_id
     FROM fnd_responsibility
    WHERE responsibility_key = 'SYSTEM_ADMINISTRATOR';

   fnd_user_resp_groups_api.insert_assignment (
      user_id                         => l_user_id,
      responsibility_id               => l_resp_id,
      responsibility_application_id   => l_app_id,
      security_group_id               => NULL,
      start_date                      => SYSDATE,
      end_date                        => NULL,
      description                     => NULL);

   COMMIT;
EXCEPTION
   WHEN OTHERS
   THEN
      raise_application_error (
         -20001,
         'An error was encountered - ' || SQLCODE || ' -ERROR- ' || SQLERRM);

END;


Screen