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

icon_create probleam

hi,

i am using a fm icon_create . but here the icon is not populating in my alv output.

but if i am writing write:/ result , then i am getting the icon.please let me know any probleam if i will use this FM in alv report.

help...

CALL FUNCTION 'ICON_CREATE'

EXPORTING

name = 'ICON_ACTIVE_INACTIVE'

IMPORTING

RESULT = RESULT.

ENDIF.

MOVE result TO gs_final-result.

ENDIF.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 14, 2009 at 11:12 AM

    I think, you have use the icon type-pools in your report.

    TYPE-POOLS: icon.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 14, 2009 at 11:27 AM

    You can check the standard Programs in the Package SLIS.

    Check this one - BCALV_TREE_06

    You have to also set the flag ICON field in the field catalog. Just check how the program is preparing the data.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 15, 2009 at 09:27 AM

    Hi,

    Please try this peace of code in your program it might be helpful.

    TYPE-POOLS: sym.

    INCLUDE .

    WRITE: ICON_SORT_DOWN

    AS icon to itab-temp.

    append itab.

    Above code explains how to implement Symbols and ICONs in ALV output. Please check the same to your program.

    Thanks

    Raghavendra.D.S

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 17, 2009 at 09:18 AM

    Hi,

    Add the following include in your code.

    INCLUDE <icon>.

    Next add a field in your ALV grid structue as below.

    flag LIKE icon-name

    and add the icon to the ALV grid like shown below.

    WRITE ICON_ACTIVE_INACTIVE TO i_alv-flag.

    Hope it helps.

    Murthy

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2009 at 09:39 AM

    Hello ramkunat

    First check that the size of field, you are using for the icon should be 44 chars & then mark the property ICON of corresponding field catalog entry as 'X'. It would work.

    Best regards

    Anand

    [How2SAP.com|http://www.how2sap.com/blog/category/alv/]

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2009 at 07:33 AM

    Hi Ram, Try this way to create icon on ALV.

     REPORT ZVENKAT_ALV_TRAFFIC_LIGHTS .
    TYPE-POOLS:icon.
    DATA:BEGIN OF IT_LIGHTS OCCURS 0,
           MATNR  TYPE MARD-MATNR,
           WERKS  TYPE MARD-WERKS,
           LGORT  TYPE MARD-LGORT,
           LIGHTS TYPE CHAR4,       "Variable is needs to be declared with length 4 char
          END OF IT_LIGHTS.
    TYPE-POOLS:SLIS.
    TYPES:T_FIELDCAT         TYPE SLIS_FIELDCAT_ALV,
          T_EVENTS           TYPE SLIS_ALV_EVENT,
          T_LAYOUT           TYPE SLIS_LAYOUT_ALV.
    DATA:W_FIELDCAT         TYPE T_FIELDCAT,
         W_EVENTS           TYPE T_EVENTS,
         W_LAYOUT           TYPE T_LAYOUT.
    DATA:I_FIELDCAT         TYPE STANDARD TABLE OF T_FIELDCAT,
         I_EVENTS           TYPE STANDARD TABLE OF T_EVENTS.
    
    START-OF-SELECTION.
      SELECT MATNR WERKS LGORT FROM MARD INTO CORRESPONDING FIELDS OF TABLE IT_LIGHTS UP TO 10 ROWS.
      IF IT_LIGHTS[] IS INITIAL.
        DO 10 TIMES.
          IT_LIGHTS-MATNR = SY-INDEX.
          IT_LIGHTS-WERKS = SY-INDEX + 1.
          IT_LIGHTS-LGORT = SY-INDEX + 2.
          APPEND IT_LIGHTS TO IT_LIGHTS.
          CLEAR  IT_LIGHTS.
        ENDDO.
      ENDIF.
      "Just pass 1=red or 2=yellow or 3=green to lights fields
      LOOP AT IT_LIGHTS INTO IT_LIGHTS.
        IF SY-TABIX BETWEEN 1 AND 3.
          IT_LIGHTS-LIGHTS = '1'.
        ELSEIF SY-TABIX BETWEEN 4 AND 7.
          IT_LIGHTS-LIGHTS = '2'.
        ELSEIF SY-TABIX BETWEEN 8 AND 10.
          IT_LIGHTS-LIGHTS = '3'.
        ENDIF.
        MODIFY IT_LIGHTS FROM IT_LIGHTS INDEX SY-TABIX TRANSPORTING LIGHTS.
      ENDLOOP.
      DEFINE FIELDCAT.
        W_FIELDCAT-FIELDNAME = &1.
        W_FIELDCAT-TABNAME   = &2.
        W_FIELDCAT-SELTEXT_M = &3.
        APPEND W_FIELDCAT TO I_FIELDCAT.
        CLEAR  W_FIELDCAT.
      END-OF-DEFINITION.
      FIELDCAT: 'MATNR'  'IT_LIGHTS' 'MARD-MATNR',
                'WERKS'  'IT_LIGHTS' 'MARD-WERKS',
                'LGORT'  'IT_LIGHTS' 'MARD-LGORT'.
      W_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
      W_LAYOUT-ZEBRA             = 'X'.
      W_LAYOUT-LIGHTS_FIELDNAME  = 'LIGHTS'.
      W_LAYOUT-LIGHTS_TABNAME    = 'I_LIGHTS'.
      DATA:L_PROGRAM TYPE SY-REPID VALUE SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = L_PROGRAM
          IS_LAYOUT          = W_LAYOUT
          IT_FIELDCAT        = I_FIELDCAT
        TABLES
          T_OUTTAB           = IT_LIGHTS.
    Thanks Venkat.O

    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.