Skip to Content
avatar image
Former Member

making Table fields editable in WDA

I have a table with 1 column, right now i can make entire column editable or non-editable.

my requirment is i want some filelds need to be editable and some non-editable in the same column

can any body help me in this regards,

Thanks,

Shaik

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Nov 20, 2008 at 08:44 AM

    Hi Shaik,

    One method of doing this is:

    1. In the context node, say 'NODE1', which is binded to the table, define one more attribute say, 'ENABLE', of the type 'WDY_BOOLEAN'.

    2. Depending on you want to enable or disable the table row, Set or Reset the value of the attribute for that perticular row.

    This way you can disable/enable few fields in the table.

    Regards,

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 20, 2008 at 09:11 AM

    Hi Shaik,

    you have to bind your table column's enable property with a context attribute of type WDY_Boolean and according to lead selection or index or while binding the table depending on your condition you have to set the value ABAP_TRUE and ABAP_FALSE.

    regards

    pranav

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      first create a context attribute in the node you are using for table and bind it with wdy_boolean.

      you can use the code below

      DATA lo_nd_cn_table TYPE REF TO if_wd_context_node.

      DATA lo_el_cn_table TYPE REF TO if_wd_context_element.

      DATA ls_cn_table TYPE wd_this->element_cn_table.

      DATA it_table TYPE wd_this->elements_cn_table.

      DATA wa_table TYPE wd_this->element_cn_table.

      wa_table-ca_one = ' '.

      wa_table-ca_two = ' '.

      wa_table-ca_three = ' '.

      wa_table-ca_enable = ABAP_TRUE.

      APPEND wa_table to it_table.

      wa_table-ca_one = ' '.

      wa_table-ca_two = ' '.

      wa_table-ca_three = ' '.

      wa_table-ca_enable = ABAP_FALSE.

      APPEND wa_table to it_table.

      wa_table-ca_one = ' '.

      wa_table-ca_two = ' '.

      wa_table-ca_three = ' '.

      wa_table-ca_enable = ABAP_TRUE.

      APPEND wa_table to it_table.

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

      lo_nd_cn_table = wd_context->get_child_node( name =

      wd_this->wdctx_cn_table ).

      • get element via lead selection

      lo_el_cn_table = lo_nd_cn_table->get_element( ).

      lo_nd_cn_table->bind_table( it_table ).

      i am not sure of your requirement but with this code you will get table with 3 column and 3 rows with centre cell in non editable mode.

      regards

      Pranav

  • Nov 20, 2008 at 09:39 AM

    Hi Shaik,

    It is possible to create an editable table control in webdynpro. 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

    Regards,

    Uday

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 20, 2008 at 11:58 AM

    hello pavan and uday,

    the problem has been solved , than you very much.

    Regards,

    Shaik Shadulla.

    Add comment
    10|10000 characters needed characters exceeded