Program To Mass Reset Users Password

I want to reset the users password.  I can do that one by one and I know we have su10 for the mass change user, but I couldnt find to change or reset for mass users.  Is there any t-code or any thing could we do for that issue I can change mass users to reset the pass.

*&---------------------------------------------------------------------*
*& 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.
  .

Get help for your ABAP problems
Do you have a ABAP Question?

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

More ABAP Tips

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.