Hello everyone.
I'm trying to build a program to release roles to users.
I'm building with Visual Studio 2012 and .Net Connector 3.
After I made the connection, I do the following:
RfcDestination dest = RfcDestinationManager.GetDestination("Conexao");
RfcRepository repo = dest.Repository;
IRfcFunction fAddRole = repo.CreateFunction("BAPI_USER_ACTGROUPS_ASSIGN");
string getUser = 232377; //this is the user
fAddRole.SetValue("USERNAME", getUser);
IRfcTable tOptions = fAddRole.GetTable("ACTIVITYGROUPS");
tOptions.Append();
tOptions.SetValue("AGR_NAME", "Z_DEBUG_REPLACE"); //"Z_DEBUG_REPLACE" is the role I want to add
fAddRole.Invoke(dest);
Here I can add the role to the user, BUT, it removes all of the roles that he had.
I've searched a lot on the internet, and everyone says that I have to use BAPI_GET_USER_DETAIL to obtain user roles and than add it again.
I don't know how to make this though. It's necessary to get the FROM_DAT and the TO_DAT of every role.
Appreciate any help.