07-02-2007 3:45 AM
Hi Experts,
I have a program that can download an excel. Using 'WS_DOWNLOAD' I have specified the right parameter. I separated the fields using ",".
Filename = C:\TEMP\TEST.CSV
Data_Tab = D,S,00000000,ADJUSTMENTS,,,,,, 0.0000, 0.0000, 0.0000, 0.0000,155905000,07/31/2007
Error: Error when opening a download file.
Help me. Thanks!
07-02-2007 3:46 AM
HI
Use Tcode CG3Y. U can download data from application server to presentation server...
Reward me if its helpful.
Regards
Ravi
07-02-2007 3:46 AM
HI
Use Tcode CG3Y. U can download data from application server to presentation server...
Reward me if its helpful.
Regards
Ravi
07-02-2007 3:57 AM
07-02-2007 3:58 AM
What is file type mentioned in ws_download FM,Please mention as 'ASC' and see the results
Thanks
Seshu
07-02-2007 3:59 AM
Concatenate int_Dtl-RecType
int_Dtl-TranType
int_Dtl-Tin
int_Dtl-CusName
int_Dtl-LastNm
int_Dtl-FirstNm
int_Dtl-MidNm
int_Dtl-Street1
int_Dtl-Street2
int_Dtl-GexSales
int_Dtl-GzSales
int_Dtl-TaxSales
int_Dtl-ToTax
int_Dtl-Tin2
int_Dtl-RepPer
Into int_TxtHdr-NText
Separated By ','.
Append int_TxtHdr.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = pa_File
FILETYPE = 'ASC'
MODE = ' '
TABLES
DATA_TAB = int_TxtHdr
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
07-02-2007 4:02 AM
Hi,
Change the code as
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = pa_File
FILETYPE = 'ASC'
MODE = ' '
TABLES
DATA_TAB = <i><b>int_TxtHdr[]</b></i>
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
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 useful.
Regards,
Atish
07-02-2007 4:02 AM
07-02-2007 4:05 AM
07-02-2007 4:08 AM
Hi Maui,
Can you just paste the whole code. you should not get the error after this change. Can you just try to download to .txt file and see what is happening.
Regards,
Atish
07-02-2007 4:10 AM
Hi ... here is the program for dowmloading in to .CVS format .
<b>please only change the file path of yours</b>.
report ztest.
TYPE-POOLS: truxs.
TYPES:
BEGIN OF ty_Line,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
END OF ty_Line.
types : ty_Lines TYPE STANDARD TABLE of ty_Line WITH DEFAULT KEY.
DATA: itab TYPE ty_Lines.
DATA: itab1 TYPE truxs_t_text_data.
SELECT
vbeln
posnr
UP TO 10 ROWS
FROM vbap
INTO TABLE itab.
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = itab
CHANGING
i_tab_converted_data = itab1
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = 'C:Documents and Settingsc5091828Desktoptest.csv'
TABLES
data_tab = itab1
EXCEPTIONS
OTHERS = 1.
reward points if it is usefull ......
Girish
07-02-2007 4:23 AM
REPORT Z_SAMPLE.
data: begin of it_tab occurs 0,
empno like pa0002-pernr,
fname like pa0002-vorna,
lname like pa0002-nachn,
end of it_tab.
parameter: pa_File Like Rlgrap-FileName Obligatory default 'C:TEMPTEST01.CSV'.
pa_file = 'C:TEMPTEST01.CSV'.
SELECT pernr
vorna
nachn
INTO TABLE it_tab
FROM pa0002
WHERE pernr <= '300'
AND pernr >= '600'.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = pa_file
FILETYPE = 'ASC'
* IMPORTING
* FILELENGTH =
TABLES
data_tab = it_tab[]
* FIELDNAMES =
* EXCEPTIONS
* FILE_OPEN_ERROR = 1
* FILE_WRITE_ERROR = 2
* INVALID_FILESIZE = 3
* INVALID_TYPE = 4
* NO_BATCH = 5
* UNKNOWN_ERROR = 6
* INVALID_TABLE_WIDTH = 7
* GUI_REFUSE_FILETRANSFER = 8
* CUSTOMER_ERROR = 9
* NO_AUTHORITY = 10
* OTHERS = 11
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
07-02-2007 4:54 AM
hi
use fm DOWNLOAD, which will provide a dialog box for saving the file
if helpful, reward
Sathish. R
07-02-2007 4:44 AM
I think there's something wrong in specifying a filename. I used filename : 'C:\Documents and Settings\myPC\Desktop\155905000S.csv' and it's working. But I don't want my user to specify where they'll save the file.. And automatically, it will save in their desktop.
Message was edited by:
maui bayog