cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple views in used component in ABAP Web Dynpro

former_member185171
Participant
0 Kudos

Hello,

we intend to write a reusable web dynpro component, but we face some problems with it:

the component has several views, and depending how it is called different views should be accessed. We already are that far that we know that probably we have to fire different outbound plugs, but we don't find the correct location in the component to include them. Are there some exemples on how to do this?

There is also the possibility to instantiate a component. Does this mean that an application can be called without instantiating all components immediately?

Thanks for any advise.

Regards.

Kris

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

1. Define the component in the the component use tab in component.

2. Goto view controller define in properties tab in used controller.

3. Use the View container UI element in Layout tab and Contextual panel UI element under    View switch UI element display selected view in application.

4. Embed the used Component Views in View container.

5. Based on View switch UI element create Navigation links in Window tab Window controller.

0 Kudos

If u need to use other component nodes and methods.

1. node property in component controller check interface node

2.if method component controller methods tab check interface method

then U can use the method used in different controller in code wizard get the method.

Former Member
0 Kudos

One idea is to create a window with an inbound plug that has a parameter (or a set of parameters). Then, in the inbound plug of the window you can write code to fire different outbound plugs. Then, link each outbound plug to a different view.

former_member185171
Participant
0 Kudos

I am as far as firing the outbound plug to the correct view in the WDDOBEFOREACTION action method of my main view. But I have no idea how I can tell my used component where it comes from. So I have no 'condition' to check. Is it possible to 'raise' some action I can check in this method when coming from out main component?

Thanks for helping anyway.

Former Member
0 Kudos

You can create an "interface" method in the comp controller that sets a comp controller context or attribute. Call this method from the outside application before you actually open the window. In the window, check for this value and see if it is set then it means your application has been called from the outside world.

former_member185171
Participant
0 Kudos

This is an idea I had also. But it looked 'too simple'. I wonder whether there is still another solution.

Former Member
0 Kudos

If you are using Portal, you can do it using OBN. First, define an input parameter in the default inbound plug of the window. Then, define an application that calls this window. Then, create an OBN object and operation. In the default handler of the inbound plug, you can write code to fire outbound plugs based on the input paramter value.

In the external component that will call this applicaion, call it using navigation to OBN passing the parameter value.

former_member185171
Participant
0 Kudos

Problem not yet solved.

I am as far firing the correct view the first time:

  • I put my data and destination in an OO-object
  • ... and send this to my used component
  • I put the data (the object) in the context.
  • I fire the right view in the WDDOAFTERACTION of the MAIN_VIEW of my used component
  • window and views in the used component have a lifetime limited to the display of it.

The second time I try to invoke the used component I don't go through the WDDOAFTERACTION of the MAIN_VIEW ... so the plug ot the view is not fired in this case.

Can anyone tell me where I have to put this plug so it should work?

Former Member
0 Kudos

How do you invoke it the second time? My preference is to control your plugs in the window not the view. A trick you can do is to make the "Empty View" the default view of the window. Then, you control your outbound plugs in the Window's default inbound plug.

amy_king
Active Contributor
0 Kudos

Hi Kris,

Check out demo component WDR_TEST_CMPUSAGE in your system. There are others as well if you do a search for components named *usage*.

Cheers,

Amy

Former Member
0 Kudos

before calling component which view needs to be called is decided?

former_member185171
Participant
0 Kudos

Yes,

we have a method in the used component to get the appropriate data and we know which view we need to display these.