on 08-21-2008 10:15 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.