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. 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 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/
2 thoughts on “Dynamic File Name in SAP PI”
In the sFTP adapter there is no “File Schema” parameter, we only have Filename.
How would i use the ASMA parameter “FileName” from the source channel here?
You can use a UDF to read the fileName partmer.