Skip to Content
Technical Articles
Author's profile photo Marco Büscher

Password reset cross-client

Hello,

 

I had a request that a client requested a client copy. Unfortunately the passwords of the users SAP* and DDIC in client 000 could not be found anymore. So that the system copy could still be performed I decided to perform the following workaround. The program for this was a find from the net, the source is mentioned.

 

REPORT ZPWDDEL.
**************************************************
* *
* Dieses Programm setzt die Paßworthistorie *
* zurück, so daß ein User sein altes Paßwort *
* weiter benutzen kann. *
* *
* 21.09.05 *
* Ergänzung für ein verlorenes Passwort *
* Mandant = Mandant, wo das Passwort verändert *
* werden soll. *
* Modify = Hier ein X setzen, wenn verändert *
* werden soll. *
* Hexpass = Verschlüsseltes Passwort des gleichen*
* Users aus einem anderen System *
*————————————————*
* gefunden im Netz *
* Original von:IMRE KABAI *
**************************************************
TABLES: USR02.
PARAMETERS: USER LIKE USR02-BNAME,
Mandant LIKE USR02-MANDT,
Modify(1) type c,
HexPass LIKE USR02-BCODE.SELECT * FROM USR02 client specified WHERE BNAME = USER
and Mandt = Mandant.
ENDSELECT.IF SY-SUBRC = 0.
if Modify = ‘X’.
usr02-bcode = Hexpass.
usr02-uflag = ‘0’.
update usr02 client specified.
write: / ‘Passwort geändert.’.
else.
USR02-OCOD1 = USR02-OCOD2 = USR02-OCOD3 =
USR02-OCOD4 = USR02-OCOD5 = USR02-BCODE.
usr02-bcda1 = usr02-bcda2 = usr02-bcda3 =
usr02-bcda4 = usr02-bcda5 = usr02-erdat.
MODIFY USR02.
write: / ‘Paßworthistorie erfolgreich zurückgesetzt!’.
endif.
ELSE.
WRITE: / ‘Benutzer nicht vorhanden!’.
ENDIF.
At first you need this Program. Program code.
Client 100: SE16N – Table USR02 – Read HEX value. Open the table USR02, where you will find the initial password of the user encrypted as HEX value. Client 100 – Change DDIC password
Client 100 control HEX value was new and overwritten Client 100 – open Programm ZPWDDEL,  Enter User, Mandant, Set Flag X as explained in the Program code. HEX value – Save
Information, that the PW is set Client 000 Login (Possibly set new password, since 90 days have passed)
Logon works fine in Test System. Transport in Prod… Transport is running..
Transport is done. Program imported into productive system
SE16N Initial password read from DDIC. Password is hexadecimal encrypted. Login to client 100 with DDIC and new password
Assign new password (90 days policy) Set the password in the ZPWDEL program and execute the program. Save.
PW changed. Logon to client 000 with user DDIC and new password.
Successful registration. Successful registration.
REPORT ZPWDDEL.
**************************************************
* *
* Dieses Programm setzt die Paßworthistorie *
* zurück, so daß ein User sein altes Paßwort *
* weiter benutzen kann. *
* *
* 21.09.05 *
* Ergänzung für ein verlorenes Passwort *
* Mandant = Mandant, wo das Passwort verändert *
* werden soll. *
* Modify = Hier ein X setzen, wenn verändert *
* werden soll. *
* Hexpass = Verschlüsseltes Passwort des gleichen*
* Users aus einem anderen System *
*------------------------------------------------*
* gefunden im Netz *
* Original von:IMRE KABAI *
**************************************************
TABLES: USR02.
PARAMETERS: USER LIKE USR02-BNAME,
Mandant LIKE USR02-MANDT,
Modify(1) type c,
HexPass LIKE USR02-BCODE.SELECT * FROM USR02 client specified WHERE BNAME = USER
and Mandt = Mandant.
ENDSELECT.IF SY-SUBRC = 0.
if Modify = 'X'.
usr02-bcode = Hexpass.
usr02-uflag = '0'.
update usr02 client specified.
write: / 'Passwort geändert.'.
else.
USR02-OCOD1 = USR02-OCOD2 = USR02-OCOD3 =
USR02-OCOD4 = USR02-OCOD5 = USR02-BCODE.
usr02-bcda1 = usr02-bcda2 = usr02-bcda3 =
usr02-bcda4 = usr02-bcda5 = usr02-erdat.
MODIFY USR02.
write: / 'Paßworthistorie erfolgreich zurückgesetzt!'.
endif.
ELSE.
WRITE: / 'Benutzer nicht vorhanden!'.
ENDIF.

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Matt Billingham
      Matt Billingham

      You know in the blog editor there's this handy button {;} that makes code readable?

      TABLES: USR02.
      PARAMETERS: USER LIKE USR02-BNAME,
      Mandant LIKE USR02-MANDT,
      Modify(1) type c,
      HexPass LIKE USR02-BCODE.
      
      SELECT * FROM USR02 client specified WHERE BNAME = USER
                                              and Mandt = Mandant.
      ENDSELECT.
      IF SY-SUBRC = 0.
        if Modify = ‘X’.
          usr02-bcode = Hexpass.
          usr02-uflag = ‘0’.
          update usr02 client specified.
          write: / ‘Passwort geändert.’.
         else.
          USR02-OCOD1 = USR02-OCOD2 = USR02-OCOD3 = USR02-OCOD4 = USR02-OCOD5 = USR02-BCODE.
          usr02-bcda1 = usr02-bcda2 = usr02-bcda3 = usr02-bcda4 = usr02-bcda5 = usr02-erdat.
          MODIFY USR02.
          write: / ‘Paßworthistorie erfolgreich zurückgesetzt!’.
        endif.
      ELSE.
        WRITE: / ‘Benutzer nicht vorhanden!’.
      ENDIF.

       

       

      Author's profile photo Marco Büscher
      Marco Büscher
      Blog Post Author

      Thanks Matt for the info, I will use it more often in the future.

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      If I may suggest, I also find the 2-column formatting very confusing. At first I thought it's supposed to be side-by-side comparison but it doesn't seem to be the case. Please be aware that this formatting choice probably makes the post pretty much unreadable on mobile devices. I'd just update it to be a continuous text for simplicity.

      You should also probably add a big, bold disclaimer that in general, updating standard SAP tables directly is a big no-no. I'm guessing there was a specific reason to do that in your case.

      Thank you!