Skip to Content
author's profile photo Former Member
Former Member

Color a line in ALV Grid Control

<<Do not ask for or offer points>>

Hi all,

How to color a line in ALV Grid Control using OOPs.

The appropriate replies will be rewarded.

regards,

S Philip

Edited by: Matt on Dec 22, 2008 11:05 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 22, 2008 at 05:51 AM

    Hi,

    delare the work area like

    wa_layout TYPE lvc_s_layo.

    for filling the line with alternate colour.

    wa_layout-zebra = 'X'.

    the pass the following in the FM

    CALL METHOD obj_grid->set_table_for_first_display

    EXPORTING

    is_layout = wa_layout

    thanks

    Nitin Sachdeva

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 22, 2008 at 05:46 AM

    < http://sgstocks.tripod.com/alvgrid_control.htm>>

    Hi,

    To color a line, the structure of the table must include a Char4 field for color properties

    TYPES: BEGIN OF st_sflight.

    INCLUDE STRUCTURE zsflight.

    • Field for line color

    types: line_color(4) type c.

    TYPES: END OF st_sflight.

    TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.

    DATA: gi_sflight TYPE tt_sflight.

    • Loop trough the table to set the color properties of each line. The color properties field is

    • Char 4 and the characters is set as follows:

    • Char 1 = C = This is a color property

    • Char 2 = 6 = Color code (1 - 7)

    • Char 3 = Intensified on/of = 1 = on

    • Char 4 = Inverse display = 0 = of

    LOOP AT gi_sflight INTO g_wa_sflight.

    IF g_wa_sflight-paymentsum < 100000.

    g_wa_sflight-line_color = 'C610'.

    ENDIF.

    MODIFY gi_sflight FROM g_wa_sflight.

    ENDLOOP.

    • Name of the color field

    gs_layout-info_fname = 'LINE_COLOR'.

    • Grid setup for first display

    CALL METHOD go_grid->set_table_for_first_display

    EXPORTING i_structure_name = 'SFLIGHT'

    is_layout = gs_layout

    CHANGING it_outtab = gi_sflight.

    Regards,

    John

    Edited by: Matt on Dec 22, 2008 11:18 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 22, 2008 at 05:47 AM

    This message was moderated.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.