Skip to Content
0
Former Member
Sep 10, 2007 at 06:08 PM

EXCEL COLUMN PROBLEM

40 Views

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