08-23-2007 2:20 PM
Can u guys suggest me whch Function Module to be used to DOWNLOAD
data from an INTERNAL TABLE to an EXCEL file.
08-23-2007 2:24 PM
Hi John,
Use <b>GUI_DOWNLOAD.
ex:
Download the File.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = V_FILENAME " name of the file
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = '#' "tab seperator you can put ',' instead
TABLES
DATA_TAB = I_ERR_REC "internal table from which data is obtained
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Reward points if this helps,</b>
Kiran
08-23-2007 2:21 PM
08-23-2007 2:21 PM
Hi,
There is no direct function module to download to excel.
But you can use fm GUI_DOWNLOAD
or you can try with XXL_FULL_API
aRs
08-23-2007 2:22 PM
use gui_download and give the file name with the ext .xls.
reward if helpful.
cheers
sharadendu
08-23-2007 2:24 PM
Hi John,
Use <b>GUI_DOWNLOAD.
ex:
Download the File.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = V_FILENAME " name of the file
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = '#' "tab seperator you can put ',' instead
TABLES
DATA_TAB = I_ERR_REC "internal table from which data is obtained
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Reward points if this helps,</b>
Kiran
08-23-2007 2:27 PM
Hello John
With respect to <b>Unicode </b>we should no longer use the function modules for download/upload to/from the presentation server (= local PC) but instead use method <b>CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD</b> (and GUI_UPLOAD, respectively).
Regards
Uwe
08-23-2007 2:31 PM
08-23-2007 2:37 PM
Hi,
I think you cannot able to give filetype as XLS
Just give your file name as C:\TEMP\TEST.XLS
Available Types are
'ASC' :
ASCII format. The table is transferred as a text. Here, conversion exits are executed. The output format also depends on the parameters CODEPAGE, TRUNC_TRAILING_BLANKS, and TRUNC_TRAILING_BLANKS_EOL.
'IBM' :
ASCII format with IBM code page conversion (DOS). This format corresponds to the 'ASC' format, with use of target code page 1103. This code page is often used for data exchange by floppy disk.
'DAT' :
Transmission column by column. In this format, the data is transmitted just like ASCals text. However, no conversion exists are executed, and the columns are separated using tab characters. This format creates files that can be imported again using gui_upload or ws_upload.
'DBF' :
The data is downloaded in dBase format. With this format, the data types are stored as well, For this reason, import problems can be avoided - for example, problems with Microsoft Excel. In particular, you can avoid problems with the interpretation of numeric values.
'WK1' :
The data is downloaded in Lotus 1-2-3 format.
'BIN' :
Binary format. The data is transmitted in binary form. There is no editing and no code page conversion. The data is interpreted line by line and not column by column. The length of the data must be specified in the BIN_FILESIZE parameter. The table should consist of a column of type X, since - in Unicode systems - the conversion of structured data to binary data can cause errors.
aRs
08-23-2007 3:07 PM
Hi John,
generally CSV i.e. comma separated value files are stored as .XLS file.
so for the parameter <b>WRITE_FIELD_SEPARATOR</b> assign ',' you shall get your desired result.
<b>Reward points if this helps,</b>
Kiran
08-23-2007 2:35 PM
hi,
U have to give it in the filename u r giving.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'test.xls'
tables
data_tab =
.
08-23-2007 2:51 PM
Hello,
You can use
<b>GUI_DOWNLOAD
or
SAP_CONVERT_TO_XLS_FORMAT</b>
reward if helpful,
Regards,
LIJO