Application Development and Automation 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: 
Read only

Function Module to remove user a Role

Former Member
0 Likes
6,168

Hi

I'm looking for a functional module that will remove a user from a Role.

I've seen that I can add a user by using PRGN_RFC_ADD_USERS, but not sure how to remove a user.

Thanks

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,873

Read current user assignment with BAPI_USER_GET_DETAIL remove those no longer required  from table ACTIVITYGROUPS and then update with BAPI_USER_ACTGROUPS_ASSIGN followed by BAPI_TRANSACTION_COMMIT.

Regards,

Raymond

11 REPLIES 11
Read only

egenoves
Participant
0 Likes
3,873

Hello Andre,

try with BAPI_USER_ACTGROUPS_DELETE,

Regards

Read only

Former Member
0 Likes
3,873

Thanks.  It seems like BAPI_USER_ACTGROUPS_DELETE can work, but will delete ALL activity group assignments.  I'm only looking to remove a specified Role.  I.e. role should be passed in a parameter.

But thanks for the answer.  Not wrong - just not suited for me.

Read only

0 Likes
3,873

It seems you're right. In fact , the FM  BAPI_USER_ACTGROUPS_ASSIGN, assigns roles deleting all of them before !... So you just need to retrive the roles before and then adjust for whatever you want.

I don't know why these functions have these behavior ...

Regards...

Read only

former_member210541
Active Participant
0 Likes
3,873

try this

PRGN_RFC_CHANGE_USERS_IN_AGRS

Read only

0 Likes
3,873

Thanks - this really seems like the correct function, but I call this function and pass in table "DELETE_USERS_FROM_ACTGROUPS", with values AGR_NAME and UNAME.

When executing the function it does not remove that role from the user.

Am I missing something?

Should i run anything afterwards to commit the change?

Read only

AbhishekSharma
Active Contributor
0 Likes
3,873

Hi Andre,

Please try to search with BAPI_BUPA_ROLE* probably BAPI_BUPA_ROLE_REMOVE function module will work for you.

AGR_USERS is table name which stores all roles assigned to User.

Thanks-

Abhishek

Let's learn together as much as possible...
CodeInMins
Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,874

Read current user assignment with BAPI_USER_GET_DETAIL remove those no longer required  from table ACTIVITYGROUPS and then update with BAPI_USER_ACTGROUPS_ASSIGN followed by BAPI_TRANSACTION_COMMIT.

Regards,

Raymond

Read only

0 Likes
3,873

Thanks - will give it a try.  Do I still have to run PFUD User Comparison after this, or is this then not necessary?

Andre

Read only

0 Likes
3,873

In my old programs I used to call also BAPI_USER_PROFILES_ASSIGN  after BAPI_USER_ACTGROUPS_ASSIGN so no PFUD required, but you should call it, also check if it's not already scheduled by administrators as a daily background job.

Regards,

Raymond

Read only

0 Likes
3,873

Hi,

in addition to Raymond's solution, if you have an active Central User Management, then you will need the rfc fm's BAPI_USER_LOCACTGROUPS_READ and BAPI_USER_LOCACTGROUPS_ASSIGN here.

Regards,

Klaus

Read only

0 Likes
3,873

Thanks. BAPI_USER_ACTGROUPS_ASSIGN does the job with a workaround. However neither BAPI_USER_PROFILES_ASSIGN nor  BAPI_TRANSACTION_COMMIT does not run the User Comparison (with my current checks).  Will still play around, but at least I can now remove the Role.  Thanks.