Register Login

ABAP program to do mass password changes with the password you choose.

Updated Jul 08, 2019

ABAP Program to do Mass Password Changes

*&---------------------------------------------------------------------*
*& Report  ZPASSWORD_MASS_CREATE                                       *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  ZPASSWORD_MASS_CREATE message-id zpassword.

tables usr01.

data: lt_return type bapiret2 occurs 0 with header line.
data: lw_user type BAPIBNAME-BAPIBNAME.

select-options: s_bname for usr01-bname obligatory NO INTERVALS.
parameters: p_passw type bapipwd obligatory.

at selection-screen.
  loop at s_bname where option ne 'EQ'.
    message e001.
  endloop.

start-of-selection.
  loop at s_bname.
    select count(*) from usr01 where bname in s_bname.
    if sy-subrc ne 0.
      write: / 'Userid:', s_bname-low , 'is not found in database'.
      continue.
    endif.

    Write: / 'about to reset password for user:', s_bname-low.
    lw_user = s_bname-low.
    CALL FUNCTION 'BAPI_USER_CHANGE'
      EXPORTING
        USERNAME  = lw_user
        PASSWORD  = p_passw
        PASSWORDX = 'X'
      TABLES
        RETURN    = lt_return.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.


    loop at lt_return.
      write: / '.....' , lt_return-MESSAGE.
    endloop.
  endloop.
  if sy-subrc ne 0. write: / 'No user selected'. endif.


  .

 


Comments

  • 08 May 2014 7:29 am edwin
    • HI Shalesh Singh Visen  ,
    •  Thank you for the abap program.I would like to request if you can modify this program so that after execute this program,user no longer require to change the password from initial to productive.
    • Outcome : User login with productive password given by Admin.
    • Note : This program will be useful for UAT

×