Skip to Content

Group Lines Excel Function

Hi,

I have an ALV Tree (cl_salv_tree) that's works fine.

But I need to export all data to excel.

I am using OLE objects to do this.

I would like to know if is possible group lines into excel.

For example.

Today works like this

Level1 -


Value 1

---Level2 --- Value 2

---Level2 --- Value 2

-


Level3 - Value 3

I would like to do this (compress the Leve2, for example)

+ Level1 -


Value 1

-


Level2 -


Value 2

+---Level2 -


Value 2

Thanks a lot.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Feb 13, 2008 at 04:41 PM

    May be u can try this way. Instead of OLE

    " Create a custom icon in the tree toolbar using the following 
      try.
          v_text2 = text-b02.        " download to excel
    
          grt_functions->add_function(
            name     = 'DOWNLOAD'
            icon     = '@42@'
            tooltip  = v_text2
            position = if_salv_c_function_position=>right_of_salv_functions
    ).
        catch cx_salv_wrong_call cx_salv_existing.
      endtry.
    
    " Make the events for the custom function
    
      data: lr_events type ref to cl_salv_events_tree.
      lr_events = grt_tree->get_event( ).
      create object grt_events.
    
      set handler grt_events->on_user_command for lr_events.
      set handler grt_events->on_double_click for lr_events.
      set handler grt_events->on_link_click for lr_events.
      set handler grt_events->on_before_user_command for lr_events.
      set handler grt_events->on_after_user_command for lr_events.
      set handler grt_events->on_keypress for lr_events.
      try.
          lr_events->add_key_for_keypress( if_salv_c_keys=>f4 ).
          lr_events->add_key_for_keypress( if_salv_c_keys=>enter ).
        catch cx_salv_msg.
      endtry.
    
    " Call the following function module 
    " in the grt_events->on_user_command method, after arranging 
    " whichever format of your output table 
    
    CALL FUNCTION 'ALV_XXL_CALL'
    EXPORTING
    i_tabname = 'I_OUT'
    IS_LAYOUT = l_xxl_Layout
    it_fieldcat = l_xxl_fieldcat
    TABLES
    it_outtab = it_out
    EXCEPTIONS
    fatal_error = 1
    no_display_possible = 2
    OTHERS = 3.
    
    

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 22, 2020 at 03:21 PM
    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.