01-06-2014 9:18 AM
Hello,
Since we upgraded our BI plateform from AS400 to SQL Server, the files sent outside by FTP are in binary format.
Does anybody knows how to send them in ASCII format ?
We use 'FTP_COPY' command.
Thanks you in advance for your help.
Best regards,
Nicolas
01-06-2014 9:27 AM
01-06-2014 9:37 AM
Hi,
what is the problem. I do not see the mistake here. Does it matter, in which format the the file is transported?
I mean, if you got an ASCII-File it will be an ASCII when moving to another location?
Anyway, here is a link to the official helpportal how to configure an adapter. Maybe this help you out
SAP Library - SAP NetWeaver Exchange Infrastructure
Regards
Florian
01-06-2014 2:07 PM
Hi Nicolas,
I am not sure about FTP_COPY FM functionality, but you can try archieve it by FTP_COMMAND FM calls.
With 'ascii' as a command you can set FTP transfer to ASCII mode.
And with other standard FTP commands like cd, ls, put, lcd... you can copy file, change dir... There are many examples on SCN and on other sites.
By the way command to set binary mode is 'binary'.
01-06-2014 3:19 PM
Hi,
This is FTP code I wrote :
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
source = lv_pass
sourcelen = lv_lenght
key = lv_key
IMPORTING
destination = lv_pass.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = lv_user
password = lv_pass
host = lv_host
rfc_destination = lv_dest
IMPORTING
handle = lv_handle
EXCEPTIONS
not_connected = 1
OTHERS = 2.
CHECK sy-subrc EQ 0.
CONCATENATE vbeln " Sales order number is the file name
'.txt'
INTO lv_fname.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = lv_handle
fname = lv_fname
character_mode = 'X'
TABLES
text = lt_lines " table with ASCII data
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = lv_handle.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = lv_dest
EXCEPTIONS
OTHERS = 1.
You can find more example from SCN just search this functions.
Regards
Tolga