cancel
Showing results for 
Search instead for 
Did you mean: 

editable web dynpro table

Former Member
0 Kudos

Sorry for the probably dumb question but does anyone know how to make a ABAP web dynpro table editable? both specific rows and the whole table?

Regards

Mart

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Mart,

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.

Answers (4)

Answers (4)

Former Member
0 Kudos

Appologies for the delay but thankyou everyone for your replies, my table is now working a treat.

Regards

Mart

uday_gubbala2
Active Contributor
0 Kudos

Hi Mart,

I now explain you the scenario to make selected fields 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

Former Member
0 Kudos

Hi Mart,

I already answered the same in the below thread.please check this once.

Former Member
0 Kudos

Hi Mart,

for making a table UI element editable ,wt you have to do is to bind an internal table(having initial lines) to ur table node like:

DATA lo_nd_cn_table TYPE REF TO if_wd_context_node.

DATA lo_el_cn_tableTYPE REF TO if_wd_context_element.

DATA ls_cn_cn_table TYPE wd_this->element_cn_table.

DATA lt_table TYPE wd_this->elements_cn_table.

DATA ls_table TYPE wd_this->element_cn_table.

  • navigate from <CONTEXT> to <CN_DARTDETAILS> via lead selection

lo_nd_cn_table = wd_context->get_child_node( name = wd_this->wdctx_cn_table ).

//AS many rows u want editable append that many initial lines.

do 5 times.

append ls_table to lt_table.

enddo.

lo_nd_cn_table->bind_table( lt_table ).

it works fine.in any issue ,get back.

Regards

govi

where cn_table is the node to which u have binded ur table ui.