02-13-2008 4:27 PM
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.
02-13-2008 4: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.
a®
02-13-2008 4: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.
a®
07-22-2020 4:21 PM