cancel
Showing results for 
Search instead for 
Did you mean: 

Adding an editable row in an non editable table.

Former Member
0 Kudos

Hi,

My requirement is to add an Editable row in a table which is in display mode only, i mean i cannot edit the data that is present in the table.

But if the user presses the Add Row button on the Table Toolbar, a new editable row should be added in the end, so that he can save the new data entered.

methods tried:

1: I have used Inputfield as Cell Editors, with their Read only Property check marked, thougt that with the new element created, it would not be Read Only.

2: Binded the read only property with a context attribute, but still was not able to achieve this functionality.

3: Tried the above two steps with the "Enabled" property of the Table Coloumn Cell Editors as well, but no result.

Please give me some pointers on this.

Regards,

Ashish

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ashish,

Read the last line in the code as:

elem_table->set_static_attributes( static_attributes = stru_table )

instead of

elem_new_row->set_static_attributes( static_attributes = stru_table ).

Pratibha

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Ashish,

The approach you were following was correct, but I am not sure where you have placed the Enabled property attribute in the context.

Please follow these steps:

1. The table you are creating should have the enabled property set.

2. The context with you are binding the table should have an additional attribute say ISENABLED of type boolean.

3. Bind this attribute with the ENABLED property of all the input enabled fields in your table.

4. When binding the non-editable data into the table, set this property to ABAP_FALSE for each record. This will make the existing data non editable.

5. Use the below code for adding a new row and set the ISENABLE property of the added row to ABAP_TRUE.

elem_table = node_table->create_element( ).

node_table->bind_element( new_item = elem_table set_initial_elements = abap_false ).

stru_table-isenable = abap_true .

elem_new_row->set_static_attributes( static_attributes = stru_table ).

Let me know how you go about it.

Cheers,

Pratibha