Using a DOM Document in Graphical Mapping

Hi,
I have the following scenario:
A string stream is received from a SOAP adapter. From this   I extract a part that is in essence a XML document.
I then parse this into a DOM Document object. 
I want to pass this XML structure on to other graphical mapping functions so that I can map parts of this document to other structures. I cannot add it to the 'result' object in an 'Advanced user defined function'
Do I have to add it to some component of the 'container' object passed to the function ?.  If not - any ideas of how I would do this ?.
Thanks
Andre

Hi Andre,
It looks to me like you have an XML document with another XML document embedded (and encoded) inside some element. Something like:
<outerDoc>
<element>
  &lt;innerDoc&gt; ...more embedded XML... &lt;/innerDoc&gt;
</element>
</outerDoc>
It is not possible to both "unwrap" the inner document and continue to work on it in a graphical mapping. The simplest approach is to have 2 mapping steps in your interface mapping:
1. A pure Java mapping in which you get the complete outer document as input, parse your way through and extract the inner document, which is the output of this first mapping step.
2. A graphical mapping which has your inner document as input and your final result as output.
Hope that clarifies it somewhat
Best regards,
Thorsten

Similar Messages

  • How to use  Advance java function in graphical mapping in XI 2.0?

    Hi,
    currently I am using a simple java function to make an RFC call to R3 system.
    I want to avoid making connection for each lookup. Instead I want to make a single connection for whole message queue and get the corresponding values in some array or container object.
    please suggest a solution.
    I think this is possible using Advance java function, but I am not able to find any example on using Advance java function at help.sap.com.
    thaks in advance.

    Hi!!!
    I'm not sure if I understood you well.
    Do you want to preload some data into your structures in the memory and keep them there so you don't need to make a new connection during processing the whole message or every message?
    In my opinion you can cache some data during processing a message, but it's impossible to cache some data between processing messages.
    If you write your java mapping or you use graphical mapping (even with user-defined function), then you have a java class. The problem is that XI 2.0 reloads this class during processing every message, so even if you load some data from your data source into your structures in the memory, this data will be lost after reloading your mapping class.
    Regards,
    Andrzej Filusz

  • Use data type enhancement in XSLT mapping in XI

    Hi Experts,
    I'm working on SNC and I need to add an element to a data type.  I have created a data type enhancemnet with the element in it.  Now I need to get this into my XSLT mapping.  I have tried creating a message type but the data type enhancement is not recognized.
    Are data type enhancements only for proxies?  Can they be used in an XSLT or graphical mapping in XI?
    Thanks
    David Pauley

    Upon further investigation I found that Data Type Enhancements can be used with any message mapping.  There are a couple of things that you must get right.  First when creating the Data Type Enhancement make sure you use the namespace for your custom SWC that you created.  Next make sure that in the Ehancement for Data Type you use the SAP supplied data type name and namespace.  It also seems that your data type enhancement name, mapping name, and operational mapping name must have the Z_ prefix.  Save and activate, then go to system which owns the enhancement and go to SPROXY, you should see your custom SWC and under that you should see your enhanced data type, mapping, and operational mapping.  Activate and modify methods as needed here.

  • Create Attachment within Graphical Mapping using UDF

    Hi!
    We want to create an attachment witihn a graphical mapping using an UDF function.
    I use that function:
    public String addAttachment(String filename, String mimeType, String content, Container container) throws StreamTransformationException{
         BASE64Decoder decoder=new BASE64Decoder();
         try {
              GlobalContainer globalContainer = container.getGlobalContainer();
              OutputAttachments outputAttachments = globalContainer.getOutputAttachments();
              Attachment attachments = outputAttachments.create(filename, mimeType,decoder.decodeBuffer(content));
              outputAttachments.setAttachment(attachments);
              return "Adde1: "+filename;
         } catch (Exception e) {
              return e.toString();
    (SDN helped me much in creating that
    This function has no compiling errors, anything workes fine:
    It takes 3 input-parameters, see also: http://help.sap.com/javadocs/pi/SP3/xpi/com/sap/aii/mapping/api/OutputAttachments.html
    filename (ok, more or less contentID)
    mimeType (more or less contentType)
    content: Base64-encoded String which should be set as content
    In my sample I use the following constants for that function:
    filename = "fn1.txt"
    mimeType="application/xml"
    content = "UG9seWZvbiB6d2l0c2NoZXJuZCBhw59lbiBNw6R4Y2hlbnMgVsO2Z2VsIFLDvGJlbiwgSm9naHVydCB1bmQgUXVhcms=" --> cames directly from http://de.wikipedia.org/wiki/Base64
    When using the message, I got this error within SXMB_MONI:
    <SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Could not queue receive for
    message 0022642d-b106-02df-8e8c-f41c243bd112(INBOUND). Reason: java.lang.NullPointerException: while trying to
    invoke the method com.sap.aii.af.sdk.xi.lang.Binary.getBytes() of an object returned from
    com.sap.aii.af.sdk.xi.mo.xmb.XMBPayload.getContent()</SAP:AdditionalText>
    This looks pretty much the same as Add Attachment from ABAP Mapping but this tread is also not answered.
    Adding attachment from PI level looks also in that direction, again, no answer.
    So, I was wondering if someone has solved such problem?

    Hi Divyesh!
    We did it that way:
    1. Choosing the XML-Mailstructure as Destination as described in Configuring the Receiver Mail Adapter - Advanced Adapter Engine - SAP Library -  Example (XI payload with mail package)
    2. now we have created a UDF for creating the "content"
    public void getContent(String[] text, String[] attFname, String[] attType, String[] attContent, ResultList result, Container container) throws StreamTransformationException{
    // vergleich ob alle att-Arrays selbe anzahl haben
    if (attFname.length!=attType.length || attFname.length!=attContent.length) {
        result.addValue(Integer.parseInt("Fehler: alle Attachment-Eingänge müssen die selbe Anzahl an Elementen haben!"));
        String CRLF = "\r\n";
        String output="This is a multi-part message in MIME format."+CRLF+CRLF+
        "--"+getBoundary(container)+CRLF+
        "Content-Type: text/plain; charset=UTF-8"+CRLF+
        "Content-Disposition: inline" + CRLF + CRLF +
        text[0]+CRLF;
    for (int i=0;i<attFname.length;i++) {
        output+="--"+getBoundary(container)+CRLF+
        "Content-Type: "+attType[i]+"; name="+((char)34)+attFname[i]+((char)34)+CRLF+
        "Content-Disposition: attachment; filename="+((char)34)+attFname[i]+((char)34)+CRLF+
        "Content-Transfer-Encoding: Base64"+CRLF+CRLF+attContent[i]+CRLF;
    output+="--"+getBoundary(container)+CRLF;
    result.addValue(output);
    This UDF is configured as "QUEUE"
    We have configured this input-structure
    The Content itself is allready base64.
    So we can call this mapping and it creates a Multipart-Mail for us.

  • Use RFC Lookup in Graphical Mapping for Database Update

    Hello,
    I am wondering whether the RFC Lookup function in graphical mapping provides the same functionality as a general RFC function call.
    In detail I would like to update a database table using a RFC which just takes some input parameters but does not use any output parameters. Would this work too as the name "lookup" implies that it might just be possible to read something?

    HI,
    Refer these links:
    RFC Lookup by michal
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/8e7daa90-0201-0010-9499-cd347ffbbf72
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0/content.htm
    DB lookup - /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    Regards,
    Nithiyanandam

  • XSLT using Java function from graphical mapping (RFClookup)

    Hi,
    I was wondering if it is possible to use the standard Java functions of the graphical mapping (RFCLookup, Datetrans, ...) or from my own UDF inside an xslt mapping. Does anyone have every tried this or is an example available ?
    Regards Bernd

    Hi Bernd,
    here you can find an example how to use RFC lookup from an XSLT Mapping:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14?quicklink=index&overridelayout=true
    Is this what you're looking for?
    Regards,
    Gábor

  • Can we use XSLT mapping after graphical Mapping

    Hi,
    Can we use XSLT mapping after graphical mapping?
    My requirement is to generate two namespace attributes in the target output.
    So first I want to generate a structure using graphical mapping and then want to use XSLT mapping only to generate the second namespace XSI (leaving the rest of the structure as it is). Is it possible?
    <ns1:Test xmlns:ns1="wmdata.dwbi.interface" xsi:schemaLocation="wmdata.dwbi.interface w_interface_1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    Please post some solution. (I will reward points)
    Br,
    Madan Agrawal

    Hi Madan,
    Can we use XSLT mapping after graphical mapping?
    To me it seems feasible...
    But to using the two mappings one after another you will have to use BPM .
    Use transformation step for this to use the mapping and change in structure.
    Regards,

  • Mapping Split using the Graphical Mapping Tool

    Hello,
    I am a little confused right now... so I turn to you for help!
    I found this excellent blog:
    /people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool
    It details how to do a message split using the Graphical Mapping Tool. WHich is exactly what I want!
    But then I found this on help.sap.com:
    http://help.sap.com/saphelp_nw04/helpdata/en/42/ed364cf8593eebe10000000a1553f7/frameset.htm
    Which states that:
    Messages cannot be sent by using different Adapter Engines in a mapping-based message split. This affects configuration thus: All receiver agreements that have a receiver interface from the mapping entered in the key must only be assigned communication channels with the following adapter types: 
    -          RFC Adapter
    -          SAP Business Connector Adapter
    -          File/FTP Adapter
    -          JDBC Adapter
    -          JMS Adapter
    -          SOAP adapter
    -          Marketplace adapter
    -          Mail Adapter
    -          RNIF adapter
    -          CIDX Adapter
    I have a simple mappling split where I want to take a file containing multiple materials and send them one by one to a PROXY into SRM. To send to proxy I want to use the HTTP adapter which is not listed above. BUT if I read it correctly it will work, as long as I dont try to do the interface determination based on the mapping.
    Is this correct, that it will work I mean? I think so but not sure about the wording in the sentence above, and wanted to check before I go destroy my mapping.
    Thanks!
    Nam

    Hi,
    If your scenario is simple and straight fwd like from one source to one target then you can split message without BPM. As Priyanka said in the message mapping go to Message Tab and set the target message occurance to unbounded. Then in the Interface Mapping in the target interface section you will find the occurance in the last column, change occurance to unbounded.
    While doing configuration you have to go for Enhanced Interface Determination thats it.
    Provided you are above sp14, incase of any lowere SP'a you will not even able to activate your mapping program as it will expect ABSTRACT interface to do multimapping.
    Thanks,
    Prakash
    Thanks,
    Prakash

  • Can i use graphical mapping to do such conversion or do i need java mapping

    Hi Folks,
    Need all your help and experience in solving this .
    Can you let me know is it possible do to such kind of conversion in XI using file adapter or do I need to do java mapping
    Say from rom database I get data in this format
    Seq  Field Name  Field Value
    1    Cust No          Cust 1
    1        S             SS1
    1     Score1            10
    1     Score 2           12
    2     Cust No          Cust 2
    2        S             SS2
    2    Score1            5
    2    Score 2           10
    Based on this my o/p has to be
    Cust 1 SS1 10 12
    Cust 2 SS2 5 10
    ( ie values in the last column )
    The number of rows returned from database can vary . like here for 1 seq it gives 4 in the example bt it can be any number
    Like
    Seq  Field Name  Field Value
    1    Cust No          Cust 1
    1        S             SS1
    1     Score1            10
    1     Score 2           12
    1     Score3            15
    2     Cust No          Cust 2
    2        S             SS2
    2    Score1            5
    2    Score 2           10
    2     Score3            25
    Based on this my o/p has to be
    Cust 1 SS1 10 12 15
    Cust 2 SS2 5 10  25
    is there any way that we can use graphical mapping plus file content conversion to do this or is java based mapping the only solution
    Thanks
    amit

    Hi Amit,
    You can do this using Graphical mapping and File Content Conversion.You concatenate the necessary fields in a Context and assign it to the the field Data(or field name of your wish )) in the target which will of the structure
    <Records>
    <Record>
    <Data>concatenated value</Data>
    </Record>
    </Records>
    and in File Content Conversion
    make Records,Record 0:1 and Data as 0:unbounded
    and give Recordset Structure as Record
    then Record.fieldSeparator as 'nl'
    This will give you desired output
    Regards,
    Sundar

  • Avoid explicit closing tag in XML using graphical mapping

    Hi,
    I created a data type with an element called TAG1 which has an attribute called attr.
    I mapped an empty constant to the element and the value XXX to the attribute.  I`m using graphical mapping and the XML I get is the following:
    <TAG1 attr = u201CXXXu201D></TAG1>
    But for reasons of volume I need to generate the XML without the explicit closing tag, such as:
    <TAG1 value = u201CXXXu201D/>
    Is there any possibility to achieve this with graphical mapping?
    Thanks & Best Regards,
    Viviana

    > But for reasons of volume I need to generate the XML without the explicit closing tag, such as:
    >
    >  <TAG1 value = u201CXXXu201D/>
    >
    > Is there any possibility to achieve this with graphical mapping?
    This is not posible. The graphical mapping always creates start and end tag, even for empty elements.
    You need a seperate mapping step with XSLT or Java mapping.
    Regards
    Stefan

  • How to Use Graphics Map

    Hi,
    i want to create events on the  graphics as the maps in BSP.  we can do this in HTML using <map> and <area>extensions.
    There is <graphics> extension in BSP, but i don't know how to use this extension.
    <%@extension name="graphics" prefix="graphics" %>
    <graphics:map>
    </graphics:map>
    Does anybody know how to use the graphics as maps in bsp?  Can somebody help me please?
    Thanks.

    Look at the below sample BSP application:
    GRAPH_BSP_TEST
    GRAPH_TUT_CHART
    GRAPH_TUT_JNET
    Hope it might help.
    Raja

  • Did Anybody Use The Graphics Map?

    Hi,
    I want to use the graphics map but the page test_gis_with_event.htm in GRAPH_BSP_TEST standard demo bsp application doesn't show anything. You can see the screen shots following URL.
    [http://img228.imageshack.us/i/graphicsmapbsp.jpg/|http://img228.imageshack.us/i/graphicsmapbsp.jpg/]
    Did anybody use the graphics map?
    Can somebody help me please?
    Thanks.

    Hi,
    this is an configuration error. Set an breakpoint in class cl_igs_data, method send at the funtion module
    PIGFARMDATA. The variable msg_text willc ontain something like 'ListenerRfc: unknown interpreter'.
    The IGS Connection has been not setup no or not in right way. let it check by your basis.
    Best regards, Stefan

  • How to add node value using org.w3c.dom.Document?

    Hi ,
    I'm using org.w3c.dom.Document to deal with xml files. I could successfully add nodes , and their attributes. However I could not add a value of the node. (e.g. <myNode>I couldn't add this value</myNode>)
    does anyone know how to deal with this?
    I tried subNode.setNodeValue("the value i can't add"); whereas the subNode is an instance of org.w3c.dom.Node... i know this is interface i of course used the concrete class
    org.apache.crimson.tree.ElementNode
    but when I used the subNode.getNodeValue() i simply got null?
    can u plz help me?
    thanks in advance

    Reading the API documentation for the Node interface might help. At least you wouldn't be surprised when the results are exactly what the documentation says they will be.
    What would really help would be forgetting the idea that an Element can have a value. Text nodes have values, though, so create a Text node and make it the child of the Element node.

  • Graphical Mapping Vs XSLT mapping Vs Java Mapping Vs ABAP Mapping

    Hi Experts,
              I have a question regarding different message mapping options available in XI namely
    Graphical Mapping
    XSLT mapping
    Java Mapping
    ABAP Mapping
    Q1: Which amoung the above mappings is the best and why?
    Q2: On what cases Graphical, XSLT, Java and ABAP Mapping should be used?
    Q3: Is it true that graphical and XSLT mappings are converted into Java class internally?
    Kindly help!
    Thanks
    Gopal
    Message was edited by:
            gopalkrishna baliga

    Hi,
    There is no hard and fast rule for using the mapping techniques.
    Graphical Mapping is used for simple mapping cases. When, the logic for your mapping is simple and straight forward and it does not involve mult hiearchical mapping requirement. and context handling.
    Java and XSLT mapping are used when graphical mapping cannot help you.
    When the choice is between Java And XSLT, XSLT is simpler than java mapping and easier. But, it has its drawbacks.  XSLT can lead to a bad perfrormance if the Source XML is huge.
    Java Mapping uses 2 types of parsers. DOM and SAX. DOM is easier to use with lots of classes to help you create nodes and elements, but , DOM is very processor intensive.
    SAX parser is something that parses your XML one after the other, and so is not processor intensive. But, it is not exaclty easy to develop either.
    For further info on each of the mapping, refer to these links,
    Graphical Mapping,
    http://help.sap.com/saphelp_nw04/helpdata/en/6d/aadd3e6ecb1f39e10000000a114084/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
    XSLT Mapping
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
    http://www.w3.org/TR/xslt20/
    Java Mapping
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
    DOM parser API
    http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html
    Also, check this thread for more info,
    Different types of Mapping in XI
    Am not sure about XSLT , but , yes graphical mapping is converted into java classes internally and these classes use SAX parsing as well.
    Regards,
    Bhavesh

  • Should we avoid Graphical mapping and stick with Java mapping?

    After developing mappings in XI for a month, I just don't see any good reasons to use Graphical mappings over Java mappings. Maybe some experienced users here can give me some valid reasons why we should choose Graphical mappings. Here is what I think:
    Disadvantages of Graphical mappings:
    1. No way to perform automated unit testings. This is probably the biggest reason I hate it. You can do some tests manually when you work in Integration Builder. But there is no way you can write some unit testing utilities to automate the task.
    2. Complexity. Even for some simple requirements, your Graphical mappings can become complicated and hard to understand. A lot of times, I find myself staring at several dozens of graphical nodes and try to understand what it does.
    3. Impossible to reuse. This is totally against the DRY (Don't repeat yourself) principle. For example, to generate messages for JDBC adapter, it is common to have two identical fields for primary keys: one in the access node and another in the key node. If you change the mapping logic in one, you have to remember to change the other.
    Advantage with Java mappings:
    1. Fully automated unit testing. You can create JUnit tests along with your Java mapping classes and use Maven or other build tools to perform automated unit testing.
    2. Your choice of XML parsing and binding. With Java mapping, you can choose any open source framework for XML parsing and binding. For example, with XMLBeans, I can convert XML input message to a Java object, transform to another Java object and write to output message. And each Java object is generated from its corresponding XML schema.
    3. Highly reusable. We can use fundamental object-oriented designs to create highly reusable mapping components.
    4. Better version control. Since the mappings are just Java classes, we can use CVS or SVN to track code changes.
    5. Better build tools. We can fully utilize build tools like Ant and Maven to automate the build, unit tests, or even generate documents and mapping web sites.
    So do you guys agree? Maybe I am still new to XI or I am missing some important things. But at this point, I just don't see why I should use Graphical mappings. Is there anyone developing XI interfaces completely with Java mappings?
    Thanks in advance for any comments!
    Kenny Cheang

    Hi Suraj,
    > Since its graphical the blocks will take space, but
    > there is always an adavntage of processing time.
    > Ebven though it may appear bigger, it will take less
    > time as compared with Java code (for the same
    > mapping).
    Could you explain more why the graphical mapping has better performance? I thought the graphical mapping is compiled into a Java class in the runtime anyway.
    > Yes thats there, but same goes with Java mapping too
    > right (if you haven't mentioned it as constants)
    I mainly think about inheritance. If I have to build 10 interfaces and they all have some common behavior, I can create a base interface class to encapsulate the common logic. But with graphical mapping, you have to duplicate them in each interface.
    > Disadvantages of Java mapping:
    > 1. Performance
    Same as above. I just don't see why Java has worse performance. I actually think Java should have better performance. You can optimize the code anyway you want. In some cases, you have to use queue functions in graphical mapping but it's not necessary in Java.
    > 2. All might not be well versed with Java Code(though
    > everyone may know basic java) .
    I am not asking everyone to abandon graphical mapping. I am just wondering which one is better when you have skills for both.
    > 3. Lot of standard functions are available in GM
    > which you can choose, but you have to remember the
    > exact code for those in Java mapping.
    You can create functions in Java too. All you have to do is to remember the function name.
    Kenny

Maybe you are looking for

  • Mini DVI to VGA & Lion

    I've a Late 2009 Macmini with an VGA lcd connected with MiniDVI to VGA adapter. I want to know if it will work after upgrade to Lion.. Thanks!

  • How to get back from a hyperlink?

    The hyperlinks that can be inserted in iBooks Author work great in the direction out, at least from what I can tell in preview: There is a 'folding-over' animation that gets you from the book page to the website. But I find the reverse awkward: All I

  • Images not loading properly

    I'm trying to create a simple slide show using a bit of javascript. It will load the first image correctly, but after that, no images can be found. The images are there, in the right location, but it doesn't want to load them. Any help? http://katege

  • How to delete last character in a string

    Guys i have a question... how can i delete the last character in a string.. for example String myString = "helloWorld, "; how do i delete the last character in this string which is a "," ?

  • Mail suddenly retrieves old emails from IMAP

    Hello, Dunno why but sometimes Mail starts to retrieve IMAP msgs that are 1-2 years old... how can I fix this? Thanks in advance!