Deactivate password from users
ABAP, Data, System September 29th, 2008
When you have to deactivate the pasword of a large list of userts, you could use this script. For a smaller set of users you can also use Trx SU10.
First of all you need a list of all users…
Then you can copy paste all values of BNAME into this report.
-
REPORT Z_USERS_DEACTIVATE.
-
-
TABLES: USR02.
-
DATA: lv_username TYPE BAPIBNAME-BAPIBNAME,
-
wa_logondata TYPE BAPILOGOND,
-
wa_logondatax TYPE BAPILOGONX,
-
lt_return TYPE BAPIRET2_T,
-
lt_usr02 TYPE TABLE OF USR02,
-
wa_usr02 TYPE USR02.
-
-
SELECT-OPTIONS: p_usids FOR USR02-BNAME.
-
-
-
SELECT * FROM USR02 INTO TABLE lt_usr02 WHERE BNAME IN p_usids.
-
-
LOOP AT lt_usr02 INTO wa_usr02.
-
-
lv_username = wa_usr02-BNAME.
-
wa_logondata-codvn = 'X'.
-
wa_logondatax-codvn = 'X'.
-
CALL FUNCTION 'BAPI_USER_CHANGE'
-
EXPORTING
-
username = lv_username
-
logondata = wa_logondata
-
logondatax = wa_logondatax
-
TABLES
-
return = lt_return.
-
-
DELETE lt_return WHERE TYPE <> 'E'.
-
IF lt_return IS INITIAL.
-
WRITE: / 'Deactivated password:' , lv_username .
-
ELSE.
-
WRITE: / 'ERROR:' , lv_username .
-
ENDIF.
-
ENDLOOP.

About
Leave a Comment