on 03-14-2011 1:43 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.