Dynamic File Name in SAP PI

In SAP PI/PO there are several ways to create dynamic file names at receiver channel. Depending on the requirment you can make use of either Adapter Specific Massage Attributes (ASMA), User Defined Function (UDF) or Variable Substitution to set the file name dynamically. I have three articles explaining each method step by step with an example.
  • 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

  1. Javier Villarreal says:

    Hello Isuru,

    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?

    please advise.
    thank you

Leave a Reply

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