cancel
Showing results for 
Search instead for 
Did you mean: 

Send multiple content in MAIL receiver adapter

0 Kudos

Hi Folks,

Wondering to know about how to send multiple content to the receiver MAIL Adapter.

my interface is to send Production Order failure notification which is coming from SAP ECC to Mail server. and my requirement is to send a mail with the content format as below

Hi,

Interface failed to print the Production Order 20002221,20002223 in SAP

Regards,

SAP PI

         

             NOTE: This is a system generated mail. Please do not reply

              

while my test run I could able to achieve this in mapping and also sending content one in string as whole but cudnot able to get the above format accepted by adapter and adapter throwing the error as Message processing failed. Cause: java.lang.Exception: com.sap.aii.af.sdk.xi.util.XMLScanException: expecting end tag: {http://sap.com/xi/XI/Mail/30}Mail, but found {}Content at state 1

For receiver side data type I have downloaded the MAIL.xsd and mapped the below fields

Subject

From

To

Content

For content field I did write a UDF based on the source fields OrderNo and NestName  as below:

String Orders  = "";

String content = "";

for(int i = 0;i<Order.length;i++){

if(i == 0)

Orders = Order[i];

else

Orders = Orders.concat(",").concat(Order[i]);

}

//content = content.concat("Interface failed to print the Production Order").concat(Orders).concat("  in SAP");

//result.addValue("Interface failed to print the Production Order "+Orders+"  in SAP");

result.addValue("Hi,");

result.addValue(" ");

result.addValue("OPS0056 Interface failed to print the Production Order "+Orders+"  in SAP");

result.addValue(" ");

result.addValue("Regards");

result.addValue("SAP PI ");

result.addValue(" ");

result.addValue("         NOTE: This is a system generated mail. Please do not reply.");

It would really appreciated if you cud help in troubleshoot where the I am doing mistake and corrective  steps make adapter to accept multiple content and put the message body with the above format.

Regards,

Hanu J

Accepted Solutions (1)

Accepted Solutions (1)

ambrish_mishra
Active Contributor
0 Kudos

Hi Hanumantha,

You need to append the input lines with a CRLF character and then send the output to Content field of the mail packaqe.

Something like

"Hi," + CRLF + "Interface failed to print the Production Order 20002221,20002223 in SAP" + CRLF + "Regards," + CRLF + "SAP PI"

Map to Content.

Content type should be text/plain.

Hope it helps!

Ambrish

0 Kudos

Hi Ambrish,

It helped me in.. Thanks..appreciate your suggestion..

Regards,

Hanu J

Former Member
0 Kudos

Hi,

Can you please provide me a sol to ?

Thanks

Sathish

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Hanu,

I'm also looking for a solution to combine the responses. How did you solve this?

check my question -

Thanks

udo_martens
Active Contributor
0 Kudos

Hi Hanu,

you should use mail package, of course.

Download your xml source and test the mapping in Message Mapping test environment. The target should look like:

<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/plain</Content_Type>

  <Content>

This is the content.

  </Content>

</ns:Mail>

To be able to generate that type you should define your target message type with xml namespace http://sap.com/xi/XI/Mail/30

/Udo

0 Kudos

Hi Udo,

Thanks for the quick reply..I am getting the namespace as suppose to but while routing through Adapter getting the error

<?xml version="1.0" encoding="UTF-8"?>

<ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30"><Subject>XD3: INT-SIGMA to SAP Interface- Message Failure Notification</Subject><From>kvid@sap.com</From><To>pawar.ha@gmail.com;vsagar.ka@gmail.com</To><Content>Hi,</Content><Content> </Content><Content>OPS0056 Interface failed to print the Production Order 23084454,23087806,  in SAP</Content><Content> </Content><Content>Regards</Content><Content>SAP PI </Content><Content> </Content><Content>         NOTE: This is a system generated mail. Please do not reply.</Content></ns1:Mail>

the message mapping output is as required. but while the adapter processing it is through error.

Mail: call failed
13.06.2013 10:40:45.143InformationMail: sending a delivery error ack ...
13.06.2013 10:40:45.144ErrorAdapter Framework caught exception: com.sap.aii.af.sdk.xi.util.XMLScanException: expecting end tag: {http://sap.com/xi/XI/Mail/30}Mail, but found {}Content at state 1
13.06.2013 10:40:45.144ErrorMP: exception caught with message com.sap.aii.af.sdk.xi.util.XMLScanException: expecting end tag: {http://sap.com/xi/XI/Mail/30}Mail, but found {}Content at state 1
13.06.2013 10:40:45.144ErrorMail: error occured: com.sap.aii.af.lib.mp.module.ModuleException: com.sap.aii.af.sdk.xi.util.XMLScanException: expecting end tag: {http://sap.com/xi/XI/Mail/30}Mail, but found {'}Content at state 1
13.06.2013 10:40:45.144InformationMail: sent a delivery error ack
13.06.2013 10:40:45.145ErrorDelivering the message to the application using connection Mail_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.Exception: com.sap.aii.af.sdk.xi.util.XMLScanException: expecting end tag: {http://sap.com/xi/XI/Mail/30}Mail, but found {}Content at state 1.
13.06.2013 10:40:45.187InformationThe message status was set to WAIT.
13.06.2013 10:40:45.188InformationThe asynchronous message was successfully scheduled to be delivered at Thu Jun 13 11:45:45 EDT 2013

and in Communication channel I have used use mail package checked under mail attributes and content encoding been selected base64

Do we have any other setting where i am missing?

Regards,

Hanu J

udo_martens
Active Contributor
0 Kudos

Hi Hanu,

Content ONLY once! From your error msg: "expecting end tag: {http://sap.com/xi/XI/Mail/30}Mail, but found {'}Content"

/Udo

0 Kudos

Hi Udo,

Yup!! Wondering to know how do we make it happen to take content multiple times..wud you suggest whats needs to be changed to wok it?

Regards,

Hanu J