7 Replies Latest reply: Feb 12, 2007 10:40 AM by Guest RSS

ALV color codes

Alvin Lim
Currently Being Moderated

Hi all,

 

I understand that the ALV grid color codes consists of the following format:

CXYZ

X = 0 - 7

Y,Z = 0 - 1

Is there any way to display color other than the above? I need a dark grey color (the color when the grid is set to not editable). Is there anywhere to do that? The intensity option is not helping much.

 

Thanks in advance.

  • Re: ALV color codes
    sreekanth reddy
    Currently Being Moderated

    1 gray-blue headers

    2 light gray list bodies

    3 yellow totals

    4 blue-green key columns

    5 green positive threshold value

    6 red negative threshold value

    7 orange Control levels

     

    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm

  • Re: ALV color codes
    Alvin Lim
    Currently Being Moderated

    Hi, I understand I could get those standard colors by assigning from 0-7. My actual question is whether it is possible to get more colors other than those. Thanks in advance.

  • Re: ALV color codes
    Sankar M
    Currently Being Moderated

    Hi,

     

    Herewith i am sending for the sample code with alv grid report.

     

    REPORT  YMS_COLOURALV NO STANDARD PAGE HEADING.

     

    TYPE-POOLS: SLIS, ICON.

     

    DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

     

    DATA: BEGIN OF IMARA OCCURS 0,

              LIGHT(4) TYPE C,

              MATNR TYPE MARA-MATNR,

              MTART TYPE MARA-MTART,

              MAKTX TYPE MAKT-MAKTX,

              COLOR_LINE(4) TYPE C,

              TCOLOR TYPE SLIS_T_SPECIALCOL_ALV,  "cell

          END OF IMARA.

     

    DATA: XCOLOR TYPE SLIS_SPECIALCOL_ALV.

     

    START-OF-SELECTION.

     

      PERFORM GET_DATA.

      PERFORM WRITE_REPORT.

     

    ************************************************************************

    • Get_Data

    ************************************************************************

    FORM GET_DATA.

     

      WRITE ICON_GREEN_LIGHT AS ICON TO IMARA-LIGHT.

          IMARA-MATNR = 'ABC'.

          IMARA-MTART = 'ZCFG'.

          IMARA-MAKTX = 'This is description for ABC'.

      APPEND IMARA.

     

      WRITE ICON_YELLOW_LIGHT AS ICON TO IMARA-LIGHT.

          IMARA-MATNR = 'DEF'.

          IMARA-MTART = 'ZCFG'.

          IMARA-MAKTX = 'This is description for DEF'.

      APPEND IMARA.

     

      WRITE ICON_RED_LIGHT AS ICON TO IMARA-LIGHT.

          IMARA-MATNR = 'GHI'.

          IMARA-MTART = 'ZCFG'.

          IMARA-MAKTX = 'This is description for GHI'.

      APPEND IMARA.

     

      LOOP AT IMARA.

     

        IF SY-TABIX = 1.

          IMARA-COLOR_LINE = 'C410'.     " color line

        ENDIF.

     

        IF SY-TABIX = 2.                "  color CELL

          CLEAR XCOLOR.

          XCOLOR-FIELDNAME = 'MTART'.

          XCOLOR-COLOR-COL = '3'.

          XCOLOR-COLOR-INT = '1'.       " Intensified on/off

          XCOLOR-COLOR-INV = '0'.

     

          APPEND XCOLOR TO IMARA-TCOLOR.

     

        ENDIF.

     

        MODIFY IMARA.

     

      ENDLOOP.

     

    ENDFORM.                    "get_data

     

    ************************************************************************

    • WRITE_REPORT

    ************************************************************************

    FORM WRITE_REPORT.

     

      DATA: LAYOUT TYPE  SLIS_LAYOUT_ALV.

     

      LAYOUT-COLTAB_FIELDNAME = 'TCOLOR'.

      LAYOUT-INFO_FIELDNAME = 'COLOR_LINE'.

     

      PERFORM BUILD_FIELD_CATALOG.

     

    • CALL ABAP LIST VIEWER (ALV)

      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

        EXPORTING

          IS_LAYOUT   = LAYOUT

          IT_FIELDCAT = FIELDCAT

        TABLES

          T_OUTTAB    = IMARA.

     

    ENDFORM.                    "write_report

     

    ************************************************************************

    • BUILD_FIELD_CATALOG

    ************************************************************************

    FORM BUILD_FIELD_CATALOG.

     

      DATA: FC_TMP TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.

      CLEAR: FIELDCAT. REFRESH: FIELDCAT.

     

      CLEAR: FC_TMP.

      FC_TMP-REPTEXT_DDIC    = 'Status'.

      FC_TMP-FIELDNAME  = 'LIGHT'.

      FC_TMP-TABNAME   = 'IMARA'.

      FC_TMP-OUTPUTLEN  = '4'.

      FC_TMP-ICON       = 'X'.

      APPEND FC_TMP TO FIELDCAT.

     

      CLEAR: FC_TMP.

      FC_TMP-REPTEXT_DDIC    = 'Material Number'.

      FC_TMP-FIELDNAME  = 'MATNR'.

      FC_TMP-TABNAME   = 'IMARA'.

      FC_TMP-OUTPUTLEN  = '18'.

      APPEND FC_TMP TO FIELDCAT.

     

      CLEAR: FC_TMP.

      FC_TMP-REPTEXT_DDIC    = 'Material Type'.

      FC_TMP-FIELDNAME  = 'MTART'.

      FC_TMP-TABNAME   = 'IMARA'.

      FC_TMP-OUTPUTLEN  = '10'.

      APPEND FC_TMP TO FIELDCAT.

     

      CLEAR: FC_TMP.

      FC_TMP-REPTEXT_DDIC    = 'Material'.

      FC_TMP-FIELDNAME  = 'MAKTX'.

      FC_TMP-TABNAME   = 'IMARA'.

      FC_TMP-OUTPUTLEN  = '40'.

      FC_TMP-EMPHASIZE = 'C610'.   " color column

      APPEND FC_TMP TO FIELDCAT.

     

    ENDFORM.                    "build_field_catalog

     

    Thanks,

    Shankar

  • Re: ALV color codes
    Alvin Lim
    Currently Being Moderated

    The combination from the color codes was some what limited. I would like to display some of my row in white color. Can I get WHITE color from the color code combination? Any other way to get WHITE color to be display on the row? Thanks in advance.

  • Re: ALV color codes
    Currently Being Moderated

    Hi alvin,

     

    check out this program to get the possible color combinations

     

    <b>SHOWCOLO</b>

Actions