Skip to Content

Converting Icons when sending data to excel


I need some help. I have an ALV list created with REUSE_ALV_GRID_DISPLAY. There is a column of this list which contains icons. When a user presses the 'Spreadsheet' button and selects 'Excel display' these icons will appear with their SAP code (that is @0A@, @08@, etc.) in Excel. How can I convert these codes to some user friendly text like 'OK', 'FAILED', etc.? Anyway, is it possible? Thank you in advance.

Regards, Zsolt

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Jun 22, 2004 at 10:24 AM

    Hi All,

    I already have a solution which is mentioned in OSS note 365472. Unfortunately it is not the best solution, because it suggests writing an excel macro. If you know anything better, please don't hesitate...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 22, 2004 at 01:16 PM


    I don't know if you will like it, but the simplest solution would be to add a text column to you ALV report in which you would store the text of the icon (using table ICON as suggested by Dirk Altman) .

    Up to the user who downloads the report either to have a display variant with the icon texts or to download everything to excel and just suppress the column containing the icon ids...

    Hope this will help you...



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 22, 2004 at 02:34 PM


    Thak you for your suggestions. Client, unfortunately, don't want to do extra know.

    But I have found a solution:

    An instance of the class CL_GUI_ALV_GRID works behind REUSE_ALV_GRID_DISPLAY function element. It has two events: BEFORE_USER_COMMAND and AFTER_USER_COMMAND which are raised by the object in every case when an interface with the outside world of SAP is activated in ALV (I mean when the user presses the 'Send', 'Word processing', or ' Spreadsheet buttons'). These Events has no event handler by default. If you write your own, you can catch processing before and after data transportation. In the event handler methods you can modify the content of the output table. CL_GUI_ALV_GRID uses it referenced by a pointer.

    For example:

    * int_out_tab -> the output table
    * int_out_tab_excel and int_out_tab_buffer have the same type as
    *       int_out_tab
    *---Class declarations
    class lcl_event_handler definition.
      public section.
        class-methods: before_user_command
                       for event before_user_command of cl_gui_alv_grid,
                       for event after_user_command of cl_gui_alv_grid.
    *---Class definitions
    class lcl_event_handler implementation.
      method before_user_command.    "changing to excel content"
        int_out_tab[] = int_out_tab_excel[].
      method after_user_command.       "restoring the original state"
        int_out_tab[] = int_out_tab_buffer[].

    You have to insert into your program the followings before calling REUSE_ALV_GRID_DISPLAY:

    *Registering event handlers
      set handler lcl_event_handler=>before_user_command for all instances.
      set handler lcl_event_handler=>after_user_command for all instances.
    *Saving the original output list
      int_out_tab_buffer[] = int_out_tab[].
    *Generating the user-friendly Excel list
      loop at int_out_tab into int_out_tab_excel.
        case int_out_tab_excel-status.
          when '@0A@'.
            int_out_tab_excel-status = 'FAIL'.   "or whatelse you want"
            append int_out_tab_excel.
          when '@08@'.
            int_out_tab_excel-status = 'OK'.     "or whatelse you want"
            append int_out_tab_excel.



    Message was edited by: Zsolt Szuromi

    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.