2006 Jun 27 9:59 AM
Dear friends
I am trying to transfer a file from my c drive file name c:\test.csv into a ftp location . I am using the below function modules.
call 'AB_RFC_X_SCRAMBLE_STRING'
call function 'FTP_CONNECT'
call function 'FTP_COMMAND'
call function 'FTP_DISCONNECT'
The first two function modules are giving a sy-subrc value of 0 but the third where we need to specify the ftp command which in my case is " put c:\test.csv " , is not working.
it is giving a command error (sy-subrc = 1) .
Kindy advice me what needs to be done for this.
Expecting a quick help.
Thanks in advance.
Dear friends
I am trying to transfer a file from my c drive file name c:\test.csv into a ftp location . I am using the below function modules.
call 'AB_RFC_X_SCRAMBLE_STRING'
call function 'FTP_CONNECT'
call function 'FTP_COMMAND'
call function 'FTP_DISCONNECT'
The first two function modules are giving a sy-subrc value of 0 but the third where we need to specify the ftp command which in my case is " put c:\test.csv " , is not working.
it is giving a command error (sy-subrc = 1) .
Kindy advice me what needs to be done for this.
Expecting a quick help.
Thanks in advance.
2006 Jun 27 10:02 AM
2006 Jun 27 1:11 PM
Hi Ravi
Basically I am using "put" command in order to transfer a file from my pc or application server to ftp location.
I did not find any entries of " put" command in sm49.
can you guide me how to go about this issue.
Regards
2006 Jun 27 1:19 PM
Hi,
I think If you are using the FM : SXPG_COMMAND_EXECUTE, command has to be created in SM49, with FTP FM's you can directly pass the unix commands.
Laxman
2006 Jun 27 1:36 PM
Hi
I am using the below 4 function modules
call 'AB_RFC_X_SCRAMBLE_STRING'
call function 'FTP_CONNECT'
call function 'FTP_COMMAND'
call function 'FTP_DISCONNECT'
I am getting error with 'FTP_COMMAND' function module.
the error is "command error".
When I debugged the function module 'ftp_command' the error description was
FTP subcommand: Local error
Kindly suggest.
Thanks in advance.
2006 Jun 27 10:03 AM
2006 Jun 27 10:08 AM
Hi,
Sample program for FTP
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.
<b>CALL FUNCTION 'FTP_CONNECT'</b>
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.
<b>CALL FUNCTION 'FTP_COMMAND'</b>
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.
<b>CALL FUNCTION 'FTP_DISCONNECT'</b>
EXPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
OTHERS = 1.Thanks
Sudheer
2006 Jun 27 2:02 PM
Hi,
can you look at the program <b>RSEPSFTP</b>, you will understand where you are doing wrong..
Thanks
Sudheer
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |