on 11-19-2014 5:50 AM
Hi Experts,
I created 1 Dynamic Table in WDA, it is working fine.
Now my requirement is I need to make columns of this dynamic table editable.
Please guide me how I can achieve this.
my WDDOMODIFYVIEW code as follows
data : l_root TYPE REF TO cl_wd_uielement_container,
l_node TYPE REF TO if_wd_context_node,
l_table TYPE REF TO cl_wd_table.
if first_time = abap_true.
l_root ?= view->get_root_element( ).
l_node = wd_context->get_child_node( 'MY_NODE' ).
cl_wd_dynamic_tool=>create_table_from_node(
EXPORTING
ui_parent = l_root " UI Container in which Table Is to Be Located
table_id = 'MY_TABLE' " Table ID
node = l_node " Reference to the context node
).
endif.
-Regards
Rohit
Hi Rohit,
By default, system generates textview as cell editor in while generating table from node.
Here, you need to create input elements for each column and bind it to the cells of table
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 Rohit,
By default, textview will be the editor in your dynamic table, here you need to create input field and set as cell editor.
Try the below code to make all columns as editable.
METHOD wddomodifyview .
DATA : l_root TYPE REF TO cl_wd_uielement_container,
l_node TYPE REF TO if_wd_context_node,
l_table TYPE REF TO cl_wd_table.
DATA lt_cols TYPE TABLE OF REF TO cl_wd_table_column.
DATA ls_cols LIKE LINE OF lt_cols.
DATA lo_textview TYPE REF TO cl_wd_text_view.
DATA lo_input TYPE REF TO cl_wd_input_field.
DATA lv_path TYPE string.
DATA lv_id TYPE string.
IF first_time = abap_true.
l_root ?= view->get_root_element( ).
l_node = wd_context->get_child_node( 'MY_NODE' ).
l_table =
cl_wd_dynamic_tool=>create_table_from_node(
ui_parent = l_root
table_id = 'MY_TABLE' " Table ID
node = l_node
).
lt_cols = l_table->get_columns( ).
LOOP AT lt_cols INTO ls_cols.
" Default editor in dyn table is textview, get editor
lo_textview ?= ls_cols->get_table_cell_editor( ).
" get binding path and id
lv_path = lo_textview->bound_text( ).
lv_id = lo_textview->get_id( ).
" create new input element
free lo_input.
cl_wd_input_field=>new_input_field(
EXPORTING
bind_value = lv_path " BIND_VALUE
id = lv_id
RECEIVING
control = lo_input " CONTROL
).
"set new editor to cell
if lo_input is BOUND.
ls_cols->set_table_cell_editor(
the_table_cell_editor = lo_input ).
endif.
ENDLOOP.
ENDIF.
Hope this helps you.
Regards,
Rama
ENDMETHOD.
Hi,
Take another field in the context as read only property.
Bind this field for read only property for the field which you need to edit.
*Check for dynamic condition.
loop at it into wa.
Ex: if wa-matnr = 23.
wa-readonly = 'X'.
endif.
endloop.
thanks
vijay
Message was edited by: Vijay Vikram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
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.