on 09-25-2008 12:08 PM
In a view i have a table with three columns.
if i click a button 'ARRANGE' , the third column should get disabled or should not be visible.
Hi Manjunath,
You can use the same technique that I had prescribed in the [other thread|; for you.
Put this coding into the button click event. You just have to pass the column number using INDEX to the remove_column( ) or remove_grouped_column( ) of cl_wd_table. This would result in the desired column disappearing from your table.
(m_table is an view attribute of type cl_wd_table. I have saved the reference of the table into this variable in the WDDOMODIFYVIEW method)
lr_column = wd_this->m_table->remove_column( INDEX = 3 ).
As how I said earlier if the above code results in a NULL assignment exception give it a try with the code as below:
lr_column = wd_this->m_table->remove_grouped_column( INDEX = 3 ).
Hope that this helps resolve your problem.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am going to put the same adivce that I just placed in your other thread as well (please try to avoid duplicate threads as well - these two are very closely related). The suggestion that you should do dynamic manipulation outside the WDDOMODIFYVIEW should be avoided for the reasons I already gave. Once again, the use of context binding to the Visible property of the context should be the prefered method over the use of dynamic coding.
Hi Jung ,
Can you assist me in this case ?
I have 10 columns. In the Column Properties, i have binded the Cell Design Attribute to first two columns and written the following code. The four columns are getting colored. But Instead of binding statically, i want to bind the cell design property of the table column dynamically. I mean to say that i want to get the columns colored dynamically. How can i get this ?
I have even tried to in the modify view , getting the instance of CL_WD_TABLE. But if i get the insatance of CL_WD_TABLE_COLUMN , then i thin using the SET_CELL_DESIGN method we can set dynamically. How can i get the instance of CL_WD_TABLE_COLUMN
Hi Manjunath,
First get the column id using the method GET_COLUMN( ) of class CL_WD_TABLE. You can then use the SET_CELL_DESIGN( ) method of CL_WD_TABLE_COLUMN to get the desired affect. However as how Thomas has been pointing please dont resort to dynamic UI modifications unless you can't achieve the same statically. You can use this dynamic modifications in other methods just for learning dynamic programming in webdynpro but shouldnt use it in actual developments. You should only modify the UI in the WDDOMODIFY view.
Regards,
Uday
Hi Uday,
Please see the below code. I used the same way. But i am getting the error as "Method GET_COLUMN is unknown or Protected or Private"
DATA: view_elemt TYPE REF TO if_wd_view_element,
v_id TYPE string,
the_column TYPE REF TO cl_wd_table_column.
v_id = 'TABLE'.
CALL METHOD view->get_element
EXPORTING
id = v_id
RECEIVING
element = view_elemt.
DATA:colmns TYPE REF TO cl_wd_table_column.
v_id = 'TABLE_DAY07'.
CALL METHOD view->get_column
EXPORTING
id = `TABLE_DAY07`
index =
receiving
the_column = colmns.
eve tried in this way also. Still the same above error
v_id = 'TABLE'.
CALL METHOD view->get_element
EXPORTING
id = v_id
RECEIVING
element = view_elemt.
DATA:colmns TYPE REF TO cl_wd_table_column.
v_id = 'TABLE_DAY07'.
CALL METHOD view_elemt->get_column
EXPORTING
id = `TABLE_DAY07`
index =
receiving
the_column = colmns.
Hi Manjunath,
You are using it the incorrect way when you say as "CALL METHOD view->get_column( )"
Here view is of type if_wd_view.
The get_column( ) is a method of cl_wd_table.
So first you get the reference of the table into a variable of type ref to cl_wd_table.
data: lr_table type ref to cl_wd_table,
lr_column type ref to cl_wd_table_column.
lr_table ?= view->get_element( id = 'TABLE' ).
lr_column = lr_table->get_column( id = 'TABLE_PRICE' ). " Pass your column id in here
Regards,
Uday
Hi Uday,
Thanks for the code. I have just copy pasted the code. Instead of TABLE_PRICE, i have used my column ID which is in the layout.
EX:
data: lr_table type ref to cl_wd_table,
lr_column type ref to cl_wd_table_column.
lr_table ?= view->get_element( id = 'TABLE' ).
lr_column = lr_table->get_column( id = 'TABLE_DAY07' ).
But the lr_column value is initial.
Hi Manjunath,
Well this is due to the fact that the Table UI element has been enhanced and it now includes what are called as grouped columns. Go through the last post by me [in this thread|;. I was facing the same problem & Thomas Szuecs had helped me out with it. You will have to use the GET_GROUPED_COLUMN( ) instead of the GET_COLUMN( ). Also keep in mind that you will have to do casting as GET_GROUPED_COLUMN( ) returns an element of type CL_WD_ABSTR_TABLE_COLUMN and not CL_WD_TABLE_COLUMN.
Please find a sample code snippet as below:
method WDDOMODIFYVIEW .
data: lr_column type ref to CL_WD_TABLE_COLUMN,
lt_cell_design type WDUI_TABLE_CELL_DESIGN.
wd_this->gr_table ?= view->get_element( id = 'TABLE' ).
lt_cell_design = '04'.
lr_column ?= wd_this->gr_table->get_grouped_column( id = 'TABLE_PRICE' ).
lr_column->SET_CELL_DESIGN( VALUE = lt_cell_design ).
endmethod.
Regards,
Uday
Hi Manjunath,
Am sorry had scribbled off that code in a hurry. It was a mistake from my end. Please find the correct code as below.
method WDDOMODIFYVIEW .
data: lr_table type ref to cl_wd_table,
lr_column type ref to CL_WD_TABLE_COLUMN,
lt_cell_design type WDUI_TABLE_CELL_DESIGN.
lr_table ?= view->get_element( id = 'TABLE' ).
lt_cell_design = '04'.
lr_column ?= lr_table->get_grouped_column( id = 'TABLE_PRICE' ).
lr_column->SET_CELL_DESIGN( VALUE = lt_cell_design ).
endmethod.
Regards,
Uday
Hi,
I have 10 columns. In the Column Properties, i have binded the Cell Design Attribute to first two columns and written the following code. The four columns are getting colored. But Instead of binding statically, i want to bind the cell design property of the table column dynamically. I mean to say that i want to get the columns colored dynamically. How can i get this ?
I have even tried to in the modify view , getting the instance of CL_WD_TABLE. But if i get the insatance of CL_WD_TABLE_COLUMN , then i thin using the SET_CELL_DESIGN method we can set dynamically. How can i get the instance of CL_WD_TABLE_COLUMN ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.