You are on page 1of 2

Source : http://wiki.sdn.sap.

com/wiki/display/Snippets/ABAPHow+to+unlock+the+user%27s+SAP+logon+id

*&---------------------------------------------------------------------*
*& Report ZAGUS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZAGUS.
tables: usr02.
DATA: msg TYPE string.
selection-screen begin of block blck1.
parameters: p_userid like usr02-bname obligatory.
selection-screen end of block blck1.
at selection-screen.
if sy-ucomm = 'ONLI'.
authority-check object 'S_USER_GRP'
id 'ACTVT' field '05'.
if sy-subrc ne 0.
message 'No authorisation to unlock users' TYPE 'E'.
endif.select single bname
into usr02-bname
from usr02 where bname = p_userid.
if sy-subrc ne 0.
message 'Invalid userid entered' TYPE 'E'.
endif.
update usr02 set uflag = 0
where bname = p_userid.
if sy-subrc = 0.
CONCATENATE p_userid ' has been unlocked' INTO msg.
message msg TYPE 'i'.

else.
message 'Unable to unlock user' TYPE 'E'.
endif.
endif.

You might also like