Skip to Content
avatar image
Former Member

how to apply color to subtotal row in normal ALV

Hi Gurus,

How to apply color to subtotal row in normal alv.

Could you please provide the solution for this question.

thanks

dharani.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Sep 02, 2008 at 08:24 AM

    Hi,

    Check this code which may help you.

    1) add one more field to ur final internal table say COLOR(4)

    2) in layout wa_layout-style_fname = 'COLOR'. " if its grid

    wa_layout-style_fieldname = 'COLOR'. "if its list

    3) read table itab index 3.

    itab-color = 'C410'.

    modify itab index 3.

    4) see program SHOWCOLO for all color codes

    1. Add a field of data type CHAR(3) to the internal output table.

    2. Enter the color code in the appropriate field of the row to be colored in the internal

    output table:

    Code: 'Cxy'

    C = Color (all codes begin with 'C')

    x = color number ('1' - '9')

    y = highlight ('0' = off, '1' = on)

    3. Assign the internal output table color code field name to the IS_LAYOUT importing

    structure IS_LAYOUT-INFO_FIELDNAME field and pass this structure in the ALV call

    interface.

    To enable row coloring, you should add an additional field to your list data table. It should be of character type and length at least 4. This field will contain the color code for the row. So, letu2019s modify declaration of our list data table u201Cgt_listu201D.

    you should fill the color code to this field. Its format will be the same as explained before at section C.6.3. But how will ALV Grid know that you have loaded the color data for the row to this field. So, you make it know this by passing the name of the field containing color codes to the field u201CINFO_FNAMEu201D of the layout structure.

    e.g.

    ps_layout-info_fname = <field_name_containing_color_codes>. u201Ce.g. u2018ROWCOLORu2019

    You can fill that field anytime during execution. But, of course, due to the flow logic of screens, it will be reflected to your list display as soon as an ALV refresh occurs.

    You can color an entire row as described in the next section. However, this method is less time consuming.

    Coloring Individual Cells

    This is the last point about coloring procedures for the ALV Grid. The procedure is similar to coloring an entire row. However, since an individual cell can be addressed with two parameters we will need something more. What is meant by u201Cmoreu201D is a table type structure to be included into the structure of the list data table. It seems strange, because including it will make our list data structure deep. But anyhow ALV Grid control handles this.

    The structure that should be included must be of type u201CLVC_T_SCOLu201D. If you want to color the entire row, this inner table should contain only one row with field u201Cfnameu201D is set to space, some color value at field u201Ccolu201D, u201C0u201D or u201C1u201D at fields u201Cintu201D (intensified) and u201Cinvu201D (inverse).

    If you want to color individual cells, then for each cell column, append a line to this inner table which also contains the column name at field u201Cfnameu201D. It is obvious that you can color an entire column by filling this inner table with a row for that column for each row in the list data table.

    Regards,

    Rama.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 02, 2008 at 08:27 AM

    Hi Dharani,

    Here is a useful link to color a particular row in ALV:

    http://saptechnical.com/Tutorials/ALV/ColorSALV/Demo.htm

    Hope this will help.

    Regards,

    Nitin.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 02, 2008 at 08:28 AM

    Hi,

    Link:

    color-on-subtotal-in-alv

    Regards

    Adil

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 02, 2008 at 08:34 AM

    Is the subtotal is manually populated one ..?

    If you are using the SORT option it by default get the subtotal and Color also..

    Add comment
    10|10000 characters needed characters exceeded