on 06-27-2006 9:03 PM
Hi,
I am using FM 'FTP_R3_TO_SERVER' to transfer internal table data to FTP server directory.
I am able to connect to FTP server successfully but somehow this FM is not able to transfer data to specific directory. The error I am getting is "FTP subcommand: Server reports error" and I am not very sure if we need to specify any FTP command. Currently I am not using any FTP command.
I have also checked for required write access for this directory.
Could you please guide me on where else to look for..?
Thanks,
Samay
Hi Samay,
Check this table SXPGCOSTAB where in you can specify the external command, which needs to be maintained .
Please consult yr basis consultant on this
Regards
Balaji
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Samay,
Check standard reports RSFTP007 and RSFTP008.
Also check programs RSFTP*. Hope this provides some inputs.
Thanks
Lakshman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.