cancel
Showing results for 
Search instead for 
Did you mean: 

Making Table UI element editable

Former Member
0 Kudos

Hi All,

I need to make a table UI element editable. Im filled the table through internal table. I need to provide provision to edit the data epresent in table. Pls help me.

Thanks

Subathra

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

While creating the binding for the table itself, you can select the table cell editor as TextEdit / input field.

Regards

Shruti

Answers (2)

Answers (2)

uday_gubbala2
Active Contributor
0 Kudos

I now explain you the procedure to make only a few selected fields of the table as editable in WDA.

Just create the standard cell editors of the table control as, "Input Fields" instead of the normal 'TextView". (This can be done as follows... When you right click on the table UI element (under ROOTUIELEMENTCONTAINER) & say "Create Binding" you have the, "Standard Cell Editor" & "Standard Property" fields. Set "Standard Cell Editor" to "InputField" & "Standard Property" to "Value") Create a boolean attribute at component controller level & bind it to the readOnly property of the Table. (This variable should be under the same node which you are using for binding to your table ui element. If you dont create it under the same node then this variables value would stand true for all the cells under this column. If you however create it under the same node which you are using to bind your table then each cell of the column can have different true/false values resulting in different editable features.)Then within the WDDOINIT method you can You will then get the output as how desired.

Consider the code fragment below. It would result in all the fields which have the MEINS value equal to GM as read only & the rest would be editable. Hope this is clear to you now.

METHOD wddoinit .
  DATA: lv_node TYPE REF TO if_wd_context_node,
        lt_mara TYPE ig_componentcontroller=>elements_mara,
        wa_mara TYPE ig_componentcontroller=>element_mara.
 
  SELECT matnr
         ersda
         ernam
         mtart
         matkl
         meins FROM mara INTO CORRESPONDING FIELDS OF TABLE lt_mara
                                 WHERE meins = 'GM' OR meins = 'CCM'.
  SORT lt_mara BY meins.
 
  lv_node = wd_context->get_child_node( name = wd_this->wdctx_mara ).
  LOOP AT lt_mara INTO wa_mara.
    IF wa_mara-meins = 'GM'.
      wa_mara-readonly = 'X'.
    ELSE.
      wa_mara-readonly = ' '.
    ENDIF.
    MODIFY lt_mara FROM wa_mara TRANSPORTING readonly.
    lv_node->bind_structure(  SET_INITIAL_ELEMENTS = ABAP_FALSE
                              new_item = wa_mara ).
  ENDLOOP.
 
  lv_node->bind_table( new_items = lt_mara ).
ENDMETHOD.

Regards,

Uday

uday_gubbala2
Active Contributor
0 Kudos

Hi Subathra,

If you want to make your whole table editable then take all the cell editors of your table as input fields & then bind an initial internal table to your TABLE ui element. Am giving you a sample code fragment as to how you can bind an initial internal table to your node:

Regards,

Uday

METHOD wddoinit .
  DATA: lt_sflight TYPE if_main=>elements_sflight,
            wa_sflight TYPE if_main=>element_sflight,
            lv TYPE REF TO if_wd_context_node.
 
  DO 10 TIMES.
    APPEND wa_sflight TO lt_sflight.
  ENDDO.
  lv = wd_context->get_child_node( name = 'SFLIGHT' ).
  lv->bind_table( new_items = lt_sflight ).
ENDMETHOD.