File to IDoc : XML parsing in ABAP mapping

Hi,
In ABAP mapping I want to parse all of the incoming XML strings to internal table.Later I add few more fields to this table and transfer them to IDOC adapter in IDOC-XML format.In thsi case how do i get all of the input file data(converted from XML) into internal table using XML parsing in ABAP Mapping?
Thansk in advance,
RP

Hi Amil,
I insert into table but not immediately,I want all the parsed xml data into internal table and do something before I insert into DB /send it to IDOC.
I knwo how to get single Xml parsing,but how to get multple records(looping xml parse) to internal table?
Thanks,
RP
Edited by: RP@261 on Jun 3, 2009 2:14 PM

Similar Messages

  • Automatic IDOC parse in ABAP Mapping?

    Hi,
    I'm creating a very complex mapping in an IDOC -> PI -> File scenario and I'm using ABAP Mapping to do that.
    I already know how to parse an inbound xml but it's a "heavy" job and the code finishes very "hardcoded".
    As you know, SAP uses the structure EDIDD to send/receive IDOC data generically. So I'm sure that internally SAP has a method/function or something to convert the XML data sent by PI to that EDIDD data structure when you send an Idoc through PI. I can't found that, do you know if it exists?
    Thanks

    You can use function module IDX_XML_TO_IDOC to convert the XML to IDOC type internal tables.
    Check for other function module in function group IDOC_ADAPTER_MB.
    KK

  • IDOC XML Parsing

    Hi Everyone.
    I've got some lovely XML IDocs.  I'd like to read them into the IDOC Class Library and send them to SAP with JCo..........
    But I can't get some simple code to parse the XML.  I've been sending XMLs to SAP for a long time and they were always valid in SAP.  They are also valid XML.
    I also borrowed the code directly out of the JCo documentation, so you'd think it would work.
    I'm using Java 6, IDoc Class lib 3.01.  I've also tried Java 5.  If I could parse the XML I would be using SAP 4.7 and JCo 3.01....
    I've used JDOM for creating my XML.  I've tried UTF-8 and ISO-8859-1 encoding.  The error doesn't change
    The error message i get is IDOC_ERROR_PARSE_FAILURE: Invalid charachter encountered in XML input data sourcee: state=EXPECTING_IMMEDIATE_TAG_END, charPosition=48, lineNumber=1, columnNumber=49, invalidChar=U+0053, sourceSnippet=...<?xml version "1.0" encoding="UTF-8"?>....
    Heres my function I'm using.
    (getRfcConnection is my own helper function to create a RFC Destination)
    The rest of it is really just copied + pasted from the documentation.
    public static void submitXml(Sap_Pruefziffer sap_pruefziffer, String language,String iDocXML)
        throws JCoException, CS_Rfc_Exception, AbapException, IDocParseException
            JCoDestination destination = getRfcConnection(sap_pruefziffer,language);
            IDocRepository iDocRepository = JCoIDoc.getIDocRepository(destination);
            String tid = destination.createTID();
            IDocFactory iDocFactory = JCoIDoc.getIDocFactory();
            //this would be great for re-implementing the OrderDataFactory
            //although that works just fine
            // a) create new idoc
            /*IDocDocument doc = iDocFactory.createIDocDocument(iDocRepository,"MATMAS02");
            IDocSegment segment = doc.getRootSegment();
            segment = segment.addChild("E1MARAM");
            // and so on. See IDoc Specification .....
            JCoIDoc.send(doc, IDocFactory.IDOC_VERSION_DEFAULT, destination, tid);*/
            // b) use existent xml file
            //get IDOC XML/IDOC Parser
            IDocXMLProcessor processor=iDocFactory.getIDocXMLProcessor();
            //parse the XML/IDOC
            IDocDocumentList iDocList=processor.parse(iDocRepository, iDocXML);//, IDocXMLFormat.SAP_RELEASE_610, IDocXMLProcessor.PARSE_WITH_FIELD_VALUE_CHECKING
            //send the XML/IDOC per RFC (our destination)
            JCoIDoc.send(iDocList, IDocFactory.IDOC_VERSION_DEFAULT, destination, tid);
            //not really sure what this does
            destination.confirmTID(tid);
    Thanks for your help in advance
    Martin

    Hi Martin,
    For the XML file processing we have to use XML Parsers, these are bit difficult.
    We got the same issue in our project, we written normal java code to parse the xml file.
    Do one thing, if the xml file is not big one then take the xml data into a string. parse the string based on characters < and >.
    Suppose we have xml data as below
    String str = "<emp>employee1</emp>"
    You have to get the string between >,<.
    Regards,
    Lakshmi Prasad.

  • Problem in parsing in ABAP mapping

    Hi all , In our ABAP mapping  we are trying to create a DOM tree from a XML file but we are getting the error in the following statement
    l_rc = if_iparser->parse( ).
    when we track the error using
    i = l_error->get_line( ). (result 0)
    i = l_error->get_column( ). (result 2017)
    str = l_error->get_reason( ). (Expected '<' or '/>' tag)
    but strange thing is we can open the file using Stylus studio/ Altova / IE ..so may the problem is not in the XML file ....Has anybody faced the problem before ??
    Kind regarrds
    Goutam

    Hi,
    Have a look at this link.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
    I guess,your code may have problem.
    Try doing this from document.
    iparser = ixmlfactory->create_parser( stream_factory = streamfactory
    istream = istream
    document = idocument ).
    iparser->parse( ).
    Regards,
    Akshay Jamgaonkar.
    Hope this will help.

  • Deleting XML element in ABAP mapping

    hi All
    I Have I huge xml filen that has to go to an Idoc , but I only want to use the header data.
    is there a way of deleting the unwanted xml elements and their children elements in ABAP mapping.
    Thanks.

    Hi Ravi and all
    Actually I did as you said, but I get this error.
    <Trace level="1" type="T">com.sap.aii.utilxi.misc.api.BaseRuntimeException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
    XMLParser: Prefix 'ns1' is not mapped to a namespace(:main:, row:177, col:25)
    This position 177 , is the element that is not needed , so I thought if I can delete it , I can get rid of this error and move forward.
    May be you have antoher suggestion to get rid of this error.
    Thank you.

  • Idoc  - JMS queue using ABAP Mapping

    Hi all,
    I am doing a idoc to JMS queue scenario using ABAP Mapping. I am new to ABAP
    Basically i want to know how to read the OUTBOUND idoc segments and their field values. I have gone through link : IDOC--XI--IDOC Using ABAP MAPPING(Idoc to Idoc using ABAP Mapping).
    If any body could suggest me how to read idoc->segment->fields or give some sample code, it would be very helpful.
    Thanks in advance&
    Regards,
    Mani

    Hi Mani,
    Maybe it would be easier to use graphical mapping. In ABP mapping you have to parse XML and than create target document. If you want to do it I'd strongly advice you to read it:
    http://help.sap.com/saphelp_nw04/helpdata/en/47/b5413acdb62f70e10000000a114084/frameset.htm
    Regards,
    Wojtek

  • Getting XML info with ABAP mapping

    Hi everyone.
    I'm near to finish my abap mapping demo. The problem is that i don't know how i can retrieve the values of a kind of node.
    I would like to retrieve this data into a internal table. I've done the output XML.
    How can i get that values from SOURCE parameter into an internal table?
    Regards.

    Hi!
    First of all you have a little bit of XML parsing to do using the SIXML package in ABAP (see example reports in same dev class).
    Then you can travers your "document" with methods like
    get_elements_by_tag_name or get_root_element.
    There are also 2 function modules to convert a document into an ABAP internal table.
    SDIXML_DATA_TO_DOM and SDIXML_DOM_TO_DATA.
    Regards
    Michael

  • XML parser for Google maps

    Hi every one,
    I am trying to create a special format of an XML file for Google maps, I have a VI who takes the NMEA and sort out the parameters I need to create a track on the map, but I have try to make the XML file in LV but I get not right format of the XML.
    This is how the file should look like :
    file  data.zip
    And how it looks like when I use LV :
    file  LV_data.zip
    Hope to try to find a solution
    Thanks
    Lars Olov Jonsson
    Space Electronics Engineer
    Near Space Technology
    WiFi Guru, proud holder of world record in WiFi, 421 Km @ 2 mbit/s
    Attachments:
    xml parser google maps.vi ‏12 KB
    data.zip ‏1 KB
    data_lv.zip ‏1 KB

    You should check out EasyXML from JKI -- disclaimer: I work for JKI
    There's a great example of how to generate a Google Earth KLM file (somewhat similar to the Google Maps format).

  • Looking for some basics/fundamentals of XML Parsing in ABAP

    Hello SAP gurus
    I have to start workign on a project that involves Variant Configuration stuff that will be sent as XML document. I have to parse the XML document and save the needed data in some custom tables. I heard that there are some standard functions that we can use to do this job. I tried searching SDN for string XML parsing and got tons of postings regarding this. I tried to go through them one by one but it was way beyond my understanding at this time. I am looking for the fundamentals or how to start from scratch.
    I would appreciate if anybody can guide me to find some kind tutorial or basic info on where and how to start.
    Thanks a lot in advance
    Ram

    XML parsing through CALL TRANSFORMATION is one of the easiest method. A transformation needs to be created as per your XML data in transaction XSLT_TOOL and the transformation needs to be called in ABAP program using "CALL TRANSFORMATION" statement.
    Kindly search in internet for XSLT/simple transformations.

  • Even Based XML Parsing in ABAP

    Hi all ,
      Currently i am using DOM Based Parsing to parse XML in my ABAP program. i am planning to change the code by using Event based parsing which is recommended for perfomance when we parse large xml document
    Any one have the Example program for event based parsing the xml .pls help me in this.
    Thanks in Advance
    Ram

    Hello,
    you can look at the coding example
    data: event     type ref to if_ixml_event,
          event_sub type i
    lp_dom type ref to if_ixml_document,
    pstreamfac    TYPE REF TO if_ixml_stream_factory,
           pistream      TYPE REF TO if_ixml_istream,
    create the factory for streams
    pstreamfac = g_ixml->create_stream_factory( ).
    create the input stream:
    pistream = pstreamfac->create_istream_cstring( string = xml ).
    lp_dom     = g_ixml->create_document( ).
    create the iXML parser:
    parser = g_ixml->create_parser(
    stream_factory = pstreamfac
    istream        = pistream
    document       = lp_dom ).
    let the parser know which events I am interested in
    event_sub = if_ixml_event=>co_event_element_pre2 +
                if_ixml_event=>co_event_element_post.
    parser->set_event_subscription( events = event_sub ).
    do.
      event = parser->parse_event( ).
      if event is initial.
        exit. ' either end reached or error (check below)
      endif.
      data: str type string.
      case event->get_type( ).
        when if_ixml_event~co_event_element_pre2.
          str = event->get_name( ).  write: '<' str '>'.
        when if_ixml_event~co_event_text_post.
          str = event->get_value( ). write: str.
      endcase.
    enddo.
    always check for errors:
    if parser->num_errors( ) ne 0.
    endif.
    Regards,
    Marc

  • Problems with namespace XML Parsing of ABAP PI 7.0 Integration Engine

    Hi,
    I discovered the following problem.
    The customer sends a SOAP message with is forwarded through a SOAP Adapter in the integration engine.
    The structure of the message is very simple:
    <Envelope>
    <Body>
    <ORDERS05>...</ORDERS05>
    </Body>
    </Envelope>
    The customer adds the namespace information a special way:
    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope">
    <Body>
    <orders05 xmlns="">...</orders05>
    </Body>
    <Envelope>
    Here the namespaces is declared in the first element. It should be inherited into all child elements. The 'orders05' should not have the namespace ' xmlns="http://schemas.xmlsoap.org/soap/envelope" ', therefore the namespace is overwritten with ' xmlns="" '. However I don't know if this is a correct xml statement, the SAP system did not understand this.
    The integration throws an error which is stated in the message in the adapter engine:
    2008-11-06 17:31:44 Fehler SOAPFault empfangen vom Integration Server. ErrorCode/Category: XIProtocol/ITEM_MISSING; Params: /@mustUnderstand, ST: ST_XMS_MSGHDR30_RM; AdditionalText: Attribut 'mustUnderstand' erwartet; ApplicationFaultMessage: ; ErrorStack: Das XML-Element /@mustUnderstand fehlt im SOAP-Message Header (SAP XI Extension) Attribut 'mustUnderstand' erwartet
    2008-11-06 17:31:44 Fehler Fehler beim Übertragen der Message zum Endpunkt http://kas052.hauni.koerber.de:8036/sap/xi/engine?type=entry über die Verbindung SOAP_http://sap.com/xi/XI/System. Grund: com.sap.aii.af.ra.ms.api.RecoverableException: Received HTTP response code 500 : Error during parsing of SOAP header
    If I changed the SOAP message to the common format, it is accepted by the integration engine.
    <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope">
    <SOAP:Body>
    <orders05>...</orders05>
    </SOAP:Body>
    </SOAP:Envelope>
    Here the namespace ' xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope" ' is defined with a prefix and assigned to the elements 'envelope' and 'body'. The 'orders05' element has no namespace.
    However due to the xml syntax both messages are the same, so why the integration engine handle the messages different?
    Best regards,
    Nils Kloth

    The valid SOAP format supported by XI is as follows
    <SOAP:Envelope
      xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
      <SOAP:Body>
        <m:MessageTypeName xmlns:m="Some-URI">
          <Price>34.5</Price>
        </m:MessageTypeName>
      </SOAP:Body>
    </SOAP:Envelope>
    Ur sender system is not sending the data in correct Soap format and thats the cause of message rejection. The option you have to use the Soap adapter in "no soap" mode.
    Regards,
    Prateek

  • How can I configure iPlanet WS6.0 to recognize relative paths for DTD file using crimson XML parser running within a java servlet2.2?

    Actually, I can get it working using an http://.... reference while with relative reference ( i.e. just the dtd filename) it doesn't work; here is the stack trace:
    org.xml.sax.SAXParseException: L'URI relativo "MLP_SLIA_200.DTD"; non puo essere risolto senza una base URI.
         at
    org.apache.crimson.parser.Parser2.fatal(Parser2.java:3185)
         at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3176)
         at org.apache.crimson.parser.Parser2.resolveURI(Parser2.java:2758)
         at org.apache.crimson.parser.Parser2.maybeExternalID(Parser2.java:2730)
         at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1129)
         at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:489)
         at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
         at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
         at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
         at tilab.nimble.interfaceLIF.ParserDomXML.parseDocument(ParserDomXML.java:55)
         at tilab.nimble.interfaceLIF.ReqLIFTrackingServlet.doPost(ReqLIFTrackingServlet.java:777)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:897)
         at com.iplanet.server.http.servlet.WebApplication.service(WebApplication.java:1065)
         at com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp(NSServletRunner.java:959)

    Actually, I can get it working using an http://.... reference while with relative reference ( i.e. just the dtd filename) it doesn't work; here is the stack trace:
    org.xml.sax.SAXParseException: L'URI relativo "MLP_SLIA_200.DTD"; non puo essere risolto senza una base URI.
         at
    org.apache.crimson.parser.Parser2.fatal(Parser2.java:3185)
         at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3176)
         at org.apache.crimson.parser.Parser2.resolveURI(Parser2.java:2758)
         at org.apache.crimson.parser.Parser2.maybeExternalID(Parser2.java:2730)
         at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1129)
         at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:489)
         at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
         at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
         at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
         at tilab.nimble.interfaceLIF.ParserDomXML.parseDocument(ParserDomXML.java:55)
         at tilab.nimble.interfaceLIF.ReqLIFTrackingServlet.doPost(ReqLIFTrackingServlet.java:777)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:897)
         at com.iplanet.server.http.servlet.WebApplication.service(WebApplication.java:1065)
         at com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp(NSServletRunner.java:959)

  • Associating a DTD file with my XML Parser

    I was using the XDK in JDeveloper 11g. I added my xml and the java file. But, was not able to associate the DTD file wiht my program. And when I run the program, it says:
    no protocol: MeasDataCollection.dtd
    Process exited with exit code 0.
    Any help will be appreciated please.

    Thnx. But, i could not find "content" in the project properties. There is a resource where the path is defined as projects current directory. So, do you think that putting the dtd file in that path will do the work?
    I am using JDeveloper 11g as mentioned before.
    Besides that, I didnt find any option to create dtd file inside JDeveloper New> XML section. Any help on this regard will be appreciable.
    BR///Raihan.

  • Get fields of XML structure  in abap mapping

    Hi,
    I have next structure:
    get_next( ).
      endwhile.
    But it returns all fields of a node: all fields of EAN or all fields of LIN in a string without structure.
    How can I get each value of codigo, ean, desc ?
    Thanks, in advance.
    Carme

    HI,
    Can u please go through the below odf for help.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
    Thnx
    Chirag
    Reward points if it helps.

  • TO MAP ANSIX12 FILE TO IDOC ORDERS04

    HI ALL,
    i HAVE A FILE WITH THE DATA IN ANSIX12 AND I HAVE TO CONVERT IT TO IDOC ..
    CAN ANY ONE GUIDE ME.
    THANKX

    hi ,
    I have to map the ansi x12 file to idoc meta data and for mapping do i need to write a XML schema for the the ansix12 file .. i need help reagrding this .
    thankx .

