on 02-24-2009 3:11 AM
Hi All.
I have a table on my screen. I select a row and process it. After i'm done processing it, i need to change the row into a display mode so that the user cannot perform any further operations on it.
Is there any way this can be done ?
Thanks,
Fathima
Hi Fatima,
Please go thru the code mention below to make a row non - editable of a table.
For this just take a attribute of type WDY_Boolean in ur node and bind the attribute to the UI Element Enable property.
Call this logic
DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lo_el_node TYPE REF TO if_wd_context_element.
DATA lt_node TYPE wd_this->elements_node.
DATA ls_node LIKE LINE OF lt_node.
navigate from <CONTEXT> to <NODE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
get element via lead selection
lo_el_node = lo_nd_node->get_element( ).
*
get all declared attributes
lo_nd_node->get_static_attributes_table(
IMPORTING
table = lt_node ).
DATA: lv_index TYPE i.
lo_el_node = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
lv_index = lo_el_node->get_index( ).
LOOP AT lt_node INTO ls_node.
IF sy-tabix = lv_index.
ls_node-read_only = abap_true.
ELSE.
ls_node-read_only = abap_false.
ENDIF.
MODIFY lt_node INDEX sy-tabix FROM ls_node TRANSPORTING read_only.
ENDLOOP.
CALL METHOD lo_nd_node->bind_table
EXPORTING
new_items = lt_node
set_initial_elements = abap_true.
Regards
Manoj Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fathima,
Create an attribute of WDY_BOOLEAN type (say its name is read_only) under the node which is binded to your table and bind it with the read-only property of column of the table. Don't give any initial value to it. Now after doing the processing you want to make read-only, for that you need to trigger some action. In the action handler of that method set the value value of the attribute to 'X'. Refer the following code:
DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
DATA ls_cn_node TYPE wd_this->elements_cn_node.
DATA ls_cn_node1 TYPE wd_this->element_cn_node.
data: it_tab type table of wd_this->element_cn_node.
data:it_tab2 type table of wd_this->element_cn_node.
data: wa_itab type wd_this->element_cn_node.
data: wa_itab1 type wd_this->element_cn_node.
* navigate from <CONTEXT> to <CN_NODE> via lead selection
lo_nd_cn_node = wd_context->get_child_node( name = wd_this->wdctx_cn_node ).
* navigate from <CONTEXT> to <CN_NODE> via lead selection
lo_nd_cn_node = wd_context->get_child_node( name = wd_this->wdctx_cn_node ).
* get element via lead selection
lo_el_cn_node = lo_nd_cn_node->get_element( ).
* get all declared attributes
lo_el_cn_node->get_static_attributes(
IMPORTING
static_attributes = ls_cn_node1 ).
* navigate from <CONTEXT> to <CN_NODE> via lead selection
lo_nd_cn_node = wd_context->get_child_node( name = wd_this->wdctx_cn_node ).
* get element via lead selection
lo_el_cn_node = lo_nd_cn_node->get_element( ).
IF lo_el_cn_node IS INITIAL.
ENDIF.
* get all declared attributes
lo_nd_cn_node->get_static_attributes_table(
IMPORTING
table = ls_cn_node ).
DATA: lv_index TYPE i.
lo_el_cn_node = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
lv_index = lo_el_cn_node->get_index( ).
read TABLE ls_cn_node INTO wa_itab INDEX lv_index.
loop at ls_cn_node into wa_itab1.
if wa_itab1-carrid eq wa_itab-carrid and wa_itab1-connid eq wa_itab-connid.
" In my case my table has only 2 fields carrid and connid.
wa_itab1-read_only = 'X'.
endif.
append wa_itab1 to it_tab2.
endloop.
lo_nd_cn_node->bind_table( it_tab2 ).
I hope it helps.
Regards
Arjun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.