Hello All,
We are having a Proxy to Mail scenario. We have used Multi-mapping(1 - N) with mail package on the target side. Our requirement is to read the XML from every ITEM node(Source) and send as an email with one attachment. Please find the source structure below.
We are using Return as XML function (on Node3) on the source side[This XML should be sent as attachment in every mail]
Source structure
MT_XXX
-->Item(0..unbounded)
------>Node1(1)
------>Node2(1)
---------->Node3(1)
------------------->SubNode3.1(1)..
Target structure
Mail package(Signature tab we have changed the occurance to 0..unbounded)
We use the below udf to create attachment and the Email body in our message mapping
{
String emailBody = "Hello " "\n"+"Attached is the interface file for invoice:
//creating attachment
String attachmentName = invoiceNumber + ".xml";
String contentType = "application/xml;name=" + attachmentName;
GlobalContainer globalContainer = container.getGlobalContainer();
OutputAttachments outputAttachments = globalContainer.getOutputAttachments();
Attachment attachments = outputAttachments.create(attachmentName,contentType,sourceXML.getBytes());
outputAttachments.setAttachment(attachments);
return emailBody;
}
The issue we face is all the attachments are sent for every target message delivered. We need to send one email + one attachment for evry item.
Reference :
http://scn.sap.com/docs/DOC-64444
Any inputs pleease!!
Regards,
Malini