Dynamic File Name in SAP CPI

This blog will explain how to configure dynamic file name in SAP CPI. This can be used for the sap cpi FTP/SFTP receiver adapter.

Refer to the blog to learn about basic SFTP adapter configuration in SAP CPI.

We are all aware of how Dynamic Configuration works in SAP PI.  This blog post will show how to achieve dynamic configuration in receiver SFTP adapter in SAP Integration Suite (aka CPI).

Let’s take a look at a simple requirement: set the target filename dynamically based on a key field in the incoming message.

Assume we have a requirement to name the file:  Employee_<Country>.xml.

Where Country is an incoming payload value.

The Iflow will look like this:

Dynamic file name in sap cpi

Content Modifier Configuration.

A Content Modifier is one of the most important functions provided by SAP.

This function helps you to change the content of an incoming message or payload during Message Processing (i.e. Message Header, Message Exchange Property, or Message Body).

In our case, we will use it to set dynamic file name in sap cpi.

As we have to read the value from the incoming payload we will use XPATH here. In this case value of the country field is picked up.

Content Modifier in sap cpi

Receiver Channel Configuration.

The filename will be set as ${header.file_name} – The name of the parameter has to match with what is defined in the content modifier step above.

Save and deploy the iflow.

When the interface is launched, the following files will be generated:

dynamic file name in sap cpi

 

Refer SAP library for SFTP Receiver adapter 

 

One thought to “Dynamic File Name in SAP CPI”

  1. Goutham kumar says:

    Here in this case the File name will only have the country name right, how “Employee_” is getting added where it is configured?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.