on 07-15-2009 7:33 AM
Hi,
my task is to create a tabstrip dynamically and assign a view to a dynamically created tab. I created a tabstrip dynamically:
METHOD wddomodifyview .
DATA: lr_container TYPE REF TO cl_wd_uielement_container.
DATA: lr_tabstrip TYPE REF TO cl_wd_tabstrip.
DATA: lr_tab TYPE REF TO cl_wd_tab.
DATA: lr_caption TYPE REF TO cl_wd_caption.
DATA: lr_view_container TYPE REF TO cl_wd_view_container_uielement.
IF first_time = abap_true.
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_tabstrip ?= lr_container->get_child(
id = 'TABSTRIP' ).
lr_tab = cl_wd_tab=>new_tab(
id = 'TAB1'
view = view ).
lr_tabstrip->add_tab(
the_tab = lr_tab
).
lr_caption = cl_wd_caption=>new_caption(
id = 'CAPTION'
view = view
text = 'TAB1' ).
lr_tab->set_header( the_header = lr_caption ).
ENDIF.
ENDMETHOD.
This works fine. In the next step I want to create a view container UI element and assign it to the TAB1.
Does anyone know how to to this?
The last step woud be that I embed a given view from another component to the created view container. I assume that this can be done as described in the following thread:
Is my assumption correct?
Best Regards, Eddy
You can use the method NEW_VIEW_CONTAINER_UIELEMENT from class CL_WD_VIEW_CONTAINER_UIELEMENT for creating the view container.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pooja,
thanks, I enhanced the coding with your mentioned method. Additinally I added the code for embedding the view , but now I get an dump, saying:
View usage MAIN_VIEW_USAGE_1 does not exist in window W_MAIN of component Z_DYNAMIC_TAB
Here the enhanced code:
lr_view_container = cl_wd_view_container_uielement=>new_view_container_uielement(
* bind_enabled =
* bind_tooltip =
* bind_visible =
* context_menu_behaviour = E_CONTEXT_MENU_BEHAVIOUR-INHERIT
* context_menu_id =
* enabled = 'X'
id = 'VIEW1'
* tooltip =
* view =
* visible = E_VISIBLE-VISIBLE
).
lr_tab->set_content( the_content = lr_view_container ).
lr_tabstrip->add_tab(
* index =
the_tab = lr_tab
).
lr_api_main = wd_this->wd_get_api( ).
try
lr_api_main->do_dynamic_navigation(
source_window_name = 'W_MAIN'
source_vusage_name = 'MAIN_VIEW_USAGE_1'
source_plug_name = 'OUT_PLUG1'
target_component_name = 'ZEMTEST'
target_view_name = 'V_MAIN'
target_plug_name = 'DEFAULT'
target_embedding_position = 'V_MAIN/VIEW1').
I assume, that the view ussage 'MAIN_VIEW_USAGE_1 must be defined statically. But I like to defiine the usage at runtime. Is this possible?
BR, Eddy
Edited by: Edgar Meyer on Jul 16, 2009 8:31 AM
Hi,
you can not do any navigation inside WDDOMODIFYVIEW...
*somethings I found while testing with dynamic generation of tabstrip is as follows:
*for this perticular method "do_dynamic_navigation"
lr_api_main->do_dynamic_navigation(
*this your window where your main view lies
source_window_name = 'W_MAIN'
*this will be your main view name: so for example your main view is called: "VIEW_M" where the tabstrip resides, and this is the first view you created...than this parameter should read like this: "VIEW_M_USAGE_0"
source_vusage_name = 'MAIN_VIEW_USAGE_1'
source_plug_name = 'OUT_PLUG1'
target_component_name = 'ZEMTEST'
target_view_name = 'V_MAIN'
target_plug_name = 'DEFAULT'
*this will change to:" VIEW_M/VIEW1"
target_embedding_position = 'V_MAIN/VIEW1').
pls see my answer in this:
Thanks...
AS...
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.