cancel
Showing results for 
Search instead for 
Did you mean: 

Table view cell coloring using webdynpro

Former Member
0 Kudos

Hello Gurus,

I have a requirement in the table view(not alv) where in i need to color the particular table cell fied based when the field is empty.

let me tell you with an example.

e.g:

Airline    flightnumber    Currency    price

SQ        0400               dem

HQ                              usd            100

SD        3577                                 12

SM        0026            

The above table is what my output where i need to have colors for the blank fields.

* in the first row i need to have color design for price field

* in the second row i need to have color design for flight number field.

* in the third row i need to have color design for currency field.

* in the 4th row i need to have color design for currency & price field

can some one please help me out.

Thanks in Advance.


Accepted Solutions (1)

Accepted Solutions (1)

sireeshach
Explorer
0 Kudos

Hi Saikanth,

Add as many attributes as the number of columns for which you need to colour in the node which is bound to the table UI element. & bind the corresponding attribute to the "cellDesign" property of the corresponding column.


In your Example, there are 4 columns and 3 columns need to be colored.

So declare a node with 7 attributes (+ any extra attributes required based on the requirement).


Bind these 3 attributes (of the corresponding type) to the cellDesign property of the flightnumber, currency & Price columns respectively.


In the code before binding the table using the BIND_TABLE method, set these fields in the internal table to the color code values as required.



Hope this helps you.


Best Regards,

Sireesha Ch

Former Member
0 Kudos

This is my example

here i have binded 2attributes i.e flight number and airfare....

here i want red color only for airfare which is 6k and green color for flight number 0454 which i have mentioned the same in the coding.

but the problem is the entire row is getting colored for the binded attributes.

if u can see fare 6000 corresponding flight number is colored and similarly happened for the 2nd row.

sireeshach
Explorer
0 Kudos

From your example I can see that you have only one attribute COLOR, which is bound to the both the columns Flight number & Airfare.

Instead, have two variables and bind these to these 2 columns respectively. And in coding assign the corresponding color.

Hope from the below piece of code, you may understand what needs to be done.

IF wa-price = '6000'.

   wa-fare_color = 01.

ENDIF.

IF wa-connid = '0454'.

  wa-flight_color = 02.

ENDIF.

Regards,

Sireesha Ch

ramakrishnappa
Active Contributor
0 Kudos

Hi Sai,

Here you are using COLOR and binding cell design property of all columns to this. So same color gets filled in all bound cells.

You have to create individual attributes color1, color2, color3, and bind it to each column.

Regards,

Rama

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Guys,

My issue is solved

ramakrishnappa
Active Contributor
0 Kudos

Hi Sai,

You can have attributes in context node for coloring the cells with type WDUI_TABLE_CELL_DESIGN & bind the cell design of editor to respective attributes.

if <cell_1_value> is blank

          color_cell_1 = '02',

else.

          color_cell_1 = '00'.

endif.

Please refer the below document

coloring Table cells conditionally in Webdynpro ABAP…

Hope this helps you.

Regards,

Rama

Former Member
0 Kudos

for the three attributes i had did binding i.e flight number currency and price.

And even i have done the coding earlier that u have mentioned.

But the problem is in every row for all the three attributes the color is changing(if one field is blank and the rest of the fields are not blank.)

i will show you my example

here i have binded 2attributes i.e flight number and airfare....

here i want red color only for airfare which is 6k and green color for flight number 0454 which i have mentioned the same in the coding.

but the problem is the entire row is getting colored for the binded attributes.

if u can see fare 6000 corresponding flight number is colored and similarly happened for the 2nd row.