Skip to Content
Author's profile photo Eng Swee Yeoh

DynamicAttributeChangeBean – The no-mapping solution to changing Dynamic Configuration … dynamically!


As there is no dedicated Managed File Transfer (MFT) capability in PI (yet!), passthrough scenario is a common approach to achieving a 1-1 file transfer interface. A passthrough scenario is one of the simplest configuration in PI as there are no ESR objects required.

However, every now and then, we come across requirements that slightly complicates the passthrough scenario, i.e. changing the filename extension, adding prefix to the original filename, adding timestamp in a custom format. These cannot be achieved by the standard file-based adapters. To get around it, some form of mapping is required and therefore we return to the necessity to have ESR objects. Here are some common approaches so far:

  • Create a passthrough Java mapping that dynamically modifies the Dynamic Configuration attributes
  • Configure FCC at sender, perform 1-1 mapping and configure FCC at receiver
  • Execute additional OS-level commands/scripts to perform renaming/moving of file

DynamicAttributeChangeBean (DACB) is an adapter module solution that aims to fill this gap, in particular addressing these passthrough scenarios. DACB is another “develop/deploy once, use multiple times” adapter module (the likes of ExcelTransformBean) that is highly configurable and reusable.

Source Code and Deployment Archive

DynamicAttributeChangeBean belongs in the same adapter module project as FormatConversionBean. Refer to following blog for the location of source code and/or EAR deployment file.

FormatConversionBean – One Bean to rule them all!

Module Parameter Reference

Below is a list of the parameters for configuration of the module. Certain parameters will automatically inherit the default values if it is not configured.

Parameter Name Allowed values Default value Remarks






Required field. Determines the mode of processing

  • add = Adds prefix and/or suffix to the attribute
  • change = Replaces a value in the attribute with a new value
  • delete = Deletes prefix and/or suffix from the attribute
  • regex = A more dynamic version of change mode performed via regular expression matching and substitution on the attribute
  • none = Used if only timestamp addition is required
namespace Namespace of the input Dynamic Configuration attribute
attribute FileName Input Dynamic Configuration attribute
outNamespace If blank, inherit from namespace Optional output namespace if it differs from input Dynamic Configuration namespace
outAttribute If blank, Inherit from attribute Optional output attribute if it differs from input Dynamic Configuration attribute

Available when mode = ‘add’ or ‘delete’

Value at the front of attribute to be added or deleted


Available when mode = ‘add’ or ‘delete’

Value at the end of attribute to be added or deleted


Required field when mode = ‘change’

Existing value in attribute to be replaced


Required field when mode = ‘change’

New value as replacement in attribute

replaceAll Y, N N

Available when mode = ‘change’

Replaces all values of oldValue in the attribute


Required field when mode = ‘regex’

The regular expression for matching patterns of the attribute


Required field when mode = ‘regex’

The replacement value for the matched patterns. Matched capturing groups from the regular expression above can be referenced in the replacement value

addTimestamp Y, N N Adds timestamp at the end of the attribute before the extension (the last .xxx)
timestampFormat yyyyMMdd-HHmmss-SSS

The format of the timestamp following allowed patterns in Java’s SimpleDateFormat

Example Scenarios

Here are some example use case scenarios for DACB based on different configuration options. For the sake of simplicity, the results shown are Console output using the Standalone testing of Adapter Module in NWDS approach.

Scenario 1

Add prefix and suffix to the FileName attribute.

Module parameters

Parameter Name Parameter Value
mode add
attribute FileName
prefix MY_
suffix .zip


The FileName attribute is appended with a prefix and suffix.


Scenario 2

Change the extension of the FileName attribute.

Output attribute in a different namespace.

Module parameters

Parameter Name Parameter Value
mode change
attribute FileName
oldValue .txt
newValue .xml


The extension is changed from txt to xml and stored in a different namespace. Note that the original input attribute is not modified.


Scenario 3

Delete the last extension.

Use default namespace and attribute.

Add a custom timestamp.

Module parameters

Parameter Name Parameter Value
mode delete
suffix .pgp
addTimestamp Y
timestampFormat ‘_’yyyyMMdd


