on 08-30-2006 4:55 PM
Hi,
We are polling DB from XI to get deliveries with the status 'complete'. Below is the format:
resultset
row (1 to unbound)
delierynumber
deliverylineitem
billedcustomer
billedqty
status
We are able to send xml message as mail attachment.
But what we want to send it as below in MAIL BODY:
Following are deliveries:
deliverynumber deliverlineitem billedcustomer billedqty status
1234 10 3456 10 complete
2345 10 4567 20 complete
4567 20 5678 05 complete
I have few questions about how we could do this.
1) How to convert XML message in XI to text message and send it in mail body as simple report??
2) What configuration parameters I have to use to achieve this in receiver mail adapter??
3) What modules and waht module parameters we have to use to do this??
Thanx
Sue
Hi,
Which SP are you on?
This option is available from Sp 18 onwards as a new module.
http://help.sap.com/saphelp_nw04/helpdata/en/44/75bdab7b2618e8e10000000a1553f7/content.htm
Regards,
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check out this like for adapter module development
Thanks,
Prakash
Hi Susan,
If I understood correcly, there is no need fo a adapter module development and I don't see any complexity with this requirement. Please correct me if I am wrong.
You can do any mapping and concatenate all the fields with a space in between and assign to the <Content>. You will get it in the body of the message. What do you say Bhavesh?
Thanks,
Prakash
Hi,
I haven't tried that. I think it will work, my only concern is we have multiple rows in source message, each row has to go as single line in content of target message.
Occurence of content is 0 to 1.
1) Can we change the occurance of content to unbound create multiple lines?
2) Or can we do it while using concat funtion??
3) We have to mail to multiple recipients, how do we mention multiple mail ids?? Can we just give multiple email ids in To filed with ; separator?
Please check source and target message formats in my first post in this thread.
Thanx
Sue
Hi,
<i>1) Can we change the occurance of content to unbound create multiple lines?</i>
No do not chage the occurance.
<i>2) Or can we do it while using concat funtion??</i>
Yes you can pass the whole queue into a UDF. LOOP thru the records and concatenate into a string. You can also try using XSLT Mapping.
<i>3) We have to mail to multiple recipients, how do we mention multiple mail ids?? Can we just give multiple email ids in To filed with ; separator?</i>
Yes you can use ";" to separate the email IDs.
Thanks,
Prakash
Hi,
We have changed the occurance of 'Content' and we are getting following error:
2006-08-30 12:01:30Error Mail: error occured: com.sap.aii.messaging.util.XMLScanException: expecting end tag: Mail, but found {}Content at state 1
2006-08-30 12:01:30 Error Exception caught by adapter framework: Failed to call the endpoint
2006-08-30 12:01:31 Error Delivery of the message to the application using connection AFW failed, due to: Failed to call the endpoint.
Any clue about this error?
Thanx
Sue
Hi,
Plesase do not change the occurances. Just concatenate all the string into <Content> tag. There can be only one Body for a mail that is content here. Please use a UDF and pass the whole queue to it, loop thru it and concatenate it. I think you are bothered about doing a line break... you can use <BR> after every record and there is something called content_type which you can set to text/html.
<?xml version="1.0" encoding="UTF-8"?>
<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
<Subject>Subject</Subject>
<From>namea@company.com</From>
<To>nameb@company.com</To>
<Reply_To />
<Content_Type>text/html</Content_Type>
<Content>123 ABCD XXXX<BR>124 CDEF ZZZZ</Content>
</ns:Mail>
Thanks,
Prakash
Thought this information might be helpful to figure out above mentioned error
1) Downloaded XI mail adapter XML schema as "ximail30_xsd" to desktop.
2) Created external definition "ed_mail" uploading ximail30_xsd as xsd.
3) Created message mapping between our souce message and external message ed_mail.
4) Created interface mapping between o/b interface and MAIL part from the external definition.
5) We <b>didn't</b> create this scenario under the following namespace http://sap.com/xi/XI/Mail/30. IS something to do with this namespace??
Thanx
Sue
Hi,
Here is the source xsd:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://<b>NameSpace</b>" targetNamespace="<b>NameSpace</b>">
<xsd:complexType name="row">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
5e090470385011db9654000e7f22e9d4
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="DeliveryNumber">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0a0377b11db91dbf237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="10" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="DeliveryLineItem">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0a1377b11db98aaf237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="6" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="OrderNumber">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0a2377b11dbc5c4f237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="10" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="OrderLineItem">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0a3377b11db9d84f237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="6" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="BillToID">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0a4377b11dbb49bf237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="17" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="BillToName">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0a5377b11dbb38ff237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ShipToID">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0a6377b11db9370f237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="17" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ShipToName">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0a7377b11dbb66cf237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ProductCode">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0a8377b11db8f94f237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="18" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ProductDesc">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0a9377b11db929ff237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ScheduledLoadDate">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0aa377b11db8d1df237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="8" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ScheduledLoadTime">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0ab377b11dba57ff237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="6" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Carrier">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0ac377b11dbcc03f237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="40" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="CustomerPO">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0ad377b11dbb5a2f237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="35" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="OutYard">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0ae377b11dbcc51f237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="16" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="OrderedQty">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0af377b11dbbe6cf237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="15" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="OrderUofM">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0b0377b11db9264f237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="3" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LabConc">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0b1377b11dbb0e7f237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="50" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="GrossMT">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0b2377b11db99f1f237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="4" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="GrossST">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0b3377b11db9b6ff237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="4" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="BilledQty">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0b4377b11db8a9af237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="8" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Status">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
9d3ac0b5377b11dba39cf237ac102206
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="10" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="resultset">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
5e044980385011dbb2d3000e7f22e9d4
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="row" type="row" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
c1cb8fd0377b11db912af237ac102206
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Target xsd:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://sap.com/xi/XI/Mail/30" targetNamespace="http://sap.com/xi/XI/Mail/30">
<xsd:element name="Mail">
<xsd:annotation>
<xsd:documentation>
Mail package for XI - Mail Adapter
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Subject" type="xsd:string" minOccurs="0" />
<xsd:element name="From" type="xsd:string" minOccurs="0" />
<xsd:element name="To" type="xsd:string" minOccurs="0" />
<xsd:element name="Reply_To" type="xsd:string" minOccurs="0" />
<xsd:element name="Content_Type" type="xsd:string" minOccurs="0" />
<xsd:element name="Date" type="xsd:dateTime" minOccurs="0" />
<xsd:element name="Message_ID" type="xsd:string" minOccurs="0" />
<xsd:element name="X_Mailer" type="xsd:string" minOccurs="0" />
<xsd:element name="Content" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
any type
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="encoding" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:schema>
Please let me know if you have any questions.
Thanx
Sue
Hi,
Here is the UDF code
String mailBody = new String();
int inta, intb, intc, intd, inte;
inta = a.length;
intb = b.length;
intc = c.length;
intd = d.length;
inte = e.length;
for(int i = 0; i< c.length; i++)
{
mailBody = mailBody + a<i> + " " + b<i> + " " + c<i> + " " + d<i> + " " + e<i> + "<BR>";
}
result.addValue(mailBody);
1. Map only the Message Type node and do not map any other node from the source to target
2. Map all the constants like mail id, content_type = text/html etc.
3. Create a UDF with the code I have given which accepts 5 parametes and select the queue option.
4. Pass those 5 fields in order and change their context to Message Type.
6. Map the output of the UDF to the content.
Thanks,
Prakash
Hi Prakash,
Thanks for the code. I have done the same way as you told. It looks fine but I think I am doing mistake some where. Instead of real values in the content we are getting following information into content:
[Ljava.lang.String;@1e1ab0e [Ljava.lang.String;@a542d8 [Ljava.lang.String;@1c7a26c [Ljava.lang.String;@17894a8 [Ljava.lang.String;@167ac9b [Ljava.lang.String;@1750438 [Ljava.lang.String;@1682149 [Ljava.lang.String;@1614578<BR>[Ljava.lang.String;@86f394 [Ljava.lang.String;@1e1ab0e [Ljava.lang.String;@a542d8 [Ljava.lang.String;@1c7a26c [Ljava.lang.String;@17894a8 [Ljava.lang.String;@167ac9b [Ljava.lang.String;@1750438 [Ljava.lang.String;@1682149 [Ljava.lang.String;@1614578<BR>[Ljava.lang.String;@86f394 [Ljava.lang.String;@1e1ab0e [Ljava.lang.String;@a542d8 [Ljava.lang.String;@1c7a26c [Ljava.lang.String;@17894a8 [Ljava.lang.String;@167ac9b [Ljava.lang.String;@1750438 [Ljava.lang.String;@1682149 [Ljava.lang.String;@1614578<BR>[Ljava.lang.String;@86f394 [Ljava.lang.String;@1e1ab0e [Ljava.lang.String;@a542d8 [Ljava.lang.String;@1c7a26c [Ljava.lang.String;@17894a8 [Ljava.lang.String;@167ac9b [Ljava.lang.String;@1750438 [Ljava.lang.String;@1682149 [Ljava.lang.String;@1614578<BR>]
Do you have any idea what this is??
Is it okay if I mail you UDF??
Thanx
Sue
Hi,
Make sure you are passing the queue to the UDF and the content is set to Message Type. Also when you are giving input to the UDF I have posted please do add the node function removeContext.
DeliveryNo-->removeContext-->UDF-->Content
follow the same for all the fields.
Please post the UDF here.
The values that you have pasted here is from the mail you received or you took from the Test tab. I just tried with the XSD you gave me it was working fine.
Thanks.
Prakash
Hi Prakash,
Below is our UDF:
==============================================
String mailBody = new String();
int inta, intb, intc, intd, inte, intf, intg, inth;
inta = a.length;
intb = b.length;
intc = c.length;
intd = d.length;
inte = e.length;
intf = f.length;
intg = g.length;
inth = h.length;
for(int i = 0; i < c.length; i++)
{
mailBody = mailBody + a + " " + b + " " + c + " " + d + " " + e + " " +f + " " + g + " " + h + "<BR>";
}
result.addValue(mailBody);
==========================================
We have to concat 9 fields. We haven't used node function removeContext. We will test with that. The values that we posted were from Test Tab. Thanks for helping us all the way. We are almost there.
We have tested with node funtion and real time....we still getting same kind of message in content:[Ljava.lang.String
Thanx
Sue
Message was edited by: Susan Miller
Hi Prakash,
We did removeContext, set the context to message type level and passing it to queue. Still getting the following into the content:
[[Ljava.lang.String;@25c560 [Ljava.lang.String;@1c154fd [Ljava.lang.String;@1b2e54f [Ljava.lang.String;@1ecd7a5 [Ljava.lang.String;@41a61d<BR>[Ljava.lang.String;@25c560 [Ljava.lang.String;@1c154fd [Ljava.lang.String;@1b2e54f [Ljava.lang.String;@1ecd7a5 [Ljava.lang.String;@41a61d<BR>[Ljava.lang.String;@25c560 [Ljava.lang.String;@1c154fd [Ljava.lang.String;@1b2e54f [Ljava.lang.String;@1ecd7a5 [Ljava.lang.String;@41a61d<BR>[Ljava.lang.String;@25c560 [Ljava.lang.String;@1c154fd [Ljava.lang.String;@1b2e54f [Ljava.lang.String;@1ecd7a5 [Ljava.lang.String;@41a61d<BR>]
Thanx
Sue
Hi,
No there is no need to import anything. Check using display queue before passing to the UDF and output from the UDF. Also send me the scree shot of that mapping which I can see clearly with the queues displayed, and one more with the UDF source code with screen shot to this id perks.india@gmail.com
I will also look for an workaround for this.
Thanks,
Prakash
Hi,
I will have a look at the screenshots meanwhile try this I have done usinf XSLT mapping follow the steps as mentioned below
Remove Namespace XSLT
[code]<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no"/>
<xsl:template match="/|comment()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
[/code]
Mail XSLT
[code]
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:variable name="break"><br></xsl:variable>
<xsl:variable name="space"> </xsl:variable>
<xsl:template match="/">
<Mail>
<encoding/>
<Subject>Test Mail Subject</Subject>
<From>a@b.com</From>
<To>to@mail.com</To>
<Content_Type>text/html</Content_Type>
<Content>
<xsl:for-each select="MT_Mail/row">
<xsl:value-of select="DeliveryNumber"/>
<xsl:value-of select="$space"/>
<xsl:value-of select="DeliveryLineItem"/>
<xsl:value-of select="$space"/>
<xsl:value-of select="OrderNumber"/>
<xsl:value-of select="$space"/>
<xsl:value-of select="BillToName"/>
<xsl:value-of select="$space"/>
<xsl:value-of select="ProductCode"/>
<xsl:value-of select="$space"/>
<xsl:value-of select="OrderedQty"/>
<xsl:value-of select="$space"/>
<xsl:value-of select="Status"/>
<xsl:value-of select="$break"/>
</xsl:for-each>
</Content>
</Mail>
</xsl:template>
</xsl:stylesheet>
[/code]
1. Copy Remove Namespace XSLT into a file, save as RemoveNamespace.xsl and ZIP it.
2. Copy the Mail XSLT into a file, save as Mail.xsl and zip it.
3. Import both the ZIP files under the Imported Archive
4. Goto Interface mapping and change the message mapping to XSL type.
5. Select the RemoveNamespace.xsl first
6. Add one more Mapping program of type XSL and select Mail.xsl
Test it and let me know.
You can change the fields in the <Content> tag of XSLT.
Thanks,
Prakash
Hi
Check out this blog
/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
In the mapping you can concatenate it all into one string and put into the <Content>. You can either use Graphical Mapping/XSLT/ABAP/JAVA mapping to do it.
Thanks,
Prakash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.