Skip to Content
avatar image
Former Member

ALV GRID: How can i change the color of a COLUMN

I am using the cl_gui_alv_grid class very often and it works norally very well. But now i have a request to change the color of a GRID-COLUMN.

SAP Help shows you a solution which works in this way:

Release 4.7

DATA: BEGIN OF GT_OUTTAB OCCURS 0.

INCLUDE STRUCTURE <DDIC-Struktur>.

DATA: CT TYPE LVC_T_SCOL. "Table for colors

DATA: END OF GT_OUTTAB.

But if you use it in this way; following errors occurs:

1.) You have to use the table type : ANY TABLE in the method: me->set_table_for_first_display

2.) if you add the type LVC_T_SCOL to your DDIC-Structure, then an error occurs: you cannot use an table-type in a flat structure!

3.) The LVC_T_SCOL contains field names, they are not permitted. (for exp. INT ...)

Can somebody help me, to solve this problem?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • May 03, 2004 at 08:45 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 03, 2004 at 10:15 AM

    Hello Peter,

    Thank You for Your prompt replay.

    I was afraid to do it in this way 😊

    So i have to build the fieldcat manually instead using the FILEDCAT_MERGE ...

    Anyway, it works!

    Thank You and BR

    Michael

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Michael,

      I'm happy that it works.

      You can use FM LVC_FIELDCATALOG_MERGE to generate a fieldcatalog based on a DB table, than you can loop on the fieldcatalog and modify what you need.

      Incho