The default namespace and attribute is used. The PGP extension is removed from the filename, and a timestamp is added.


Scenario 4

Dynamic change mode using regular expression.

Match the filename pattern while also capturing the two numeric groups – the first (\d+) after order Order and the second (\d+) after Batch.

Rename the output using references from the matched capturing groups ($1 and $2.)

Module parameters

Parameter Name Parameter Value
mode regex
regex Order_(\d+)_Batch_(\d+).xml
replacement PO_$1_Group_$2.txt


Values 1234 and 10 are captured from the input attribute, and used in the renaming of the output attribute.


Scenario 5

And finally (and this is the most exciting example use case!) an example based on an actual requirement from this thread. For this, actual configuration and testing screenshots will be shown.

Requirement: Determine the target folder based on the dynamic values contained in the file name.

Module configuration


Monitoring Logs and Testing Result

An input file with value of Partner1_002_Invoice.xml set in the Dynamic Configuration FileName attribute.


After the module processing by DACB, an additional attribute for Directory is added, with the value dynamically determined from the input filename. The target directory = /sapinterface/xxx/Partner1/002/


The audit log shows the attribute changes and the file being routed to the dynamically determined target directory.


And we find the file in the directory as expected!



With usage of DACB, most passthrough scenarios can remain “ESR object”-less (although there is actually reason to have at least the Service Interface defined in ESR)

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Good one 🙂

      Thanks for covering possible dynamic patterns in your module.

      Best Regards,

      Praveen Gujjeti

      Author's profile photo Suhale Shaik
      Suhale Shaik

      Well explained 🙂

      Thanks for sharing this.


      Suhale Shaik.

      Author's profile photo Former Member
      Former Member

      Super 🙂 .

      Nice and I have to bookmark this till I remain in integration...:).


      Author's profile photo Former Member
      Former Member

      Very nice...

      Can you please share the source code?

      Author's profile photo Eng Swee Yeoh
      Eng Swee Yeoh
      Blog Post Author

      This is already mentioned in the "Source Code and Deployment Archive" section.

      Author's profile photo Peeyush Bansal
      Peeyush Bansal

      Source code is not available

      Author's profile photo Former Member
      Former Member

      Great blog, thanks !

      Author's profile photo K Ramesh
      K Ramesh

      Great blog... appreciate your effort.  i deployed your module and i achieved my requirement.

      Author's profile photo Eurico Borges
      Eurico Borges

      Hi @Eng Swee Yeoh    could this module be used in a context of a dynamic sender filename in a case of a filename that has fixed part and a timestamp? This would be for a case where we would want to retrieve always only 'todays' file (e.g EXCHANGERATES_20161121.txt ) from a FTP server.


      Author's profile photo Eng Swee Yeoh
      Eng Swee Yeoh
      Blog Post Author

      Hi Eurico

      The SAP File/FTP adapter does not support dynamic selection of file to retrieve irregardless of the capability of this module.

      A workaround approach to pick files dynamically is described in the following blog:-

      Eng Swee

      Author's profile photo Former Member
      Former Member

      Other very nice Bean from Eng, congratulation!


      I’m trying to get the name from payload, is it possible with this Bean?



      Author's profile photo Peeyush Bansal
      Peeyush Bansal

      Hi @Eng Swee Yeoh    , Please share the source code for this module

      Author's profile photo Jason Lehmiller
      Jason Lehmiller

      Hi, would you like a PI brainteaser related to this?  I need to ultimately move an XML file via SFTP, but I will not know that the XML file is ready to send until a separate “.xml.ready” handshake file with the same name otherwise, is created in that same directory.  I deployed “Custom_AF_Modules/DynamicAttributeChangeBean” and I can successfully call it to change the FileName property to the XML file name, but it doesn’t actually get the other XML file when I change the FileName property that references it.

      Author's profile photo Jason Lehmiller
      Jason Lehmiller

      Phew, I found a potential solution under:

      Author's profile photo Rahul More
      Rahul More

      Can you please add the source code, currently it is not available......