Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

line color in REUSE_ALV_GRID_DISPLAY row color depending of A FIELD VALUE

Hi!

I'm using the REUSE_ALV_GRID_DISPLAY FM and I have to display the line wich have c in a field in red and the other lines in green.

I'm displaying a Log table and I want to display errors in red and the other lines in GREEN.

I have a field in wich there is a letter to differenciate if the line has error or not.

Do someone know how can I do that?

Thanks.

Jorgelina.

Former Member
Former Member replied

Hi Ina,

Pls go through this program,

type-pools : slis.

types : begin of g_ty_data ,

matnr type matnr ,

werks type werks_d ,

color(4) type c,

End of g_ty_data.

Data : g_t_data type table of g_ty_data WITH HEADER LINE ,

g_t_cat type slis_t_fieldcat_alv WITH HEADER LINE,

g_r_layo type slis_layout_alv.

start-of-selection.

select matnr werks

into table g_t_data

from mard.

g_t_cat-fieldname = 'MATNR'.

append g_t_cat.

g_t_cat-fieldname = 'WERKS'.

append g_t_cat.

*----> Here you specify the field in the table containg the color code

g_r_layo-info_fieldname = 'COLOR'.

*--> Loop and assign color

LOOP AT g_t_data.

g_t_data-color = 'C600'.

modify g_t_data.

endloop.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

Regards

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question