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: 

Deactivating password for user on a CUA system

Former Member
0 Kudos

Hi,

I have made a user-exit that creates the user on our CUA system using BAPI BAPI_USER_CREATE1. The problem is that I can’t find the functionality to deactivate the password for the user. Does anyone know a BAPI (or another RFC) or maybe another nice way to fix this?

I know I can do it using batch input and wrap it in a RFC, but that is not very pretty.

/Gitte

2 REPLIES 2

Former Member
0 Kudos

Found the answer my self.

In logon structure CODVN and CODVC should be set to X.

0 Kudos

The SAP does the deactivation of the password in a different way. I have tried to debug the SAP program and found out that there is a FM to actually deactivate the password in CUA system.

Find the below the code for the same.

CONSTANTS : l_c_method TYPE bapimethod VALUE 'PWDINIT'.

DATA : l_v_bcode TYPE usr02-bcode,

l_v_usrname TYPE bapibname-bapibname.

DATA : l_wa_logondata TYPE bapilogond.

CLEAR l_wa_logondata.

l_wa_logondata-bcode = l_v_bcode.

l_wa_logondata-codvn = 'X'.

CLEAR l_v_usrname.

l_v_usrname = l_v_user_username.

CALL FUNCTION 'SUSR_ZBV_USER_SEND'

EXPORTING

username = l_v_usrname

method = l_c_method

subsystem = l_v_uszbvsys-subsystem

logondata = l_wa_logondata

EXCEPTIONS

wrong_system = 1

OTHERS = 2.

IF sy-subrc NE 0.

CONCATENATE 'Password for the User'

l_v_user_username

'could not be deactivated'

INTO l_v_log_string

SEPARATED BY space.

ELSE.

CONCATENATE 'Password for the User'

l_v_user_username

'has been Deactivated'

INTO l_v_log_string

SEPARATED BY space.

ENDIF.