Skip to Content
author's profile photo Former Member
Former Member

Change Color of Cell in ALV Grid

hii,

i want to change the color of particular cell on basis of some criteria in my alv grid

i am using FM

REUSE_ALV_GRID_DISPLAY

how to do that?

abhishek suppal

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2005 at 09:29 AM

    Hi

    In your output table you have to insert a field (for color) as SLIS_T_SPECIALCOL_ALV.

    DATA: BEGIN OF T_OUTPUT OCCURS 0,

    .......

    TCOLOR TYPE SLIS_T_SPECIALCOL_ALV,

    END OF

    DATA: GT_LAYOUT TYPE SLIS_LAYOUT_ALV.

    DATA: LT_COLOR TYPE slis_specialcol_alv.

    In the layout structure you have to indicate the name of field color:

    gt_layout-coltab_fieldname = 'TCOLOR'.

    When you're appending the record to show, you have to fill the data for cells color:

    • Values

    T_OUTPUT-FIELD1 = ....

    T_OUTPUT-FIELD2 = ....

    T_OUTPUT-FIELD3 = ....

    • Color

    REFRESH T_OUTPUT-TCOLOR.

    CLEAR LT_COLOR.

    LT_COLOR-FIELDNAME = 'FIELD1'.

    IF T_OUTPUT-FIELD1 =....

    LT_COLOR-COLOR-COL = '2'. "Number of color

    ELSE.

    LT_COLOR-COLOR-COL = '2'.

    LT_COLOR-COLOR-INT = '1'. "Intensified on/off

    ENDIF.

    APPEND LT_COLOR TO T_OUTPUT-TCOLOR.

    CLEAR LT_COLOR.

    LT_COLOR-FIELDNAME = 'FIELD2'.

    IF T_OUTPUT-FIELD2 =....

    LT_COLOR-COLOR-COL = '3'. "Number of color

    ELSE.

    LT_COLOR-COLOR-COL = '3'.

    LT_COLOR-COLOR-INT = '1'. "Intensified on/off

    ENDIF.

    APPEND LT_COLOR TO T_OUTPUT-TCOLOR.

    ...........

    APPEND T_OUTPUT.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 22, 2005 at 04:24 AM
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.