cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing email body

Former Member
0 Kudos

Hi All

I have a requirement to read an email which contain purchase order information and create a order in R/3 system. I am geeting a mail as follows.

Ranfurly Home

Site# 51213411

Phone 096258211

Fax 096242080

Email tt

PO# 2001104

Supplier MEADOW FRESH NZ LIMITED Deliver To Ranfurly Home

PO BOX 397 Site# 51213411

539 Mt Albert Rd

Royal Oak

NZ1 1023

Fax

E-mail ttt

Please confirm Receipt of this Order with the Compass Site

Supplier Number Date Deliver On: 31-MAR-09

NZ088015185 25-MAR-09 Ship Via:

Line Item Description Qty Uom Price Ext Amount

1 74016 Butter 7.00 EA 1.00 7.00

2 67040 Butter - Catering Spre 7.00 TUB 1.00 7.00

ad

3 86713 Butter - Original 7.00 TUB 2.00 14.00

4 26843 Butter - Portion Contr 7.00 BOX 2.00 14.00

olled Unit Margarine 1

0x100

5 74057 Butter - Salted Portio 7.00 CTN 50.00 350.00

ned Tararua

6 15922 Butter - Semisoft 7.00 TUB 50.00 350.00

7 102217 Butter - Soft Original 7.00 TUB 50.00 350.00

8 26857 Butter - Spread Standa 7.00 TUB 50.00 350.00

rd

9 74017 Butter - Unsalted 7.00 EA 50.00 350.00

When XI convert this to XML, XI places and emal body in content tag as follows

<Content>Ranfurly Home Site# 51213411 Phone 096258211 Fax 096242080 Email ttcompass-au PO# 2001104 Supplier MEADOW FRESH NZ LIMITED Deliver To Ranfurly Home PO BOX 397 Site# 51213411 539 Mt Albert Rd Royal Oak NZ1 1023 Fax E-mail ttgoodmanfielder.co.nz Please confirm Receipt of this Order with the Compass Site Supplier Number Date Deliver On: 31-MAR-09 NZ088015185 25-MAR-09 Ship Via: Line Item Description Qty Uom Price Ext Amount 1 74016 Butter 7.00 EA 3.95 27.65 2 67040 Butter - Catering Spre 7.00 TUB 13.20 92.40 ad 3 86713 Butter - Original 7.00 TUB 2.50 17.50 4 26843 Butter - Portion Contr 7.00 BOX 14.00 98.00 olled Unit Margarine 1 0x100 5 74057 Butter - Salted Portio 7.00 CTN 62.80 439.60 ned Tararua 6 15922 Butter - Semisoft 7.00 TUB 2.88 20.16 7 102217 Butter - Soft Original 7.00 TUB 2.34 16.38 8 26857 Butter - Spread Standa 7.00 TUB 3.54 24.78 rd 9 74017 Butter - Unsalted 7.00 EA 3.95 27.65 764.12</Content>

I don't see any way of getting the information I want. There is no line feeder . Please can some body advice.

Thanks & Regards

Shantha Bandara

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member200962
Active Contributor
0 Kudos
When XI convert this to XML, XI places and emal body in content tag as follows

This is beccause the payload that you want to send to the receiver has to be in the Content tag....no matter whether it is a mail-body that you want or attachment....

I don't see any way of getting the information I want.

In what way are you expecting the mail message.....if you want to do some formatting so that the mail message looks good you can use HTML formatting in XSLT mapping...but everything within Content tag....there is one blog by Michal which says how you can format a mail message using HTML and XSLT...

Regards,

Abhishek.

Former Member
0 Kudos

In the email message if each line is separated by something(say $)then we can search for that symbol to breake the content data

Former Member
0 Kudos

Hi Kubra

If you look at the data stream in content tag you see there is no any special character to identify the end of the line. I am not sure that I have to do anything in the mail adapter communication channel to insert some thing at the end og the line. But If I look at the mail in Lotusnote mail client I can see it nicely formated.

Thanks for trying to help me.

Regards

Shantha Bandara

Former Member
0 Kudos

Hi Prasanna

Thanks for the reply. Even if I use UDF still I need to identify the end of the line. If you examine the message I posted carefully you will see that there is no line feeder.

Please advice

Thanks & Regards

Shantha Bandara

Former Member
0 Kudos

Yes exactly you cannot see the messages separated by newline or carriage line feed if you want to see how the message is reaching to mail adapter go to Messaging System tab (http://host:port/MessagingSystem/monitor/monitor.jsp)and click there display message bytes which shows the format data is reading by the adpater but IS wont show the same

If you want handle the data using particular format go through the blogs specified above

Rajesh

Former Member
0 Kudos

Thanks for the information. I will try what you guys suggested and come back to you .

Thanks & Regards

Shantha Bandara

prasannakrishna_mynam
Contributor
0 Kudos

Hi Shantha,

The reason why i suggested UDF and regular expressions is, with this you can find a particula string you are looking for, and you need to write some code to rearrange the content back to normal form and i have noticed that the Content doesn't have any line feed, otherwise i could have suggested you to split by that line feed, please search for the regular expressions in java, i hope it might help you. If you can spend some time on it. The following is the example how this regula expressions can work.

Lets say this your content..
ADDRESS 2003 by Mercury Interactive 
 and regular expression is :  /ADDRESS (\d*)/ 

then the result
2003

Regards,

Prasanna

prasannakrishna_mynam
Contributor
0 Kudos

Hi Shantha,

Use UDF to get the content you want using regular expressions. The following code give you some idea.

import java.util.regex;
Pattern p = Pattern.compile(Content);
Matcher m = p.matcher(your_xmlStringInput);
 
while(m.find()){
return your_xmlStringInput.substring(m.start,m.end()-);
}

Regards,

Prasanna

former_member732072
Active Participant
0 Kudos

Hi,

Please have a look at the following blog and a link and see if it helps you.

/people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher

Best Regards

Former Member
0 Kudos

Hi Prakash

Thanks for the prompt reply. This did not help me. I want to use XI system to receive mails as we want to have greater visibility of all the messages exchanged.

I could not got to the last link. It take me to the SDN home page.

Thanks & Regards

Shantha Bandara