Skip to end of metadata
Go to start of metadata

I saw many times in forums that many users are asking same question, so I decided to write a WIKI on this issue.Here i  am about show one ALV table with editable rows.I hope every one is familier with editable columns and conditionally editing the cells of a column.

To do this add one context attribute READ_ONLY of type ABAP_BOOL to your context node.Then follow the below logic to make the editable row.method WDDOINIT .

DATA lo_nd_flights TYPE REF TO if_wd_context_node.
DATA lo_el_flights TYPE REF TO if_wd_context_element.
DATA ls_flights TYPE wd_this->element_flights.
DATA ls_final TYPE wd_this->element_flights.
DATA lt_flights TYPE TABLE OF wd_this->element_flights.
DATA lt_final TYPE TABLE OF wd_this->element_flights.

* navigate from <CONTEXT> to <FLIGHTS> via lead selection
lo_nd_flights = wd_context->get_child_node( name = wd_this->wdctx_flights ).

*Get the data from context node
CALL METHOD lo_nd_flights->get_static_attributes_table
    table = lt_flights.

*Populate READ_ONLY attribute
LOOP AT lt_flights INTO ls_flights.
  MOVE-CORRESPONDING ls_flights TO ls_final.
  IF ls_final-connid='0017'.  "I want to edit the rows of a table whose connection no is 17,remaining all rows are non editable
    ls_final-read_only = abap_false.
    ls_final-read_only = abap_true.
  APPEND ls_final TO lt_final.
CALL METHOD lo_nd_flights->bind_table
new_items = lt_final
* set_initial_elements = ABAP_TRUE
* index = .

*Instantiate ALV and call GET_MODEL method
data lo_cmp_usage type ref TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
  lo_cmp_usage->create_component( ).

DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model( ).

DATA:lt_columns TYPE salv_wd_t_column_ref,
ls_columns TYPE salv_wd_s_column_ref,
lr_input TYPE REF TO cl_salv_wd_uie_input_field,
lr_column TYPE REF TO cl_salv_wd_column,
lt_node_info TYPE wdr_context_attr_info_map,
ls_node_info TYPE wdr_context_attribute_info,
lv_tabix TYPE sy-tabix,
lr_info TYPE REF TO if_wd_context_node_info.
name TYPE string,
END OF ty_name.
DATA: lt_name TYPE TABLE OF ty_name,
ls_name TYPE ty_name.

*Get the context node information
lr_info = lo_nd_flights->get_node_info( ).
lt_node_info = lr_info->get_attributes( ).
LOOP AT lt_node_info INTO ls_node_info.
  ls_name-name = ls_node_info-name.
  APPEND ls_name TO lt_name.
CALL METHOD lo_value->if_salv_wd_table_settings~set_visible_row_count
    value = 100.

*Get all the columns to make row editable
CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
    value = lt_columns.

*Now loop the columns table and change the cell editor of a column
LOOP AT lt_columns INTO ls_columns.
  lr_column = ls_columns-r_column.
  lv_tabix = sy-tabix.
  READ TABLE lt_name INTO ls_name INDEX lv_tabix.
  CREATE OBJECT lr_input
      value_fieldname = ls_name-name.
  CALL METHOD lr_column->set_cell_editor
      value = lr_input.
*To make the required row is editable
  lr_input->set_read_only_fieldname( value = 'READ_ONLY' ).

*Set the table Editable
lo_value->if_salv_wd_table_settings~set_read_only( value = abap_false ).
*delete column
CALL METHOD lo_value->if_salv_wd_column_settings~delete_column
    id = 'READ_ONLY'.

Check the below output