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 output of the report in excel programatically

Former Member
0 Kudos
682

Hi

I think subject itself is more explanatory .

i need to Export the output of the report in excel programatically.

I know that i can use gui_download FM .

But i m dynamically printing my report so i dont have the perfect internal table. thjats why i can not use gui_download.

Hope u got it .

Each person will get the point depend on the ans

Thaks

Gain_ponits

1 ACCEPTED SOLUTION

Former Member
0 Kudos
168

Hi,

If you want to export to a real excel file, I can propose you two options:

1) Use office integration - lcl_xls_interface

Demo program: SAPRDEMO_TABLES_IN_EXCEL

2) FM 'SAP_CONVERT_TO_XLS_FORMAT'. It save a file in excel format.

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

Message was edited by: Svetlin Rusev

4 REPLIES 4

Former Member
0 Kudos
169

Hi,

If you want to export to a real excel file, I can propose you two options:

1) Use office integration - lcl_xls_interface

Demo program: SAPRDEMO_TABLES_IN_EXCEL

2) FM 'SAP_CONVERT_TO_XLS_FORMAT'. It save a file in excel format.

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

Message was edited by: Svetlin Rusev

andreas_mann3
Active Contributor
0 Kudos
168

Hi,

or create a csv-file , delimitesd by ';'.

Andreas

Former Member
0 Kudos
168

Hi al,

Thanks for reply!!

I thing is I dont have my internal table in proper form.

So i m producing my report by doin some calculation .

Thants why i wann export my output which has dynamically produced into excel by program.

I know that after gettin output i can go to option and list and export to excel manually.

Above thing i wann do programatically

hope u can understand my quaey .

Gain_Point

0 Kudos
168

Hi,

I can propose you 2 variants:

<b>1) write list to DAT file.</b>

report ztest.

type-pools SLIST.

data: pages TYPE slist_pagedescr_tab,

list TYPE slist_list_tab,

fmbs TYPE slist_fmbs_tab,

fmbx TYPE slist_fmbs_tab,

fsel TYPE slist_fsel_tab,

tags TYPE slist_hypertags_tab,

list_index type i,

listlevel_description TYPE slist_listds.

write:/ 'This is my test list'.

at line-selection.

PERFORM PREPARE_LIST_TABLES IN PROGRAM SAPLSLST

TABLES

PAGES

LIST

FMBS

FMBX

FSEL

TAGS

USING

LIST_INDEX

CHANGING

LISTLEVEL_DESCRIPTION.

CALL FUNCTION 'LIST_CONVERT_TO_DAT'

TABLES

LIST = LIST[]

FMBS = FMBS[]

FMBX = FMBX[]

FSEL = FSEL[].

<b>2) read list values</b>.Read the list values(READ LINE stmt) within a DO loop and transfer them to internal table. Save the internal table to a file.

Svetlin