cancel
Showing results for 
Search instead for 
Did you mean: 

Row Colouring In Web Dynpro- Urgent

Former Member
0 Kudos

Hi,

I am using ALV control on screen and my requirement is to change the colour of specific rows of the ALV control depending on my business logic.

I know there is a way to change the color of ALV column using the api's provided. I would like to know, is there any way using which i can change the color of the ROW ??

Help will be rewarded!!!!

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

thanx alot all

Former Member
0 Kudos

tanx alot

Former Member
0 Kudos

Hi,

U will be having one Node for that ALV Table Know.Add one Attribute for eg., CELL_DESIGN of type WDUI_TABLE_CELL_DESIGN.In the Properties of Table Column Properties there is one Field Called CellDesign.U Map the Attribute CELL_DESIGN for the Column which u want Color.If u want for a Row then map that attribute for each column.

U cant set ur own colors for the Cell.In the CellDesign Property u will be having a Dropdown in which a list of values will be present u can make use of that colors.

U can give the CellDesign Colors from the [Documentation|http://help.sap.com/saphelp_nw2004s/helpdata/en/56/5e9041d3c72e7be10000000a1550b0/frameset.htm] such as badvalue_dark,badvalue_light,etc.,

During the Runtime,based on the condition u can set the Values for that Attribute Using SET_ATTRIBUTE.

For Eg.,

DATA lo_nd_table TYPE REF TO if_wd_context_node.

DATA lo_el_table TYPE REF TO if_wd_context_element.

DATA lt_table TYPE wd_this->elements_table.

DATA ls_table TYPE wd_this->element_table.

lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).

  • get element via lead selection

lo_el_table = lo_nd_table->get_element( ).

lo_nd_table->get_static_attributes_table(

IMPORTING

table = lt_table ).

loop at lt_table into ls_table.

if ls_table-text = '1'.

lo_el_table->set_attribute(

name = `CELL_DESIGN`

value = 'negative' ).

elseif ls_table-text = '2'.

lo_el_table->set_attribute(

name = `CELL_DESIGN`

value = 'positive' ).

endif.

endloop.

Regards,

Padmam.

Former Member
0 Kudos

Hi ,

It is possible to assign colors to a specific row. But you need to have some work around.

You have to create an extra attribute for each column that you have in your table. The type of that attribute should be of WDUI_TABLE_CELL_DESIGN.

After Instatiating your ALV Component you have to use the following statement for the column that you have to apply the color.

ls_column-r_column->set_cell_design_fieldname( COLUMN1_DESIGN ). Assuming ls_column-r_column will have COLUMN1 as filed name.

There are 16 colors that are defined and each combination from '00' to '15' will define one color.

Look at the structure below. Its a table with 4 columns(2nd and 4th represents colors for first and third columns)

value11 00 value12 00

value21 00 value22 00

value31 02 value32 02.

If you consider the above struture as your output table 3 rows and 4 columns then your third row will be highlighted in green color because 02 represents green. You can hide your second column and fourth column in above example because they represents colors. Use the following statement to hide those columns.

ls_column-r_column->set_visible(

cl_wd_uielement=>e_visible-none ). "ls_column-r_column will have 'COLUMN1_DESIGN'

Reward pts if found helpfull

Sathish

Former Member
0 Kudos

Hi,

Check this link,

Thanks.