By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
Hi there ABAP Experts,
I am struggling to find a good example where an ALV grid displays icons in one of the columns. I don't mean the lights on an ALV grid. Those are fairly easy to display. But say in one column, I would like to display different icons, depending on the value in another field, does anyone know how to do this? I have dug around plenty but could not find any useful info. Any help will be greatly appreciated.
You can achieve this by adding the Include ICON in your program and in the final internal table which you display as grid create a character field of length 4 and move the icon value to this field.
. * pass the icon name to the final int.table field it_final-char4 = icon_column_right . * display the grid by calling the FM / Method CALL METHOD go_alvdata_ingst->set_table_for_first_display EXPORTING i_structure_name = '/CD487/S_INGR_STMT' io_alvdata = go_lcl_alv CHANGING ct_outtab = it_final ct_fieldcatalog = gt_fcat EXCEPTIONS exc_failure = 1 OTHERS = 2 .
An example for you: CONSTANTS: icon_id_failure LIKE icon-id VALUE ' @', icon_id_okay LIKE icon-id VALUE ' @'. TYPES: BEGIN OF ls_tab, matnr LIKE equi-matnr, maktx LIKE makt-maktx, b_werk LIKE equi-werk, b_lager LIKE equi-lager, lgobe LIKE t001l-lgobe, sernr LIKE equi-sernr, icon LIKE icon-id, objnr LIKE equi-objnr, END OF ls_tab. *Table that display the data for the ALV. DATA: itab TYPE ls_tab OCCURS 0 WITH HEADER LINE. PERFORM get_h_date . IF h_date => sy-datum . itab-icon = icon_id_okay. ELSE . itab-icon = icon_id_failure. ENDIF.
This tip presents an SAP FAQ discussion thread. The SAP FAQ is the latest addition to SearchSAP.com's portfolio of collaborative, interactive and independent support resources for the SAP community. By registering as a member of the SAP FAQ network, you'll have the opportunity to trade lessons learned and practical advice with other SAP users on a range of SAP-specific topics. Sign up for free SAP FAQ membership here.