Sunday 26 January 2020

Script to Reset User Password from Backend in Oracle APPS

SET serveroutput ON;
DECLARE
  l_user_name    VARCHAR2(30):= UPPER('SANDEEP_SHARMA');
  l_new_password VARCHAR2(30):= 'sysadmin';
  l_status       BOOLEAN;
BEGIN
  l_status   := fnd_user_pkg.ChangePassword ( username => l_user_name,
                                              newpassword => l_new_password
                                            );
  IF l_status  THEN
    dbms_output.put_line ('Password reset successfully for the User:'||l_user_name);
    COMMIT;
  ELSE
    DBMS_OUTPUT.put_line ('Unable to reset password due to'||SQLCODE||' '||SUBSTR(SQLERRM, 1, 100));
    ROLLBACK;
  END IF;
END;

Thursday 23 January 2020

Add System Administrator Responsibility to a User from Back end in Oracle Apps R12

BEGIN
   FND_USER_PKG.ADDRESP
                       ('SANDEEP_SHARMA',
                        'SYSADMIN',
                        'SYSTEM_ADMINISTRATOR',
                        'STANDARD',
                        'Add Sysadmin Responsibility to A user from Backend',
                        SYSDATE,
                        SYSDATE + 1000
                       );
   COMMIT;
   DBMS_OUTPUT.PUT_LINE ('Responsibility Added Successfully');
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.PUT_LINE (   ' Sys Admin Resp cannot be added: '
                            || SQLCODE
                            || SUBSTR (SQLERRM, 1, 100)
                           );
END;
/