Skip to Content
Nov 15, 2019 at 08:04 AM

Distributing Roles via BAPI in CUA not working as expected (BAPI_USER_LOCACTGROUPS_ASSIGN)

180 Views Last edit Nov 15, 2019 at 08:23 AM 2 rev


I'm assigning Roles via "BAPI_USER_LOCACTGROUPS_ASSIGN" in a CUA environment (from a 3rd party tool).

I can assign it in Prod where CUA installed by using "BAPI_USER_ACTGROUPS_ASSIGN", but to distribute it to the other systems linked in CUA I assume "BAPI_USER_LOCACTGROUPS_ASSIGN" is the way to go.

But it does not distribute to any of the other systems. Can anyone assist me with info on what I am doing wrong?

SCUM settings are all set to GLOBAL

Error coming back from code below is:

Role does not exist
System not part of CUA

(which is strange as the Role does exist in all systems and there are multiple systems linked via CUA)

Sample (pseudo) Code:

RFCFunction func = sap.CreateFunction("BAPI_USER_LOCACTGROUPS_ASSIGN");
func.Exports["USERNAME"].ParamValue = "MYTESTUSR";
func.Exports["NO_DB_UPDATE"].ParamValue = "";
func.Exports["INCL_HR_ASSIGN"].ParamValue = "X";
func.Exports["DISTRIBUTE_CHANGE_ONLY"].ParamValue = "X";

RFCStructure rfcStruct = func.Tables["ACTIVITYGROUPS"];
rfcStruct["AGR_NAME"] = "Z_TEST_ROLE";                         
rfcStruct["FROM_DAT"] = "15.11.2049";                         
rfcStruct["TO_DAT"] = "31.12.2019";