on 06-22-2015 2:09 PM
Hi Experts,
I have developed JDBC to IDOC scenario in PI 7.0.
The problem is with the special character '&'
I am getting different fields for Item, in that there is one field 'Item_description'
I am getting the input value like
<Item_Description>specification for electroless nickel plating 
When ever i got the payload from the sender system as an xml format and the value for 'Item_description" as specified above
because of special character '&' the message is failed in PI.
I am manually removing that special character from payload and again re sending then it is successfully processed to Target system.
I have decided to go for Java mapping and I have developed the code as below.
Java code:
package com.Mapping;
import java.io.InputStream;
import java.io.OutputStream;
import com.sap.aii.mapping.api.AbstractTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.TransformationInput;
import com.sap.aii.mapping.api.TransformationOutput;
public class Mapping_Java extends AbstractTransformation {
public void transform(TransformationInput transformationInput,
TransformationOutput transformationOutput)
throws StreamTransformationException {
try {
InputStream inputstream = transformationInput.getInputPayload()
.getInputStream();
OutputStream outputstream = transformationOutput.getOutputPayload()
.getOutputStream();
byte[] b = new byte[inputstream.available()];
inputstream.read(b);
String strContent = new String(b);
if (strContent.contains("&")) {
getTrace().addInfo("& is present");
strContent = strContent.replaceAll(" ", "&");
}
outputstream.write(strContent.getBytes());
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
The above code works for it can replace the "&" by Tab space.
I was stuck here, That I want to remove that '&' symbol only for 'Item_description' field not for remaining fields.
I hope we should write some condition for the above code to replace '&' for only that field.
Please guide me friends,
How to add that condition in that code and how to go for java mapping for PI 7.0 version.
it help full to me a lot.
Thanks in Advance,
Regards,
Teja.
Hi All Thanks for all your replies and Support. Finally the problem has been solved with out using Java mapping and and with out writing any UDF.
Please find the below screenshots.
Tested in Message mapping and Operation Mapping, it is success.
The message is successfully reached target.
Thanks to all
Regards,
Teja.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can check for the xml tag as below and do remaining logic in then.
if(strContent.contains("<Item_description>"))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.