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: 

export data to Excel sheet

Former Member
0 Kudos

Dear guys,

I have table control displaying internal table records.

now i want option of exporting this records into excel sheet or i want to save these datas into excel document.

how to do this..

pls give suggestions..

ambichan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

This FM exports to excel.

call function 'SAP_CONVERT_TO_XLS_FORMAT'

exporting

  • I_FIELD_SEPERATOR = seper

  • I_LINE_HEADER = 'X'

I_FILENAME = P_FILE

tables

I_TAB_SAP_DATA = itab

exceptions

CONVERSION_FAILED = 1.

Svetlin

8 REPLIES 8

Former Member
0 Kudos

Hi ,

Have a Push button on the screen, use GUI_DOWNLOAD fm.

Pass Internal table values to the FM.

See Documentation of th FM for examples.

Rgds.

Former Member
0 Kudos

Hi,

This FM exports to excel.

call function 'SAP_CONVERT_TO_XLS_FORMAT'

exporting

  • I_FIELD_SEPERATOR = seper

  • I_LINE_HEADER = 'X'

I_FILENAME = P_FILE

tables

I_TAB_SAP_DATA = itab

exceptions

CONVERSION_FAILED = 1.

Svetlin

0 Kudos

hey svetlin

thanks for your reply.

why this FM 'SAP_CONVERT_TO_XLS_FORMAT' is not working with me?

it says some generate error?

i am working in enterprise..

ambichan

0 Kudos

Hi,

I'm working on 4.6C and the FM works OK. This FM uses office intergration utilities ( especially interface i_oi_spreadsheet ). You can create your own export using this interface.

Demo program: SAPRDEMO_TABLES_IN_EXCEL

Svetlin

Message was edited by: Svetlin Rusev

0 Kudos

It's recommended FM 'GUI_DOWNLOAD' to be used, instead 'WS_DOWNLOAD'.

Svetlin

Former Member
0 Kudos

Hi

Try to use WS_UPLOAD function module with IMPORT parameter FILETYPE = 'XLS' (default = 'ASC')

Regards

Ashish

Former Member
0 Kudos

Sorry Ambi

By mistake i wrote WS_UPLOAD instead of WS_DOWNLOAD

Cheers

Ashish

Former Member
0 Kudos

Hi,

Try this function module

DATA: BEGIN OF ole_server OCCURS 5.

INCLUDE STRUCTURE tole.

DATA: END OF ole_server.

ole_server-app = 'EXCEL.SHEET'.

APPEND ole_server.

CALL FUNCTION 'OLE_SERVER_CHECK'

IMPORTING

down_load_path = file

TABLES

ole_server_app = ole_server

EXCEPTIONS

unsupported_os = 1

unsupported_server = 2

no_ole_server_found = 3

OTHERS = 4.

if sy-subrc is initial.

CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'

EXPORTING

FILE_NAME = PATH_AND_FILE

TABLES

DATA_TAB = Tab_data

FIELDNAMES = fildnames.

endif.

I hope this will work.

Cheers,

Sasi