cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic tab and embedding of view

Former Member
0 Kudos

Hi,

I'm using the code from the following discussion about dynamic tab appearance: http://scn.sap.com/thread/1926672

This works fine, but now, I need to embed a view into my dynamically created tab. I think I need to insert a ViewUIElementContainer into the tab and then I can embed the view but I don't know how to do this? What is the right way?

Please help.

Thanks

Chris

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi Chris,

Use CL_WD_TAB->SET_CONTENT to set a ViewContainerUIElement object as the content of the tab. When you instantiate the ViewContainerUIElement object, pass the controller of the embedded view to the constructor.

See also, .

Cheers,

Amy

Former Member
0 Kudos

How can I reach the controller of the embedded view?

amy_king
Active Contributor
0 Kudos

Hi Christian,

You can use the code wizard within any method of your view to get a reference to the view's controller. For example...

DATA lo_api_myview TYPE REF TO if_wd_view_controller.
lo_api_my
view = wd_this->wd_get_api( ).

Or if you are in method wddomodifyview, you can directly use the VIEW parameter which implements IF_WD_VIEW_CONTROLLER.

Cheers,

Amy

Former Member
0 Kudos

Hi Amy,

I know this method. The problem is, I'm in the WDDOMODIFYVIEW of the View V_MAIN. Here, I add a tab to the tabstrip. Now, I want to embed the View V_TAB into the tab. Firstly, I create a ViewUIElementContainer and set this as content of the tab. Then I need to pass the controller of the View V_TAB to the contructor of the ViewUIElementContainer, but I don't know how to get this controller because I'm currently in the View V_MAIN?

amy_king
Active Contributor
0 Kudos

Hi Chris,

If you are trying to embed view V_TAB from view V_MAIN you may need to approach it differently. Take a look at the responses in discussion Embed a view dynamically in a ViewContainerUIElement.

Cheers,

Amy

Answers (1)

Answers (1)

Former Member
0 Kudos

The constructor of CL_WD_TAB takes two parameters, ID and VIEW. The VIEW param is type of IF_WD_VIEW. How can I get this param?

Former Member
0 Kudos

You can (should)  not get the reference of view V_TAB from view V_MAIN as the programming interface is private for the V_TAB controller only.

Work-around is possible to pass the view's reference, but you should not do this.

Try the approach suggested by Amy.