Special Character Handling (&) in the payload content in PI 7.1

Hello All,
My Scenario is Idoc to File. I need to handle some special characters like "&" in  XML payload content in PI 7.1. I am receiving & character in the text field.
eg:
<RECORD>
   <BEGDA>20100901</BEGDA>
   <STAT1>A</STAT1>
   <NAME1>Grandview&MO CLMR</NAME1> 
  <PERL_SUB_AREA>0005</PERL_SUB_AREA>
</RECORD>
I created java mapping by using the blog: http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9420. [original link is broken] [original link is broken] [original link is broken]
"The code used in java mapping is converting & into &amp"
Mapping is working fine in the test tab of Operation mapping and the message is successfully handling the record with & character(message with Chequered Flag).In the result tree view,it is showing 
<PERL_TEXT>Grandview&MO CLMR</PERL_TEXT
and in the source XML view
<PERL_TEXT>"Grandview&ampMO CLMR"</PERL_TEXT>
Issue:
Now the record is written as
<RECORD>
  <CUST_STATUS>A</CUST_STATUS>
  <COMPANY>1050</COMPANY>
  <PERL_AREA>1MOB</PERL_AREA>
  <PERL_TEXT>"Grandview&ampMO CLMR"</PERL_TEXT>
  <PERL_SUB_AREA>0005</PERL_SUB_AREA>
</RECORD>
Since & is coming as part of text, "it is converting & -> &amp" in the text field and the record is written in the file as
"A|1050|1MOB|Grandview&ampMO  CLMR|0005 ....."
While it should come as:
A|1050|1MOB|Grandview&MO  CLMR|0005 .....
Java mapping code used is as:
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import com.sap.aii.mapping.api.StreamTransformation;
public class HandleAmpersand implements StreamTransformation {
     public void setParameter (Map param) { }
     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("&amp;".getBytes());
                    out.flush();
     } catch (Exception e) {  }
Also, i am using message mapping after java mapping in operation mapping
Please guide me where it is going wrong.
Thanks
Shikha Jain
Edited by: Jain Shikha on Jan 5, 2011 4:42 AM

