cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a table row or a particular attribute read-only

Former Member
0 Kudos

Hi Experts,

I want to make some rows or fields of rows read-only depending upon some condition.

Can anyone can suggest me how to do that?

Thanks in advance,

Subhasis

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

create another context attribute in your context node binded to the table control

context attribute - 'READONLY' of type WDY_BOOLEAN

bind this attribute to the readonly property of all the cell editors in your table

while filling the values in the context node also fill the READONLY attribute based on your condition

for readonly put ABAP_TRUE to make it write set the value as ABAP_FALSE

Abhi

Former Member
0 Kudos

Hi Abhi,

thanks for your reply.

Answers (2)

Answers (2)

TomVanDoo
Active Contributor
0 Kudos

Use the properties of your table context

every attribute of your context has some properties

namely:

-Read_only

-Enabled

-Visible

-Required

-Final

they are at attribute level

bind the field-properties of your table to these attribute properties

in your supply function, where you bind the data into the context, loop over your table

bind every row one by one through bind_element (where initial setting is false)

now you have an interesting method on the element (which is returned from the bind funtion) Set_attribute_props_for_elem

you supply this method with a table of all elements and their respective properties that you want to set.

at runtime, these properties can still be adjusted in for example, event handlers, plug handlers, even in ALV functions. (do note, for ALV you'll need to have an attribute SALV_WD_TABLE_INDEX.

I can't tell you why you need that extra attribute, but i'm suspecting that i'm abusing a little bug there. (or that the component is bugged for needing that attribute)

Former Member
0 Kudos

Hi,

actually my question was.....i have binded the table with a context node and input field as cell editor.

Now i want some row or cells of a read-only which meets a particular condition.

I dont want entire colomn read only.

Can you or anybody else help me on these?

thanks,

Subhasis

Former Member
0 Kudos

You have to work with "TableCellVariants",

if you want enable custom behaviour for TableRows (orCells)

check also this Thread: [Making selected rows of a table control editable|]

Former Member
0 Kudos

You can also create separate context attributes for each and every column in the table and fill this with value 'ABAP_TRUE' or 'ABAP_FALSE' as you loop through the table in the method. This will help in editing individual cells of the table.

Make sure you don't use 'BIND_TABLE', instead use 'BIND_STRUCTURE' and also change the value of the context attribute in the loop pass of the internal table.

Regards,

Satheesh.

Former Member
0 Kudos

create one context attribute in your context node bind it to the table control

context attribute - 'READONLY' of type WDY_BOOLEAN

bind this attribute to the readonly property of the cell editors which you want as read ony.

depending upon your condition for which you want your row as read only, set the value of attribute as readonly.

it will make desirable rows as readonly.

e.g

LOOP AT lt_vbak INTO wa_vbak.

IF wa_vbak-erdat = 'sys-date'.

wa_vbak-readonly = abap_true.

ELSE.

wa_vbak-readonly = abap_false.

ENDIF.

Edited by: Neha Thukral on Aug 26, 2008 11:53 AM