Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Former Member
Business Driver
Purchase and Sales information is sent from a partner via Email as a CSV attachment.
PI has to poll the Email server, retrieve these mails and write the CSV files in PI server directory with exactly the same name as the mail attachment.
This requirement has popped up many times in the sdn forums
and the solution to this currently is to deploy a custom adapter module
But the same requirement can be sufficed with absolutely no coding or creation of adapter modules.
This can be achieved with 3 standard beans:
MultipartHeaderBean ,PayloadSwapBean and DynamicConfigurationBean
In this blog I have highlighted only the specific settings that have to be maintained
in the communication channels to achieve our requirement, all the other ESR & ID objects should be created as usual.
Sender Email Channel Settings
In the sender email communication channel make sure to check the ‘Keep Attachments’ option , which is required to retain the attachment.
Also check the ‘Set Adapter-Specific Message Attributes’ option to enable the Dynamic Configuration attributes to be available.
Pic 1.1
Pic 1.2
The MultipartHeaderBean enables us to access the attributes of other payloads that are appended to the XI message as
an additional attachment.
In the ‘Module’ tab add the MultipartHeaderBean with the following parameters:
Parameter Name                Parameter Value       
Using the PayloadSwapBean here we can replace the application payload of the XI message
i.e. email content, with another payload that is appended to the XI message i.e. the attachment
Add the PayloadSwapBean with the following parameters:
Parameter Name                Parameter Value       
swap.keyName    Payload-Name
Pic 1.3

Receiver File Channel Settings


Now in the Receiver File adapter we are going to use the DynamicConfigurationBean to retrieve the attachment name.

The attachment file name is available in the Dynamic configuration attribute Part[1].Content-Description, which we will write to the PI message interface name.

To the 'Module' tab add the  DynamicConfigurationBean with the following parameters:

Parameter Name                Parameter Value       





Pic 2.1

Using Variable Substitution, create a variable fname referencing the message interface name and access this variable in the file name field.

Pic 2.2

Pic 2.3




The configurations are complete. It’s time to test our scenario.

A sample mail is sent to the mail account which the sender email adapter is polling with the attachment name MyAttachment1.CSV

Pic 3.1

Integrated configuration was used in this scenario, so we can see the Dynamic Configuration message attributes in message monitoring.

Note that Part[1].Content-Description has been set to MyAttachment1.CSV at runtime.

Pic 3.2

The payload was swapped successfully and the attachment data has been set to the main payload as shown below.

Pic 3.3

We can see the output file in the output folder path with the same name as our attachment MyAttachment1.CSV.

Labels in this area