You can download the total report as it is look like on the online screen by using function module 'LIST_TO_ASCI'.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
Just pass the list index and one internal table into
which it will download the report.
The strucure of the itab will be
Data: begin of itab occurs 0,
end of itab.
after this just use 'ws_download' function and pass this itab.
The total online report will get downloaded into the flat file.
The function module 'LIST_TO_ASCI' should use at the end of report,
that is after writing each and every statement in the report.
small example is as follows.
REPORT ZDOWNLOAD_REP .
DATA: BEGIN OF ITAB occurs 0,
MATNR TYPE MARA-MATNR,
MTART TYPE MARA-MTART,
MBRSH TYPE MARA-MBRSH,
MATKL TYPE MARA-MATKL,
END OF ITAB.
data: begin of itab1 occurs 0,
end of itab1.
select * from mara into corresponding fields of table itab.
loop at itab.
WRITE:/ ITAB-matnr, itab-mtart, itab-mbrsh,itab-matkl.
CALL FUNCTION 'LIST_TO_ASCI'
LIST_INDEX = 0
LISTASCI = itab1.
CALL FUNCTION 'WS_DOWNLOAD'
FILENAME = 'C:report.txt'
FILETYPE = 'ASC'
DATA_TAB = itab1.
This will work in all the versions of SAP.