Skip to Content
0
Former Member
Aug 09, 2006 at 08:46 AM

Dynamicly embed a View

29 Views

Hi,

there are already some topics around here covering this task a little, but my solution doesn't work.

Additionaly I don't want some dynamic component stuff or anything, I just want my View named EmbeddedView to be inserted into another view.

Should be that complex (but it is).

Could someone please gibe me a hint why my solution doesn't work:

1. my wdDoModifyView:

/* I create an ViewContainerUIElement and add a ViewContainer by using a name which is stored in the context (containername) */

if (firstTime) {

IWDViewContainerUIElement viewcontainerui = (IWDViewContainerUIElement) view.createElement(IWDViewContainerUIElement.class, null);

viewcontainerui.setViewContainer(wdContext.currentContextElement().getContainerName());

IWDTransparentContainer root = (IWDTransparentContainer) view.getRootElement();

root.addChild(viewcontainerui);

}

2. my wdDoInit() Method

/* I simply try to create a new viewcontainer containing my in this component existing view. At the end I add the name of the container to my context */

IWDViewInfo viewinfo = wdComponentAPI.getComponentInfo().findInViews("EmbeddedView");

IWDViewContainerInfo viewcontainer = viewinfo.createViewContainer();

wdContext.currentContextElement().setContainername(viewcontainer.getName());

The result is an exception

"com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: View container UI element test in view HideTest2View of component HideTest2 represents view container -271470246_0 which does not contain a view"

Best regards

Thomas