cancel
Showing results for 
Search instead for 
Did you mean: 

Only first row editable in WD table

matteo_montalto
Contributor
0 Kudos

Hi gurus,

I'm dealing with a simple WD Table (CL_WD_TABLE) which has only two columns, say A and B.

While B would contain an inputfield and should be always editable, for column A I need to implement the following logic:

- input field enabled for the first row;

- field not enabled (read only) elsewhere.

Now... I know the best way to implement such a logic is binding column A cellEditor's READONLY property to an attribute which belongs to the row.

The problem here is that the Node (table source) is bound to a DB structure which doesn't have a "readonly" field and I cannot modify it.

I was thinking that maybe a cellVariant could do the magic. But... is there a way to setup a cellVariant to state that

if row index = 1 then -> inputfield

else.

   --> textview

?


How can I overcome the problem without modifying datasource node structure?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

You can use cell Variant( to make this scenario complex) but it's not required for this scenario. You can simply bind the read only property of 'B' to the same attribute to which the value is bound but to the property read only of that attribute. and then use set_attribute_property( ) method.

if row index = 1.

lo_el_flight->set_attribute_property(

        attribute_name `B`       " your attribute name

        property = 3    " Property 3 - Read Only

        value =  ' ' ).  " Enable

else

lo_el_flight->set_attribute_property(

        attribute_name `B`

        property = 3  

        value = 'X' ). " Disable

endif.


Check this document for reference: http://scn.sap.com/docs/DOC-27125

Hope this helps u,

Regards,

Kiran

Answers (1)

Answers (1)

venkat_ratnam3
Explorer
0 Kudos

Hi Matteo ,

for the read-only field : one option we have is you can remove the structure name from the context properties, which would still give you the attribute structure of the dictionary but here in this case we need to take care of the mapping structure as the attributes are now different .

another thing is we can create our own structure copying the standard structure and add our field  .

regarding the enabling of field for first row we can loop over the internal table, which we are going to bind the table read the index as your idea and set the attribute of context bound to that .

thanks ..