Add Roles to Users - automated with BAPI in ABAP [english]

Поділитися
Вставка
  • Опубліковано 6 лют 2025
  • 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...

КОМЕНТАРІ • 15

  • @christophemuyshondt7769
    @christophemuyshondt7769 10 місяців тому

    Thank you, very handy indeed. Also useful when modifying the validity end date of the assigned roles

    • @CustAndCode
      @CustAndCode  9 місяців тому

      Thank you for your feedback and thanks for watching my videos! 🤗

  • @karelhavliczech6455
    @karelhavliczech6455 2 роки тому +1

    Thank you, it is handy!

  • @sk16034
    @sk16034 Рік тому

    Thanks for sharing your knowledge. Can you please explain how to add roles to multiple users using the same BAPI?

    • @CustAndCode
      @CustAndCode  Рік тому

      You are very welcome! To your question: Fetch your users and call the BAPI in a loop. 🤗

    • @sk16034
      @sk16034 Рік тому

      Thanks for your prompt response. Your videos are really helpful in real time.

    • @CustAndCode
      @CustAndCode  8 місяців тому

      Thanks a lot! 🤗😀

  • @sibstories4710
    @sibstories4710 2 роки тому +1

    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.

    • @CustAndCode
      @CustAndCode  2 роки тому

      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. 🤔

    • @sibstories4710
      @sibstories4710 2 роки тому

      @@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?

    • @CustAndCode
      @CustAndCode  2 роки тому

      @@sibstories4710 No, you have to pass the Role Name not the Profile! 🤗

    • @karelhavliczech6455
      @karelhavliczech6455 2 роки тому

      Hi, maybe the very first question is, are working in CUA environment? ...under Solman or stand alone system?

    • @sibstories4710
      @sibstories4710 2 роки тому

      @@CustAndCode apologies for the confusion. Was looking at a different bapi 😅 thank you