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

hello

can fe fill a color in internal table or we can set a picture in it

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jan 26, 2007 at 06:21 PM

    You can set the color codes and icon codes in your internal table, that's it. The color and icons will show when using the ALV grid over your internal table, but the internal table will have only the internal code for line color and icons.

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

    • HEre is an example program which uses line color in ALV as well as icons.

      
      report zrich_0004
             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.
      
      ************************************************************************
      *  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.
      
      ************************************************************************
      * 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  = '4'.
        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.
      
      

      Regards,

      Rich Heilman

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.