Series of CPI Adapter – FTP Adapter
2023-10-5 21:15:14 Author: blogs.sap.com(查看原文) 阅读量:23 收藏

In this blog post, we’ll take a closer look at the FTP 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 FTP adapter and how it can be used to integrate systems in their organization.

FTP Adapter Overview:

The FTP adapter is an essential component for connecting SAP Cloud Integration to a remote system, facilitating the transfer of files using TCP (Transmission Control Protocol).

Configuring the Sender FTP Adapter:

Source Tab:

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.

Encryption

Choose the transport encryption option based on your requirements. You can select Explicit FTPS, Implicit FTPS, or Plain FTP (no encryption).

Credential Name

Specify the name of the User Credentials artifact that contains the user name and password.

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 Tab:

  • Schedule on Day
  • Schedule on Recur

Configuring FTP Receiver 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.

Encryption:

Dynamic: Select this option to let the system determine at runtime which encryption to use. The value of property SAP_FtpEncryption is used for that purpose. Possible values are ftp, ftps or ftpes.

  • ftp: Plain FTP – no encryption
  • ftps: Implicit FTPS
  • ftpes: Explicit FTPS

Processing Tab:

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 FTP 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.

Get hands on my other blogs

Chapter 1- HTTP Adapter : Series of Adapters – CPI | SAP Blogs

Chapter 2- SFTP Adapter : Series of CPI Adapters – SFTP | SAP Blogs

Chapter 3 – SOAP 1.x Adapter : Series of CPI Adapter – Soap 1.x | SAP Blogs

Please comment your views and suggestion.


文章来源: https://blogs.sap.com/2023/10/05/series-of-cpi-adapter-ftp-adapter/
如有侵权请联系:admin#unsafe.sh