In SAP Integration Suite (CPI) and PI/PO there are several ways to create dynamic file names at the receiver channel. Depending on the requirement you can make use of either Adapter Specific Massage Attributes (ASMA), User Defined Function (UDF) or Variable Substitution to set the file name dynamically set the file name in the receiver adapter in SAP PI/PO. However, In SAP CPI, the process is relatively straightforward because you can leverage Camel Simple Expressions. In Integration Suite (CPI), you can define headers or exchange parameters to store filenames, directories, and other dynamic values. These parameters can then be used with Camel Simple Expressions to set values at the receiver adapter.
I have the following articles explaining each method step by step with an example.
Dynamic File Name/Directory Using Parameters and Camel Expressions in SAP Integration Suite (CPI)
In Integration Suite (CPI), you can use headers or exchange parameters to define the file name and other values that need to be set at runtime. Then, by using Camel Simple Expressions, you can assign the value of those parameters to file name, directory, etc.—at the receiver adapter during runtime.
Of course, for more complex file name determination logic, you can implement the logic using a Groovy Script of a User Defined Function (UDF).
Check my example – Define Dynamic Parameters at the Receiver Adapter in SAP Integration Suite CI (CPI)
Adapter Specific Message Attributes (ASMA).
This is most suitable for a file-to-file scenario where you want to set the file name according to the sender file name. Adapter-specific messages attribute from the sender can be set to the receiver by configuring the communication channels accordingly.
Check my example (includes variable substitution also) on this @ https://sapintegrationhub.com/pi-po/asma/adapter-specific-message-attributes-sap-pi/.
User Defined Function (UDF).
This method is suitable for complex file name generation where you want to generate the file name based on a complex logic using the incoming message content. For example if you want to set a substring of a certain variable to the file.
Check my example @ https://sapintegrationhub.com/pi-po/udf/dynamic-file-name-udf-sap-pi/
Variable Substitution in the communication channel.
This method can be used if you want to create the file name from certain attributes of the receiver payload.
Check my example @ https://sapintegrationhub.com/pi-po/file-adapter/variable-substitution-dynamic-filename-sap-pi-po/
The post Dynamic File Name in SAP PI PO & CPI appeared first on SAP Integration Hub.
