cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic user deletion

former_member201054
Contributor
0 Kudos

Hi,

If a user is not using the system for 30 days continiously then his Id/username should be deleted automatically ..How to do this

I would appreciate all your help.

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

You will indeed have to create a cusom ABAP program for this. The code to get all users in the current client who have not logged on in the last 30 days would look as follows:

DATA: gt_usr02 TYPE STANDARD TABLE OF usr02,
      gw_usr02 LIKE LINE OF gt_usr02.

DATA: refdate  TYPE dats.

refdate = sy-datum - 30.
SELECT * FROM usr02 INTO TABLE gt_usr02 WHERE trdat < refdate.
LOOP AT gt_usr02 INTO gw_usr02.
  WRITE: / gw_usr02-bname, 'Last logged on:', gw_usr02-trdat DD/MM/YYYY.
ENDLOOP.

Instead of a simple WRITE you can then call a BAPI function to change the user, e.g. BAPI_USER_LOCK or BAPI_USER_DELETE.

30 days looks a bit sharp to actuallly delete users. In a first stage I would simply lock them. Then after a much longer period, e.g. 3 to 6 months, you can delete them.

Hope this helps,

Mark

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Daniel,

Work with ABAPer, and create a program which run for every 30days.

That should delete the user, which user master data is not getting updated since last 30 days.

Test the same several times as this is critical if you applied directly in PRO.

Regards

Nick Loy