Technical Articles
Cloud Integration – Dynamically Configure the SFTP Receiver Adapter
This blog describes how to configure the connection and processing settings of the SFTP receiver adapter dynamically to be able to send messages to multiple SFTP servers from one SFTP channel. This feature will be available for customers starting with the 8-June-2020 release. This blog describes the configuration options.
Dynamically Configure the SFTP Receiver Adapter
In some business cases, messages have to be sent to multiple SFTP servers, for example depending on specific payload data or on the sender of the message. Starting with the 8-June-2020 release, you can configure the SFTP adapter in Cloud Integration dynamically. Using this feature you can connect one SFTP receiver channel to more than one SFTP servers.
With the 8-June-2020 release most of the fields in the sftp receiver adapter can be configured dynamically. Some using header or property and some by specifying the value in a pre-defined property.
Fields Configurable with Header or Property
You can configure the entry fields Directory, File Name, Address, Location ID, User Name, Credential Name and Private Key Alias dynamically using header (${header.abc}) or property (${property.abc}) as shown below.
If the header or property is not defined during runtime, an error is thrown.
Dropdowns with Dynamic Option
There are two options, Authentication and Proxy Type, that are to be configured using dropdown lists on the user interface. You can specify these settings dynamically by choosing the option Dynamic from the dropdown (as shown in the screenshot above) and defining the actual value in the respective SAP property.
The SAP properties to be used and the possible values are:
Attribute SAP property Type Values
Proxy Type SAP_FtpProxyType String ‘internet’ and ‘onPremise’
Authentication SAP_FtpAuthMethod String ‘key’, ‘user’ and ‘dual’
If the property is not defined during runtime, an error is thrown.
Fields Configurable using pre-defined SAP Property
The checkboxes, additional dropdowns and integer fields are configurable dynamically by defining the values in pre-defined SAP properties. The following table shows the names of the properties for the different configuration options:
Attribute SAP property Type Values
Timeout SAP_FtpTimeout int Values of type integer
Max. Reconnect Attempts SAP_FtpMaxReconnect int Values of type integer
Reconnect Delay SAP_FtpMaxReconDelay int Values of type integer
Automatically Disconnect SAP_FtpDisconnect boolean, string ‘true’, ‘false’
Change Directories Stepwise SAP_FtpStepwise boolean, string ‘true’, ‘false’
Create Directories SAP_FtpCreateDir boolean, string ‘true’, ‘false’
Use Fast Exists Check SAP_FtpFastExistsCheck boolean, string ‘true’, ‘false’
Handling for Existing Files SAP_FtpAfterProc String ‘Overwrite’, ‘Append’, ‘Fail’, ‘Ignore’
Flatten Filenames SAP_FtpFlattenFileName boolean, string ‘true’, ‘false’
There is no need to define all the configuration options dynamically, I recommend you to do so only if the required settings differ for the different SFTP servers you want to connect to. If the property is not set, the runtime uses the value defined in the channel.
Dynamic Known Hosts File
To be able to establish a secure connection to an SFTP server, the host key of the SFTP server has to be available in a known hosts file in the Cloud Integration tenant. There are two options to store known hosts files in Cloud Integration:
- You deploy the known hosts file in the tenant in the Security Material monitor. You can store the host keys of multiple SFTP servers in this known hosts file. During the runtime, the SFTP adapter verifies the SFTP host against this known hosts file. If you have a fix list of SFTP servers, you can store the host keys of all the SFTP servers in this single known hosts file. In this case, there is no need to define the known hosts file dynamically in the SFTP adapter.
- The second option is to store the known hosts file in the Partner Directory. This way, you can specify the known hosts file dynamically in the SFTP adapter. You upload the host key for a specific partner ID in a known hosts file to the Partner Directory and use it from there dynamically during runtime. This would be the recommended option if you wanted to connect to multiple SFTP servers of different partners from one generic integration flow. To do this, define property SAP_FtpPdUri with the URI for the Partner Directory access in the integration flow before calling the SFTP adapter, for example SAP_FtpPdUri=’pd:<PD partner ID>:<Id>:Binary’. Use the Partner Directory APIs to upload the host key of the SFTP server for a specific partner in a known hosts file to the Partner Directory in binary format with content type text. Refer to the blog Partner Directory – Partner Dependent XML Structires and IDs for how to use the Partner Directory and how to upload binary data there.
Hi Mandy,
Thanks for the blog.
Bhaskar.
Thanks Mandy for sharing latest feature.
Can you suggest any publicly available SFTP server which can be used to test SFTP related iflows using CPI.
As far as I know there are no public sftp servers to send messages to. You will have to setup one.
Best regards,
Mandy
you can try google cloud.
https://blogs.sap.com/2019/06/29/try-sftp-scenarios-in-cpi-with-your-own-sftp-server-using-google-cloud/
Hi Mandy,
Thanks for the article.
I am trying to set Authentication dynamically.
For this I created property SAP_FtpAuthMethod = user and deployed IFlow.
But, I am getting error at runtime
Hello Rashmi,
please check in tracing that:
Best regards
Mandy
Hi Mandy Krimmel ,
Below is the error details -
Trace -
I dont see property getting set at runtime, only user name and credentials getting set
Content modifier before SFTP (recever) adapter
Please help me to understand what is wrong in my IFlow.
TIA,
Rashmi
Hello Rashmi,
in the content modifier you define the property SAP_FtpAuthMethod with Type property and value user, this means the value is read from property user, but there is no such property and thats why SAP_FtpAuthMethod is also not set. Please set SAP_FtpAuthMethod to constant user if you want to define it with the value user. For this select Type Constant. Or read the value from an existing property.
Best regards
mandy
Hello Mandy,
I have a requirement of placing file at SFTP target folder, but the folder is “/_ftp/0480038021/outbox”.
where 0480038021 is username (Authentication is Public Key).
We believe that the “/_ftp/0480038021” will be generated at runtime and at CPI we are supposed to configure only “/outbox” in Folder location at SFTP receiver channel.
But its not working, CPI is not able to access the folder path “/outbox”.
Will appreciate your help in this regard.
Thank you.
Hello,
if the home directory of the user that is used to connect to the sftp server is /_ftp/0480038021 then yes, /outbox should work. Maybe you try with the SSH connectivity test to check the access to the directory. Use the optopn 'Check Directory Access' to dig a bit deeper into the problem. Maybe the user does not have authorization to create files or does not have access rights?
Best regards
Mandy