cancel
Showing results for 
Search instead for 
Did you mean: 

Custom ABAP code to unlock users who are locked due to incorrect login attempts

Former Member
0 Kudos

Hello,

I need a custom ABAP code to unlock users who are locked due to incorrect login attempts. I plan to schedule it as a background job hourly for Saturday and Sunday nights where no support or basis personnel available.

Thank you,

Chathuranga.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can use FMs BAPI_USER_GETLIST to read users from system, BAPI_USER_GET_DETAIL for check is user locked, BAPI_USER_LOCK/BAPI_USER_UNLOCK for lock/unlock users.

Regards,
Roman

Answers (2)

Answers (2)

Former Member
0 Kudos

This is what I did

Logic for the Report

  1. Read the user list from system with BAPI_USER_GETLIST

  1. Use BAPI_USER_GET_DETAIL to check the user status for locked due to failed login attempts. This will be indicated in Export parameter ISLOCKED with value LUUU

            List the locked users with failed login attempts

  1. Then unlock the selected users from BAPI_USER_UNLOCK
Former Member
0 Kudos

Hi Chathuranga,

Can yo please post the code here. Basically am not from an ABAP back ground.

I could use your code for a similiar requirement.

Thanks in advance

Sudarvizhi P

former_member188883
Active Contributor
0 Kudos

Hi Chathuranga,

Check table USR02 with an input to field User Lock (UFLAG)=128 (purely incorrect password lock), that will help you identify users locked due to incorrect login attempts.

You may write a simple abap report to query this table and identify users with uflag status 128. Next piece of code should be to update this uflag =0 for the identified list of users.

You may schedule this report after testing in background.

Regards,

Deepak Kori