Hi Jain Shikha,
I have faced similar issue in our production system.
Our issue:-
Sender system is sending :- DEKOR " OBS!
Other middleware is converting it and sending to SAP PI as :- DEKOR &amp ;quot; OBS!
Because of this, there is increase in size from 12 characters to 21 characters. We were getting error as the target side ABAP table has column width 15.
Our solution:- Wrote a java mapping to convert &amp;quot; to u201C
if (strContent.contains("&")) {
                    getTrace().addInfo("& is present");
                    strContent = strContent.replaceAll("&amp ;", "&");
                    strContent = strContent.replaceAll("&quot ;", "\"");
                    strContent = strContent.replaceAll("&apos ;", "\'");
                    strContent = strContent.replaceAll("&amp ;", "&");
                    strContent = strContent.replaceAll("&lt ;", "<");
                    strContent = strContent.replaceAll("&gt ;", ">");
Note: - quote ("), apostrophe ('), ampersand (&), less than (<), greater than (>) are special characters in XML. They should not be present in data. http://www.w3.org/TR/REC-xml/
Not Well formed XML:
<Name>Raghuu2019s</Name>   <Name> Raghu & Vamsee </Name>
Well formed XML:
<Name>Raghu&apos;s</Name>   <Name>Raghu &amp; Vamsee</Name>
Graphical mapping, XSLT, DOM, SAX need well formed XML as input, otherwise they give parser exception.
Your solution:-
I understand you are using a graphical mapping. Follow below steps
Step 1: Convert u201CNot Well formed XMLu201D to u201CWell formed XMLu201D, using java mapping (which your doing already).
Step 2: Use Graphical mapping for your transformation logic.
Step 3: Again convert back u201CWell formed XMLu201D to u201CNot Well formed XMLu201D (As this what target system is expecting. Use below java mapping.
Regards ,
Raghu
Edited by: Raghu Vamsee on Jan 6, 2011 1:45 PM
Edited by: Raghu Vamsee on Jan 6, 2011 1:59 PM

Similar Messages

  • SOAP Adapter - Error because of special character (u00FC - Umlaut) in payload

    Hello,
    We have a SOAP sync scenario.
    SAP -> PI 7.0 -> 3rd Party system
    We have a special character (ü - Umlaut) as part of the payload.
    When the message enters message pipeline in PI, I can see the payload XML till message branching step.
    From Message mapping step, i get the message - "The XML page cannot be displayed. An invalid character was found in text content" in SXMB_MONI.
    In communication channel monitoring, I see the following error:
    SOAP: error occured: com.sap.aii.af.ra.ms.api.RecoverableException: Parsing Error: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 72(:main:, row:2, col:2106)(:main:, row=2, col=2106) -> com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 72(:main:, row:2, col:2106): java.io.IOException: Parsing Error: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 72(:main:, row:2, col:2106)(:main:, row=2, col=2106) -> com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 72(:main:, row:2, col:2106)
    But, when I pass the same message(with special character) to the 3rd party system using SOAP UI, i get a valid response back.
    So, what is going wrong in PI?
    Thanks,
    Chandra

    Hi Gouri,
    you are right. My message is successful in SXMB_MONI, and the error is coming from comm channel monitoring with deliverin to target.
    My sender is a proxy, and we can not specify any encoding in proxy sender.
    I did not specify any encoding in SOAP Receiver aswell.
    This is the sequence in comm channel monitoring:
    Success: Delivering to channel: CI_SOAP_Receiver_Sync
    Success: MP: Entering module processor
    Success: MP: Processing local module localejbs/sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean
    Success: SOAP: request message entering the adapter with user J2EE_GUEST
    Error: SOAP: call failed: java.io.IOException: Parsing Error: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 72(:main:, row:2, col:2046)(:main:, row=2, col=2046) -> com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 72(:main:, row:2, col:2046)
    Error SOAP: error occured: com.sap.aii.af.ra.ms.api.RecoverableException: Parsing Error: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 72(:main:, row:2, col:2046)(:main:, row=2, col=2046) -> com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 72(:main:, row:2, col:2046): java.io.IOException: Parsing Error: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 72(:main:, row:2, col:2046)(:main:, row=2, col=2046) -> com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 72(:main:, row:2, col:2046)
    So, what can i do to fix this?
    Thanks,
    Chandra
    Edited by: Chandra Sekhar H on Mar 3, 2011 12:25 PM

  • Request.getParameter(): special character handling problem

    Hello, there:
    This should be an easy question for the gurus in here.
    I use a string attached to the url as the parameter string, which includes spaces. the system automatically converts them to %20, but when I receive them in my servlet using request.getParameter, a special character, &Acirc; appears; I couldn't proceed with it.
    I suppose this is a common problem but seems that I didn't find topics about it on this forum.
    So anyone can help? Any encoder/decoder APIs to handle it?
    Thanks a lot,
    Sway

    hi,
    escape can solve ur problem
    use js function to submit form like
    function subForm()
    var any_spcl_value ="kdfhjdf$%@#$% 2FGSFG @%@#%@# V";
    mainForm.action = "index.jsp?value="+ escape(any_spcl_value);
    mainForm.submit();
    and use request.getParameter("value");
    u ll get kdfhjdf$%@#$% 2FGSFG @%@#%@# V as it is.
    AE

  • Special character handling in XI

    Hi,
    I have a scenario wherein edifact files are passed through XI to partners .
    The edifact input file contains special characters like ô which gets converted to Ã.This is causing the despatch advice to fail at the receiver end.
    Can anyone suggest how such characters should be handled in XI ?
    Thanks in advance.

    You can use localejbs/Seeburger/CharsetConversion bean as well. And in the module config table, add teh following parameters
    sourceEnc = UTF-8
    targetEnc = ISO-8859-1(or what ever target encoding you want).
    This is with the assumption that the data is going from SAP to a local(EDI)system via XI.
    Use localejbs/CallBicXIRaBean after the character conversion in the Processing sequence.
    cheers
    danus
    Edited by: Chidambaram Danus on May 8, 2008 3:27 PM

  • Dtw gives special character while importing the data

    Hi all
    I m trying to update business partner and my template file is tab delimited but I don't know why my all business partner updated with special character " like this "" even I tried to update from CSV also ??
    Can anybody help me to remove or update this special character from business partner name as well as bill to address , block, building, city  by query or any other way ??
    Thanks
    Ricky

    Hi ricky 1,
    Before you upload the CSV/TXT file, open it up in a Notepad.
    You will see the "hidden" quotation marks that don't appear in Excel.
    Use the replace function to remove them, save it, then upload again.
    Kind Regards,
    Nick Lakasas

  • Odd character generation in the payload from the R/3 side to PI server

    Dear Experts,
           The scenario is an integration from R/3 -PI- Webserver (Ext CRM server). An ABAP report is executed on the R/3 side which in turn invokes the RFC which is connected to PI server through RFC Adapter. On the receiving side the SOAP Adapter is used for connecting the External web server. Now when ABAP Report is executed on R/3 server it generates a transaction which does not gives error but the payload generated from the R/3 side is incorrect. When we check it on the PI server using the SXMB_MONI transaction, we can clearly see the odd characters like ㄲ㠸㈰㠺㔴㘱㌺ which is defined as string in the inbound message payload.ie In the payload looks like as given below. 
    <ns1:string>??㠸㈰㠺㔴㘱㌺</ns1:string>
    Kindly advice on how to overcome such problem. Is there any setting which needs to be done on the R/3 side or on the PI server side pls let us know.
    Thanking You
    With Kind Regards
    Sylvester

    Hi,
    You can change the encoding in your SOAP Adapter ...
    check SAP Note:
    Note 856597 - FAQ: XI 3.0 / PI 7.0 / PI 7.1 SOAP Adapter
    Rgds,
    Naveen.

  • How do I create a connection with a special character (!) in the password ?

    Oracle 11.2.0.3 EE on Solaris
    SQL*Developer 3.1.0.6 on Windows 7
    Due to security requirements our passwords contain an exclamation mark (!) but I can't get SQL*Developer to recognize it.
    I've tried to put it in quotes, escaping it and even swearing at it but to no avail.
    I get the famous ORA-1017-Invalid username/password
    It seems to be no trouble for TOAD!!
    Many thanks!
    -gary

    The solution has been found!!
    I finally saw a error in the message tab at the bottom of the screen: error 108 o.jdbc.driver.OracleDriver Error while registering Oracle JDBC Diagnosability MBean.
    According to Oracle Support Note:469494.1 I had a conflict with having two (2) versions of SQL*Developer on my laptop.
    The first was downloaded and installed as a standalone product. This was followed up by installing the 11g Client which also contains a version of SQL*Developer, albeit a much older version. This caused a JDBC library conflict of some kind.
    As per the note, since I only had one (1) Oracle Home, I renamed the %ORACLE_HOME%/jdbc/lib directory to lib$.
    That seems to force the use of the newer jdbc library files and all seems to be good.
    Turned out not to be anything related to the special characters in the password even though the popup message indicated that was the issue.
    Thanks for all the help!!
    -gary

  • SharePoint key word query, how does the "Query Text" query special character in a query variable?

    I have a no code sandbox solution, in a content by search web part, I want to return pages from the library except the page I am visiting.
    I have 2 pages:
    Page A, the title is: Page title without special character
    Page B, the title is: Page title with special character "a b c d ..."
    And then I use Title<>{Page.Title} in the query text of the CSWP.
    While I visit Page A, the CSWP returns Page B, it works as expected.
    But while I visit Page B, the CSWP returns nothing, expected result should be Page A. I just consider, whether the special characters in the Title of Page B breaks the query text.
    I can not find similar topics in the forum, Does anyone have idea?
    Many thanks!

    Thank you for your feedback, Daniel.
    I have some updates, and found the root cause: if the field value contains special characters, the CSWP will not render the double quotation marks around the field value.
    View the page html source, and then find the text "QueryModification", you will see what happen:
    Query Text Input: Title<>{Page.Title}
    1. While the page title is "Test Page 1" (without special character), the rendered query text is
    Title<>\"Test Page 1\". It works as expected.
    2. While the page title is "Test-Page-1" (with special character "-", of cause we have more special characters on production), the rendered query text is
    Title<>Test-Page-1.  The double quotation marks are not rendered by the CSWP, so the query text are broken. It does not work as expected.
    If I make the query text as Title<>"{Page.Title}"
    1. While the page title is "Test Page 1", the rendered query text is
    Title<>\"\"Test Page 1\"\". It does NOT work since the
    quotes are duplicated (no sure why CSWP duplicates the quota mark),
    2. While the page title is "Test-Page-1", the rendered query text is
    Title<>\"Test-Page-1\".  Quotes are correct, but it does NOT work as expected still.
    The expected rendered query text (view from the html source) should be
    Title<>\"Test\\\-Page\\\-1\". (Here is test url: <a href="http://server/_api/search/query?querytext='Title<>"Test%5c%5c%5c-Page%5c%5c%5c-1"'&rowlimit=10">http://server/_api/search/query?querytext='Title<>"Test%5c%5c%5c-Page%5c%5c%5c-1"'&rowlimit=10)
    From the above information, I can say the CSWP not handle the special character correctly ("\" is not inserted before any special charactor).
    Is there any setting in CSWP can be used to resolve above problem?

  • How can I use Greek symbols in a text in Pages? Greek symbols are not in the special character list.

    How can I use Greek symbols in a Pages text? Greek symbols are not included in the special character collection.
    I need to import for example a sigma from Word or Adobe illustrator and then Pages can recognise it. I can not find it from within Pages.

    Special character palette from the edit menu does have sigmas under European ... > Greek ...
    You can do a search at the bottom of the Special Character palette. Double click on the greek capital letter sigma. You will get a lot of sigmas.

  • Is there a Special Character for the number of pages in a document?

    I'm creating a template (in cs6) for a series of documents of variable length, and each document needs to be numbered with the format, "page A of Z." I see the special character for inserting the current page number (A) and I'd like to have the number of pages in the document (Z) added automatically as well. Is there a wildcard, special character, or script that will accomplish this? I'd rather not have to enter the number of pages manually as the value will change as these go through the editing process; I'd prefer to have the numbers update automatically. Has anybody done this before?

    Your first suggestion is the only way to capture the last page of a book that's comprised of independent document files. The last page number text variable works only within a single document.
    Anyone who wants a last page in book text variable badly enough can post a feature request at Wishform.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices    
    Arïel wrote:
    Stop press!
    You can also, much more simply, create a new text variable. There is
    specifically one for "last page number". That's much simpler.
    Type>Text Variables>Define>New, and in the Type dropdown just select
    "last page number".
    ariel

  • Special Character Restrictions for Native XML Driver

    Hi,
    I have found the following special character restrictions in the documentation:
    "Because they are handled specially by the Native XML driver, do not use the following special characters to define element types and attributes in your XML schema:u201C.u201D, u201C/u201D, u201C\u201D, u201C:u201D u201C@u201D."
    After checking the createad XML-Files in our projects that we will use for CR4E there is often a  u201C.u201D in the definition. Because this is delivered from third-party, we wish that the  u201C.u201D  will be enabled.
    In the moment we create the XSD-Files from the XML-File with XML2XSD.
    It is possible in the future?
    Best Regards
    Arnold Meier

    The changes aren't in XI Release 2, but in 2008.
    Do you still have Nha's XML data?  I edited Document_Policy, Policy_AllCoverages, Policy_Beneficiary to Document.Policy, Policy.AllCoverages, Policy.Beneficiary, then use the following code in CR4E 2.0:
    reportClientDocument reportClientDocument;
    ConnectionInfo connectionInfo;
    PropertyBag propertyBag;
    * Connect to the Java Print Engine and create a new document.
    reportClientDocument = new ReportClientDocument();
    reportClientDocument.setReportAppServer(ReportClientDocument.inprocConnectionString);
    reportClientDocument.newDocument();
    * Define connection to the XML and XSD files.
    propertyBag = new PropertyBag();
    propertyBag.put("Local XML File", "C:\\Documents and Settings\\tueda\\Desktop\\nha.xml");
    propertyBag.put("Local Schema File", "C:\\Documents and Settings\\tueda\\Desktop\\nha.xsd");
    propertyBag.put("Convert Multivalue to Table", Boolean.FALSE);
    propertyBag.put("Database DLL", "crdb_xml.dll");
    connectionInfo = new ConnectionInfo();
    connectionInfo.setAttributes(propertyBag);
    * Specify the dataset in the XML as a Table, and add to the report.
    Table table = new Table();
    table.setConnectionInfo(connectionInfo);
    table.setName("Document.Policy/Policy.Beneficiary");
    table.setAlias("Document_Policy/Policy_Beneficiary");
    reportClientDocument.getDatabaseController().addTable(table, null);
    * Save report to file C:\local_xml.rpt
    reportClientDocument.saveAs("nha_local_xml.rpt", "C:\\", ReportSaveAsOptions._overwriteExisting);
    reportClientDocument.close();
    Sincerely,
    Ted Ueda

  • Error while releasing transport request -  Special character "_" in generic

    Hi all,
    we're receiving the error  Special character "_" in generic key  when releasing a best practice transport.
    Note 1304725 describes my error, but the solution cannot be implemented. The reason for this is that we do not have an individual entry for eacht yb_PS,..,
    but we have only one entry where field BWERT has a wildcard '*' as entry.
    Does anyone has  some idea how to solve this ?
    kind regards !

    Hello Bjorn,
    How did you get this solved?
    I'm having nearly the same issue:
    A custom-table with a total key lenght of about 365 characters. As soon as I enter a special character (_) in the key field just before the position 120, the message tk287 rejects the entry. Entering the special character in a key field at about key position
    60, there's no message rejecting the entry.
    Regards

  • Error "TK287" when releasing a request - Special character "_" is invalid.

    I have some tables in Solution Manager and having some warnings:
    Table: CRM_SVY_DB_ST
    Field value:CRM_SVY_GENERATE_BSP_TEMPLATE.XSLT
    Field: TRANSFORMATIONID
    It doesn´t accept the special character "_"
    Below the error when releasing and the explanation of the error in the sequence.
    Key messages: TABU CRM_SVY_DB_ST 300DSWPCI_ISSUE_FDBCK 0000000000DCRM_               
    Special character "_" in generic key                                                                               
    Key messages: TABU CRM_SVY_DB_ST 300DSWPCI_ISSUE_FDBCK 0000000000DCRM_               
    Special character "_" in generic key                                                                               
    Key messages: TABU CRM_SVY_DB_ST 300DSWPCI_ISSUE_FDBCK 0000000000DCRM_               
    Special character "_" in generic key                                                                               
    Key messages: TABU CRM_SVY_DB_ST 300DSWPCI_SERVICE_FDBCK 0000000000DCRM_             
    Special character "_" in generic key                                                                               
    Key messages: TABU CRM_SVY_DB_ST 300DSWPCI_SERVICE_FDBCK 0000000000DCRM_             
    Special character "_" in generic key                                                 
    Explanation of the error:
    Special character "_" in generic key
    Message no. TK287
    Diagnosis
    The generic key 300DSWPCI_ISSUE_FDBCK 0000000000DCRM_ was entered for the object CRM_SVY_DB_ST. All keys that match up to the asterisk are to be transported.
    The key cannot have any special characters before the asterisk, since they are interpreted in different ways by different database systems.
    The key contains the special character _.
    System Response
    The entry is rejected.
    Procedure
    Extend the generic entry, or specify all keys individually.

    Hi,
    Go through SAP note 711103 & 688363.
    Regards,
    Sachin Rane.
    Edited by: Sachin Rane on Mar 12, 2009 2:48 PM

  • Using the Mail content and Mail Attachment in the mapping

    Hi,
    I have a requirement in which I need to read a file from the mail server and I am using the sender mail adapter for this. I have to convert the attachment of the mail in to the payload. To do this I am using the payload swap bean and mail transform bean. Now the issue is I have to get the information from both attachment and the mail content and need to map it to the target message. Please let me know how to do this.
    Thanks!
    ~Vaas

    Not sure if there is a staright forward way to achieve this.
    But I can think of a work around for your scenario.
    >>To do this I am using the payload swap bean and mail transform bean.
    Instead of doing it this way, try
    1. Message Transform bean that will transform the payload(content of the mail) to XML.
    2. PayloadSwapBean to switch Payload and Attachment.
    3. Message Transform bean to transform the attachment to XML.
    4. Custom adapter module to read the attachment, contnet and create your own desired XML.
    Alternatively, step 4 could be replaced by a Java mapping doing the same operation.
    Regards
    Jai

  • Unseen ESSId with special character - Satellite M40

    Hi,
    I have a Satellite M40 with an atheros AR5005g wireless card.
    I have a wireless network with WPA2-PSK encryption. The ssid looks like that : g4s8j6b-special character-o7v35s7gt3q1c6b8
    With the latest driver it is impossible to see the ssid an to connect to this network.
    I have tried an Atlantis USB Wireless adaptor and it can find the wirelessnetwork (I can not connect, because the USB Adapter does not supported WPA2-PSK)
    For me it is a driver 's problem. How can i solve this problem ? This "special character " is not recognising from the drivers isn't it ? is it possible to convert the ssid in HEX code and to insert the ssid in HEX code and the key in HEX code in a data, to force the connection ? (manual connection like Linux)
    yours faithfully
    Oh this forum does not support the character ... it looks like this : http://en.wikipedia.org/wiki/%C3%9F
    (Unicode U+00DF)

    Hi,
    The ssid works with my other laptop (intel Wireless pro 3945 a/b/g) on Vista and Ubuntu (manual configuration).
    The ssid can to be see with the atlantis usb wireless adapter.
    > {quote:title=[email protected] wrote:}{quote}
    > That SSID is very long. Have you tried using a shorter SSID?
    For me that not the problem. On my other Laptop, before it works with my ubuntu system i had to make clean my driver's installation. Then I have converted the ssid and the wpa2-psk key in HEX code. That's why for me, it seems to be a driver's problem but it is not to find a solution anywhere.
    How can i try to set up the ssid in HEX code and not ASCII with a win XP system ?
    Yours faithfully

Maybe you are looking for

  • Admin server not running

    Hello, We are using wls 10.3.3 located in different unix machine. Using putty we work with the servers from the desktop computers. We want to monitor the JVM using Jrockit mission control from desktop. We have JRMC installed in the Windows XP desktop

  • Lightroom Gallery Issues

    Hey guys I have been having a problem lately uploading my lightroom Gallery and it is really starting to get annoying. Sometimes the website displays flawlessly, Other times it is all out of proportion. I don't change any setting in between the expor

  • Close Notification is triggering at the completion of each path

    In my company we are using BRF+ flat rule for routing rule in process id: SAP GRAC Access Request.  The problem is when each path is completed the end user receives close notification and we want user to receive close notification only at the end of

  • In sequence for write/read, value of wait time?

    I made a sequence for write then read on a serial port. Sometimes, the read string is not the entire one. I put some wait time of 500ms in write sequence and wait time of 500ms in read sequence. Could it be the problem ?Is it possible to change the b

  • ERROR WHEN SENDING EMAIL (REPORTS)

    Hi all, Sorry to write about Reports here, but the Reports Forum is slow today, nobody answers the questions... if anyone here could help me i would thank a lot. I am trying to send the report by email, i already modified the file rwbuider.config, bu