04-21-2007 4:38 AM
Hello friends,
I am trying to download a file in the application sever.But I am getting the error "Error in downlaoding file".What is the mistake in the following code?
Regards,
Hari prasath.
DATA : BEGIN OF ITAB OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
END OF ITAB.
DATA : FN LIKE RLGRAP-FILENAME.
SELECT KUNNR FROM KNA1 INTO CORRESPONDING FIELDS OF TABLE ITAB UP TO 5 ROWS.
FN = 'i2\data\debitnote\kunnr'.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = FN
FILETYPE = 'DAT'
TABLES
DATA_TAB = ITAB.
OPEN DATASET FN FOR OUTPUT IN TEXT MODE.
CLOSE DATASET FN.
04-21-2007 4:40 AM
we dont use download FM for application servers.
Check this link -
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ccd358411d1829f0000e829fbfe/content.htm
Check this thread, you wll get a complete example on this one.
Regards,
Amit
Reward all helpful replies.
04-21-2007 5:02 AM
Hi
Do not use the WS_DOWNLOAD FM. Its obsolete.
Insted try this code.
DATA : BEGIN OF ITAB OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
END OF ITAB.
DATA : FN LIKE RLGRAP-FILENAME.
SELECT KUNNR FROM KNA1 INTO CORRESPONDING FIELDS OF TABLE ITAB UP TO 5 ROWS.
FN = 'i2\data\debitnote\kunnr'.
Open the file for writing
open dataset FN for output in text mode encoding default.
Write the Itab contents to the file
loop at ITAB.
transfer ITAB to FN.
endloop.
close dataset FN.