Dynamic File Name UDF SAP PI

Hi Guys,

This is another way of setting a dynamic file name at receiver. You can write a simple UDF to create the file name in the message mapping. File name created in the message mapping can be set at the receiver using adapter specific message attributes (ASMA).

In this example (iDoc to File scenario) I am setting the iDoc Message type and Material number to the file name in the below format.


File name: <Message Type>_<Material Number>_TimeStamp.XML



Create the UDF: Set_FileName

Configure the parameters of the UDF. In this example message type and material number













Write the UDF logic to set the file name














 Configure the Message Mapping program









 Configure the receiver file communication channel 

You can set any text as the file name as it would be replaced by the ASMA.









Set the ASMA















Set the time stamp












Test Case


SAP PI, SAP PI 7.31, ABAP, File Name, Communication Channel, ASMA, Adapter Specific Message Attributes, Dynamic File name, iDoc, File, File adapter, Isuru Fernando

Labels: , , , , , , , , , , ,