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 insert update standard table AGR_USERS?

suityan98
Explorer
0 Kudos

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.

5 REPLIES 5

Colleen
Advisor
Advisor

are you calling the BAPIS? I think they are: BAPI_USER_ACTGROUPS_ASSIGN and BAPI_USER_ACTGROUPS_DELETE

0 Kudos

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 .

gabmarian
Active Contributor
0 Kudos

suityan98

What message(s) does the BAPI return?

0 Kudos

suityan98 Did you commit the changes? (BAPI_TRANSACTION_COMMIT)

gabmarian
Active Contributor

sandra.rossi AFAIK security related BAPI's contain their own commit.