02-20-2008 4:40 PM
Dear ,
when i am trying to send data in internal table of type charterter declared below(i.e iresult) to FTP SERVER program giving the DATA ERROR = 3 when 'FTP_R3_TO_SERVER' fuction module is exected and file it not creating in ftp server . plz help me pointS must be given .
the FTP_CONNECT ,FTP_COMMAND function modules are executing properly giving handle 1 and its sy-subrc = 0 .
when 'FTP_R3_TO_SERVER' is executed it is giving SY-SUBRC = 3 ( DATA ERROR ) i.e it is failing to out internal table data in FTP SERVER . PLZ HIDE ME ITS URGENT .
THIS IS CODE I USED .
DATA : BEGIN OF iresult OCCURS 5,
rec(450),
END OF iresult,
DATA :
dest LIKE rfcdes-rfcdest VALUE 'SAPFTP',
compress TYPE c VALUE 'N',
host(64) TYPE c.
DATA: hdl TYPE i.
DATA: BEGIN OF result OCCURS 0,
line(100) TYPE c,
END OF result.
DATA : key TYPE i VALUE 26101957 ,
dstlen TYPE i,
blob_length TYPE i.
host = p_host .
DESCRIBE FIELD p_password LENGTH dstlen IN CHARACTER MODE.
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD p_password ID 'KEY' FIELD key
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD p_password
ID 'DSTLEN' FIELD dstlen.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = p_user
password = p_password
host = host
rfc_destination = dest
IMPORTING
handle = hdl
EXCEPTIONS
not_connected = 1
OTHERS = 2.
IF sy-subrc = 0.
CONCATENATE 'cd' ftppath INTO ftppath SEPARATED BY space .
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = hdl
command = ftppath
TABLES
data = result
EXCEPTIONS
command_error = 1
tcpip_error = 2.
IF sy-subrc = 0 .
CLEAR result .
REFRESH result .
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = hdl
command = 'ascii'
TABLES
data = result
EXCEPTIONS
command_error = 1
tcpip_error = 2.
IF sy-subrc = 0 .
DESCRIBE TABLE iresult LINES lines.
blob_length = lines * width .
clear : lines.
Delete the existing file
CONCATENATE 'del' ftpfile INTO delfile SEPARATED BY SPACE.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = hdl
command = delfile
TABLES
data = result
EXCEPTIONS
command_error = 1
tcpip_error = 2.
*End of deleting the existing file
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = hdl
fname = ftpfile
blob_length = blob_length
TABLES
blob = iresult
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF sy-subrc <> 0 .
WRITE 'Error in writing file to ftp' .
ELSE.
WRITE 'File downloaded on the ftp server successfully'.
ENDIF.
ENDIF.
ELSE.
WRITE : 'Path on ftp not found : ' , ftppath .
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = hdl.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = 'SAPFTP'
EXCEPTIONS
OTHERS = 1.
ELSE.
WRITE 'Could not connect to ftp' .
ENDIF.
ENDFORM. " FTPFINANCEACCESS_DOWNLOAD
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'PASSWORD'.
screen-invisible = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Edited by: manoj kv on Feb 21, 2008 7:51 AM
Edited by: manoj kv on Feb 21, 2008 10:31 AM
Edited by: manoj kv on Feb 23, 2008 5:22 AM
Edited by: manoj kv on Feb 23, 2008 2:59 PM
02-22-2008 2:00 PM
02-21-2008 9:56 AM
hi manoj,
I have gone thr your report.
Please set debugger at point 'FTP_COMMAND' and check whether data flows through the report or not.
You will get that file is not in proper format or it might be empty i.e. structure dose not support.
reward if useful.
Sachin
02-21-2008 11:55 AM
Dear ,
i got an issue on this program from client that data is storing in destination file in FTP FOLDER in complete data in single line instead of storing in line by line . but when i tried by running in debugging mode it is 'FTP_CONNECT' ,
'FTP_COMMAND function module running properly ie sy-subrc = 0 . but when 'FTP_R3_TO_SERVER' is executed it is giving sy-subrc = 3 i.e DATA_ERROR and it is not even creating file in FTP FOLDER . plz help me and points must be rewarded.its urgent .plz tell abt how to display line by line in FTP server
02-22-2008 11:30 AM
Hi Manoj,
If the data flows smoothly then data error might be because of specified file size on FTP server. The file size on FTP server has limited size so it is not recomended to use.
These are standared FTP programs which allows you to FTP from within SAP.
The SAPFTP.EXE should be pre-installed in the users local harddisk before you can used this functions.
Do a check first by executing program RSFTP005. It will tell you whether it can detect the SAPFTP.EXE program.
RSFTP001 - SAPFTP version
RSFTP002 - Execute FTP Command
RSFTP003 - Test
RSFTP004 - FTP copy
RSFTP005 - SAPFTP check
RSFTP006 - FTP command list
RSFTP007 - Test FB:FTP_SERVER_TO_R3 / FTP_R3_TO_SERVER
RSFTP008 - Test FB:FTP_CLIENT_TO_R3 / FTP_R3_TO_CLIENT
Sachin
02-22-2008 3:35 PM
Dear ,
i exected RSFTP005 program and i got this below output .
SAPFTP check
Check RFC destination SAPFTP...
... OK.
Ping RFC destination SAPFTP...
... OK.
Check RFC destination SAPFTPA...
... OK.
Ping RFC destination SAPFTPA...
... OK.
in our previous discussion u told me that "You will get that file is not in proper format or it might be empty i.e. structure dose not support "
plz tell me how u r telling that file will not get in proper order and which structure does not support .
my client given issue that whole data storing in single line .
plz do the needful help. points must be rewarded .
thanking u .
Edited by: manoj kv on Feb 25, 2008 5:56 AM
Edited by: manoj kv on Feb 26, 2008 9:38 AM
Edited by: manoj kv on Feb 28, 2008 8:04 AM
02-27-2008 4:31 AM
Dear ,
In our prevous discussion abt FTP_R3_TO_SERVER u told that file will not be stored in proper order in FTp server.
i checked in FTP server u r correct that file is not storing in proper order in FTP server . plz help how to get the file in proper order .it urgent . full points must be given
Edited by: manoj kv on Mar 5, 2008 2:16 PM
02-22-2008 2:00 PM
02-22-2008 3:37 PM
Dear ,
plz tell me the difference between 'SAPFTPA' and 'SAPFTP'.
points must be rewarded .
thanking u ,
02-22-2008 4:25 PM
SAPFTP runs on the client (local PC), and SAPFTPA runs on the application server.
If you are connecting from your SAP application server to another remote host, then you use SAPFTPA.
If you are connecting from your PC to the remote host, use SAPFTP.
02-22-2008 4:44 PM
Dear ,
my client is located in US and i am working trying to solve the issue form india and i am trying to connect to FTP sever form my pc. plz suggest me the reason for data_error sy-subrc = 3 why it is comming when ftp_r3_to_server fun mod is running.
Edited by: manoj kv on Feb 25, 2008 5:48 AM
Edited by: manoj kv on Feb 26, 2008 6:35 AM