cancel
Showing results for 
Search instead for 
Did you mean: 

Download to Excel File

Former Member
0 Kudos

Hello,

I have a scenario; where the table is been populated with data; and i need to download these data in to an Excel file on button action. I need the exact way to do this. Can anyone help me through this.

Regards,

Vinod

  • Rewards waiting..

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

U have to pass the data to an internal table(it_table[]) and use FM as follows..

    • Download

CALL TRANSFORMATION ('ID')

SOURCE tab2 = it_table[]

RESULT XML xml_out.

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

CALL FUNCTION 'CRM_IC_XML_STRING2XSTRING'

EXPORTING

INSTRING = xml_out

*

IMPORTING

OUTXSTRING = lv_content.

cl_wd_runtime_services=>attach_file_to_response(

i_filename = 'file.xls'

i_content = lv_content

i_mime_type = 'x-excel/application'

i_in_new_window = abap_true ).

Regards

kartik