Deleting or omitting Special characters in PI mapping

Hello ,
    My scenario is , SAP ECC to legacy , ie. IDOC --> XI/PI -BPM --> Legacy(XML) ,
  here in Idoc we have a field which gives has a special character '§'  which I need to remove this before it goes out from PI.
how to handle this , Is there a best way to do?
  Note : From legacy they can handle other character but legacy system could not accept this char.
Regards,
Sethu.

Hi Sethu,
                 here is the java mapping code to meet your requirement. I assumed you are working on PI 7.1 or above versions.
The java mapping code pattern,associated library files and compilation enviornment are different in PI7.0 and lower versions.
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import com.sap.aii.mapping.api.AbstractTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.TransformationInput;
import com.sap.aii.mapping.api.TransformationOutput;
public class RemoveSpecialChar extends AbstractTransformation {
      * @param args
     public void execute(InputStream in, OutputStream out)
               throws StreamTransformationException {
          // TODO Auto-generated method stub
          try
               byte b[]=new byte[in.available()];
               String encoding="UTF-8";
               in.read(b);
               String inputXML=new String(b);
               inputXML=inputXML.replaceAll("§","");
               out.write(inputXML.getBytes(encoding));
          catch(Exception e)
               throw new StreamTransformationException(e.getCause().toString());
     public void setParameter(Map arg0) {
          // TODO Auto-generated method stub
     public static void main(String[] args) {
          // TODO Auto-generated method stub
          try{
               RemoveSpecialChar genFormat=new RemoveSpecialChar();
               FileInputStream in=new FileInputStream("C:\Apps\my folder\sdn\qmark.xml");
               FileOutputStream out=new FileOutputStream("C:\Apps\my folder\sdn\qmark1.xml");
               genFormat.execute(in,out);
               catch(Exception e)
               e.printStackTrace();
     public void transform(TransformationInput arg0, TransformationOutput arg1)
               throws StreamTransformationException {
      this.execute(arg0.getInputPayload().getInputStream(), arg1.getOutputPayload().getOutputStream());
you need to use this mapping before message goes out of PI server.
You can consult following articles for further help on java mapping
http://wiki.sdn.sap.com/wiki/display/XI/BeginnersguidetoJavamappingusingDOMparserinSAPXI
http://www.****************/Tutorials/XI/Mapping/Index.htm
regards
Anupam

Similar Messages

  • Mapping error because of special characters

    Hello,
    We are extracting data from SAP system and sending it thru XI to 3rd party system (writing xml files on to file server).
    Now, because of presence of few special characters in the data, there is a mapping exception error in XI.
    The data which is causing the issue is "ABRANCENTRO   MEDIAÇÃO IMOBILIÁRIA".
    In SXMB_MONI, i see that this is failing is Request Message mapping step.
    We can not remove special characters as this is master data. How can i fix this issue?
    DO i need to use any modules in communication channel for this purpose?
    Any leads are highly appreciated.
    Thanks,
    Chandra

    Hi Chandra,
    an UDF cant help you assumedly coz that characters lead to "not wellformed" XML. Any parser would complain about that. So the PI parser would throw an error before executing the UDF.
    The question is: what does the receiver expect? You wrote you like to write xml files to a server. But if the XML is not wellformed, the receiver would not be able to parse them, and therefore usually not able to process them.
    If you really want to create such a file (not wellformed XML) you can create that with a not parsing mapping (ABAP or Java). So you map the message just with string operations. This is not very recommentable and only possible for very simple mapping cases.
    Regards,
    Udo

  • JAVA Mapping: Handle Special characters like u00E4,u00FC an so on

    Hi everybody,
    we have a JAVA Mapping that gerenates text nodes with special characters.
    The generated XML is later used in an graphical message-mapping.
    During runtime we ge the trace/error:
    com.sap.aii.utilxi.misc.api.BaseRuntimeException: Fatal Error:
    com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 31(:main:, row:1, col:2498) at
    com.sap.aii.mappingtool.tf3.Transformer.checkParserException
    Does anybody know, how to modify the JAVA-mapping to have a workaound for this problem?
    Thanks
    Regards Mario
    Edited by: Mario Müller on Jul 22, 2008 4:33 AM

    Hi Mario,
    As java mapping does not validate the xml,the output gets created but if u have to use the xml structure,the u will have to include the following.
    Assume u r using a write method to write the output xml,then
    check for tspecial charactters like &,<,>.' etc and replce them as shown below
    private void write(String s)
         //Traverse through the string
    for (int i=0 ; i < string.length();i++)
         String s1 = data.substring(i, i + 1);
              if (s1.equals("&"))
                   write ("&amp;");
              else if (s1.equals("<"))
              write("&lt;");
              else if (s1.equals(">"))
              write("&gt;");
              else if (s1.equals("\""))
              write("&quot;");
              else if (s1.equals("'"))
              write("&apos;");
              else
              write(s1);
    Should help u out
    Edited by: Mohd Tauseef Ibrahim on Jul 22, 2008 11:08 AM
    Edited by: Mohd Tauseef Ibrahim on Jul 22, 2008 11:09 AM

  • Runtime mapping error due to the special characters in source XML

    Hi All,
    I am facing problem with the special characters coming in the source XML message. it is failing at runtime in the mapping level. when i test with the same XML message manually in graphical message mapping it works.
    it looks like a UNICODE problem which we face noramlly in ABAP as well. but looking for a solution.
    For your reference i am giving the data which i am recivieing and the error message below.
    the problem is with the character .
    Source payload error:-
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    An invalid character was found in text content. Error processing resource 'file:///C:/WINNT/profiles/CG1009/Local Settings/Temp/a173eb8_2721HTML000003'. Line 26, Position 22
    Early response is appreciated.
    Thank you

    If your message contains special chars and the encoding is not being set, then the error is of the system which is sending the message, not XI's. The webserver should return the correct encoding.
    At adapter engine, You can set the enconding for the messages you send (for example, in Soap adapter module, set XMBWS.XMLEncoding parameter with value iso-8859-1),  but not for the messages you receive.
    As a workaround, you could try using a Java Mapping to change the encoding manually. For that, set the encoding of the OutputFormat of the XML you'll serialize. Try the following code piece for the mapping (inside a try/catch declaration):
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder documentBuilder = factory.newDocumentBuilder();
    Document input = documentBuilder.parse(in);
    OutputFormat format = new OutputFormat(XML, "ISO-8859-1", false);
    XMLSerializer serializer = new XMLSerializer(out, format);
    serializer.serialize(input);
    For that code to work, you'll need to import xercesImpl.jar and xml-apis.jar in Imported Archives of mapping objects, in Integration Repository. Both are available at http://xerces.apache.org/xerces2-j/ .
    Regards,
    Henrique.

  • "Special Characters" Accent Marks delete letter

    Hello fellow Pages users,
    I can't quite figure out how to solve a little problem I'm experiencing in Pages. In a text document, I am trying to put an accent mark over a letter (like the diacritical marks one finds over letters in dictionaries to help with pronunciation). I highlight the letter I want to accent, and then I select "Special Characters" from the Edit menu. In the "Character Palette," I select the accent mark I want to use (which is listed under "Punctuation"). But when I select "Insert," the accent mark replaces the letter I want to accent! All I have left is an accent mark on the document, which is useless without the letter it is supposed to accent!
    I was wondering whether anyone has encountered this problem (if it is a problem--maybe I'm just going about this the wrong way) and whether there is a workaround. Thank you very much for your time; please let me know if I need to clarify anything.
    Kind regards,
    Chris
    P.S. I could just use Microsoft Word, but (1) since my computer is fairly new, I don't have Word at the moment and (2) I would like to learn how to do this in Pages, if it is possible. Please forgive me if this topic has already been covered; I tried to "search" for this topic, but had trouble isolating this specific problem in the Discussions.

    Hello Starfighter
    The characters you are selecting from the Punctuation section of the Character Pallette are separate characters - they don't overlay other characters. What you need to do is select a Latin font and pick your character with the accent from there.
    It might be simpler for you to use the keyboard viewer instead. When you hold down the ⌥ key you will notice that several of the keys on the keyboard appear orange. This is because they are designed to work in combination with another keystroke to input an accented character e.g. The sequence ⌥ u e will produce the character ë.
    I hope that helps.

  • How to remove all special  characters

    Hi,
    I want to remove all (128-223)the special characters that come in the mapping from the URL
    http://www.danshort.com/ASCIImap/
    128-223 ,I mean if any characters that come in between these numbered characters I have to remove in mapping.
    please suggest.
    thank you,
    Sri

    HI Sri
    You can use the Java code as given above
    Other method can be XSLT
      <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
                <xsl:output  method="xml" indent="yes" omit-xml-declaration="yes"/>
                <xsl:template  match="/source node">
                      <target node>
                            <xsl:value-of  select="replace(.,'sepcial character','')"/>
                      </target node>
                </xsl:template>
          </xsl:stylesheet>
    Thanks
    Gaurav

  • Displaying special characters in ALV report.

    Hi Experts,
    Can we display special characters in ALV reports? Special characters such as tick mark.(Like in character map(Font Bookshelf  Symbol 7) of windows ).
    I tried with icons in ALV report, I was able to display tick icon in the ALV report, but when we export the report in to a excel, the icons comes in as Hexadecimal code.
    Can any we display special characters like tick in ALV report or display the icons in excel aswell?
    I will be gratefull for the <urgency reduced by moderator> response.
    Regards,
    Sharath.
    Edited by: Thomas Zloch on May 10, 2011 10:26 AM

    Sharath,
    I think it is possible to do so.
    Please check this link.
    http://www.sapfans.com/forums/viewtopic.php?f=13&t=322569
    Thanks,
    Guru.

  • Time-dependent Vendor Master & Handling Special Characters

    Hi,
    I need to extract time-dependent Vendor Master.
    1. The data source for <b>0VENDOR</b> does not have fields to hold the valid date range.
    2. Does the Master data in R/3 for Vendors will hold the valid date range?
    3. The text for <b>0VENDOR</b> provides time-dependent, but how to map the <b>valid from</b> and <b>valid to</b> fields?
    Handling Special Characters:
    We are trying to extract data from Legacy system via DB Connect. The item text field consists of special characters. Of course in BW customization we can specify all the special characters to consider. But the special character we observed is 'square' symbol i.e. 'new line character' in Oracle. We are updating this to an ODS object. When looked at error log, observed that green light for the number of records transferred and updated, but finally when it load into ODS object and activates popping up the error message saying 'could not recognize special character'.
    Please help me getting the 2 issues resolved.
    Thanks in advance.
    Regards,
    Sudhakar.

    Hi Everyone,
    Thanks for inputs on Special characters issue...
    Finally resolved with below piece of code in the start routine:
    DATA: FLAG,
          OFF TYPE I,
          LEN TYPE I VALUE 1,
          ALLOWED_CHAR(95) VALUE
    '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_=+ ' &
    'abcdefghijklmnopqrstuvwxyz:;<>,.?/|\{}[]"'''.
    CONSTANTS: C_CHAR VALUE '-'.
      LOOP AT DATA_PACKAGE WHERE NOT /BIC/ZI_DESC IS INITIAL .
        DO.
          IF DATA_PACKAGE-/BIC/ZI_DESC CN  ALLOWED_CHAR.
            REPLACE SECTION OFFSET SY-FDPOS LENGTH LEN OF
                    DATA_PACKAGE-/BIC/ZI_DESC WITH C_CHAR.
            FLAG = SPACE.
          ELSE.
            FLAG = 'X'.
          ENDIF.
          IF FLAG = 'X'.
            EXIT.
          ENDIF.
        ENDDO.
        MODIFY DATA_PACKAGE.
      ENDLOOP.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    I have seen the link sent by 'Eugene Khusainov' today. Thought putting my piece of code that may help others...
    Regards,
    Sudhakar.

  • How to Handle Special Characters in PI7.1

    Hi Team,
    I need to handle some special characters like <,>,& etc.. from WS Adapter to CRM in PI 7.1.
    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9420 [original link is broken]
    By using the above blog i had implemented the Java Code as
    public void execute(InputStream in, OutputStream out){
    try{
    int read_data;
    while((read_data = in.read()) != -1){
    if (read_data == '&'){
    out.write("&amp;".getBytes());
    }else if (read_data == '>'){
    out.write("&gt;".getBytes());
    }else if (read_data == '<'){
    out.write("&lt;".getBytes());
    }else if (read_data == '/'){
    out.write("&frasl;".getBytes());
    }else if (read_data == '\''){
    out.write("&apos;".getBytes());
    else { out.write(read_data);
    out.flush();
    } catch (Exception e){}
    I had added this class file in Operational Mapping.
    It is working  if we have only one IF condition for & in while
    Any suggestion
    Thanks
    Sriram

    Hi Ramesh,
    Thanks for your inputs, I have tried your code but it is not working. The error message stays the same.
    Dear Stephane,
    To describe the error more, the requirement is the payload coming from source through WS Adapter consists of the special characters <, > , & which are basic sematics of XML syntax. I need PI to process this payload with special characters and successfully transfer it to target CRM system. I have created the Java class with code (ref: Blog 9420) as stated earlier and added this class to my existing Operation Mapping. I am expecting the java mapping to replace the special characters in payload like  < with "&gt;" . So as the case with the other characters >,&,'
    After activaton of my operation mapping, I triggered the test message with Soap UI client and I could able to get a successful mapping only When I put the logic for &ampersand symbol only. However when I am trying to add the logic for > or < or ' the mapping is failing . I am using UTF-8 encoding across the source and PI enviroments.
    Sample SOAP message :
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:abcabca.com">
       <soapenv:Header/>
       <soapenv:Body>
          <urn:MT_ABCDEFG_Req>
         <activity>
              <id/>
              <type>ZEMA</type>
              <actionType>C</actionType>
              <firewall>10000003</firewall>
              <subject>small &gt; &lt; attachment test</subject>
              <location/>
              <startDate>2010-07-08T10:53:31.000Z</startDate>
              <endDate>2010-07-08T10:53:31.000Z</endDate>
              <mainClient>1000319</mainClient>
              <mainContact>1000003</mainContact>
              <isConfidential>false</isConfidential>
              <summary/>
              <fullText>test body  - small.txt</fullText>
              <owner>1000021</owner>
              <from>ABCDEDF</from>
              <sendTo>emailaddress</sendTo>
              <copyTo/>
              <keywords/>
              <referenceId/>
              <createdBy>1000021</createdBy>
              <additionalContacts/>
              <additionalClients/>
              <additionalParticipants/>
              <status>A0008</status>
              <attachments>
                   <fileUrl>20100708110053-XXXXXXXXX</fileUrl>
                   <fileName>small.txt</fileName>
              </attachments>
              <attachments>
                   <fileUrl>20100708110053-XXXXXXXXX</fileUrl>
                   <fileName>EMail 2010-07-08.pdf</fileName>
              </attachments>
         </activity>
          </urn:MT_ABCDEFG_Req>
       </soapenv:Body>
    </soapenv:Envelope>
    Output on the SOAP UI  client for the above request:
    <!--see the documentation-->
    <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP:Body>
          <SOAP:Fault>
             <faultcode>SOAP:Server</faultcode>
             <faultstring>Server Error</faultstring>
             <detail>
                <s:SystemError xmlns:s="http://sap.com/xi/WebService/xi2.0">
                   <context>XIAdapter</context>
                   <code>ADAPTER.JAVA_EXCEPTION</code>
                   <text>com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.engine.interfaces.messaging.api.exception.MessagingException: XIServer:NO_MAPPINGPROGRAM_FOUND:
         at com.sap.aii.adapter.soap.ejb.XISOAPAdapterBean.process(XISOAPAdapterBean.java:1160)
         at sun.reflect.GeneratedMethodAccessor342.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(
    What do you think where I am doing the wrong?
    Sriram

  • How to Avoid Special Characters in string

    Hai.
    I want only Alphabets & Digits to be entered in to my string.No any other special characters except spaces.How can I do this? 
    Solved!
    Go to Solution.

    MikeS81 wrote:
    see the attached example.
    I would allow a few more, e.g. 0 and 8 to allow editing of the entered string (backspace, cursor buttons, delete key, etc.).
    Message Edited by altenbach on 11-21-2008 12:49 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    check_char_LV80MOD.vi ‏14 KB
    FilterStringInput.gif ‏6 KB

  • How to insert special characters in pdf comments

    Now, we are ready to go "no paper" workflow, and so mark anything on pdf file, but we cannot insert most of special characters in PDF comments. Same as here, and the xml entity is "&PSgr;", "how to archive it?

    >what the Character Map is?
    You don't know how to use Google?
    Character map is a standard part of Windows for using special
    characters with any program.
    In Windows XP, Start > All Programs > Accessories > System Tools >
    Character Map.
    Aandi Inston

  • Issue in creating a add link to a document content type on a doc lib name with , / special characters

    hi,
    i am having a  requirement to create/use "add link to a document" content type for a item in the document library.
    so i got  the code from below site :
    http://howtosharepoint.blogspot.in/2010/05/programmatically-add-link-to-document.html
    my issue is, if teh document  library names are single words - like MOM, model, procedures etc this  functionality is working fine and i am able to view the link to a document as an item. 
    but when the doc lib name contains special characters like , or  /  , this link to a  document  content type functionality is NOT working.
    can anyone pls point me whether this is the  actual  issue ? ie, if  the doc lib name contains special chars  like , or /  my
    add link to a document wont work? is there any restrictions/limitations for doc lib names in SharePoint ?
    for eg: my doc lib names are :
    1) Report and analysis, Data
    2) form / template
    3) map/ plot
    help is highly appreciated!

    hi,
     its talking abt the subsite names and  folders and NOT the document librraies.
     is there any link which gives the naming convention / restricted names for  document libs or  splists , from msdn / blogs.technet.
    thnx

  • Apple, please address this issue!!! Searching and special characters

    I've found at least one other topic here regarding this issue, but Apple has yet to address it, or even confirm that it's in fact an issue.
    A big portion of my library consists of international artists, many who have special/nonstandard characters in their names (e.g. "Tiësto"). In previous versions of iTunes, I could search for "Tiesto" (note the absence of the umlaut over the 'e') and all of those tracks would appear. However, after upgrading to iTunes 9, I'm forced to search for "Tiësto" in order to view those tracks.
    Thinking about this issue, it would seem that this is normal behavior, as an artist named "Pàz" isn't necessarily the same as "Paz". But the reality is that NO ONE wants to take the time to search for the alt-code of a special character, and then type it in. Additionally, most people (including me) have a number of reasons for not renaming the artist to conform to standard characters.
    Clearly, something has changed between iTunes 8 and 9. And it's incredibly frustrating. A big chunk of my library is virtually inaccessible to me now, unless I search for terms that don't contain special characters.
    Apple, **PLEASE** address this issue. I'm not the only one with the problem and it's become a huge pain in my side to have to work around this.

    I don't see how it's sloppy or why there should be any reason that it shouldn't have given you both.
    Even putting aside that gracenote and others don't have consistent spelling in their databases, that when you download from the iTunes store, who knows what you're going to get, so that one's library could be all over the place and one might not even notice it, accents and other markings don't change the fact that a u is the same letter as ú.
    Yes, it's pronounced different. Yes, the difference is very important. But it's the same base letter. And even if it's considered a different letter in another language, in English we have 26 letters and all the accents and tildes and umlauts don't make them a new letter, which is what we're talking about here.
    It's a huge pain that looking for an album that has "Zürich" in the field and I type in "Zurich" I can't find it. I have to think about if I really do have that album, maybe I deleted it by accident, etc. And then I think to type "rich" and then it pops up.
    That's way too many steps. I don't know keyboard shortcuts and I don't want to learn them. In English, it should be letters, not characters, that count.

  • Deleting file with special character in name gets error -43

    In my Trash folder there is a .html file with a name containing special characters (oriental) left over from when I uninstalled Adobe CS2. When I try to change the file name to delete the special characters so I can trash the file, I get error -43, and the name won't change. Therefore I can't get the file deleted from the computer because I can't get rid of the special characters.
    Is there another way to accomplish the same thing?

    I presume you are referring to the notorious Vietnamese file. Others have had success getting rid of it wuth these instructions .
     

  • Error while handling special characters ( and &) in Sender File adapter

    Dear All,
    Scenario: Third Party System --> (File adapter) SAP PI 7.1 (SP05) --> (Proxy) ECC
    We are receiving CSV file and no mapping is required in PI as all the processing is being done by third party tool. But we are receiving special characters like ',",>,< and & in the csv file.
    When we are using File Type as TEXT and File Encoding as ISO-8859-1 than we are getting error. We changed File Type to BINARY and than we are able to handle ',",> but having issue in handling < and &.
    Any idea how we can handle it.
    Please note trhere is no Mapping in SAP PI so cannot uise Java mapping.
    Thanks a lot
    Chanakya

    Hey,
    You can add ABAP Script in Receiver Proxy for eliminating or replacing with NULL or empty. Since you dont have mapping for formatting these kind of junks you can follow the above approach.
    Else, you can remove the junks at OS level while running a small script and make it available to PI.
    Or else, you need to create mapping for sender and recevier structure though it is same, then you add a very simple UDF for fine tune.
    Use this UDF
    Here a is the input value.
    String b = "";
    b = a.replaceAll(",", "0");
    b = a.replaceAll("@", "0");
    Like all the special characters you can take and replace with zero.
    return b;
    Thanx
    Pothana

Maybe you are looking for

  • How to generate a chart in JPanel

    i want to implement (draw) a grpahical bar chart on JPanel , please help me

  • Jabber 9 UCM 6 and phone control..

    Hello, I'm setting up Presence and Jabber for a client with UCM 6.1.  Everthing seems to be working fine except the ability to control desktop phones from Jabber.  Although all the settings appear to be ok whenever a user tries to change from softpho

  • Building an Application in Windows to be used in Linux (with the Run-Time Engine)

    Hi All, I have an LabVIEW project I have developed in a Windows environment.  I can create an Application (.exe) using the Build Specification -> Application Builder which works fine on the development platform. I now want to distribute the applicati

  • How to get a Class object with a generic type of list

    Hi, I want to get an instance of a class which is of type List<ABC>. How can I get that ? What I tried was Class c = List<ABC>.class , bu this is not compiling. I can get new ArrayList<ABC>().getClass() , but the type of that class would be Class<? e

  • Call function module from ITS template

    Hi all, Does anybody know if it is possible to call an ABAP function module (or embed any ABAP command) in an ITS template (HTML B)? If so, can someone post some sample codes? Thanks! Jay