on 10-29-2014 9:47 PM
Hi guys,
I want to create a webdynpro application. Actually I have a problem with the UI Element GRoup and I have no Idea where the problem is.
Here is the screen with two group element
The problem is that the user have to select a line in the first table. But it isn't possible. But in the second table it is possible .
I create the first table with the following code:
cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
CALL METHOD WD_NODE_INFO->ADD_NEW_CHILD_NODE
EXPORTING
NAME = STRUCTURE_NAME
IS_MULTIPLE = ABAP_true
IS_INITIALIZE_LEAD_SELECTION = ABAP_false
* is_mandatory = abap_true
* is_mandatory_selection = abap_true
RECEIVING
CHILD_NODE_INFO = wd_node_info.
CALL METHOD CL_WD_table=>new_table
EXPORTING
bind_data_source = STRUCTURE_NAME
* BIND_ROW_SELECTABLE = abap_true
ID = 'TABLE'
RECEIVING
control = lr_table.
The second table I create the table wit the "same" code
CALL METHOD WD_NODE_INFO->ADD_NEW_CHILD_NODE
EXPORTING
NAME = STRUCTURE_NAME
IS_MULTIPLE = ABAP_TRUE
IS_INITIALIZE_LEAD_SELECTION = ABAP_FALSE
RECEIVING
CHILD_NODE_INFO = wd_node_info.
cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
" Creating internal table with the same structure as our dynamic context node
CALL METHOD CL_WD_table=>new_table
EXPORTING
bind_data_source = STRUCTURE_NAME
ID = 'RDLTABLE'
RECEIVING
control = lr_table.
------->>>>>>> I think here is no different
The Only different I think are the layout settings
1. I want to select one line in the first table(TABLE_GROUP). How can I mark only one line in this table ?
2. If the user mark one line I want to read/get the information of this line. I don't know how ?
Thanks for your assistance.
Wolfgang
HI Guys I tried a lot of settings, I#m desperate 🙂
If I change the methode CL_WD_table=>new_table the line select button changed. But I cannot push the button.
I tried a lot of things. I find out, it is not a layout problem. I changed the customizing( I changed the ID of the two table ) in the tabstrip "Layout" . And now i have the same problem at the other container. It must be a coding problem. see coding above.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try following parameters:
CL_WD_TABLE=>NEW_TABLE(
...
ROW_SELECTABLE = 'X'
SELECTION_MODE = '08' "multi, no lead
... )
What do you see then?
Do you need all the generic stuff? Maybe you try it with a given ContextNode to simplify your coding first? Then it's easier to find out which attributes are missing/wrong
Hi Christopher,
sorry for the delayed anwser. i had a problem with my sdn account.
I changed the coding as you decribed.
I get the same result. I see the line buttons but I can't push the line.
mmmmmmhhhh.
Have you another idea ?
Thanks
Wolfgang
PS: the input structure is dynamic and i know no other possibilitie to create a table dynamic in wd
Hi,
I believe you have placed your code inside the IF condition of first_time of view! If not, please place your code inside the.,
if first_time = abap_true.
** your code
endif.
hope this helps,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Wolfgang,
When you create table using cl_wd_table=>new_table, by default ROW_SELECTABLE is set to true. Hence you could be able to select rows.
Now, you need to check out all the containers in the hierarchy if any of those have ENABLED property unchecked.
For selected only one row in first table, pass the parameter SELECTION_MODE = CL_WD_TABLE=> E_SELECTION_MODE-SINGLE
To handle the onlead select event, you need to create an event inside view PROCESS_ROW_DATA and pass it while creating table
ON_LEAD_SELECT = 'PROCESS_ROW_DATA'
Now, inside the event handler method PROCESS_ROW_DATA , read the parameters to get the selected the element of context node.
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guys ,
Here is the coding for the first table:
"method ZCREATE_ALV .
* FIELD-SYMBOLS: <tab> TYPE table.
field-symbols: <lt_data> type any table,
<list> type DFIES.
constants lc_col(4) VALUE 'COL_'.
constants lc_id(3) VALUE 'ID_'.
data: wd_node_info type ref to if_wd_context_node_info,
wd_node type ref to if_wd_context_node,
lr_container type ref to cl_wd_uielement_container,
lv_tablename type string,
lF_first type boolean,
lt_db_data type ref to data,
lf_bind type string,
lf_col type string,
lf_index type string,
lf_id type string,
lf_text type WDY_MD_TRANSLATABLE_TEXT,
lr_table type ref to cl_wd_table,
dyn_attr_info type wdr_context_attribute_info,
ls_attribute type wdr_context_attribute_info,
lr_table_col type ref to cl_wd_table_column,
lr_table_col1 type ref to cl_wd_table_column,
lr_text_view type ref to cl_wd_text_view,
lr_input_field type ref to cl_wd_input_field,
lr_column_name_header TYPE REF TO cl_wd_caption.
DATA: lR_seltab TYPE REF TO data.
FIELD-SYMBOLS <seltab> TYPE table.
DATA: lo_typedescr TYPE REF TO cl_abap_typedescr, " RTTI-Objekt
lt_field_list TYPE ddfields, " Tabelle vom Typ ddfields
lo_datadescr TYPE REF TO cl_abap_datadescr, " RTTI-Objekt
lo_structdescr TYPE REF TO cl_abap_structdescr, " RTTI-Objekt
lo_tabledescr TYPE REF TO cl_abap_tabledescr. " RTTI-Objekt
*überprüfen ob bereits durchlaufen
DATA lo_nd_visible TYPE REF TO if_wd_context_node.
DATA lo_el_visible TYPE REF TO if_wd_context_element.
DATA ls_visible TYPE wd_this->Element_visible.
DATA lv_table_group TYPE wd_this->Element_visible-table_group.
* navigate from <CONTEXT> to <VISIBLE> via lead selection
lo_nd_visible = wd_context->get_child_node( name = wd_this->wdctx_visible ).
* @TODO handle non existant child
* IF lo_nd_visible IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_visible = lo_nd_visible->get_element( ).
* @TODO handle not set lead selection
IF lo_el_visible IS INITIAL.
ENDIF.
* get single attribute
lo_el_visible->get_attribute(
EXPORTING
name = `TABLE_GROUP`
IMPORTING
value = lv_table_group ).
refresh lt_field_list.
*Feldnamen holen
CALL METHOD cl_abap_datadescr=>describe_by_data
EXPORTING
p_data = z_tab
RECEIVING
p_descr_ref = lo_typedescr.
IF lo_typedescr->type_kind EQ cl_abap_datadescr=>typekind_table.
lo_tabledescr ?= lo_typedescr.
ENDIF.
CALL METHOD lo_tabledescr->get_table_line_type
RECEIVING
p_descr_ref = lo_datadescr.
IF lo_datadescr->type_kind EQ cl_abap_datadescr=>typekind_struct1.
lo_structdescr ?= lo_datadescr.
ELSEIF lo_datadescr->type_kind EQ cl_abap_datadescr=>typekind_struct2 .
lo_structdescr ?= lo_datadescr.
ELSE.
*RAISE struc_fehler.
ENDIF.
CALL METHOD lo_structdescr->get_ddic_field_list
EXPORTING
p_langu = sy-langu
p_including_substructres = 'X'
RECEIVING
p_field_list = lt_field_list
EXCEPTIONS
not_found = 1
no_ddic_type = 2
OTHERS = 3.
IF sy-subrc <> 0.
* RAISE struc_fehler.
ENDIF.
wd_node_info = wd_context->get_node_info( ).
try.
if lv_table_group eq abap_false.
CALL METHOD WD_NODE_INFO->ADD_NEW_CHILD_NODE
EXPORTING
NAME = STRUCTURE_NAME
IS_MULTIPLE = ABAP_true
IS_INITIALIZE_LEAD_SELECTION = ABAP_false
* is_mandatory = abap_true
* is_mandatory_selection = abap_true
RECEIVING
CHILD_NODE_INFO = wd_node_info.
* If lf_first eq abap_true.
wd_node = wd_context->get_child_node( name = STRUCTURE_NAME ).
wd_node_info = WD_node->GET_NODE_INFO( ).
*Beim zweiten Mal drücken des Buttons müssen die Attribute vorher gelöscht werden
* WD_node_info->REMOVE_DYNAMIC_ATTRIBUTES( ).
loop at lt_field_list ASSIGNING <list>.
DYN_ATTR_INFO-NAME = <list>-fieldname.
DYN_ATTR_INFO-IS_READ_ONLY = abap_true.
DYN_ATTR_INFO-TYPE_NAME = 'STRING' ." Data Element(CHAR20) ( Type Of Attribute )
DYN_ATTR_INFO-NODE_INFO = wd_node_info.
CALL METHOD wd_node_info->ADD_ATTRIBUTE
EXPORTING
ATTRIBUTE_INFO = DYN_ATTR_INFO.
endloop.
else.
wd_node = wd_context->get_child_node( name = STRUCTURE_NAME ).
endif.
lr_container ?= z_view->get_element( id = 'TABLE1' ).
* cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
" Creating internal table with the same structure as our dynamic context node
CALL METHOD CL_WD_table=>new_table
EXPORTING
bind_data_source = STRUCTURE_NAME
* SELECTION_MODE = CL_WD_TABLE=>E_SELECTION_MODE-SINGLE
* ROW_SELECTABLE = abaP_true
* BIND_ROW_SELECTABLE = abap_true
ID = 'TABLE_1'
RECEIVING
control = lr_table.
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_table ).
loop at lt_field_list ASSIGNING <list>.
lf_index = sy-tabix.
CONCATENATE STRUCTURE_NAME '.' <list>-fieldname INTO lf_bind.
CONCATENATE lc_id lf_index INTO lf_id.
condense lF_id no-gaps.
lr_input_field = cl_wd_input_field=>new_input_field( bind_value = lf_bind ID = lf_id ).
CONCATENATE lc_col lf_index INTO lf_col.
condense lf_col no-gaps.
LR_TABLE_COL = cl_wd_table_column=>new_table_column( id = lf_col ).
lr_table->add_column( the_column = lr_table_col ).
lf_text = <list>-fieldname.
lr_column_name_header ?= cl_wd_caption=>new_caption( text = lf_text ).
lr_table_col->set_table_cell_editor( THE_TABLE_CELL_EDITOR = lr_input_field ).
lr_table_col->set_header( lr_column_name_header ).
endloop.
if lv_table_group eq abap_false.
wd_node->bind_table( new_items = z_tab ).
lr_container->add_child( lr_table ).
lv_table_group = 1.
lo_el_visible->set_attribute(
name = `TABLE_GROUP`
value = lv_table_group ).
else.
wd_node->bind_table( new_items = z_tab ).
endif.
endtry.
endmethod.
Thanks Wolfgang
Hi Wolfgang,
If you want to read only one line from first table, make the cardinality for selection as 0:1 or 1:1(if 1:1, make sure the table has at least one entry ).
And if the user selects one line, you get the selected line information from the onleadselect event of the table.
Regards,
Harsha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.