cancel
Showing results for 
Search instead for 
Did you mean: 

Copy or Create PCD Role Programmatically

Former Member
0 Kudos

Hello all,

I am trying to figure out if there is a way to either copy an existing PCD role to a new role name or whether it is possible to create a PCD role programmatically and also have it create the corresponding UME role. I have code that creates a UME role, but that does not create the corresponding PCD role which means that I cannot programmatically delta link pages to the role.

Seems as if the PCD API to modify/create roles is deprecated. I am working in 7.3 at the moment.

Any help would be appreciated.

Thanks.

Curtis

Accepted Solutions (0)

Answers (2)

Answers (2)

saar_dagan
Employee
Employee
0 Kudos

Hi Curtis,

this is a code for creating an iview but I belive this is the way to create a role as well:

detlev_beutner
Active Contributor
0 Kudos

Hi Saar,

The fragment you have posted is document on help.sap.com (http://help.sap.com/saphelp_nw70/helpdata/en/5f/cf9d4207e1c86ae10000000a155106/frameset.htm).

Anyhow, there is no similar code for roles. That's the reason why I was looking for it and found it through a tough decompiling session.

Regards

Detlev

Former Member
0 Kudos

Nobody has tried doing this or is doing this? Is there a way to remove pages from a role once it is assigned to a user?

Thanks.

Curtis

detlev_beutner
Active Contributor
0 Kudos

Hi Curtis,

Just stumbled over this, as I was looking for this myself. At least I can show you now how to copy an existing role:

Hashtable envAdm = new Hashtable();

envAdm.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);

envAdm.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_ADMINISTRATION);

envAdm.put(Context.SECURITY_PRINCIPAL, user);

IAdminBase roleToCopy = (IAdminBase) admCtx.lookup(fullPath);

PcmInteractiveDirOperations op = (PcmInteractiveDirOperations) roleToCopy.getImplementation(IAdminBase.INTERACTIVE_DIR_OPERATION);

op.copy(fullTargetPathWithID, null);

Hope it helps

Detlev