Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Coloring of ALV Report with ZEBRA - COLOR SHOULD CHANGE ONLY WHEN VBELN CHA

0 Kudos

Hi,

I have a requirement in which i need to display a table in a ALV format. the table contains the values which are in the below format:

VBELN POSNR XXXX XXXXX XXXXX

1 10 xx xx xxx

1 20 xx xx xx

1 30 xx xx xx

2 00 yy yy yy

2 10 yy er dfsf

2 20 yy yy yy

3 00 zz zz zz

3 10 zz zz zz

i need to color the rows of ALV report in the alternative colors. ALL similiar VBELN should have one color.

for eg: VBELN 1 should have one color and VBELN 2 should have the other color. VBELN 3 should have the color given by VBELN 1( in the form of ZEBRA) . PLEASE help me out in this issue .

Edited by: shivu on Sep 5, 2008 11:38 AM

3 REPLIES 3

Former Member
0 Kudos

Hi,

Use the following code.

*For the layout

WA_LAYOUT-ZEBRA = 'X'.

WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

*For displaying the output

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_BYPASSING_BUFFER = ' '

I_SAVE = 'A'

I_CALLBACK_PROGRAM = ' '

I_CALLBACK_PF_STATUS_SET = 'F01_ALV_EVENT_PF_STATUS_SET'

I_CALLBACK_USER_COMMAND = 'F01_ALV_EVENT_USER_COMMAND'

IS_LAYOUT = WA_LAYOUT

IT_FIELDCAT = IT_FCAT[]

I_GRID_TITLE = W_GRIDTITLE

TABLES

T_OUTTAB = IT_OFIN[].

Former Member
0 Kudos

hi ,

I assume u know how coloring are done normally.

i hav just added the part of code for the logic of colring alternate vbeln.

DATA: l_flag TYPE c.

loop at it_vbak into wa_vbak.

refresh it_color.

clear wa_color.

at new vbeln.

if l_flag = ' '.

wa_color-fname = 'VBELN'.

wa_color-color-col = cl_gui_resources=>list_col_positive.

append wa_color to it_color.

clear wa_color.

l_flag = 'X'.

else.

wa_color-fname = 'VBELN'.

wa_color-color-col = cl_gui_resources=>list_col_negative.

append wa_color to it_color.

clear l_flag.

endif.

ENDAT.

wa_vbak-colinfo[] = it_color[].

modify it_vbak from wa_vbak.

endloop.

0 Kudos

Hi,

can you provide me the full coding