on 09-13-2010 2:12 PM
Hi Experts,
How can we edit selected record or row in a table? can any one give me some suggetions?
Thanks and Regards,
kris.
Hi,
sorry Table Column read_only property has to binded to 'SET_READ_ONLY' attribute.
Say you had 3 columns all 3 columns read_only property has to be binded 'SET_READ_ONLY' attribute
With Regards,
Shridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sridhar,
Actually, i want display data in a table, i am using service call to get data, by defalut coloumns are text views, i changes some cols as input some as dropdownbykey some as text view. when i am trying to test all are in edit mode. but my requirement is first ineed to display in edit mode, when user select a record and click on update button, that record need to convert in edit mode so that user can update data.? Help me please.
Thanks
kris.
hi,
As shridhar suggested , create a attribute (say set_read_only) of type abap_bool and bind it to the read_only property of all columns.
Then in your handler of edit button , get the selected element using GET_LEAD_SELECTION() and then set the attribute "read_only" for that element to abap_false.This will make all columns editable.
Thanks,
Aditya.
Hi,
I guess your table read_only property is not set. So in layout set the read_only property of table.
Then when user selects the row and clicks Update button, here
1. You need to set the read_only property as abap_false .
2. Choose the input field or dropdown or any UI you want as selected cell variant.
With Regards,
Shridhar
Hi
METHOD onactionupdate .
DATA lo_nd_is_data TYPE REF TO if_wd_context_node.
DATA lo_el_is_data TYPE REF TO if_wd_context_element.
DATA ls_is_data TYPE wd_this->element_is_data.
DATA : lv_name TYPE wd_this->element_is_data-name,
lv_sal TYPE wd_this->element_is_data-sal,
lv_per TYPE wd_this->element_is_data-percent,
lv_empno TYPE wd_this->element_is_data-empno,
wa_data TYPE ysg_demo,
it_data TYPE STANDARD TABLE OF ysg_demo.
* navigate from <CONTEXT> to <IS_DATA> via lead selection
lo_nd_is_data = wd_context->path_get_node( path = `YSG_DEMO.CHANGING.IS_DATA` ).
* get element via lead selection
lo_el_is_data = lo_nd_is_data->get_element( ).
lo_nd_is_data->get_lead_selection( ).
lo_el_is_data->get_attribute( EXPORTING name = `EMPNO` IMPORTING value = lv_empno ).
lo_el_is_data->get_attribute( EXPORTING name = `NAME` IMPORTING value = lv_name ).
lo_el_is_data->get_attribute( EXPORTING name = `SAL` IMPORTING value = lv_sal ).
lo_el_is_data->get_attribute( EXPORTING name = `PERCENT` IMPORTING value = lv_per ).
MOVE : lv_empno TO wa_data-empno,
lv_name TO wa_data-name,
lv_sal TO wa_data-sal,
lv_per TO wa_data-percent.
* APPEND wa_data TO it_data.
MODIFY ysg_demo FROM wa_data.
ENDMETHOD.
Note: First get data to your table and take button say 'UPDATE' and implement the code on action of a button.Hope this will help you.
Regards
Sankar
Edited by: sankar.cgsl on Sep 15, 2010 11:00 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please maintain the attribute 'set_read_only' along with other attributes table. Bind this attribute to the table read_only property.
Say User clicks on 'Edit' button then get the row selected using get_lead_Selection method of node and set the attribute of 'set_read_only' as abap_false. This will make the row editable.
ths should be written in edit action method ************
element = node->get_lead_selection( ).
element->set_attribute(
exporting
name = 'SET_READ_ONLY'
value = abap_false ).
Note : Table columns read_only property has to be binded to set_read_only attribute.
With Regards,
Shridhar
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kris,
data lo_nd_ type ref to if_wd_context_node.
data lo_el type ref to if_wd_context_element.
lo_nd = wd_context->get_child_node( name = wd_this->wdctx_node_name).
call method lo_nd->get_lead_selection
receiving
element = lo_el
lo_el holds the value of the selected row
Thanks
Bala Duvvuri
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.