0% found this document useful (0 votes)
129 views

Dynamic Email Attachment Name For Received Mails - Process Integration - Community Wiki

This document describes how to dynamically set the file name of email attachments received in SAP Process Orchestration. It involves mapping fields in the mail message structure to populate the attachment name, content type and disposition using values from the original file. When implemented correctly, the received email attachment will have the same name as the original file placed in the sender system.

Uploaded by

fziwen
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
129 views

Dynamic Email Attachment Name For Received Mails - Process Integration - Community Wiki

This document describes how to dynamically set the file name of email attachments received in SAP Process Orchestration. It involves mapping fields in the mail message structure to populate the attachment name, content type and disposition using values from the original file. When implemented correctly, the received email attachment will have the same name as the original file placed in the sender system.

Uploaded by

fziwen
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

4/5/2020 Dynamic Email Attachment name for Received Mails - Process Integration - Community Wiki

Welcome to the new version of SAP Community Wiki: Learn What's New? and what has changed.
Pages / … / Step-by-Step Guides - Connectivity - Main page

Dynamic Email Attachment name for Received Mails


Created by Former Member, last modified by Kenny Scott on Jun 28, 2011

When dealing with mail adapters, most often we tend to send or receive mails with attachments that have few concerns that we need to take care of. For instance
attachment filename, content type etc. At times when we receive any mail with attachment, we face the issue with the default name of the attachment, as it is not the
original filename that has been sent as attachment via mail.

Business Case:
Files placed in the sender business system (FTP) are sent as email attachments to the recipients based on payload of the sent message and the email attachment
should have same name of file placed in sender business system. The files that are placed in sender business system are of type flat or xml.
Off target Approach:
For receiver mail adapter choosing Transport Protocol as SMTP and Message Protocol as XIPAYLOAD, then marking Use Mail Package and Keep Attachments
produces a mail attachment with default name e.g.:- untitiled.xml, though we can give any name as a attachment name using standard adapter module
MessageTransformBean, but its not dynamic approach as every time we need to mention the file name in Module Configuration table of Module tab.
Dynamic Approach:
Design the objects as we do for normal email approach, source structure holds the structure of sender payload, since we are using mail package we need download
the SAP Note 748024 (User required) and import it using external definition. The following is the target structure of the imported xsd.

Fig1: Mail Message Of SAP Note 748024 XSD


https://wiki.scn.sap.com/wiki/display/XI/Dynamic+Email+Attachment+name+for+Received+Mails 1/4
4/5/2020 Dynamic Email Attachment name for Received Mails - Process Integration - Community Wiki
We need to disable the fields as shown in the above figure: 1. among mapped fields, three fields that are marked
(Content_Type, Content_Description, Content_Disposition) should be mapped with the following.
The filed Content_Type should be mapped with the constant node with value "application/xml".
Content_Description field should be mapped with the UDF, which gets the filename using Dynamic Configuration (Enable the option Adapter Specific Message
Attributes at sender communication channel of file adapter).
DynamicConfiguration conf = (DynamicConfiguration)
container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName;
Content_Disposition should contain the value in the following format.
Format: "attachment;filename="<filename>"",
where <filename> should get from the above UDF.
The following figure illustrates how Content_Disposition should be mapped.

Fig2: Mapping Field Content_Disposition with UDF assignFileName


Once the mapping of the remaining field has finished design rest of the objects as normal. When comes to the configuration part, things we need to take care while
configuring receiver mail configuration channel is to check Use Mail Package and Keep Attachments options as shown in following figure.

Fig3: Mail Attributes in Receiver Mail Adapter


Once you execute the scenario, after you finished with rest of the configurations as normal, the result produces email attachment names dynamically as with the same
filename of sender business system as shown in following figure(s) 4 & 5.

https://wiki.scn.sap.com/wiki/display/XI/Dynamic+Email+Attachment+name+for+Received+Mails 2/4
4/5/2020 Dynamic Email Attachment name for Received Mails - Process Integration - Community Wiki

Fig4: File placed in Sender FTP

Fig5: Received Email with attachment

xi_stepbystep_adapters bc-xi-con-mai

7 Comments
Unknown User (sqfbkkg)
And how you relize the mapping of the content field of the mail???
Thanks

Edwin Theuns
Hi,
how is the mapping for the field Content relized?and the rest of the design(Interface Mapping, etc?
Greetings

Unknown User (sqfbkkg)


Someone knows how is the mapping if the initial file is a XML file??
Please HELP ME!!!!!!

https://wiki.scn.sap.com/wiki/display/XI/Dynamic+Email+Attachment+name+for+Received+Mails 3/4
4/5/2020 Dynamic Email Attachment name for Received Mails - Process Integration - Community Wiki

Unknown User (t6l9j80)


I have the same question a Ma Belen.
I have an XSLT style sheet that generates an HTML payload file and have it working not using the package. However I want to use the package so I can
dynamically assign the subject line and to emails from a table in the Integration Directory.
Can you provide the UDF code for the two UDF's?

Justin George
One important configuration missing in the blog is to check the ASMA settings at the receiver adapter also. Without that, this will not work.

Mark Bernabe
Hi,
Thanks. I followed the steps and it worked. The same filename was sent as E-Mail however, the contents are gone. Has anyone encountered the same
problem?
Mark

Sunil Kumar Tangudu

Hi,

I have followed as above but the content in the file is blank. How to rectify it.
Without mapping we have gone for using script in File sender channel but the script is sending same files mutliple times instead of one time.

Thanks,
Sunil

Privacy Terms of Use Legal Disclosure Copyright Trademark Cookie Preferences

https://wiki.scn.sap.com/wiki/display/XI/Dynamic+Email+Attachment+name+for+Received+Mails 4/4

You might also like