Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ALV Icon - traffic lights

I tried to use icons on my ALV grid but with the following codes, I do not see the icon, the column appears empty. What's wrong with my code?

TYPE-POOLS: slis, icon.
TYPES: BEGIN OF st_final,
       light LIKE ICON-ID,
       ebeln TYPE ekbe-ebeln,
       ebelp TYPE ekbe-ebelp,
       matnr TYPE ekbe-matnr,
       END OF st_final.
DATA: it_final TYPE STANDARD TABLE OF st_final,
      wa_final LIKE LINE OF it_final,
      gt_fieldcat TYPE slis_t_fieldcat_alv,
      gwa_fieldcat LIKE LINE OF gt_fieldcat.
......
......
LOOP AT it_final INTO wa_final.
 IF wa_final-wepos = 'X'.
   IF wa_final-rbstat <> 5 AND wa_final-eindt > chk_dt.
      wa_final-light = '@0A@'.
   ELSEIF wa_final-rbstat <> 5 AND wa_final-eindt < chk_dt.
       wa_final-light = '@09@'.
  ELSEIF wa_final-rbstat = 5.
      wa_final-light = '@08@'.
   ENDIF.
 ENDIF.
ENDLOOP.

form alv_display .

  PERFORM build_fieldcat.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program             = sy-repid
     it_fieldcat                    = gt_fieldcat
     i_save                         = ''
   TABLES
      t_outtab                       = it_final
   EXCEPTIONS
     program_error                  = 1
     OTHERS                         = 2.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

endform

form build_fieldcat .
IF gt_fieldcat[] IS INITIAL.

   gwa_fieldcat-col_pos = '1'.
   gwa_fieldcat-fieldname = 'LIGHT'.
   gwa_fieldcat-outputlen = '4'.
   gwa_fieldcat-icon = 'X'.           "this is an icon
   gwa_fieldcat-seltext_l = 'Status'.
   APPEND gwa_fieldcat TO gt_fieldcat.
   CLEAR gwa_fieldcat.

......
......

ENDIF.
endform.                    " buildfieldcat

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question