cancel
Showing results for 
Search instead for 
Did you mean: 

Reading iView Personalization Data from WebDynpro

0 Kudos

Hi,

I'm trying to access (read) iView-personalization data in pcd from web dynpro java.

First i tried http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/4d46fb8a-0b01-0010-9fbe-e4b96533b222


/* WD Personalisation */
IViewPersonalization pers = IViewPersonalizationFactory.getIViewPersonalization("MusicBoxApp");
IViewPropertyWrapper layout = pers.getIViewProperty("MainViewPersonalizationData.Layout");

Here the "pers" is filled correctly and all the properties and correct values can be found the "reader"-substructure in the object-inspector of the debugger. BUT using the getIViewProperty-Method returns null into "layout" (it seems to be reading in the "iViewPropertiesMap"-Substructure instead).

I tried using the other approach described in the book "maximizing webdynpro for java" or http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b07501ec-39a7-2910-0699-f71070d2b245 or http://help.sap.com/saphelp_nw04/helpdata/en/44/7040622043053ce10000000a1553f6/frameset.htm :


Hashtable env = new Hashtable();
InitialContext iCtx = null;
try
{    
env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(Context.SECURITY_PRINCIPAL, WDClientUser.getCurrentUser().getSAPUser());
env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
env.put(IPcdContext.PCD_PERSONALIZATION_PRINCIPAL, WDClientUser.getCurrentUser().getSAPUser());

iCtx = new InitialContext(env);
IAttributeSet attrSet = (IAttributeSet) iCtx.lookup(iViewPath);

String layout = attrSet.getAttribute ("MainViewPersonalizationData.Layout");
}

Here I do get a value in "layout", but it is not the personalized one, but the default one.

Does anybody have an idea what is going wrong or how to make it work?

PS: we are using EP 7.00 SP18

Regards,

Manuel

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hi,

no I did not have any success yet

Any idea, why it does not work :

- the first approach returns null through the available methods of the IViewPersonalization-Object, but the correct value could be found easily using the debug-object-inspector

- the second approach returns a value - but the default one instead of the personalized one. I was not able to find the correct vale using the debug-object-inspector

Best regards,

Manuel

Former Member
0 Kudos

any luck with this?

Former Member
0 Kudos

hi manuel

Are you sure that getSAPUser gets you the correct implementation? Lets hope theres nothing broken in the portal, did you check for existing SAP notes?