‎2010 Dec 03 8:46 AM
I want to fetch data in internal table from FTP server...
P_FILE = '/data/Newfolder/test.txt'.
OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
break-point.
IF SY-SUBRC = 0.
DO.
READ DATASET P_FILE INTO IT_ITAB.
APPEND IT_ITAB.
CLEAR IT_ITAB.
ENDDO.
ENDIF.
-
but I m getting sy-subrc = 8 ....so dataset couldnt open....plz give correct code
Edited by: ritesh9898 on Dec 3, 2010 9:46 AM
Edited by: ritesh9898 on Dec 3, 2010 9:47 AM
‎2010 Dec 03 8:50 AM
Check your file path again '/data/Newfolder/test.txt'.
Is it capital N in newfolder?
Also check if you have valid authorization su53...
‎2010 Dec 03 8:50 AM
Check your file path again '/data/Newfolder/test.txt'.
Is it capital N in newfolder?
Also check if you have valid authorization su53...
‎2010 Dec 03 9:26 AM
‎2010 Dec 03 9:50 AM
Hi Ritesh,
If you want take file from FTP you should us some functional modules, OPEN DATESET is for application server files.
For FTP refer the some standard programs
RSFTP001 to RSFTP011.
Regards,
Sri
‎2010 Dec 03 10:08 AM
‎2010 Dec 03 11:20 AM
Hi try this..
you need authorisations to ftp server and login credentials.
data: ftp_add type char1024.
concatenate '//' p_user ':' p_pwd '@' p_host '/<diretory>/Try.pdf' into ftp_add.
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = P_PWD
SOURCELEN = SLEN
KEY = KEY
IMPORTING
DESTINATION = P_PWD.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
USER = P_USER
PASSWORD = P_PWD
HOST = P_HOST
RFC_DESTINATION = P_RFCDES
IMPORTING
HANDLE = L_HDL.
CONCATENATE 'cd' P_DIR INTO L_CMD SEPARATED BY SPACE.
SLEN = STRLEN( P_PWD ).
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = L_HDL
COMMAND = L_CMD
COMPRESS = P_COMP
TABLES
DATA = LT_RESULT
EXCEPTIONS
COMMAND_ERROR = 1
TCPID_ERROR = 2.
data : t_blob type table of solix.
call function 'FTP_SERVER_TO_R3'
exporting
handle = l_hdl
fname = DOCID2
CHARACTER_MODE = 'X'
importing
blob_length = l_length
tables
blob = t_blob "it_blob
text = t_blob
exceptions
tcpip_error = 0
command_error = 0
data_error = 0
others = 0.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = L_HDL.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
DESTINATION = P_RFCDES
EXCEPTIONS
OTHERS = 1.