Skip to Content
avatar image
Former Member

row color in dynamic tables

Hi,

I am currently programming dynamic tables and want to

specify the color of a new row. Obviously, this has to be done in method ->new_row:

CALL METHOD valid_reference->new_row

EXPORTING sap_style = sap_style

sap_color = sap_color

sap_fontsize = sap_fontsize

sap_fontstyle = sap_fontstyle

sap_emphasis = sap_emphasis.

Unfortunately, I did not get any information on how to specify sap_color. Can anyone post an example or state some reference, please.

Thanks

Klaus

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Jun 29, 2004 at 10:08 AM

    I have no idea how to do this, but did you try using the color constants that you would use in the WRITE statement?

    eg. WRITE x COLOR col_total.

    Scott

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 29, 2004 at 10:40 AM

    Hallo Klaus,

    Use a field CHAR(04) and following example-code:

    ..gf_cntrl...

    farbe(04) type c,

    ยดยดยดยด

    gc_colc211 LIKE gf_cntrl-farbe VALUE 'C211',

    gc_colc311 LIKE gf_cntrl-farbe VALUE 'C311',

    The code is a logical addition of color attributes i guess.

    Hope i could help You

    BR

    Michael

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hallo Michael,

      Sorry for asking again, but I cannot really understand

      what you intend me to do.

      what is ...gf_control...

      and how to use gc_colc211

      Would it be possible to add some more code, please.

      Tanks a lot

      Klaus

  • avatar image
    Former Member
    Jun 29, 2004 at 02:19 PM

    Hello Klaus,

    The gc_fields are just global constants whithin Your Program.

    Define a Field in Your ITAB type Character(04) and call it f.x. "FARBE"

    data: gf_layout type lvc_s_layo.

    data: gt_fldcat type lvc_t_fcat.

    constants: gc_colc211 LIKE gf_cntrl-farbe VALUE 'C211',

    gc_colc311 LIKE gf_cntrl-farbe VALUE 'C311'.

    c_fldfarb like f_fldcat-fieldname value 'FARBE'. " Name of the Field

    Fill the structure gf_layout with the name of the Color field:

    gf_layout-info_fname = c_fldfarb.

    Modify the fieldcat-table in this way, that the field "FARBE" should not be displayed (hidden).

    read table gt_fldcat into gf_fldcat with key fieldname = c_fldfarb.

    if sy-subrc = 0.

    gf_fldcat-no_out = 'X'.

    modify gt_fldcat from gf_fldcat index sy-tabix.

    endif.

    if you want to change the color, loop at the itab:

    loop at gt_itab into gf_itag.

    h_mod = sy-tabix mod 2.

    if h_mod = 0.

    gf_itab-farbe = c_colc211.

    else.

    gf_itab-farbe = c_colc311.

    endif.

    modify gt_itab from gf_itab.

    endloop.

    Hope i could help You

    BR

    Michael

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 29, 2004 at 05:18 PM

    Hi!

    Is Klaus talking about adding a new row for an ALV gird or something else? Because, as much as I know, ALV grid class has no method as "new_row" (of course this may be a method of a locally defined event handler but it doesn't seem so) or features like "fontsize", "fontstyle".

    So, what Klaus means by "dynamic table" is not an ALV grid instance, is it?

    *--Serdar

    Add comment
    10|10000 characters needed characters exceeded