cancel
Showing results for 
Search instead for 
Did you mean: 

making Table fields editable in WDA

Former Member
0 Kudos
266

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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,

Answers (3)

Answers (3)

Former Member
0 Kudos

hello pavan and uday,

the problem has been solved , than you very much.

Regards,

Shaik Shadulla.

uday_gubbala2
Active Contributor
0 Kudos

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

pranav_nagpal2
Contributor
0 Kudos

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

Former Member
0 Kudos

hello pranav,

with the above to methods i can enable and disable entire column, but i need specific cell to be enable

for example i have a table with 2 columns and 5 rows, i need second row second cell only in enabled.

Thanks,

Shaik Shadulla.

pranav_nagpal2
Contributor
0 Kudos

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