Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Download an internal table to excel file

Former Member
0 Kudos

hi ,

how can i download an internal table into an excel file.

Regards

Arun

7 REPLIES 7

athavanraja
Active Contributor
0 Kudos

During debuggin right click and choose option save as excel or if you want to do it thru program you can use gui_download to do the job.

Regards

Raja

0 Kudos

No , i would like to download , during the program execution.

0 Kudos

Then you can use FM GUI_DOWNLOAD to do the job. This has been discussed many times in the forum . search the forum for code sample. its simple.

REgards

Raja

0 Kudos

Hi ,

my requirement is that i want each field of the internal table to be in seperate col of the excel document.

e.g my internal table is

123 abc

456 dcg

my output must be

123 | abc

456 | dcg

0 Kudos

Yes this function can do that.

just pass the filename with extension .xls and the itab.

Raja

Former Member
0 Kudos

Hi,

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

filename = 'd:\cps_data1.xls'

filetype = 'DAT'

mode = 'A'

TABLES

data_tab = intab

EXCEPTIONS

file_open_error = 1

file_write_error = 2

invalid_filesize = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

no_authority = 10

OTHERS = 11

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

here intab is your internal table name.

Try this. it will help.

Regards,

Kathir

0 Kudos

Hi Arun

Use the FM "RH_START_EXCEL_WITH_DATA" if your system has it.

<i>As another thing, let me introduce you the SDN forums pointing system: You can assign points to posts you find helpful while solving your question. You can reward points by clicking the yellow star icon at header of each reply post. You can reward;

- one 10 points (solved)

- two 6 points (very helpful answer)

- many 2 points (helpful answer)</i>

Kind regards...

*--Serdar