cancel
Showing results for 
Search instead for 
Did you mean: 

Embedding a component view into a ViewUIElementContainer

Former Member
0 Kudos

Hi,

I'd like to know if it's possible to embed the main view of a component into a ViewUIElementContainer.

Most of the UI in our application is generated at runtime.

Since this behavior is found in almost every view of the application we are about to migrate to webdynpro, I'd like to create a reusable component, that can be parametered with a description of the UI elements I want to draw. In return I could fetch the user input data through convenient methods.

Since the parts of the View which are dynamic vary from one view to another, It would be inappropriate to create a viewset every time I want to use a component. Therefore I'd like to know if it's possible to embed a component into a ViewUIElementContainer.

If it's not, I'll rely on classical design patterns to encapsulate my functionality.

Does anybody have any suggestions?

Alexis Trudeau

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

yes you can do that. Using components is one of the key ideas inside the Web Dynpro programming model.

You have to do several things to achive this:

  • The component, which should be embedded, has to define a InterfaceView containing the UI of the component.

  • The embedder component has to define a component usage for the embedded component.

  • Depending on the life-cycle of the embedded component the embedder component has to create / destroy the embedding component instance.

If the embedded component has the same life-cycle like the embedder component you can create the needed component instance within the wdDoInit() method of the embedder component controller.

To create a component usage instance you have to use something like

wdThis.wdGet<Name of the Component Usage>.createComponent().

  • To visualize the embedded component you have to use a ViewUIContainerElement. Assign the needed interface view of the embedded component to it (in the Web Dynpro Explorer under the right Window).

This is of course the simplest use-case for using components inside a Web Dynpro application.

Best regards

Jochen

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you all,

I found that Tutorial 13 about view compositions goes much more in detail for want I wanted than Tutorial 14 about server eventing.

So if any of you wonders how to bind a component Interface view to a ViewUIElementContainer, just follow Tutorial 14 and you'll have your answer.

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Alexis,

exactly for this purpose I wrote the tutorial about Web Dynpro View Compositions. Thanks for your recommendation.

Greetings, Bertram

Former Member
0 Kudos

Hi,

Yes it is possible.

When you call view of the component A from component B

you should define component usage for each instance of component A throw component usage node in left side manu.

For more information refer to:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/documents/a1-8-4/using server-side eventing in web dynpro components.pdf