cancel
Showing results for 
Search instead for 
Did you mean: 

Replacing & with & in message mapping

Former Member
0 Kudos

Hi,

In my scenario I'm using Graphical mapping tool and I have to replace the & that's coming in the input xml with & in the output with in the message mapping, Is Value mapping is the only solution or do we have any other options that we can use for this.

Basically I'm getting runtime error in the message Mapping since I had a & in the value which is not recognized.

thanks,

Joe.P

Accepted Solutions (0)

Answers (4)

Answers (4)

stefan_grube
Active Contributor
0 Kudos

When you have an ampersand in the incoming stream, then the graphical mapping cannot parse the mapping and you cannot change this value inside the mapping. You have to change the ampersand before the mapping. You can do this with a Java mapping, but here you have to ensure that the ampersand is not used to start an escape sequence.

When you use ABAP proxy to send messages, then the ampersand should be escaped by & amp ; If this is not the case, write an OSS message for this.

When you use the test tool to simulate the message, then replace the ampersand by your own.

Regards

Stefan

0 Kudos

Hello Stefan,

I've followed your advice and used a java mapping. With this I could successfully replace

"&" by "&".  My receiver file adapter now gets the XML-message propery with  "&" instead of "&". However I need to apply content conversion as we need the output as a csv.-file.

As soon as I use content conversion an error is thown during the content conversion:

..File Content Conversion starting.

Message konnte nicht an den JCA-Adapter weitergeleitet werden. Grund: org.xml.sax.SAXParseException: The entity name must immediately follow the & in the entity reference.

.....

So do you see a solution approach when I have to use content conversion?


Thanks for your appreciated feedback.


Kind regards

Christof Johner


Former Member
0 Kudos

I am trying this on SP13. What is your SP??

Former Member
0 Kudos

Hi Singh,

I'm using SP12 will that matter in any way.

Former Member
0 Kudos

Hi Joe,

For this no need to do value mapping. You get rid of by using "<b>replaceString</b>" function in your message mapping.

There will be 3 input boxes in this function. In first box Map ur source, in second box map a constant (value should be &) and in the third input box again map a constant (enter the value which want to be replaced with "&" if you want that only "&" should be removed that just leave the constant <b>BLANK</b>) and then map your target node.

SOURCE ---> replaceString -


> TARGET.

Regards,

Sarvesh

Former Member
0 Kudos

Hi,

thanks for the response, that did not help me I still get the same parse exception on the row where there is a &. Here is the error that I'm seeing.

Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: Entity Reference must end on ;(:main:, row:586, col:52)

and this is my in comming data.

<Position_Desc>Director Finance M&A_Dept771_SSC7000</Position_Desc>

trying to replace& there with &amp;

Former Member
0 Kudos

Hi Joe

Sorry, I still don't understand why you want to replace & with &.

This may help you ...

You incoming message & is represented as

<b> & amp;</b>

internally

This is because & is a special character and is treated specially in XML.

Regards

Vijendra

Message was edited by:

Vijendra Bhanot

Message was edited by:

Vijendra Bhanot

Message was edited by:

Vijendra Bhanot

Former Member
0 Kudos

Joe,

Just now i have tested your data in my system and it is working fine.

Kindly check if you have mapped everything properly.

Save and activate and then try it.

Regards

Former Member
0 Kudos

Hi,

that did not help me here is the mapping that I'm using based on what you said. if you can give me your email

_______

<b>Please not request or provide email IDs

SND XI Forum Moderator</b>

_______

I can send the screen shot from the mapping tool. I can't attach the image over here.

Source -


Constant = & -


replaceString -


Target.

Constant = & -


thanks,

Former Member
0 Kudos

Hi,

Thanks for the reply, in fact my in comming message is not represented by &amp; I can see only a &. My data is something like this. M&A as you said I should see M&amp;A but I don't see that. so that's why I'm doing this conversion or replacestring.

thanks,

Joe.P

Former Member
0 Kudos

Can't share ID

Message was edited by:

Vijendra Bhanot

bhavesh_kantilal
Active Contributor
0 Kudos

What is the source?

The Source if sending an XML will have to send & as & amp ; ( without spaces) the reason is that & is the escape sequence in XML and a standard XML represents & as & amp ;.

Trying to replace this in Graphical Mapping will not help as , if the Source sentds & as simple & , the XML parser internally used by Graphically Mapping will error out as the input XML is not a a valid XML.

Regards

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

My scenario is RFC-ABAPProxy--XI- File.

so the RFC is sending me as & instead of &amp.

this is what I see in the my incoming xml and this failing during runtime.

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Messages xmlns:ns0=" http://sap.com/xi/XI/SplitAndMerge">;

<ns0:Message1>

<nr1:MT_HCMPositionData xmlns:nr1="http://XXXX.com/xi/HCM/Recruitment ">

<PositionIDs>

<PositionID>20008644</PositionID>

<Position_Desc>Director Finance M&A_Dept771_SSC7000</Position_Desc>

<Job_Code>Director Finance M&A</Job_Code>

<Staffing_Stat>1</Staffing_Stat>

<Org_Type>DEPARTMENT</Org_Type>

</PositionIDs>

</nr1:MT_HCMPositionData>

</ns0:Message1>

</ns0:Message1>

bhavesh_kantilal
Active Contributor
0 Kudos

Can you open the XML in SXMB_MONI and then say View Source.

The view source will contain & as & amp ;

If it is SAP that is triggering the data to XI, then I dont think the issue is &

Regards

Bhavesh

Former Member
0 Kudos

Hi Joe

I saw your mail. What you are trying to do is already taken care of by XI's XML parser. There is no need to replace &. Now this is true that you are getting error. So I would suggest that activate your mapping and execute the scenario end-to end once more ... and see if error still occure. If it does .. then copy the error payload to message mapping Test and that way you will be in better position to debug it. Also share across the error message payload and error log.

Good Luck

Vijendra

Former Member
0 Kudos

Vijendra,

Sending or asking for mail id is against the sdn engagement rules. Delete the same. Providing the soulution in this way affect otheres to get the right answer. Just go through engagement rules once.

Joe you too.

Regards,

Sarvesh

Former Member
0 Kudos

Hi Joe

What's the value with & in your incoming message?

Vijendra