Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
GopisettySai
Explorer

Chapter 2 - SFTP


In this blog post, we’ll take a closer look at the SFTP adapter, one of the most widely used adapters in SAP CPI. We’ll explore its features, use cases, and provide step-by-step instructions for configuring the adapter as both a sender and receiver.


By the end of this blog post, readers will have a better understanding of the SFTP adapter and how it can be used to integrate systems in their organization.


SFTP Adapter Overview:


The SFTP adapter in SAP CPI acts as a bridge between the CPI integration flow and an SFTP server. It allows for the exchange of files between the CPI tenant and external systems via the SFTP protocol. The adapter supports both inbound and outbound file transfers, making it a versatile tool for various integration scenarios.


The SFTP adapter can be used in a wide range of integration scenarios, including:




  • Connecting cloud and on-premise systems

  • Exchanging data with external partners and vendors

  • Integrating different applications within an organization


Configuring the Sender SFTP Adapter:



File Access Parameters:


Directory :


File-Path where from where file should be read


Ex: Directory/Subdirectory(D/CPI).


File Name:


Name of the File to be processed, If it is left empty ,all the files will be processed


Ex:SAP_CPI.csv ,


Tip : If we want to read to specific header file . Ex: SAP_CPI*.csv


Connection Parameters:


Address:


Hostname or Ip address of the server with port number .


Ex: sftpserver:22



Proxy Type:


The type of proxy that we are using to connect to the target system:


1)Internet: If we are connecting to a cloud system, we can use the option “Internet”.


2)On-Premise : If we are connecting to a on-premise system, then we need to add the URL in cloud connector



Location Id:


These can be used only when we select the On-Premise proxy type.


 

Authentication:


This specifies How CPI is authenticated when we are connecting to SFTP server.


We can select three authentication methods:


1)Public Key


2)Username/Password


3)Dual Authentication


Timeout:


Maximum waiting time to contact sftp server , While establishing the connection to perform read operation.


Maximum Reconnect Attempts:


Maximum number of attempts allowed to reconnect to the SFTP server before message processing starts. The default is set to 3. Enter 0 to disable this behavior.


Reconnect Delay :


Time (in milliseconds) the system waits before attempting to reconnect to the SFTP server; default Value: 1000.


Automatically Disconnect:


Disconnect from the SFTP server after each message processing.


Processing Tab:



Read Lock strategy:


Prevents files that are in the process of being written from being read from the SFTP server. The endpoint waits until it has an exclusive read lock on a file before reading it. Select one of the following options based on the capabilities of the SFTP server:


Types:


1)None


2)Rename


3)Content Change


4)Done File Expected.


Max. Messages per Poll:


Maximum number of messages to gather in each poll. Consider how long it will take to process this number of messages, and make sure that you set a higher value for Lock Timeout (in min). The messages are picked up sequentially.


Lock Timeout (in min):


Specify how long to wait before trying to process the file again in the event of a Cloud Integration outage. If it takes a very long time to process the scenario, you may need to increase the timeout to avoid parallel processing of the same file. This value should be higher than the processing time required for the number of messages specified by Max. Messages per Poll.


Change Directories Stepwise:


Select this option to change directory levels one at a time.


Include Subdirectories:


Selecting this option allows you to look for files in all subdirectories of the directory.


Use Fast Exists Check:


If selected, file exists check is performed on the SFTP server. If your server doesn't support this operation, switch back to client side check. This option is enabled by default.


Post-Processing:


 


Controls Which option we need to perform after message processing.


Types:




  • Delete File

  • Keep File and Mark as Processed in Idempotent Repository

  • Keep File and Process Again

  • Move File


 

Scheduler :





  • Schedule on Day

  • Schedule on Recur


Configuring the Receiver SFTP Adapter:



Please follow the same procedures followed for sender configurations for receiver too . In these I will explain the configs Which are not available in Sender adapter.


Target:


Append Timestamp: Appends a timestamp at the end of the file name


Processing :



Change Directories Stepwise:


Select this option to change directory levels one at a time.


Create Directories:


If selected, creates missing directory levels as provided in the file's pathname (selected by default).


Flatten File Names:


Flatten the file path by removing the directory levels so that only the file names are considered and they are written under a single directory.


Prevent Directory Traversal:


If the file contains any backward path traversals such as \..\ or /../.., this carries a potential risk of directory traversal. In such a case, message processing is stopped with an error. The unique message ID is logged in the message processing log.


Use Fast Exists Test:


If selected, file exists check is performed on the SFTP server. If your server doesn't support this operation, switch back to client side check. This option is enabled by default.


Handling for Existing Files:


Define how existing files should be treated.


There are the following options:


1)Append


2)Fail


3)Ignore


4)Override


Temporary File Name:


If selected .Enter a unique temporary file name.


At Last there are some tricks you can follow




  1. You can’t append timestamp while using dynamic naming for the file,So use this format  ${date:now:yyyyMMddHHmmss}.csv ,you can modify the timestamp as you like.

  2. 2)If you want the filename in runtime. Please use this property ${header.CamelFileName} to capture filename.

  3. 3) Kindly use Automatically Disconnect option, so that there will be less connection failures to sftp server.


 


In summary, the SFTP is must use adapter for banking integrations and it can be used as both a sender and receiver in SAP CPI. By following the steps outlined in this blog post, you’ll be able to configure the adapter and exchange data seamlessly between different systems in your organization.


Thank you for reading this blog post, and we hope you found it informative and helpful. Stay tuned for more blog posts on other adapters in SAP CPI.


Please comment your views and suggestion.


 

BYE FOR NOW WILL BE BACK WITH ANOTHER ADAPTER SOON!!!!


3 Comments
Labels in this area