on 07-09-2008 9:21 AM
Hi Experts,
I'm now able to create a new tab page (cl_wd_tab) dynamically for a tab strip (cl_wd_tabstrip), and in the tab page, I created a View Container (cl_wd_view_container_uielement).
* create tab
lr_tab = cl_wd_tab=>new_tab(
id = c_tab_change_request
view = lr_view ).
* create tab caption
lr_caption = cl_wd_caption=>new_caption(
id = c_cap_change_request
view = lr_view
text = 'Change Request' ).
* set caption
lr_tab->set_header( lr_caption ).
* create view container
lr_content = cl_wd_view_container_uielement=>new_view_container_uielement(
id = c_change_request_container
view = lr_view ).
* set view container
lr_tab->set_content( lr_content ).
* add tab
lr_tabstrip->add_tab( lr_tab ).
After this, I tried to embed a component to the View Container, and this also works.
lr_component_usage = lr_component_usage_group->add_component_usage(
name = c_requestdoc_usage
embedding_position = embedding_position
used_component = 'Used_Component' ).
but to show the embeded component, it seems that I have to perform a dynamic navigation
view->do_dynamic_navigation(
source_window_name = lr_window_controller->name
source_vusage_name = l_view_usage_name
source_plug_name = 'TO_CHANGE_REQUEST'
target_component_name = 'GRFN_MDCHG_REQUEST_DOC'
target_component_usage = c_requestdoc_usage
target_view_name = 'MAIN_WINDOW'
target_plug_name = 'DEFAULT'
target_embedding_position = embedding_position ).
and the problem is here for naviagtion...
The tab creation code is in WDOMODIFYVIEW method, but we cannot do navigation in it.
but I created the the tab, view container, and usage in WDOMODIFYVIEW. this means I have to do the navigation after WDOMODIFYVIEW...
I don't where is the correct place to do this navigation...
Edited by: Sylvos Cai on Jul 9, 2008 10:21 AM
Are you OK?
I'm trying do it.add tab pages use other views.
i create lots of views in this controllor
crate a tabstrip in mainview.
when i run ,the tabstrip in the mainview generate lots of tab references to other view.
like this:
in WDDOMODIFYVIEW:
METHOD wddomodifyview .
DATA l_controller TYPE wdy_controllert.
DATA l_controllers TYPE wdy_controllert_table.
DATA l_wd_tabstrip TYPE REF TO cl_wd_tabstrip.
DATA l_wd_tab TYPE REF TO cl_wd_tab.
DATA l_wd_caption TYPE REF TO cl_wd_caption.
DATA l_wd_view TYPE REF TO if_wd_view.
DATA l_id TYPE string.
DATA l_text TYPE string.
DATA l_api TYPE REF TO if_wd_controller.
l_api = wd_this->wd_get_api( ).
IF first_time = abap_true.
l_wd_tabstrip ?= view->get_element( 'TABSTRIP' ).
l_controllers = cl_wdr_test_utils=>get_views_of_component( 'ZQQ_TEST_TABLE' ).
LOOP AT l_controllers INTO l_controller .
CONCATENATE 'SELECT_TAB__' l_controller-controller_name INTO l_id.
l_text = l_controller-description.
creat tab
l_wd_tab = cl_wd_tab=>new_tab( ).
create tab caption
l_wd_caption = cl_wd_caption=>new_caption(
id = l_id
text = l_text ).
set caption
l_wd_tab->set_header( l_wd_caption ).
l_wd_tabstrip->add_tab( l_wd_tab ).
ENDLOOP.
ENDIF.
ENDMETHOD.
in tabstrip's event onSelect SELECT_TAB:
data l_view_controller type ref to if_wd_view_controller.
data l_nav_services type ref to if_wd_navigation_services.
data l_view_name type string.
data l_dummy type string. "#EC NEEDED
split id at '__' into l_dummy l_view_name.
l_view_controller = wd_this->wd_get_api( ).
l_nav_services ?= l_view_controller.
call method l_nav_services->do_dynamic_navigation
exporting
source_window_name = 'MAIN_WINDOW'
source_vusage_name = 'MAIN_USAGE_1'
source_plug_name = ID
target_view_name = 'MAIN_WINDOW'
target_plug_name = 'DEFAULT'
TARGET_EMBEDDING_POSITION = 'TABSTRIP/TABSTRIP'.
BUT
now It have a problem
the tab do not load the view object.
Edited by: qianchang on Mar 4, 2009 10:01 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can not trigger navigation in WDDOMODIFYVIEW, before that you don't have the view container ui element, try to make the view UI container available at design time rather at runtime.
Abhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.