on 04-26-2010 1:10 PM
Hi,
I have to implement a WebDynpro applicatoin with multiple views in one window, and additional pop-up windows.
On startup its neccessary to read out a table and create dynamically context nodes with attributes.
I want to represent this context nodes as drop-down lists on one view, but I want to react on the selected entries not just in this view. So I need to generate the context nodes in the context of the main COMPONENTCONTROLLER and bind it to the different views as soon as it is generated (or the views are instanced, whatever comes second).
Now my problem:
I know how to generate context nodes dynamical ( cl_wd_dynamic_tool=>create_nodeinfo_from_struct(...) ) and I know how to create UI Elements connection to the view Context on my View.
BUT:
How do I map and bind the (dynamical generated) context from the COMPONENTCONTROLLER to the view(s)?
Here is an eLearning on this subject:
Dynamic Mapping from the Component Controller to the View (done in the View WDDOINIT):
DATA: lo_node_info TYPE REF TO if_wd_context_node_info,
lo_dyn_node_info TYPE REF TO if_wd_context_node_info,
stru_mapping_info TYPE wdr_context_mapping_info,
tab_mapping_path TYPE wdr_ctx_element_path_segments,
wa_path TYPE wdr_ctx_element_name,
lo_controller TYPE REF TO if_wd_controller,
lt_path TYPE string_table,
lv_result TYPE abap_bool.
wa_path = 'COMPONENTCONTROLLER.SFLIGHT'.
INSERT wa_path INTO TABLE tab_mapping_path.
* stru_mapping_info-component_usage = .
stru_mapping_info-controller = 'COMPONENTCONTROLLER' .
stru_mapping_info-path = tab_mapping_path.
lo_node_info = wd_context->get_node_info( ).
*Map the context node dynamically
CALL METHOD lo_node_info->add_new_mapped_child_node
EXPORTING
child_name = 'SFLIGHT'
mapping_info = stru_mapping_info
RECEIVING
child_node_info = lo_dyn_node_info.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To avoid forum limitations I split my posting in two.
Here is the sample of the generation of the UI elements. To dynamic mapping you have to also dynamically generate the UI elements. Make sure that you really need dynamic context/UI elements however. A fixed context with a RowReapter or MultiPane is much easier to maintain over time.
In the View WDDOMODIFYVIEW:
data lr_container type ref to cl_wd_uielement_container.
data lr_input type ref to cl_wd_input_field.
data lr_table type ref to cl_wd_table.
data lr_caption type ref to cl_wd_caption.
data lr_table_column type ref to cl_wd_table_column.
data lr_table_standard_cell type ref to cl_wd_table_standard_cell.
if first_time = abap_true.
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
cl_wd_table=>new_table(
exporting
bind_data_source = 'SFLIGHT.SFLIGHT'
id = 'DYNTABLE'
receiving
control = lr_table ).
cl_wd_input_field=>new_input_field(
exporting
bind_value = 'SFLIGHT.SFLIGHT.CARRID'
id = 'INPUT1'
receiving
control = lr_input ).
lr_table_column = cl_wd_table_column=>new_table_column( ).
lr_table_column->set_table_cell_editor( lr_input ).
lr_caption = cl_wd_caption=>new_caption( ).
lr_caption->set_text( 'Some text' ).
lr_table_column->set_header( exporting the_header = lr_caption ).
lr_table->add_column( exporting the_column = lr_table_column ).
* create the layout data of the text view
data lr_grid_data type ref to cl_wd_grid_data.
lr_grid_data = cl_wd_grid_data=>new_grid_data( lr_table ).
lr_table->set_layout_data( lr_grid_data ).
lr_container->add_child(
exporting
the_child = lr_table ).
endif.
Thanks a lot.
I searched, but I didb't find the eLearning.
This seems not so difficult at all, I'm afraid, that I really need the dynamic generated context and elements, because the drop downs are assigned to make filters, and I don't know at design time what criteria I will be able to set filters on, until the data is read from the database.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.