cancel
Showing results for 
Search instead for 
Did you mean: 

How to make selected row of normal table as editable in webdynpro abap

Former Member
0 Kudos

hi all,

How to make a row of a normal table as editable on click of a button action.

i have a requirment like i m displaying 10 records in a table onselect event i m geting selected row index. after that when i click on change button the selected row should come in editable mode to allow user to change data.

i refered the link: http://scn.sap.com/thread/1055753

select * from sflight

  into corresponding fields of table it_flights up to 100 rows.

loop at it_flights into ls_flights .

if ls_flights-price = '185.00'.

    ls_flights-readonly = abap_true.

else.

     ls_flights-readonly = abap_false.

endif.

append ls_flights to it_final.

endloop.

data: obj_table type ref to cl_wd_table,

      lr_column type ref to cl_wd_table_column,

      lr_column1 type ref to cl_wd_table_column,

      lr_input type ref to cl_wd_input_field,

      lr_input1 type ref to cl_wd_input_field.

obj_table ?= view->get_element( 'TABLE1' ). HERE ITSELF ITS GOING FOR DUMP AS NULL VALUE REFERENCE ERROR  I GAVE TABLE1 AS ID.

obj_table->set_visible_row_count( value = 50  ).

lr_column = obj_table->get_column(

               id         = 'TABLE1_PRICE'

*              INDEX      = INDEX

                 ).

lr_input = cl_wd_input_field=>new_input_field(

      bind_value          = 'FLIGHTS.PRICE'

      id                  = 'IP1'

        ).

  lr_input->set_read_only( value = abap_false   ).

lr_input->bind_read_only( path = 'FLIGHTS.READONLY'   ).

*Path means your nodename.attribute name

lr_column->set_table_cell_editor( the_table_cell_editor = lr_input  ).

Can any one help me in this issue or is there any other way to achieve this requirement?

Regards,

Santhosh

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

Refer to this document which I created jus now   http://scn.sap.com/docs/DOC-27125

Hope this helps u.,

Thanks & Regards,

Kiran

Former Member
0 Kudos

Hi Kiran,

Thanks  a lot it solved my problem i gave 10 points..

Can you please help me in another post: http://scn.sap.com/thread/3163226

Regards,

Santhosh.

Answers (2)

Answers (2)

Former Member
0 Kudos

HI,

You can do this. Create an attribute inside the same table node of type boolean. bind the attribute to the read only property of all your columns. In your Onselect event of the table get the selected element reference using get_lead_selection method. from the element referenc get all the values --> change the attribute value as space (to make it as editable) and set the values again in the row.

Hope this explains..

Thanks

Rupachandran

Former Member
0 Kudos

Hi,

For all the Table Columns, create two variants. One with TextView and other with Inout field. Initially keep the variant as Text View. On the event handler for button, Just get the selected row and change the variant to Input field. In this way you can make the row editable.

Steps for variants.

1. Add an attribute of type string to the context node binded to table. say VARIANT.

2. Add two variants as explained above for each table Column  and add elements TextView and Input Field to them respectively. Assign different 'variant key' for both the variants. Say TXT for TextView Variant and INP For Input Field Variant

3. Bind SelectedCellVariant Property of the table column with the attribute VARIANT created above.

4. In WDDOINIT set the attribute VARIANT of all the elements of the node as TXT

5. On button click set the attribute VARIANT of the selected element as INP.