Add Roles to Users - automated with BAPI in ABAP [english]
ฝัง
- เผยแพร่เมื่อ 24 ส.ค. 2024
- In this video I show you how to add roles to users automatically with a BAPI in ABAP. In a first step I use the BAPI: BAPI_USER_ACTGROUPS_ASSIGN which adds roles to SAP users.
But the BAPI ignores already existing roles and deletes them. So that this does not happen I use in a second step the function module: SUSR_USER_AGR_ACTIVITYGR_GET to read existing roles in advance to transfer them.
The example today is the basic functionality, the program itself can of course be extended by checking users and assigning them one or more roles if the authorization fits.
#BAPI #SAP #Roles
▬▬ My Hardware ▬▬▬▬▬▬▬▬▬▬▬▬▬
Microphone: amzn.to/3zj2UIz
Headphone: amzn.to/3GUBRFg
*The links are affiliate links. There are no additional costs.
▬▬ My Software (free) ▬▬▬▬▬▬▬▬▬▬▬
Video Recorder: bit.ly/678fgh6
Video Editor: bit.ly/38Rj9lb
▬▬ Further Links ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Become my subscriber: bit.ly/CustAnd...
All videos in English: bit.ly/CustAnd...
Thank you, very handy indeed. Also useful when modifying the validity end date of the assigned roles
Thank you for your feedback and thanks for watching my videos! 🤗
Thanks for sharing your knowledge. Can you please explain how to add roles to multiple users using the same BAPI?
You are very welcome! To your question: Fetch your users and call the BAPI in a loop. 🤗
Thanks for your prompt response. Your videos are really helpful in real time.
Thanks a lot! 🤗😀
Thank you, it is handy!
With pleasure! 😀🤗
I’m considering this BAPI for automatic role assignment. However I tried running the BAPI alone first for testing via se37 and I always get return message that says ‘authorization profile does not exist or is inactive’. But when I tried adding the same role to the user directly in su01, it did not have the error. I wonder what kind of role does the BAPI only allow for it to be successful.
I have now tested this on my test system. Unfortunately, I cannot reproduce the error. It always works for me, whether with profile, enabled or disabled. 🤔
@@CustAndCode we should only use the profile names we see in table usr10 and not the role names from agr_users for this bapi, correct?
@@sibstories4710 No, you have to pass the Role Name not the Profile! 🤗
Hi, maybe the very first question is, are working in CUA environment? ...under Solman or stand alone system?
@@CustAndCode apologies for the confusion. Was looking at a different bapi 😅 thank you