Skip to Content

How to generate target file name based on the input attachment file name

Recently we have developed a HTTP to File scenario in PI. There was a requirement that the target file name will be same as the attachment file name. SAP has provided a java method to read the attachment data and content type, content ID, but there is no standard function to read the attachment file name.

We have referred the following blog to create the HTTP test client for our interface.

The new java HTTP adapter supports attachment, Multipart Documents, form submission. The adapter also provides options to send URL parameters and Header Parameters in the dynamic header of the PI message.

So to read the attachment file name, we have passed the attachment file name in the URL and then read the same from dynamic header. Below are the detail steps

  1. Find the input parameter for attachment , inside the HTML form

<td width=”30%”><input type=”file” name=”Attachment1″ size=”40″ /></td>

Attachment1 is the parameter.

2. Modify the java script to include the attachment file name in the URL


So in the URL file name parameter will carry the actual attachment file name.

3.Make the change in the communication channel so that the file name will be populated in the dynamic header


4.Write the following line of java code to read that value from header and then set the same for file adapter so that the target file will be generated with that name


Test Result:


File name populated in header


Target file name generated


You must be Logged on to comment or reply to a post.