Make your own free website on Tripod.com
SAP ABAP Programming, Functional and Basis Components 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 Hints and Tips on Configuration and ABAP/4 Programming
*                 http://sapr3.tripod.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 Hints and Tips on Configuration and ABAP/4 Programming