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

ALV GRID, CHANGE ROW COLOR AFTER FIRST DISPLAY

HI FRIENDS,

I wants to change row color of an alv grid after it's first display.

for that i am using SET_TABLE_FOR_FIRST_DISPLAY method.

but now i want to change color of row within PAI event.

Can any one gives me code for that.

Thank you.

Regards,

Virat

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2007 at 09:04 AM

    hi,

    add one more column in ur internal table(which u r passing to that alv method) as zcolor with type CHAR OF LENGTH 4.

    AND PASS 'C211' value to that field. so that u can get color in ur alv grid.

    where c211 in which 2 is for color u can change this value for ur preference color.

    and pass this field zcolor to this field as gs_layout-info_fieldname

    gs_layout-info_fieldname = 'ZCOLOR'.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2007 at 09:07 AM

    *--- Internal table holding list data

    DATA BEGIN OF gt_list OCCURS 0 .

    INCLUDE STRUCTURE SFLIGHT .

    DATA rowcolor(4) TYPE c .

    DATA cellcolors TYPE lvc_t_scol .

    DATA END OF gt_list .

    then,

    DATA ls_cellcolor TYPE lvc_s_scol .

    ...

    READ TABLE gt_list INDEX 5 .

    ls_cellcolor-fname = 'SEATSOCC' .

    ls_cellcolor-color-col = '7' .

    ls_cellcolor-color-int = '1' .

    APPEND ls_cellcolor TO gt_list-cellcolors .

    MODIFY gt_list INDEX 5 .

    Hope this helps you,

    Regards,

    Pavan P.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2007 at 09:06 AM

    1 . add one more field to ur final internal table say COLOR(4).

    2. in layout

    wa_layout-info_fname = 'COLOR'.

    3. in PAI

    loop at itab.

    if sy-tabix LE 5.

    itab-COLOR = 'C410'.

    modify itab index sy-tabix.

    endif.

    endloop.

    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.