07-28-2022 4:18 AM
Hi, currently my company create a program to upload roles in txt file to insert and delete roles of a user, however, I am facing a problem which is the program unable to add new roles for the new user in sap ABAP. This is because the new user without any role will not available in the standard table agr_users, any recommended ways to insert roles to the new users using any function module or bapi? Thank you.
07-28-2022 4:35 AM
are you calling the BAPIS? I think they are: BAPI_USER_ACTGROUPS_ASSIGN and BAPI_USER_ACTGROUPS_DELETE
07-28-2022 6:10 AM
yes nothing change
LOOP AT GT_FILE_USER.
"CHECK CURRENT ROLE TO AVOID DELETE LAST ROLE INSERTED
CALL FUNCTION 'SUSR_USER_AGR_ACTIVITYGR_GET'
EXPORTING
USER_NAME = GT_FILE_USER-USRID
* WITH_TEXT = ' '
TABLES
USER_ACTIVITYGROUPS = LT_CURRENT_ROLES
EXCEPTIONS
USER_NAME_NOT_EXIST = 1
OTHERS = 2.
APPEND LINES OF lt_CURRENT_ROLES TO LT_ROLES.
CALL FUNCTION 'BAPI_USER_ACTGROUPS_ASSIGN'
EXPORTING
USERNAME = GT_FILE_USER-USRID
TABLES
ACTIVITYGROUPS = LT_ROLES
RETURN = LT_RET .
07-28-2022 6:47 AM
07-28-2022 8:31 AM
07-28-2022 9:41 AM
sandra.rossi AFAIK security related BAPI's contain their own commit.