‎2007 Jul 17 2:16 PM
When i tried to call ftp_command fn module This is the error mentioned in the SAP job log:
Attempting to perform FTP transfer
Command Error
ascii
FTP transfer failed !
‎2007 Jul 17 2:18 PM
Hi,
Here is the sample Program
REPORT ZFTPSAP LINE-SIZE 132.
DATA: BEGIN OF MTAB_DATA OCCURS 0,
LINE(132) TYPE C,
END OF MTAB_DATA.
DATA: MC_PASSWORD(20) TYPE C,
MI_KEY TYPE I VALUE 26101957,
MI_PWD_LEN TYPE I,
MI_HANDLE TYPE I.
START-OF-SELECTION.
*-- Your SAP-UNIX FTP password (case sensitive)
MC_PASSWORD = 'password'.
DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
*-- FTP_CONNECT requires an encrypted password to work
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
ID 'DSTLEN' FIELD MI_PWD_LEN.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
*-- Your SAP-UNIX FTP user name (case sensitive)
USER = 'userid'
PASSWORD = MC_PASSWORD
*-- Your SAP-UNIX server host name (case sensitive)
HOST = 'unix-host'
RFC_DESTINATION = 'SAPFTP'
IMPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
CHECK SY-SUBRC = 0.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = MI_HANDLE
COMMAND = 'dir'
TABLES
DATA = MTAB_DATA
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
LOOP AT MTAB_DATA.
WRITE: / MTAB_DATA.
ENDLOOP.
ELSE.
* do some error checking.
WRITE: / 'Error in FTP Command'.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
OTHERS = 1.
Regards
Sudheer
‎2007 Jul 17 2:23 PM
hi,
Following are the ftp commands,
-? - use -? by itself to display a list of commands or add the -? switch to any command to obtain help on the syntax and use
dir - displays contents of the directory
cd - change directory
get - the command get \<filename> allows the download of a file
mget - allows download of multiple files this command and those above may be performed with read permissions
put - the command put \<filename> uploads a file from the client host to the server. This and all subsequent commands require appropriate user permissions to write to the directory
mput - allows upload of multiple files
delete - entered as delete \<filename>
mkdir - entered as mkdir \<directoryname>
rename - entered as rename \<old_filename>
Hope it helps.
<b>rewards pint if helpful....</b>
Regards,
AbhaySingh
‎2007 Jul 17 2:37 PM
Plz give point if u feel that our answer is satisfying....
Thanks
Abhay SIngh.
‎2007 Jul 17 3:09 PM
First Check with Standard program : RSFTP002 and RSFTP00*
then see if ftp is connecting there ..
if not then there some correct parameter input error..
Regards
Prax
‎2007 Jul 18 7:41 AM
To the ftp command module i am passing the handle as 1 and command as
put physicalfilename ftppath and verify as X . Now it is giving command error .
Please reply its urgent
‎2007 Jul 18 7:51 AM