on 11-10-2010 4:39 AM
Hi,
I have found several posts/solution on how to disable a ALV Table column dynamically. But could not find any on a normal Table UI element. Can anyone please let me know how to do this or point me to an existing link?
I have a table with 6 columns and i want to make some of them read-only basing on some condition. I have bound the read-only attribute of the cell editors of the table columns to context attribute but by doing this the row is turning read-only and not the column. But i want the column to be read-only.
Thanks.
Aditya.
Hi Aditya ,
try this classes to dynamically change proporties of column of a table
CL_WD_TABLE
CL_WD_TABLE_COLUMN
create object for these to classe in your method , like below code
DATA : lo_element TYPE REF TO if_wd_view_element,
lo_table TYPE REF TO CL_WD_TABLE,
lo_table_col TYPE REF TO CL_WD_TABLE_COLUMN.
CALL METHOD view->get_element
EXPORTING
id = TBL_DETAIL'
RECEIVING
element = lo_element.
lo_table ?= lo_element.
IF lo_table IS BOUND.
CALL METHOD lo_tton->get_column
EXPORTING
id =
index = '02'
RECEIVING
the_choice = lo_table_col
.
IF lo_table_col IS BOUND.
CALL METHOD lo_table_col->set_visible
EXPORTING
value = ' '.
ENDIF.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>try this classes to dynamically change proporties of column of a table
>CL_WD_TABLE
>CL_WD_TABLE_COLUMN
I strongly recommend that you NOT follow this approach. Dynamic maniuplation of the UI element objects within WDDOMODIFYVIEW should be your absolute last resort. The recommendation is to bind the visible property of the TableColumn to a context attribute. You then control the visibility by simply changing the value of the corresponding context attribute.
Hi Thomas,
I agree. I want to do it in WDMODIFYVIEW only. But i am not finding any SET method for setting the read-only property to a table column. The above code will make the columns Invisible but that is not what i want. The column should be visible but in read-only mode. In the layout designer the Column does not have read-only property so i can bind it to a context attribute and manage. Only the CellEditor has the read-only property but by setting that, as i said, the row is turning read-only.
can you please advise?
Hi,
Use method set_attribute_property. Check this link.
http://help.sap.com/saphelp_nw04s/helpdata/en/45/d44e0cdff073b1e10000000a11466f/content.htm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.