cancel
Showing results for 
Search instead for 
Did you mean: 

Cell variants cannot be exported?

Former Member
0 Kudos

Hi,

I am using cell variants in my applications. When i m trying to export my alv table data to excel, i am gettign the following warning mesage "cell variants cannot be exported". And also the columns which i have used cell variants are not exported in excel. Is it possbile to export cell variants? if no, then please tel me what is the solution for this?

Thanks,

Sathishkumar GS

Accepted Solutions (0)

Answers (3)

Answers (3)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>Could you please tell , how to add a new button in alv toolbar?.

Here is a button choice example. Easy to adapt to a simple button if necessary.

* Connect to the component Usage of the ALV
  IF wd_this->wd_cpuse_alv( )->has_active_component( ) IS INITIAL.
    wd_this->wd_cpuse_alv( )->create_component( ).
  ENDIF.

  DATA l_table TYPE REF TO cl_salv_wd_config_table.
  l_table = wd_this->wd_cpifc_alv( )->get_model( ).

 DATA l_download_polestar TYPE REF TO cl_salv_wd_function.
  l_download_polestar = l_table->if_salv_wd_function_settings~create_function( 'DOWNLOAD_POLESTAR' ).
  DATA l_btn_choice TYPE REF TO cl_salv_wd_fe_button_choice.
  CREATE OBJECT l_btn_choice.
  l_btn_choice->set_text( wd_assist->if_wd_component_assistance~get_text( 'AT1' ) ). "Analytics
  DATA l_choice TYPE REF TO cl_salv_wd_menu_action_item.
  CREATE OBJECT l_choice
    EXPORTING
      id = `POLESTAR`.
  l_choice->set_text( wd_assist->if_wd_component_assistance~get_text( 'AT2' ) ). "Display in BOBJ Explorer
  l_btn_choice->add_choice( l_choice ).
  CREATE OBJECT l_choice
    EXPORTING
      id = `WHOHAR`.
  l_choice->set_text( wd_assist->if_wd_component_assistance~get_text( 'AT3' ) ). "Display in Whohar
  l_btn_choice->add_choice( l_choice ).
  l_btn_choice->set_repeat_selected_action( abap_false ).

  l_download_polestar->set_editor( l_btn_choice ).

ChrisPaine
Active Contributor
0 Kudos

If you want to have a little nicer formatting to you Excel export - you can reuse the ALV excel export logic - Not sure if this is a good idea or not - but here is a link to my blog that gives you the code to do it (and related discussion as to whether this is a good idea. - I'd be interested to hear your thoughts!)

[Using WD ABAP ALV export - the hacked way|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/19646] [original link is broken] [original link is broken] [original link is broken];

Former Member
0 Kudos

Hi,

Could you please tell , how to add a new button in alv toolbar?.

thanks,

GS

abhimanyu_lagishetti7
Active Contributor
0 Kudos

remove the standard export button, write your own code to export the data into excel.

data: lv_string type string,

lv_xstring type xstring.

data: conv type ref to cl_abap_conv_out_ce.

loop at lt_tab into ls_tab.

concatenate lv_string ls_tab-col1 cl_abap_char_utilities=>horizontal_tab

ls_tab-col2 cl_abap_char_utilities=>horizontal_tab

ls_tab-col3 cl_abap_char_utilities=>newline

into lv_string.

endloop.

conv = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).

conv->convert( exporting data = lv_master_string importing buffer = lv_master_xstring ).

cl_wd_runtime_services=>attach_file_to_response( i_filename = 'data.xls'

i_content = lv_xstring

i_mime_type = 'XLS'

i_in_new_window = abap_true ).