Maybe you are looking for

  • How do I use a FileStream with an IFilePromise without knowing the File?

    I've finished the implmentation of my project using Async IFilePromises by extending the ByteArray class. I can drag out of my application and files are created by copying bits over the network, etc. The issue I'm running into is that because I used

  • File Attributes from App Server by RFC (GET_FILE_ATTRIBUTES does not work )

    Hello, We have an Objects application that is started through an RFC BAPI call from a Java app. The Java app. passes a file to the BAPI. We want to test, as efficiently as possible, if the file is 0 bytes long. We have tried /epsf/get_file_attributes

  • Access (public) WebLogic patches without CSI / My Oracle Support?

    Hi, I would like to access a (hopefully public) patch to upgrade from WLS 10.0.3.3 to WLS 10.0.3.4. I am using the (publicly available) server for development as a contractor. However, downloading patches now requires to have a "My Oracle Support" me

  • Beginner's guide to outputting data from Labview to MySQL

    Hi I am a student who has only recently started using Labview for a data logging project, so my knowledge of how to use it is rather lacking. My current aim is to be able to output the logged data directly into a MySQL server, so that the data can th

  • Parental Controls CPU 100%

    Under Activity Monitor Parentalcontrols is running at between 30-97% CPU- whatever will bring the total to 100%. this has been ongoing for several days now and the computer will not fully go to sleep- screen goes dark, but no flashing light, but I ca