on 05-26-2009 9:52 AM
Hello All,
I created a Webdynpro ALV report in which I have assigned a color to some cells using the following tutorial :
The problem is that when I want to sort a column, all the colors disappear.
Do you know how to keep the assignment of the colors to the cells after a sorting?
Thank your for your help.
Regards,
Hi,
I have gone through the document and i think instead of using attribute "celldesign" we can use the method "SET_CELL_DESIGN" of class "CL_SALV_WD_COLUMN" to set the cell design.
Avoid using "celldesign" attribute to set the cell design and insted of that, get the column "Airline"(l_column1 in the document) and call the method l_column1->set_cell_design( CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-badvalue_light )
It will solve the sorting issue.
Thanks,
Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
I tried your way to do but it doesn't work, and honestly I don't know why using the method "set_cell_design" would work better than changing directly the attribute "celldesign", because the method is doing the same thing.
Here is my code in the method that builds the ALV :
...
WHEN 'DURA_ACTUAL_WEEK'.
<fs_column>-r_column->set_position( 9 ).
lr_column_header = <fs_column>-r_column->get_header( ).
lv_text = cl_bsp_get_text_by_alias=>get_text(
language = sy-langu
alias = 'ZNXO_TIMESHEET/TOTAL_WEEK' ).
lr_column_header->SET_TEXT( lv_text ).
lr_column_header->SET_DDIC_BINDING_FIELD( '00' ).
<fs_column>-r_column->set_cell_design_fieldname( value = 'CELL_DESIGN_TOT' ).
<fs_column>-r_column->set_cell_design( CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-badvalue_light ).
FREE : lr_column_header, lv_text.
...
Hi,
I tried and it is working absolutely fine for me. check the follwoing code. let me know if you have further doubt.
DATA LR_COLUMN TYPE REF TO CL_SALV_WD_COLUMN.
DATA lv_value TYPE REF TO cl_salv_wd_config_table.
lv_value = lo_interfacecontroller->get_model(
).
CALL METHOD lv_value->if_salv_wd_column_settings~get_column
EXPORTING
id = 'CARRID'
receiving
value = LR_COLUMN
.
CALL METHOD lr_column->set_cell_design
EXPORTING
value = CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-badvalue_light
.
Thanks,
Rahul
Hello All,
I think I have found the issue.
In fact the columns settings are good, so we can change directly the attribute "celldesign" or we can use the method "set_cell_design", both are working.
But at the end of my columns settings I have this code :
*---- Set table settings -
>
lr_config->IF_SALV_WD_FUNCTION_SETTINGS~SET_ENABLED( abap_true ).
lr_config->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_CHECK_AVAILABLE( abap_false ).
lr_config->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_APPEND_ROW_ALLOWED( abap_false ).
lr_config->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_DELETE_ROW_ALLOWED( abap_false ).
lr_config->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_INSERT_ROW_ALLOWED( abap_false ).
lr_config->IF_SALV_WD_TABLE_SETTINGS~SET_SELECTION_MODE( '08' ). "Multiple selection
lr_config->IF_SALV_WD_TABLE_SETTINGS~SET_DESIGN( '00' ). "Alternating
lr_config->IF_SALV_WD_STD_FUNCTIONS~SET_PDF_ALLOWED( abap_false ). "Deactivate "Print Version"
lr_table_settings ?= lr_config.
lr_table_settings->set_read_only( abap_false ).
I am disabling the standard functions "CHECK", "APPEND_ROW", "DELETE_ROW", "INSERT_ROW".
When I comment those 4 methods, the sorting is working well and the colors remain in the cells.
Do you know why ??
How can I fix that?
Hi,
I dont see any reason why it should not work.
I still feel there is something wrong with your code while setting the cell design of the column.
It is good that you are able to acheive your column color using "set_cell_design" method of CL_SALV_WD_COLUMN. Sorting will work fine with this. Enjoy.
Thanks,
Rahul
Hi,
As i said, i dont see anything wrong in your code which harm the sorting functionality.
If you still want then i would suggest you to comment the follwoing line:
lr_config->IF_SALV_WD_FUNCTION_SETTINGS~SET_ENABLED( abap_true ).
Get the table settings properly for the required column.
Although it is also right: lr_table_settings ?= lr_config.
but use the method get_column to set the specific column settings.
Thanks,
Rahul
Hi,
I found out the issue.
The colors disappear after a sort because the layout of the ALV is declared as "Alternating" :
lr_config->IF_SALV_WD_TABLE_SETTINGS~SET_DESIGN( '00' ). "Alternating
If I set the design to standard it works :
lr_config->IF_SALV_WD_TABLE_SETTINGS~SET_DESIGN( '01' ). "Standard
I think the Alternating display is incompatible when we use cell_design.
Nobody can help?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.