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

EXCEL COLUMN PROBLEM

Former Member
0 Likes
336

Hi,

I'm using the following code to download a report into excel

DATA: begin of i_ascii_list occurs 0, text(134) type c, end of

i_ascii_list.

DATA lista LIKE abaplist OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'LIST_FREE_MEMORY'

TABLES

listobject = lista.

SUBMIT RHRHDC00

AND RETURN

EXPORTING LIST TO MEMORY.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = lista

EXCEPTIONS

OTHERS = 1.

perform save_ascii_list.

call function 'MS_EXCEL_OLE_STANDARD_DAT'

exporting

file_name = 'C:\sample.XLS'

tables

data_tab = i_ascii_list.

*#####################################-

  • FUNCTION: save_ascii_list

*#####################################-

form save_ascii_list.

CALL FUNCTION 'LIST_TO_ASCI'

EXPORTING

LIST_INDEX = -1

TABLES listasci = i_ascii_list

listobject = lista

EXCEPTIONS empty_list = 1

list_index_invalid = 2

OTHERS = 3.

endform.

The problem is that excel file shows all the information of each row in first column. I need for each column of the report to be in one column of excel, like when you download the report via menu list-> export -> spreadsheet. How to do that? There is some better way to convert report RHRHDC00 (for example) into excel?

Thanks in advance

1 REPLY 1
Read only

Former Member
0 Likes
295

You can use the function module ''ALV_XXL_CALL'" to download Data in a Excel file.You can avoid the problem of downloading data into same Column.

If you want to know how it is used. See the SAP Program "XXLFTEST".

Thanks

Shekar