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

INTERNAL TABLE INTO EXCEL

Former Member
0 Likes
2,145

MAY ANY ONE SUGGEST ME HOW I CAN TRANSFER MY DATA FROM INTERNAL TABLE INTO EXCEL.

OR HOW TO CONVERT MY INTERNAL TABLE INTO EXCEL AND SAVE IT IN LOCAL DIRECTORY.

IS THERE ANY FUNCTION MODULE PRESENT FOR THIS.

I M WAITING FOR REPLY

10 REPLIES 10
Read only

Former Member
0 Likes
1,138

DATA FROM INTERNAL TABLE INTO EXCEL.

USE FM <b>gui_download.</b>

REFER...

/people/harry.dietz/blog/2005/11/11/yet-another-from-database-or-internal-table-to-excel

Read only

Former Member
0 Likes
1,138

GUI_DOWNLOAD and GUI_UPLOAD are used to transfer contents from file to internal and back.

Read only

Former Member
0 Likes
1,138

Hi,

Consider these code.

<a href="/people/sap.user72/blog/2006/02/07/downloading-data-into-excel-with-format-options">/people/sap.user72/blog/2006/02/07/downloading-data-into-excel-with-format-options</a>

<a href="/people/rich.heilman2/blog/2005/09/12/manipulate-excel-with-ole-abap">/people/rich.heilman2/blog/2005/09/12/manipulate-excel-with-ole-abap</a>

Regards,

Arun Sambargi.

Read only

dani_mn
Active Contributor
0 Likes
1,138

Hi,

look into this simple example.

<b>

report ZWA_TEST2.

data:  file type string,
       path type string,
       file_path type string.

data: itab type standard table of t001.

start-of-selection.

SELECT * FROM t001 INTO TABLE itab.


 call method cl_gui_frontend_services=>file_save_dialog
 changing      filename          = file
               path              = path
               fullpath          = file_path.

check not file_path is initial.

call method cl_gui_frontend_services=>gui_download
  exporting    filename                = file_Path
                WRITE_FIELD_SEPARATOR = 'X'
   changing    data_tab                = itab.

</b>

Regards,

Wasim Ahmed

Message was edited by: Wasim Ahmed

Read only

Former Member
0 Likes
1,138
Read only

0 Likes
1,138

hai check this,

there is one FM, <b>ws_excel</b> .

CALL FUNCTION 'WS_EXCEL'

EXPORTING

FILENAME = 'C:/RAMU.XLS'

  • SYNCHRON = ' '

TABLES

DATA = LT_EXCEL " internal table u want to download to excel

  • EXCEPTIONS

  • UNKNOWN_ERROR = 1

  • OTHERS = 2

.

Read only

Former Member
0 Likes
1,138

Hi Pavan,

U can refer to the below code

'SAP_CONVERT_TO_XLS_FORMAT'REPORT Zxls .

parameters: p_file like rlgrap-filename default 'c:\temp\test01.xls'.

data: itab like t001 occurs 0 with header line.

CLEAR itab.

REFRESH itab.

select * from t001 into table itab.

CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'

EXPORTING

I_FILENAME = p_file

TABLES

I_TAB_SAP_DATA = itab

regards,

Sharat

ps: reward points if helpful

Read only

Former Member
0 Likes
1,138

Hi,

Simple technique is USE GUI_DOWNLOAD & in the file name extension give .xls and FIELD_SEPERATOR = 'X'.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

<b> FILENAME = 'C:\ABC.XLS'

FILETYPE = 'ASC'

WRITE_FIELD_SEPARATOR = 'X'</b>

*--AND SO onn

regards,

Srikanth

Read only

Former Member
0 Likes
1,138

Hai Pavan

Check the following Code

data: v_file type string,

v_path type string,

v_file_path type string.

data: begin of it_mara occurs 0,

matnr like mara-matnr,

mbrsh like mara-mbrsh,

mtart like mara-mtart,

meins like mara-meins,

end of it_mara.

start-of-selection.

SELECT matnr

mbrsh

mtart

meins

from mara

into table it_mara

where mtart = 'ROH'.

if sy-subrc = 0.

sort it_mara by matnr.

endif.

if not it_mara[] is initial.

call method cl_gui_frontend_services=>file_save_dialog

changing filename = v_file

path = v_path

fullpath = v_file_path.

check not v_file_path is initial.

call method cl_gui_frontend_services=>gui_download

exporting filename = v_file_Path

WRITE_FIELD_SEPARATOR = 'X'

changing data_tab = it_mara[].

endif.

Regards

Sreeni