"-Begin-----------------------------------------------------------------
"-
"- Program to set password of standard users SAP* and DDIC from client
"- 000 to minisap or initial, alternative copy it from client 001.
"-
"- Hint: Use program RSUSR003 to check the existing standard users.
"-
"- Hint: Try successfully with SAP NetWeaver AS ABAP 7.31
"-
"-----------------------------------------------------------------------
Program zSetPwd.
"-minisap-------------------------------------------------------------
Constants c_passcode(20) Type x Value
'402BB8222D165B6574648E5369E502EEA3434386'.
Constants c_pwdstate Type i Value 0.
Constants c_pwdhash(255) Type c Value
'{x-issha, 1024}ihgnqKY51fbSTX+IDJ7Hfo6p0QghC06kiH3c8rTmDts='.
"-initial-------------------------------------------------------------
" Constants c_passcode(20) Type x Value
" 'C9C3594FF543373E26468F0AA99CF90DC4FA68D6'.
" Constants c_pwdstate Type i Value 1.
" Constants c_pwdhash(255) Type c Value
" '{x-issha, 1024}s3ekCy8cvdGVeAeXbw8tnSdkQES4QMVEockNeuwk/rk='.
Data:
lv_USR02_000 Type USR02,
lv_USR02_001 Type USR02.
"-Set user SAP* in client 000 the password to minisap-----------------
Select Single * From USR02 Client Specified
Into lv_USR02_000 Where BNAME = 'SAP*' And MANDT = '000'.
If sy-subrc = 0.
lv_USR02_000-PASSCODE = c_passcode.
lv_USR02_000-PWDSTATE = c_pwdstate.
lv_USR02_000-PWDSALTEDHASH = c_pwdhash.
Update USR02 Client Specified From lv_USR02_000.
"Select Single * From USR02 Client Specified
" Into lv_USR02_001 Where BNAME = 'SAP*' And MANDT = '001'.
"If sy-subrc = 0.
" lv_USR02_000-PASSCODE = lv_USR02_001-PASSCODE.
" lv_USR02_000-PWDSTATE = lv_USR02_001-PWDSTATE.
" lv_USR02_000-PWDSALTEDHASH = lv_USR_001-PWDSALTEDHASH.
" Update USR02 Client Specified From lv_USR02_000.
"EndIf.
EndIf.
"-Set user DDIC in client 000 the password to minisap-----------------
Select Single * From USR02 Client Specified
Into lv_USR02_000 Where BNAME = 'DDIC' And MANDT = '000'.
If sy-subrc = 0.
lv_USR02_000-PASSCODE = c_passcode.
lv_USR02_000-PWDSTATE = c_pwdstate.
lv_USR02_000-PWDSALTEDHASH = c_pwdhash.
Update USR02 Client Specified From lv_USR02_000.
"Select Single * From USR02 Client Specified
" Into lv_USR02_001 Where BNAME = 'DDIC' And MANDT = '001'.
"If sy-subrc = 0.
" lv_USR02_000-PASSCODE = lv_USR02_001-PASSCODE.
" lv_USR02_000-PWDSTATE = lv_USR02_001-PWDSTATE.
" lv_USR02_000-PWDSALTEDHASH = lv_USR_001-PWDSALTEDHASH.
" Update USR02 Client Specified From lv_USR02_000.
"EndIf.
EndIf.
"-End-------------------------------------------------------------------