Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Editable Table: Only first row is editable

Hello,

I created an editable empty table with dynamic columns. But now only the first row of this table is editable. Do anybody know what's the problem??

Regards,

Mario

replied

Hi Mario,

Then it is very simple.

You can do in 2 ways.

First way

1.go to columns of table right click on that and select remove cell editor again right click on column now select insert cell editor, a pop up will appears ask you to enter id and type of field.Enter Id and select Input field from drop down.

repeat the same for all the columns thats all your table will be editable when you run the application.

Second Way

1. create a context attribute READ_ONLY of type ABAP_BOOL in your context node attributes.

2.populate the above attribute with value abap_true like below.

loop at lt_flight into ls_flight.

ls_flight-readonly = abap_true.

modify lt_flight from ls_flight transporting readonly.

endloop.

3.Now modify the cell editors of columns means change the cell editor of column to editable.

Note: Write below code in the Method WDDOMODIFYVIEW

lr_info = node_sflight->get_node_info( ).
  lr_nodeinfo = lr_info->get_attributes( ).

  loop at lr_nodeinfo into ls_nodeinfo.

    concatenate 'SFLIGHT.'  ls_nodeinfo-name   into fs_name-str.
    append fs_name to lt_name.

  endloop.

 lr_info = node_sflight->get_node_info( ).
  lr_nodeinfo = lr_info->get_attributes( ).

  loop at lr_nodeinfo into ls_nodeinfo.

    concatenate 'SFLIGHT.'  ls_nodeinfo-name   into fs_name-str.
    append fs_name to lt_name.

  endloop.


lr_info = node_sflight->get_node_info( ).
  lr_nodeinfo = lr_info->get_attributes( ).

  loop at lr_nodeinfo into ls_nodeinfo.

    concatenate 'SFLIGHT.'  ls_nodeinfo-name   into fs_name-str.
    append fs_name to lt_name.

  endloop.

  lr_cols = lr_table->get_columns( ).

  loop at lr_cols into lr_tbcol.

    str1 = lr_tbcol->if_wd_view_element~get_id( ).

    concatenate str1 '1' into str1.

    lv_tabix = sy-tabix.
    read table lt_name into fs_name index lv_tabix.

    if sy-subrc = 0.

      lr_input1 =
      cl_wd_input_field=>new_input_field(
          bind_value          = fs_name-str "Node.attibute name to be bound
          enabled             = abap_true
          id                  = str1
*        on_enter            =  ON_ENTER
*        read_only           = 'X'
*    VIEW                = VIEW

             ).

lr_input1->bind_read_only( path = 'SFLIGHT.READONLY' ).

lr_tbcol->set_table_cell_editor( the_table_cell_editor = lr_input1 ).

endif.

clear str1.

clear fs_name.

clear lr_tbcol.

endloop.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question