on 03-03-2005 5:55 PM
Hi,
I want to send an email from XI to my mail server (Lotus) by using the Mail Adapter with option "Use mail package".
I have just succeed to send email with only <b>ONE line</b> because of field "content" which has an occurence 0..1.
How is it possible to have several lines?
When I try to duplicate field "content" or to change its occurence (0..Unbounded), then I don't receive an email?
<i>Note: Unfortunatelly, I don't know XSL / XSLT mapping.</i>
If you want to have several lines, you have to put EOL within the one "content" tag like this:
<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
<Subject>Hello</Subject>
<From>sender@sender.com</From>
<To>receiver@receiver.com</To>
<Content>row1
row2
row3
row4</Content>
</ns:Mail>
Sorry, I can only give you an XSLT example to do this. Assume your original message payload is:
<root>
<text>row1</text>
<text>row2</text>
<text>row3</text>
<text>row4</text>
</root>
you can use following XSLT file, which you attach directly to the Mail Adapter (like described in another thread):
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="*">
<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
<Subject>Hello</Subject>
<From>sender@sender.com</From>
<To>receiver@receiver.com</To>
<Content><xsl:apply-templates/></Content>
</ns:Mail>
</xsl:template>
<xsl:template match="text">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Now the same logic with using the graphical mapping tool:
Assume your source structure is:
<root>
<text>row1</text>
<text>row2</text>
<text>row3</text>
<text>row4</text>
</root>
Create a advanced user defined function like this:
public void AddText(String[] a, ResultList result, Container container){
String b = "";
for (int j=0;j<a.length;j++)
b = b + a[j] + "n";
result.addValue(b);
}
Now you connect
text -> addText -> Content
The rest you fill with constants.
Regards
Stefan
Message was edited by: Stefan Grube
Hello Stefan,
your example works fine for a simple message.
But I want to send a complete IDOC by mail to a mailserver.
Can you give me an idea or example how to do this by graphical mapping or XSLT (I'm not fine in XSLT).
What do you mean within this thread, that I can add this XSLT to the mail adapter.
Can you give me some words to search for this thread?
best regards
Werner Magerl
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.