cancel
Showing results for 
Search instead for 
Did you mean: 

Mail - XI - SAP

Former Member
0 Kudos

Hi,

I am working on following scenario:

1) Customer sends data in the attachment of Mail (attachement is a tab delimited file)

2) XI is used as middleware. Mail will be receive in XI and then XI will map the source data into target.

3) Target will be posted into ECC through ABAP Proxy.

for the scenario I am configuring sender mail adapter (PayloadSwapBean in module). The Problem I am facing is to convert attached tab delimited file into XML file.

Please suggest the solution

Edited by: tapan singh on Mar 14, 2011 2:43 PM

Accepted Solutions (1)

Accepted Solutions (1)

udo_martens
Active Contributor
0 Kudos

Hi,

you have alternatives:

1. Send the attachment unconverted to a intermediate storage, where you pick it up with PI standard file conversion. Disadvantages are a higher load, not real time and more complex monitoring.

2. Create a not-parsing mapping with either ABAP or Java to create the XML target format directly. This costs assumedly more development time and is more difficult to change.

Regards,

Udo

Former Member
0 Kudos

HI ,

I beleve i could create mapping to convert tab delimited file to xml in BIC mapper and then configure that mapping into module.

In this case what will be the processing seqence - first payloadswapbeans, then mapping to convert tab delimeted to XML??

Regards

tapan

Edited by: tapan singh on Mar 14, 2011 3:30 PM

Former Member
0 Kudos

Hi,

Did you checked the Module Message Transform Bean which can be used at the mail adapter module and can specify there the content conversion parameters like FCC...

for e.g on how to use this check the below blog

/people/sobhithalaxmi.kata/blog/2009/07/21/cost-free-edi-integration-using-message-transformation-bean

HTH

Rajesh

Answers (2)

Answers (2)

Former Member
0 Kudos

Once you set up the above configuration, you will get one record at a time.

Create a souce message interface like the followings:

XXXXXXXXX_Mail

rows

record

Target message interface:

XXXXXXXXX

rows

field 1

field 2

field 3

Write a UDF function to remove the TAB space

public removeTABSpace(String record,Container container){

//write your code here

StringTokenizer st = new StringTokenizer(record,"\t",false);

String t="";

while (st.hasMoreElements()) t += st.nextElement();

return t;

}

Write another UDF to get the field 1 for example:

public String getField1(String input,Container container){

int counter=0;

int beginIndex=0;

int endIndex=0;

int i;

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

if (input.charAt(i)==34){

counter=counter+1;

}

if (counter==1){

beginIndex=i+1;

counter=0;

break;

}

}

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

if (input.charAt(i)==34){

counter=counter+1;

}

if (counter==2){

endIndex=i;

counter=0;

break;

}

}

input=input.substring(beginIndex,endIndex);

return input;

}

Get the mapping like the followings:

record - removeTABSpace - getField1 - field 1

If you need to get field 2, you will write another UDF to handle it.

It should work now. Let me know how you go with it.

Edited by: Bai Li on Mar 15, 2011 3:22 AM

Former Member
0 Kudos

Thanks Bai Li !!

I am working on it and surely get back to you.

Thanks Indeed!!

Former Member
0 Kudos

Processing sequence as follows:

1. localejbs/AF_Modules/PayloadSwapBean Local Enterprise Bean swap1

2. localejbs/AF_Modules/MessageTransformBean Local Enterprise Bean tran1

3. sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local Enterprise Bean mail

Module Configuration as follows: Fill the XXXX part with your info.

swap1 swap.keyName payload-name

swap1 swap.keyValue MailAttachment-1

tran1 Transform.Class com.sap.aii.messaging.adapter.Conversion

tran1 Transform.ContentType ext/xml;charset=utf-8

tran1 xml.conversionType SimplePlain2XML

tran1 xml.documentName XXXXXXX_Mail

tran1 xml.documentNamespace http://XXXXX.com.au/XXXX

tran1 xml.fieldSeparator \t

tran1 xml.processFieldNames fromConfiguration

tran1 xml.structureTitle rows