on 02-16-2009 11:46 AM
hi Experts,
I have a table in which i am displaying data. Now in Each Row of table I have an Edit Button.
I want to make to row that editable for which Edit button is pressed.
How to proceed for that. ?
Thanx.
Hi Saurav,
when using table UI element, you will be binding some internal table to it. Ensure that this internal table
has a column with of type Boolean( lets call this column col_read_flag ).
When you bind the internal table to, UI element table, bind the property READ ONLY with the value in col_read_flag from the node, for all the columns of your table.
By default before displaying your table fill 'X' in columne col_read_flag for all rows in your internal table thus , entire table on UI would appear read-only when applicataion is executed.
Since you have edit button on each row, ONACTION when this button is pressed code to get the TABLE index, modify the col_read_flag value to ABAP_FALSE, thus your table row would become editable.
Greetings
Prashant
P.S. Points welcome
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
To read the table index:
refer this code:
method ONACTIONONLINKCLICK .
data: lr_element type ref to if_wd_context_element,
lv_index type i.
lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
lv_index = lr_element->get_index( ).
Refer this [thread|], look for the reply of shaik shadulla.
I hope it helps.
Regrads
Arjun
Edited by: Arjun on Feb 16, 2009 6:05 PM
Edited by: Arjun on Feb 16, 2009 6:09 PM
Hi Saurav,
node_data is the internal table thats binded to your TABLE UI ELEMENT.
data:
node_data type ref to if_wd_context_node,
iindex type i,
lv_err_count type i,
lt type table of zst_my_regs,
ls like line of lt.
node_data = wd_context->get_child_node( name = if_componentcontroller=>wdctx_data ).
if ( node_data is initial ).
return.
endif.
call method node_data->get_static_attributes_table
importing
table = lt.
if lines( lt ) lt 1.
return.
endif.
iindex = node_data->get_lead_selection_index( ).
if iindex lt 0.
return.
endif.
read table lt index iindex into ls.
ls-col_read_flag = abap_false.
modify lt from ls index iindex.
node_data->bind_table ( lt ).
here in i am opening the ROW that has LEAD Selection for EDIT.
Greetings
Prashant
Hi Sourav,
Please go thru the code mention below to make a row 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 on the Action of ur Edit Button
METHOD onactiononclick .
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.
ENDMETHOD.
Regards
Manoj Kumar
Edited by: Manoj Kumar on Feb 17, 2009 1:58 PM
hi,
in the table you have an atribute read only.bind this to an attribute some editable type wdy_boolean.
then for the edit button also you have the read only attribute.for this also bind this to the same attibute editable type wdy_boolean.
now using set_attribute set the editable value to abap_true or abap_false based on your requirement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
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.