Do you have SAP accounts across multiple Clients within the same environment? This program will save a lot of hassle within a development or test environment. It copies the password for a nominated user account, i.e. from the current client, to all other clients that account resides in. The program was written in v.4.0B.
REPORT ZPASSWORD.
*---------------------------------------
* Written in a 4.0B system - perform a * syntax check in newer R/3
* versions. If the structure of table
* USR02 hasn't changed, this program
* will work in that later version.
*
* This program will set the password of
* the selected account from the
* client it is run in to all other
* clients in the same environment.
*
* N.B. Message 000 within message class
* ZF contains placeholders only
* - in other words, change ZF to a
* similar available message number
* & class within your own system
* IE. MESSAGE 000(ZF) [in table T100]
* looks like: & & & &
*---------------------------------------
TABLES: USR02, "User master
T000. "Client Table
*
DATA: PWORD LIKE USR02-BCODE.
*
PARAMETER USER LIKE USR02-BNAME DEFAULT SY-UNAME. "Account to Synchroniz
*---------------------------------------
START-OF-SELECTION.
* authorisation check - user can only
* synchronise their own account
* unless they have the authority to
* maintain ALL user accounts
IF SY-UNAME NE USER.
AUTHORITY-CHECK
OBJECT 'S_USER_GRP'
ID 'CLASS' FIELD '*'
ID 'ACTVT'
Requires Free Membership to View
When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.
Hannah Smalltree, Editorial Director FIELD '02'.
IF SY-SUBRC NE 0.
MESSAGE E000(ZF) WITH 'You may only change your own account'.
ENDIF.
ENDIF.
SELECT SINGLE BCODE INTO PWORD
FROM USR02 WHERE BNAME = USER.
IF SY-SUBRC EQ 0.
SELECT * FROM T000
WHERE MANDT NE SY-MANDT.
UPDATE USR02 CLIENT SPECIFIED
SET: BCODE = PWORD
BCDA1 = SY-DATUM
BCDA2 = ''
BCDA3 = ''
BCDA4 = ''
BCDA5 = ''
OCOD1 = ''
OCOD2 = ''
OCOD3 = ''
OCOD4 = ''
OCOD5 = ''
WHERE MANDT = T000-MANDT
AND BNAME = USER.
IF SY-SUBRC EQ 0.
WRITE: / T000-MANDT, USER, 'Updated'.
ELSE.
WRITE: / T000-MANDT, USER, 'Update FAILED !!!!!!'.
ENDIF.
ENDSELECT.
ELSE.
WRITE: / USER , 'Does not exist in this client'.
ENDIF.
This was first published in September 2002