Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to lock status of user

Former Member
0 Kudos
1,465

Hello techies,

                        i need to check the lock status of the user .

i know table usr02-bname.

But that is not geting the right status.

Can you help me to get status using any bapi or fm.

Thanks..

1 ACCEPTED SOLUTION

anupam_anand
Participant
0 Kudos
435

Hi Praveen,

Use the BAPI BAPI_USER_GET_DETAIL to get the user details and you can use BAPI_USER_LOCK and BAPI_USER_UNLOCK to lock and unlock users respectively.

Obviously, you need to have authorizations to do so.

Do let me know if it helped.

Thanks,

Anupam

10 REPLIES 10

Former Member
0 Kudos
435

Hi,

Check this  SUSR_USER_LOCKSTATE_GET

0 Kudos
435

hi kiran .

it will also get the lock details but only system admin lock and global.

no option if too many password attempts.

anyways it also helped me.

thanks.

Former Member
0 Kudos
435

Hi

Can you check with below SQL Query ...

SELECT SINGLE *

              FROM USR02 CLIENT SPECIFIED

INTO WA_USR02

WHERE BNAME = P_BNAME

AND MANDT = P_MANDT.

Regard's

Smruti

0 Kudos
435

i already used usr02 .

0 Kudos
435

Have you tried the mentioned FM, what exactly you are looking for!

0 Kudos
435

then check with reply with below code ...


IF LOCKSTATE-LOCAL_LOCK = 'U' AND LOCKSTATE-GLOB_LOCK = 'U'.

Write :/1 'User not locked'.

   

ELSEIF LOCKSTATE-LOCAL_LOCK = 'L' AND LOCKSTATE-GLOB_LOCK = 'U'.

    

Write :/1 'User locked locally and unlocked globally'. 

   

ELSEIF LOCKSTATE-LOCAL_LOCK = 'U' AND LOCKSTATE-GLOB_LOCK = 'L'.

Write :/1'User unlocked locally and locked globally'. 

   

ELSEIF LOCKSTATE-LOCAL_LOCK = 'L' AND LOCKSTATE-GLOB_LOCK = 'L'.

     

Write :/1'User locked locally and locked globally'. 

   

ELSE.

Write :/1'No user lock status available'. 

ENDIF.

Regard's

Smruti

0 Kudos
435

Hi

I hope you got your required solution , but can try with below code once .. .

DATA : S_BNAME TYPE XUBNAME ,

       S_UFLAG TYPE XUUFLAG ,

       S_MODDA TYPE XUMODDATE ,

       S_MODTI TYPE XUMODTIME .

SELECT SINGLE  A~BNAME A~UFLAG A~MODDA A~MODTI  INTO (S_BNAME,S_UFLAG,S_MODDA,S_MODTI)

     FROM USH02 AS A WHERE A~BNAME = 'SMRUTI'

                                     AND A~MODDA = ( SELECT MAX( B~MODDA )  FROM USH02 AS B

                                                                                                            WHERE B~BNAME = 'SMRUTI')

                                      AND A~MODTI = ( SELECT MAX( C~MODTI )  FROM USH02 AS C

                                                                                                          WHERE C~BNAME = 'SMRUTI' AND C~MODDA  = A~MODDA ).

WRITE: /1  'User Name :'    ,S_BNAME,

                  'User Status : ' ,S_UFLAG .

Regard's

Smruti

anupam_anand
Participant
0 Kudos
436

Hi Praveen,

Use the BAPI BAPI_USER_GET_DETAIL to get the user details and you can use BAPI_USER_LOCK and BAPI_USER_UNLOCK to lock and unlock users respectively.

Obviously, you need to have authorizations to do so.

Do let me know if it helped.

Thanks,

Anupam

0 Kudos
435

cheers anupam..

i got with your bapi..

exporting parameter isylock did the thing.

thanks..

0 Kudos
435

No problems buddy..Glad it helped.

Thanks,

Anupam