Hi ABAPERS!
I’m calling bapi BAPI_USER_CHANGE remotely in order to change expired date & user group.
Although the BAPI returns message: “User XXXXX has changed” no changes are made when I check SU01 transaction in the target system.
If I test the bapi via SE37 transaction, changes are made.
In more detail, my requirement is to set up some actions automatically when a user leaves a company. For this purpose created a FM which include BAPI calls. All of them are working fine except BAPI_CHANGE_USER. Here the list of actions and the bapi I use.
- Lock the user -> BAPI_USER_LOCK
- Remove all roles -> BAPI_USER_ACTGROUPS_DELETE
- Remove profiles -> BAPI_USER_PROFILES_DELETE
- Expire the user / Change the user group to a specific user group --> BAPI_USER_CHANGE
My code:
CLEAR ls_logondata.
ls_logondata-class = 'LEAVERS'.
ls_logondata-gltgb = sy-datum.
ls_logondatax-class = 'X'.
ls_logondatax-gltgb = 'X'.
CALL FUNCTION 'BAPI_USER_CHANGE' DESTINATION lv_dest
EXPORTING
username = lv_username
logondata = ls_logondata
logondatax = ls_logondatax
TABLES
return = lt_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' DESTINATION lv_dest
If I check the system log, it seems that a rollback is executed by the system setting expired date/ user group to original values.
Any idea about this problem? Or do you know another BAPI to use for the same purpose?
Thank you!