cancel
Showing results for 
Search instead for 
Did you mean: 

*Handling special character '&' in side the payload

Former Member
0 Kudos

Hi,

We are using the ORDCHG IDoc ,under the segment E!EDKA1->NAME->payload(Distribution Center 8 & 9).This is errored in X,due to the payload.

How to handle the special character &.Let me know.

Thanks,

Srinivasa

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Srinivasa,

We can handle the special characters in the message mapping with the help of small java code.

Check the above users mentioned link. or

Take the below java code and generate the class file, after take the ".Class" file and "aii_map_api" and zip this and import this code in the Imported Archived and add this program to the message mapping (normal message mapping program with this program [select the add button in the operation mapping and select mapping type as java and add this program zip file].

import java.io.InputStream;

import java.io.OutputStream;

import java.util.Map;

import com.sap.aii.mapping.api.StreamTransformation;

import com.sap.aii.mapping.api.StreamTransformationException;

public class HandleAmpersand implements StreamTransformation {

public void setParameter(Map arg0) {

}

public void execute(InputStream in, OutputStream out) {

try {

int read_data;

while ((read_data = in.read())!=-1)

{

if (read_data != '&')

out.write(read_data);

else

out.write("&".getBytes());

}

out.flush();

} catch (Exception e) {

}

}

}

Regards

Ramesh

Answers (1)

Answers (1)

former_member200962
Active Contributor
0 Kudos

Canot be handled by Message Mapping:

You either need JAVA mapping asmentioned here: https://weblogs.sdn.sap.com/pub/wlg/9420 [original link is broken] [original link is broken] [original link is broken]

Or enclose the corresponding field in CDATA element in an XSLT mapping (lots of exmaples available on SDN)

Regards,

Abhishek.

Shabarish_Nair
Active Contributor
0 Kudos

as mentioned earlier, my suggestion is to use a simple java mapping before your message mapping to change the & to its xml format as specified in the blog - https://weblogs.sdn.sap.com/pub/wlg/9420 [original link is broken] [original link is broken] [original link is broken]