cancel
Showing results for 
Search instead for 
Did you mean: 

Error while re-using view

Former Member
0 Kudos

Hi,

I've several views which i want to re-use but when i add a view which I have already used, i get the error:

Processing HTTP request to servlet [dispatcher] finished with error.


The error is: com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: duplicate usage of view .BasketView

	at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:515)

	at com.sap.tc.webdynpro.progmodel.view.ViewManager.bind(ViewManager.java:397)

	at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:554)

	at com.sap.tc.webdynpro.progmodel.view.ViewManager.bind(ViewManager.java:397)

	at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:554)

	at com.sap.tc.webdynpro.progmodel.view.ViewManager.bind(ViewManager.java:397)

	at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:554)

	at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:421)

	at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:130)

	at com.sap.tc.webdynpro.progmodel.view.InterfaceView.initController(InterfaceView.java:41)

	at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)

	at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.displayToplevelComponent(ClientComponent.java:135)

	at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:404)

	at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:618)

	at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)

	at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:251)

	at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)

	at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)

	at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)

	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

	at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)

	at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)

	at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)

	at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)

	at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)

	at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)

	at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

	at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)

	at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)

	at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)

	at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

	at java.security.AccessController.doPrivileged(Native Method)

	at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)

	at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)

Why cant I re-use my view?

much thanks,

Hugo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thats a slighty different case because he wants the same view but with different data. In my case, the basketview is allways the same everywhere....

In another project im re-using a view the same way im trying now, 2 seperate views using a view which is overlapping for both of them. The basketview should be exactly the same but now i get this error!

H

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Hugo,

a Web Dynpro view is a singleton within the component instance it belongs to. This means a view can only be displayed on the UI (inside the current view assembly) one time.

To reuse a view inside a view compostion you must apply the folowing technique:

- embed this view in a reusable component

- define two usages of this "service" component inside the component client (parent component)

- embed two component interface views (one per component usage) into the view composition of the parent component

Both component interface views can be simultaneously displayed on the UI.

Regards, Bertram

Former Member
0 Kudos

Hi,

ok, that makes sense.

-Embedding it in a reusable component seems a bit of an overkill.

-defining 2 usages of the view to be used sounds like a good option...the only question is how do i do that? Can u point me a bit in the right correction?

much thanks,

regards,

Hugo

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Hugo,

you cannot display the same view (two instances of it) more than once without embedding it in a Web Dynpro component and defining two usages for it. The Web Dynpro programming model does not define "Web Dynpro Views" as reusable entities. The only unit of re-use is a Web Dynpro component, not its contained entities like custom controllers or views etc.

Perhaps I have not got the picture of your application scenario yet, but as soon as you want to display the same view on the view assembly twice you must wrap it in a re-usable component.

Read my tutorial on <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/1ee0e990-0201-0010-75bf-a087c241cb83">modeling Web Dynpro View Compositions</a>

It implements exactly your scenario: an image display component is used twice. The first component displays image A and the second component displays image B.

Best Regards, Bertram

Former Member
0 Kudos

Hi Hugo/Bertram,

The link is dead...Cannot find the tutorial you have spoken of...

Can you please send the document to my mail please to johnpeterc@gmail.com

Thanks a lot.

JP

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi

this sounds interesting 4 me.

i tried my self to use one view twice...(for create und Changeing data)..here seems to be the solution but al Links are dead

plz reup

kr

tk

Former Member
0 Kudos

Hi Bertram,

Occasionally I have found Modeling in Web Dynpro View Compositions pdf document and found it very interesting. Unfortunatelly I cannot find 2 sample projects mentioned there.

Could you help please?

Nikolay

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Nikolay,

my "Modeling Web Dynpro View Composition" tutorial was removed from the Web Dynpro Java sample applications page on SDN because I applied ViewSets and ViewAreas inside windows instead of ViewContainer UI elements inside specific Web Dynpro layout views. Except this sub-optimal (as less flexible; you have more layout and sizing possibilities with ViewContainer UI Elements in virtual layout cells of container UI elements with Matrix or Grid layout in comparison to ViewAreas in ViewSets of a window) technique the tutorial is still very valuable for Web Dynpro application developers. As an example, it demonstrates the concept of creating multiple instances of the same visual component based on separate component usages. This principle is absolutely crucial for developing component-based Web Dynpro applications.

You can read the tutorial description with all related links below.

Regards, Bertram

View Compositions

This Web Dynpro sample application implements a complex view composition. The term view composition describes a set of all view assemblies that can be accessed by navigation. A view assembly consists of normal Web Dynpro views and interface views of Web Dynpro components within the browser window. You can model view compositions in the Navigation Modeler as part of the Web Dynpro tools.

The following options are applicable to model view compositions:

Embedding several views in view setsm, Embedding view sets in each other, Embedding visible Web Dynpro components using their component interface views

In this tutorial, a Web Dynpro component is embedded using two instances.

Embedding views and view sets in view layouts by using the ViewContainerUIElement

Code Sample

The ready-to-use project is available to download from SDN [13TutWD_ViewComposition.zip|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/business_packages/a1-8-4/13tutwd_viewcomposition.zip]

Corresponding Tutorial: [Modeling View Compositions in Web Dynpro|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/2cceb190-0201-0010-be88-acdbeb2ad65f]

Details

Project Template: The initial project (starting point for this tutorial) is available to download from SDN: [13TutWD_ViewComposition_Init.zip|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/business_packages/a1-8-4/13tutwd_viewcomposition_init.zip]

Level of complexity: Expert

Key features covered: view sets, view assembly, view composition, nested view sets, component interface view, component usage, component reuse, multi-instance capability of Web Dynpro components, UI element Image, UI element ViewContainerUIElement, calculated context attributes

Time required for completion: 2 hrs

Created by: SAP AG

Former Member
0 Kudos

Hi Bertram,

Thanks a lot for the correct links!

Your help saved me a lot of time!

Best regards,

Nikolay

Former Member
0 Kudos
Former Member
0 Kudos

Thanks a lot for the same.

I had already searched and found the same. But forgot to update the thread that I did...

Thanks a lot once again.

JP

I wish I could reward points...bu am not able to.

Former Member
0 Kudos
Former Member
0 Kudos

Hello Hugo,

Check on the duplicate usage of a view.

Regards,

Christophe