Skip to Content

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

change the color of a row in ALV grid, using OOPS, SET_TABLE_FOR_FIRST_DISP

Please help!!!

Thanks in advance...

Former Member
Former Member replied

Hi Basant ,

You have to set the EMPHASIZE option in the field catalog and while creating the layout mention gd_layout-info_fieldname = 'LINE_COLOR'.

line_color is used to store row color attributes.

Pls refer to the code below

*Data Declaration



ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

statu TYPE ekpo-statu,

aedat TYPE ekpo-aedat,

matnr TYPE ekpo-matnr,

menge TYPE ekpo-menge,

meins TYPE ekpo-meins,

netpr TYPE ekpo-netpr,

peinh TYPE ekpo-peinh,

line_color(4) type c, "Used to store row color attributes

END OF t_ekko.

fieldcatalog-fieldname = 'EBELN'.

fieldcatalog-seltext_m = 'Purchase Order'.

fieldcatalog-col_pos = 0.

fieldcatalog-outputlen = 10.

fieldcatalog-emphasize = 'X'.

fieldcatalog-key = 'X'.

  • fieldcatalog-do_sum = 'X'.

  • fieldcatalog-no_zero = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

form build_layout.

gd_layout-no_input = 'X'.

gd_layout-colwidth_optimize = 'X'.

gd_layout-totals_text = 'Totals'(201).

  • Set layout field for row attributes(i.e. color)

gd_layout-info_fieldname = 'LINE_COLOR'.

  • gd_layout-totals_only = 'X'.

  • gd_layout-f2code = 'DISP'. "Sets fcode for when double

  • "click(press f2)

  • gd_layout-zebra = 'X'.

  • gd_layout-group_change_edit = 'X'.

  • gd_layout-header_text = 'helllllo'.

endform. " BUILD_LAYOUT

Hope this helps.



0 View this answer in context

Helpful Answer

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