Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

JDBC to IDOC scenario with Java mapping

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 &#x16;

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;







public class Mapping_Java extends AbstractTransformation {

     public void transform(TransformationInput transformationInput,

               TransformationOutput transformationOutput)

               throws StreamTransformationException {

          try {

               InputStream inputstream = transformationInput.getInputPayload()


               OutputStream outputstream = transformationOutput.getOutputPayload()


               byte[] b = new byte[inputstream.available()];


               String strContent = new String(b);


               if (strContent.contains("&")) {

                    getTrace().addInfo("& is present");

  strContent = strContent.replaceAll(" ", "&");



          } catch (Exception exception) {





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,




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



0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question