Skip to Content
avatar image
Former Member

Table view cell coloring using webdynpro

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.


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 06, 2015 at 06:54 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • Jan 06, 2015 at 06:50 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.

      s.PNG (11.4 kB)
      d.PNG (7.7 kB)
  • avatar image
    Former Member
    Jan 06, 2015 at 08:39 AM

    Thanks Guys,

    My issue is solved

    Add comment
    10|10000 characters needed characters exceeded