cancel
Showing results for 
Search instead for 
Did you mean: 

Embedding a view inside a dynamically created tab within a WDC

otto_boehrer
Explorer
0 Kudos

Hi!

I have created inside a WD view dynamically a tabstrip element with a number of tabs only known at runtime. That works fine!

Now I have the problem, that I want to replace the content of one of these tabs with an already existing (static) view of the same component.

For that, I created a UI container element in the dynamic tab container (reference 'lr_tab_content') via the following code fragment:

data: lr_view_container type ref to cl_wd_view_container_uielement.

lr_view_container =

cl_wd_view_container_uielement=>new_view_container_uielement( id = 'SEC_SERV_VIEW_CONT' ).

lr_tab_content->add_child( lr_view_container ).

cl_wd_flow_data=>new_flow_data( element = lr_view_container ).

Next, I tried to create a dynamic navigation link to the already existing static view 'V_WS_CONFIG_SEC_PROV' via the following code fragment:

data: l_view_controller_api type ref to if_wd_view_controller.

l_view_controller_api = wd_this->wd_get_api( ).

data: lr_component_usage type ref to if_wd_component_usage.

lr_component_usage = l_view_controller_api->prepare_dynamic_navigation(

source_window_name = 'MAIN_WINDOW'

source_vusage_name = '???'

source_plug_name = 'TO_SEC_PROVIDER'

target_view_name = 'V_WS_CONFIG_SEC_PROV'

target_plug_name = 'FROM_WS_CONFIG' ).

It fails, because I do not know what to enter in the parameter 'source_vusage_name' (again, it is the same component).

I tried to define in the WDC some kind of "self-reference", but that is not allowed.

Could someone give me a tip how I can embed that existing, static view into the dynamic tabstrip and tab?

Many thanks in advance,

Otto

Accepted Solutions (0)

Answers (3)

Answers (3)

otto_boehrer
Explorer
0 Kudos

Hi all!

I have meanwhile rebuild my WDC and entered static tabstrip elements which I complete by the dynamic ones.

All the static tabs, each of them planned to keep an already existing view, I have defined as static and bound on each of them an individual context element for its visibility setting.

Although this solution is a only workaround, it is solving my problem.

Anyway, many thanks for your help!

Otto

Former Member
0 Kudos

Hi Otto,

maybe using the UI-Element <b>HorizontalContextualPanel</b> instead of the TabStrip-Control can make life easier.

I combined the UI-Element HorizontalContextualPanel and a ViewContainer for an application which needs to show a varying number of tabstrips.

A Web Dynpro Component Interface was added to the ViewContainer. And the Web Dynpro Components shown in the ViewContainer all implement that WD Component Interface.

During runtime, the components matching the active tabstrib is created.

DATA lr_cmp_usage TYPE REF TO if_wd_component_usage.

DATA l_component_name TYPE string.

lr_cmp_usage->create_component( l_component_name ).

Kind regards,

Silke

Former Member
0 Kudos

Hi,

you can find your source_vusage in the window part of your component by clicking

the source view, view use can be found on the bottom of the page.

<a href="http://help.sap.com/saphelp_nw04s/helpdata/en/4c/60154219fce12ce10000000a1550b0/frameset.htm">documentation</a>

grtz,

Koen

otto_boehrer
Explorer
0 Kudos

Tx for that quick response, Koen!

The docu is not clear on that parameter, but you directed me to the correct place.

Now I am one step further on that subject, but I have a follow up question related to the above mentioned method 'prepare_dynamic_navigation'.

I specified 'target_embedding_position' with the dynamically created view container (value = 'WS_CONFIG/SEC_SERV_VIEW_CONT'), but the static view is not displayed in the tab, i.e. the tab remains empty.

So I am missing something. I fired the navi plug, but that leads in WDDOMODIFYVIEW to an error ("Navigation in Phase WDDOMODIFYVIEW Cannot Be Triggered"), so this is not the correct way.

Some additional tip would be highly appreciated.

Tx, Otto

shwetars
Advisor
Advisor
0 Kudos

Hi Otto,

The view usage name is the name of the view suffixed with '_usage_1'.

eg: if your static view name is 'V_STATIC' then the view usage name would be 'V_STATIC_USAGE_1'.

if you want to navigate to the view automatically then use the method do_dynamic_navigation, however this shouldn't be used within the method wddomodifyview( ).

if you are using prepare_dynamic_navigation( ) then the outbound plug needs to be fired explicitely.

Hence you can save your view reference as a global attribute the first time the application is loaded and later on use it in any method to create dynamic ui elements and finally call the method do_dynamic_navigation, in this way we wouldn't be doing navigation from within wddomodifyview.

Regards,

Shweta

otto_boehrer
Explorer
0 Kudos

Tx, again, the call to 'prepare_dynamic_navigation' seems to be ok now.

But the firing of the plug remains a problem. I registered on the tabstrip an event for selecting a tab (via 'set_on_select'). When selected, that event handler fires the outbound plug to the static view. But when the tabstrip is displayed first, the static view is not visible until the tab gets manually selected in the tabstrip.

So there is still a question related to my intiial problem: How can I display that view right at the first displaying of the tabstrip? Or how can I fix the "fire plug" problem from above?

Seems to me that I still need some tips here ... Otto

Former Member
0 Kudos

Hi,

if you mean your first view (default without the navigation),

you should check the window part of your component,

go to the viewcontainer where this is happening,

and right click on the default view, then set as default.

grtz,

Koen

shwetars
Advisor
Advisor
0 Kudos

Hi Otto,

you can set the default view usage for the dynamically created view container as follows:

in the below scenario i have a view container vc2 and i am setting the default view usage dynamically. Perhaps you can use the same logic for ur tabstrip implementation.

data :

lview type ref to cl_wdr_view,

uinfo type ref to if_wdr_rr_view_usage,

vca type ref to IF_WDR_RR_VIEW_CNT_ASSIGNMENT.

lview ?= view.

uinfo ?= lview->VIEW_USAGE_INFO.

vca = uinfo->GET_VCA_FOR_CONTAINER('VC2').

vca->set_default_view_usage('V_STEP1_USAGE_1').

Regards,

Shweta