cancel
Showing results for 
Search instead for 
Did you mean: 

Cells color disappear after sorting columns in a Webdynpro ALV report

Former Member
0 Kudos

Hello All,

I created a Webdynpro ALV report in which I have assigned a color to some cells using the following tutorial :

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b7... .

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,

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

...

Former Member
0 Kudos

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

Former Member
0 Kudos

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?

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Rahul,

Please have a look on my last answer above.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Nobody can help?