01-25-2018 9:38 PM
Hi experts, I have an issue with a develop that uses FTP protocol.
Well, I have to transfer xml and pdf files from FTP Server to SAP App Server, to do it I use SAPFTPA, that allows me use App Server as local directory. The xml files goes well but the pdf files doesn't. The pdf file have content (when I open it via AL11) but when I try to see it with a pdf viewer it's shown in blank.
I have executed the transfer commands in terminal and the pdf files are ok.
This is the abap code I use to tranfer:
*setting local directory (ECC directory vía SAPFTPA)
p_cmd = 'lcd /usr/sap/InterfaceSAP/XML_Rec_FacElec/PAC'.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = l_handle
command = p_cmd
TABLES
data = lit_mtab_data
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
*Setting transfer mode to binary
p_cmd = 'binary'.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = l_handle
command = p_cmd
TABLES
data = lit_mtab_data
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
*create the command for ftp console << get file_name.pdf >>
concatenate p_name '.' gc_ext3 into p_cmd.
concatenate 'get' p_cmd into p_cmd separated by space.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = l_handle
command = p_cmd
TABLES
data = lit_mtab_data
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
*after transfer file delete it
concatenate p_name '.' gc_ext3 into p_cmd.
concatenate 'delete' p_cmd into p_cmd separated by space.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = l_handle
command = p_cmd
TABLES
data = lit_mtab_data
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
01-26-2018 8:09 AM
Your code seems okay, because you transfer in binary mode.
So, the question is : after the FTP, how do you exactly proceed to display the file ?
01-27-2018 2:46 PM
Dear Em
could you please send me the sapftp version, sapftp.exe -V
thanks
JozsefH
01-29-2018 1:40 PM
Hi everyone, thanks for quick answers I have solved the issue. It wasn't the FTP transfer, it was the path I take them from, so it shows in blank because, I din't remembered, I show a blank pdf when the viewer, of course this is in another develop, didn't found the pdf file in this path. Thanks!
01-29-2018 6:47 PM
Thanks for the update. Please close the question, see this blog.