on 05-25-2009 1:50 PM
Hello,
im trying to Color some Cells in a Webdynpro ALV.
So far i found out that there are maybe two ways:
one like this with WDUI_TABLE_CELL_DESIGN
but i didnt find out, how to color specified Cells. With this example it is only possible to color the column by the saved color.
the other way is to append a color table to ich column LVC_T_SCOL
and after that
* We will set this COLOR table field name of the internal table to
* COLUMNS tab reference for the specific colors
TRY.
lo_cols_tab->set_color_column( 'T_COLOR' ).
CATCH cx_salv_data_error. "#EC NO_HANDLER
ENDTRY.
http://help-abap.blogspot.com/2008/10/salv-table-9-apply-colors.html
but i dont works in Webdynpro ALV. or has someone an idea?
i hope someone can help me.
greets,
Sascha
Hi,
Check out this link
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/abapWebDynproALV-ChangeCellColourbasedonContent
Regards,
Lekha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
its very near but the problem is, i have to work with a colortable
because die itab looks like this
workgroup | skill | pt1 | pt2 | pt3 | pt4 | pt5|
and for example: if pt1 has the cheapest price, cell pt1 ind line 1 hast to be colored green.
or if pt1 and pt2 and pt5 are cheapest and have the same amount. they all have to be colored green.
the nearest solution i found was the one with de colortable type LVC_T_SCOL, but it dont works with WD ALV maybe i didnt found the right way.
Hi ,
Check this thread, [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71393]
In your case you will have to create 1 attribute ( type WDY_UIE_LIBRARY_ENUM_TYPE ) for every column. ( for eg: c1, c2, c3 ,c4 , c5 for pt1 pt2 pt3 pt4 pt5 respectively ) and bind it as follows,
*---------- Column settings
DATA: l_column_settings TYPE REF TO if_salv_wd_column_settings.
l_column_settings ?= lo_value.
* Get columns
DATA: lt_columns TYPE salv_wd_t_column_ref ,
ls_columns TYPE salv_wd_s_column_ref .
DATA: l_column_header TYPE REF TO cl_salv_wd_column_header .
lt_columns = l_column_settings->get_columns( ) .
LOOP AT lt_columns INTO ls_columns .
CASE ls_columns-id .
WHEN 'PT1' .
l_column_header = ls_columns-r_column->get_header( ) .
l_column_header->set_ddic_binding_field(
if_salv_wd_c_column_settings=>ddic_bind_none ) .
ls_columns-r_column->set_cell_design_fieldname( value = 'C1' ). "binding C1 is attribute
WHEN 'PT2' .
l_column_header = ls_columns-r_column->get_header( ) .
l_column_header->set_ddic_binding_field(
if_salv_wd_c_column_settings=>ddic_bind_none ) .
l_column_header->set_text( 'Item No' ) .
ls_columns-r_column->set_cell_design_fieldname( value = 'C2' ). " binding
........similarly continue for all the columns.
Now modify your internal table based on your condition and set the required color as follows,
LOOP AT lt_alv INTO ls_alv.
if pt1 is lowest.
ls_alv-color1 = '02'. " green
elseif pt2 is lowest.
ls_alv-color2 = '03'. "red
endif.
MODIFY lt_alv FROM ls_alv INDEX sy-tabix.
ENDLOOP.
* Bind Data to ALV
cn_alv->bind_table( lt_alv ).
Hope it helps!
Radhika.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
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.