ABAP Certification, Smartform, Sapscripts, BAPI, JAVA, Visual Basic Programming Books
*
* Copy the current Client password to the rest of the Client
*
* Run this program in the Client where you want all the rest
* of the Client password to be copied.
* The user you specify will have the same Client password as the
* Client where you login and run this program.
* For e.g. if you run this program in Client XXX, the rest of the
* Client like 123, 456 will have the same password as Client XXX.
*
*  Author by  : SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips
*               http://www.sap-basis-abap.com
*
REPORT ZCOPYPASS .

TABLES: USR02, T000.

DATA: PASSWD LIKE USR02-BCODE.

PARAMETERS: USER     LIKE USR02-BNAME.

SELECT SINGLE * FROM USR02 WHERE BNAME = USER.

IF SY-UNAME <> 'SAP*'.
  WRITE: / 'Only SAP* is allowed to run this program'.
  EXIT.
ENDIF.

IF SY-SUBRC <> 0.
  WRITE: / USER, 'user does not exist!'.
  EXIT.
ENDIF.

PASSWD = USR02-BCODE.
CLEAR USR02.

WRITE: / 'The password of', USER, 'updated in client:'.

SELECT * FROM T000 WHERE MANDT <> '066' AND MANDT <> SY-MANDT.
  SELECT * FROM USR02 CLIENT SPECIFIED
           WHERE MANDT = T000-MANDT AND
                 BNAME = USER.

    WRITE: / USR02-MANDT.
    USR02-BCODE = PASSWD.
    USR02-LTIME = SY-UZEIT.
    USR02-BCDA1 = USR02-BCDA2 = USR02-BCDA3 = SY-DATUM.
    USR02-BCDA4 = USR02-BCDA5 = SY-DATUM.

    UPDATE USR02 CLIENT SPECIFIED.
  ENDSELECT.
ENDSELECT.

*--- End of Program

Return to :-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.sap-basis-abap.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.sap-basis-abap.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.