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

Bhaskar_Tripath
Participant
0 Kudos

Hi All,

I want to export data into local file. The line of internal table is greater than 1023 characters. I have used List->Export->Local File.... But when I open that file in excel the data is wrapped (here with wrapping I mean the fields of the internal table comes in two rows of the excel sheet and so is the data). I want my record to be in a single row in the excel sheet.

Thanks & Regards,

Bhaskar Tripathi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

try with below code

Use Function moduleSCMS_STRING_TO_FTEXT to split lengthy strings into lines to desired lengths.

You can declare flext_tab with only one field of desired length.

Write the contents of this internal table by looping ...

Regards

Sreeni

3 REPLIES 3

Former Member
0 Kudos

Hi,

Try downloading into a flat file and then open it in excel. Check if this solves your problem.

Regards,

Siddhesh S.Tawate

Former Member
0 Kudos

Hi,

try with below code

Use Function moduleSCMS_STRING_TO_FTEXT to split lengthy strings into lines to desired lengths.

You can declare flext_tab with only one field of desired length.

Write the contents of this internal table by looping ...

Regards

Sreeni

venkat_o
Active Contributor
0 Kudos

Use the function module SAP_CONVERT_TO_XLS_FORMAT to download the internal table to an excel file.

DATA: t100_lines TYPE STANDARD TABLE OF t001 WITH DEFAULT KEY.

PARAMETERS: p_file LIKE rlgrap-filename DEFAULT 'c:\tmp\test.xls'.
SELECT * FROM t001
  INTO TABLE t100_lines.

CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
  EXPORTING
    i_filename     = p_file
  TABLES
    i_tab_sap_data = t100_lines.
Regards, Venkat.O