Application Development and Automation 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: 
Read only

Regading export to excel

Former Member
0 Likes
825

Hi All

I am new to ABAP. I am planning to export data from tables to excel. Is there any helpful function modules or sample report program.

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
790

hi

use this simple code .

CONCATENATE filename '.XLS' INTO lv_filename1.

TYPES:BEGIN OF gty_header,

name(30) TYPE c,

END OF gty_header.

gs_header-name = field name.

APPEND gs_header TO gt_header.

CLEAR gs_header.

append all the field names to the gt_header.

and in the function module pass

the gt_header as

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = lv_filename1

write_field_separator = 'X'

TABLES

data_tab = gt_final

fieldnames = gt_header

EXCEPTIONS

file_write_error = 1

unknown_error = 2.

gt_final has the internal table data,

gt_header has field names.

~linganna

hi

use this simple code .

CONCATENATE filename '.XLS' INTO lv_filename1.

TYPES:BEGIN OF gty_header,

name(30) TYPE c,

END OF gty_header.

gs_header-name = field name.

APPEND gs_header TO gt_header.

CLEAR gs_header.

append all the field names to the gt_header.

and in the function module pass

the gt_header as

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = lv_filename1

write_field_separator = 'X'

TABLES

data_tab = gt_final

fieldnames = gt_header

EXCEPTIONS

file_write_error = 1

unknown_error = 2.

gt_final has the internal table data,

gt_header has field names.

~linganna

6 REPLIES 6
Read only

Former Member
0 Likes
790

Use Func Module - GUI_DOWNLOAD.

Read only

Former Member
0 Likes
790

Hi Rakshita,

Go to t-code SE11

give your table name and execute it on selected condition.

AFter that goto

Table entry -> list -> Export -> Local file

select radiobutton spreadsheet

and say ok .

It will store your table data to excel file at your desired location.

Regards,

Vijay

Read only

0 Likes
790

But in this case you need to select all the objects manually no...I need to fetch them all at once the function module will be helpful..can you give me a sample code also.. I am completly new to ABAP...

thanks

Read only

former_member189420
Active Participant
0 Likes
790

Hi,

Do you want to download from the internal table to excel? If yes, then GUI_DOWNLOAD should work provided suffix the extension of the file name as ".xls".

Hope this helps.

Regards,

Anand Patil

Read only

Former Member
0 Likes
791

hi

use this simple code .

CONCATENATE filename '.XLS' INTO lv_filename1.

TYPES:BEGIN OF gty_header,

name(30) TYPE c,

END OF gty_header.

gs_header-name = field name.

APPEND gs_header TO gt_header.

CLEAR gs_header.

append all the field names to the gt_header.

and in the function module pass

the gt_header as

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = lv_filename1

write_field_separator = 'X'

TABLES

data_tab = gt_final

fieldnames = gt_header

EXCEPTIONS

file_write_error = 1

unknown_error = 2.

gt_final has the internal table data,

gt_header has field names.

~linganna

Read only

0 Likes
790

I am sorry to mention late here I am trying to flush from DDIC table and not internal table.

Thanks for help

Edited by: rakshita hegde on Jul 6, 2009 1:15 PM