cancel
Showing results for 
Search instead for 
Did you mean: 

special character issue

Former Member
0 Kudos

Hi,

Scenario is JDBC- PI- SAP.

When XI pulls data from oracle, it comes with special character . (for special character, please see the screenshot below).

Due to this its giving mapping error.

Please let me know if anyone has overcome such issue.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Are you sure ur mapping is failing due to "[]"?....if i can recall it correctly this character comes when u open the xml file (in some cases when messages comes from DB) using view source option under moni...BTW whats the error u r getting?

Thanks

Amit Srivastava

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Adding to what Amit said, it looks like a space. Use a hexeditor to be sure.

Regards,

Mark

Former Member
0 Kudos

Hi Amit,

You have got it correctly.This character comes when i open the xml file  using view source option under moni. The error is "com.sap.aii.utilxi.misc.api.BaseRuntimeException thrown during application mapping ".

Can you please focus on it.


Former Member
0 Kudos

Hi,

Copy the payload from moni and check the same under ESR message mapping. In addition to that, check the moni trace to find out more details abt this error.

Chk this thread also:

http://scn.sap.com/thread/653545

Thanks

Amit Srivastava

Answers (5)

Answers (5)

Former Member
0 Kudos

Before analysing further or creating Java mapping workarounds: open the file in Internet Explorer, it probably will display an error, meaning the document is not well-formed. Probably wrong encoding is used (happens often)

=> this should be solved in the sending system (Oracle). If PI receives a not-well-formed document, the graphical mapping throws an error.

CSY

former_member181985
Active Contributor
0 Kudos

Have a separate reusable java mapping to filter such special characters.

Use the below code snippet in execute method.

  BufferedReader br = new BufferedReader(new InputStreamReader(inputstream));

  BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outputstream));

  Pattern p = Pattern.compile("[^ -~]");

  Matcher matcher = p.matcher("");

  String str = null;

  while((str = br.readLine()) != null) {

             matcher.reset(str);

             bw.write(matcher.replaceAll("?"));

             bw.newLine();

- Praveen

Former Member
0 Kudos

Thanks Praveen,

Can you please elaborate on where i can find this "execute method".

Ho i can actually link it further, such that i get correct output.

Regards,

Vishal K

anupam_ghosh2
Active Contributor
0 Kudos

Hi Vishal,

              Please download the hex editor from this link http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm

Now paste the specific line in the file in the editor. Find out the hex code. Lets say for example the code you found is "7A" which is ascii code for 'z'. So if you write a UDF in the mapping to remove such character I feel that will eradicate the symbol. The input to the UDF is a string s="ztz"  after we remove 'z' it becomes s="t". the UDF is

String r=""+ (char)(0X7A);

s=s.replaceAll(r,"");

return s;

 

Hope this helps.

Regards

Anupam

iaki_vila
Active Contributor
0 Kudos

Hi Vishal,

Check that the message mapping and operation mapping are not missed with the ID test tool. Also, check that the mandatory fields are being filled, as Amit points you and with the operation mapping test tool. You can obtain a exception cleares pointing you if there is any target mandatory tag missed.

Regards.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Few cents.. You can handle using java mapping those special characters first and then go for message mapping.  You can use simple java string methods like Example

Special character   &

String input = "your data";// assume you store the data in the input String

input.replace("&", "&amp");

If you dont want those special characters remove

input.replace("&"."");

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Vishal,

PI handles nearly 64 special characters and it avoids mapping failures.

In your case identify the what is the special character in Oracle and if you dont want that special charater at receiver end then erase it at mapping level.

refer below blog

http://scn.sap.com/people/rajasekhar.reddy14/blog/2011/09/05/regular-expressions-regex-usage-in-sap-...

Regards,

Raj