Lv_remote_dir ' -hostkey=*"' INTO lv_open_cmd.ĬONCATENATE '"put' lv_path_file_to_transfer lv_filename INTO lv_put_cmd SEPARATED BY space.ĬONCATENATE lv_put_cmd '"' INTO lv_put_cmd.ĬONCATENATE '/log="\\saprouter\INTERFACE\' sy-sysid 'E:\usr\sap\DEV\xxxxx\work\log_xfp.txt" /loglevel=0' INTO lv_log_cmd. Another possibility is to give the real hostkey surrunded by quotes and not a “*”.ĬONCATENATE '"open sftp://' lv_userid ':' lv_password lv_host ':' This will be used like : "open -hostkey=*" We still have a card up our sleeve, but its a possibility that is definitely not good for the security : Now, let say the public key is subject to changes or it is impossible to access Winscp visual interface. WinScp Visual Interface (Screenshot from own system) To make this public key known, simply connect to the SFTP using the Visual Interface of Winscp (it will create the correct entry in the Registry) : Feel free to name it with time and date so it wont be increased each time, or clear it regularly.Īt this point, the command can be successful only if the public key of the SFTP server is known by our system (Windows). The last one is to put at the end of the command and allows you to have a log of each connection. confirm : Toggles confirmations (overwrite, etc.).In batch mode, any choice prompt is automatically replied and any input prompt is cancelled (after short time interval), The two first options comes at the beginning : log="E:\usr\sap\DEV\xxxxx\work\log_xfp.txt" /loglevel=0 With all that, here is a list of command that are suggested to include as well : "option batch on" It can be replace by “./”, to give the remote file the name of the file in the first paremeter.įinally, we give a nice “exit” to cut the connection. The first part is the file that is to be transfered and the second the name of file on the SFTP after transfer. The “put” : "put C:\Users\sapabap\testfile.txt testfile.txt" (Of course the “” are not to be keeped in the final line.) On this step, it is also possible to connect to the root of the SFTP server and the give the location with the next command parameter : “put”. The remote folder is the SFTP path on which the file must be dropped. As the communication is done through SSH, we’ll consider it safe. The first part is already known and will be taken into accound by our SM69.Īfter that, comes the “open” : "open speaks for itself, but to make it work : must be a user with the access rights on the, the password can be gived here. Below a command example, we’ll detail it later on : "C:\Program Files (x86)\WinSCP\WinSCP.exe" /command "open "put C:\Users\sapabap\testfile.txt testfile.txt" "exit" It requests us to put all the arguments in the same time and in the correct order. SM69 for the creation of System Command (Screenshot from own system)Īs described before, the goal is to have a Oneliner. Winscp needs to be installed on the server,Īssuming that Winscp is installed in a “classic” sort of way, here is the command that will allow the system to summon Winscp : "C:\Program Files (x86)\WinSCP\WinSCP.exe" /command.Winscp allow you to connect and to action on a remote SFTP within one line of command. Proposed solutionĪs describe in the blogs quoted before, one solution will be to use the free-to-use Winscp app. The impact of this is that you have to find a way to build a script able to connect to SFTP and then do action inside the SFTP native app. The native SFTP command cannot be used as a OneLiner. Still, if the SAP system is running on a Unix Based system, everything is fine, because the syntax offered by Unix allow you to run SFTP command in Oneliner (using | eventually), but if the SAP system is running on a Windows NT based system, problems arise. According to note 795131, the best solution is to use a third party software to do it and then call the third party software from SAP (using SM49/69 host command). The great blogs : already describe the solution of this present blog, only it does not give a step by step solution.Īs Said, SAP does not cover SFTP using SAPFTP. Although these various blogs are good, what is proposed here is a way to do it without any constraints. This subject has also been covered by many blogs. The main problem we face for this using standard SAP is described in note : 795131 – FAQ: SAPFTP cannot perform secure FTP communication. The aim of this blog is to give an easy way to setup an SFTP connection between a SAP system and an SFTP server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |