ABAP mapping XML inside another XML

<b>Cross posted to ABAP Objects</b>
From XI we want to make an abap mapping.
The input xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:mt_dummy xmlns:ns0="http://kmd.dk/phh/externalEventEngine/pfhaen">
<details>
<Navn>Nielsen</Navn>
<Adresse><![CDATA[><?xml version="1.0" encoding="UTF-8"?><ns0:mt_dummy2 xmlns:ns0="http://kmd.dk/phh/externalEventEngine/pfhaen"><Details2><Vej>tingvej</Vej><Husnr>75</Husnr></Details2></ns0:mt_dummy2>]]></Adresse>
</details>
</ns0:mt_dummy>
One of the fields in this structure <Adresse> contains another xml structure. It is this structure we want as a result of our ABAP mapping. First we get the value of the field <Adresse>. This field contains the actual xml structure that we want to map. We convert the structure to xstring and run it through a new parser and create our output document.(See code below).
The code works fine if we just use a ‘normal’ xml structure, but when one of the fields contains a XML structure and we want to parse this structure, we get the error. Is there anything we have missed, or is this not possible in ABAP mapping ?
If we test the code with SXI_MAPPING_TEST we get no errors, but in runtime we get the following error in SXMB_MONI:
‘The XML page document can not be shown
The XML document must have an element at the top level’
method IF_MAPPING~EXECUTE.
initialize xml
type-pools: ixml.
class cl_ixml definition load.
*create main factory
data: ixmlfactory type ref to if_ixml.
ixmlfactory = cl_ixml=>create( ).
*create stream factory
data: streamfactory type ref to if_ixml_stream_factory.
streamfactory = ixmlfactory->create_stream_factory( ).
*create input stream
data: istream type ref to if_ixml_istream.
istream = streamfactory->create_istream_xstring( source ).
*initialize input document
data: idocument type ref to if_ixml_document.
idocument = ixmlfactory->create_document( ).
*parse input document
data: iparser type ref to if_ixml_parser.
iparser = ixmlfactory->create_parser( stream_factory = streamfactory
istream = istream
document = idocument ).
iparser->parse( ).
data: pnode type ref to if_ixml_node,
pnode2 type ref to if_ixml_node,
pnode3 type ref to if_ixml_node.
data: l_blob type string,
l_xml type string,
l_length type i.
pnode = idocument.
pnode2 = pnode->get_first_child( ).
pnode2 = pnode2->get_first_child( ).
pnode2 = pnode2->get_last_child( ).
l_blob = pnode2->get_value( ).
data: l_blob2 type xstring.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = l_blob
MIMETYPE = ' '
ENCODING =
IMPORTING
BUFFER = l_blob2
EXCEPTIONS
FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*2. parse
*create main factory
data: ixmlfactory2 type ref to if_ixml.
ixmlfactory2 = cl_ixml=>create( ).
*create stream factory
data: streamfactory2 type ref to if_ixml_stream_factory.
streamfactory2 = ixmlfactory2->create_stream_factory( ).
*create input stream
data: istream2 type ref to if_ixml_istream.
istream2 = streamfactory2->create_istream_xstring( l_blob2 ).
*initialize input document
data: idocument2 type ref to if_ixml_document.
idocument2 = ixmlfactory2->create_document( ).
*parse input document
data: iparser2 type ref to if_ixml_parser.
iparser2 = ixmlfactory2->create_parser( stream_factory = streamfactory2
istream = istream2
document = idocument2 ).
iparser2->parse( ).
data: odocument type ref to if_ixml_document.
odocument = idocument2.
data: irc type i.
*render document----
*create output stream
data: ostream type ref to if_ixml_ostream.
ostream = streamfactory2->create_ostream_xstring( result ).
*create renderer
data: renderer type ref to if_ixml_renderer.
renderer = ixmlfactory2->create_renderer( ostream = ostream
document = odocument ).
irc = renderer->render( ).
endmethod.

Hey,
It seems like the output is not a valid XML,
(I guess that the input XML is different from your test).
XML must have one element at the top level,
for example:
<A>
Ilan
</A>
<B>
Shani
</B>
is not a valid XML,
A valid XML should look like:
<mt_dummy>
<A>
Ilan
</A>
<B>
Shani
</B>
</mt_dummy>
In order to see the in-valid XML, press on the right-click mouse on the i.e error text,
and chose "view source".

Similar Messages

  • Best way to Transform one XML to another XML using SSIS

    I am using Altova Mapforce tool to transform one XML into another XML, but now we are planning to use any other best way of using XSLT transformation. Could you guys shed me some light on different approaches and which one would be best based on time and
    cost constraint.
    In Altova Map force Tool, due to below reasons we wanted to avoid that,
    Resource cannot work parallely in single XSLT
    Maintanence is very difficult
    Licensed version of tool
    When the XML size grows, new resourse are feeling difficult to edit the XSLT etc.,
    Related to .net approaches would be best.
    Can we create XSLT by using SSIS to transfrom one xml into another xml format.
    In .net code we can do, but feel that it is time consuming due to large size of XML.
    Any other best way for handling XSLT transformation or any tool

    XSLT can be applied to an XML file fed as a source, but it does not resolve #1. I by the way do not understand this point, technically.
    For SSIS to go live in prod you need to deplete a SQL Server license (CPU + CALs).
    The time to transform in SSIS will be equal to doing in .net code as the whole SSIS is coded in .Net, too.
    Here, in this section of the forum we may not have the needed expertise in XSLT or XML transformations.
    In my IT life, XML transformations were done in Java if on a *NIX box. On Windows a C# .net app webservice did it. The most interesting implementation, and if you are a heavy users of XML is to use a dedicated database as Base X, it has an XLSLT transform
    moduleL http://docs.basex.org/wiki/XSLT_Module
    Arthur
    MyBlog
    Twitter

  • How to convert an xml to another Xml with a different structure...

    hi
    i have an xml which should be converted to a standard xml with an entirely different structure(Different elements)....can this be done with xml,xsl alone or do we need to write an java class along with them...if there are any examples..it would be of great help...plz help me out....as this is a work stopper...
    given below is the kind i have
    <hotelinfo>
    <hotelname>RADISSON HOTEL CHENNAI </hotelname>
    <address>355 C Gst Road St Thomas Mount Chennai1 600016IN</address>     <price>90.00 - 150.00</price>
    <distance>2 (W)</distance>
    </hotelinfo>
    i need to convert it into
    <propertyName>RADISSON HOTEL CHENNAI </propertyName>
    <address>
    <addressLine>355 C Gst Road St Thomas Mount</addressLine>
    <CityName>Chennai</CityName>
    <PostalCode>600 001</PostalCode>
    <StateName>TamilNadu</StateName>
    <CountryName>India</CountryName>
    </address>
    thanks in advance

    Ok here is the code...
    package mypack;
    import java.io.File;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Result;
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    * @author SM23772
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class Roopa {
         public static void main(String[] args) {
              File docFile = new File("Roopa.xml");
              Document doc = null;
              Document newDoc = null;
              String hname = null, task = null;
              try {
                   DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                   DocumentBuilder db = dbf.newDocumentBuilder();
                   doc = db.parse(docFile); //parsing Roopa.xml
                   newDoc = db.newDocument(); //Created New document Object for new xml
                   hname = doc.getElementsByTagName("hotelname").item(0)
                             .getFirstChild().getNodeValue();
                   task = doc.getElementsByTagName("task").item(0).getFirstChild()
                             .getNodeValue();
                   Node rootNode = newDoc.createElement("property-info"); //creating root node;
                   Node pp = newDoc.createElement("name"); //creating a node called name
                   Node taskNode = newDoc.createElement("task"); //creating a node called task
                   pp.appendChild(newDoc.createTextNode(hname)); //appending a text node inisde name
                   taskNode.appendChild(newDoc.createTextNode(task)); //appending the text node inside task
                   rootNode.appendChild(pp); //asppending the nodes inside the root node                       
                   rootNode.appendChild(taskNode);
                   newDoc.appendChild(rootNode); //appending the root node to the document
                   writeXmlFile(newDoc, "Dest.xml"); //function called to write the document to Dest.xml
              } catch (Exception e) {
                   System.out.println(e);
         public static void writeXmlFile(Document doc, String filename) {
              try {
                   // Prepare the DOM document for writing
                   Source source = new DOMSource(doc);
                   // Prepare the output file
                   File file = new File(filename);
                   Result result = new StreamResult(file);
                   // Write the DOM document to the file
                   Transformer xformer = TransformerFactory.newInstance()
                             .newTransformer();
                   xformer.transform(source, result);
              } catch (TransformerConfigurationException e) {
              } catch (TransformerException e) {
    The xml files:
    roopa.xml:
    <hotel>
    <hotelname>RADISSON HOTEL CHENNAI</hotelname>
    <more-info><task>give treate to shanu</task></more-info>
    </hotel>
    Dest.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <property-info><name>RADISSON HOTEL CHENNAI</name><task>give treate to shanu</task></property-info>Please go through the code.. if u have any more concerns do let me know................
    cheers
    Shanu

  • Add XML to another XML

    Let's say I have an XML data looking like this:
    <VFPData>
      <issuedetails>
        <id>26</id>
        <custno>04000</custno>
      </issuedetails>
      <sku35576>
        <action>Audit Existing Inventory</action>
        <selected>false</selected>
      </sku35576>
    </VFPData>
    I want to add to this XML the following XML:
    <VFPData>
      <sku35578>
        <action>Audit Existing Inventory</action>
        <selected>false</selected>
      </sku35578>
    </VFPData>
    So, the whole thing will look like this:
    <VFPData>
      <issuedetails>
        <id>26</id>
        <custno>04000</custno>
      </issuedetails>
      <sku35576>
        <action>Audit Existing Inventory</action>
        <selected>false</selected>
      </sku35576>
      <sku35578>
        <action>Audit Existing Inventory</action>
        <selected>false</selected>
      </sku35578>
    </VFPData>   
    Thanks for help.

    Hi,
    With E4X you can add nodes or elements to an XML document, the following link should help you out.
    http://livedocs.adobe.com/flex/3/html/help.html?content=13_Working_with_XML_02.html
    David.

  • Can ant call a target from my build.xml from another xml file?

    can ant have a target something like this:
    <target mytarget>
    <antcall file="C:\app\build2.xml" targetname="blah">
    </target>
    Is it possible to call a target in my build.xml that will then look in a file called build2.xml and call a target in that xml file?
    Thanks,
    Tad

    I looked at the manual and the site and couldn't find anything, you don't have to tell me the exact xml if
    it bugs you, all I want to know is if it is possible and if it is what task should I use, I will look up
    the attributes and how to do it.Now this really takes the biscuit.
    I gave you a very specific link to the document that tells you which task to use and which arguments to set. Did you check that link? If so, what else do you want? If not, why not?

  • Abap mapping - Error in Control Framework

    Hi Gurus,
    Scenario: IDOC - -- XI -
    Http (post)
    i am using ABAP mapping for IDOC to XML. I am able to test it using sxi_mapping_test which gives me output XML. But, when i test the scenario from RWB, it fails with "SYSFAIL" error in inbound queue as per moni.
    error - "Error in Control Framework".
    Looks like it did not even go to message mapping pipeline step.
    Please help.
    Thank you,
    mk

    HI,
    Hope you have done all the necessary pre-requisites for ABAP mapping
    This may help u- http://help.sap.com/saphelp_47x200/helpdata/en/55/bff20efe8c11d4b54a006094b9456f/content.htm
    just cross verify with this guide-
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
    Please also try to debug as follows...
    put a break point inside your class/method....
    goto tcode SXI_MAPPING_TEST....give in the configuation details of your scenario...and when you execute, give the IDOC-XML, copy it from SXMB_MONI where you are getting the error....
    when you execute, it shoudl stop at the break point that you had set in your class....continue debugging using 'F6' function key, and check where you are hitting this error...
    The chances are that the FM that converts IDOC-XML to flat file format might not have been executed correctly...
    Thanks
    Swarup

  • How to replace the root tag in ABAP Mapping

    how to replace the root tag with the certain string in ABAP Mapping
    just like
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
         <name>Lawrence</name>
    </root>
    into
    <?xml version="1.0" encoding="UTF-8"?>
    <myRootElement>
         <name>Lawrence</name>
    </myRootElement>
    i don't want to implement it in message mapping
    please give me the sample code
    thanks in advance

    Use below code
    odocument = ixmlfactory->create_document( ).
    msgtype = odocument->create_simple_element(
    name = 'myRootElement'
    parent = odocument ).
    Thanks
    Praveen

  • Unicode in ABAP-Mapping (u00E9 becomes u00C3u00A9)

    Hello all,
    I implemented this guide to create a flatfile from an IDoc. It works fine, but some characters are not mapped correctly: an "é" for example becomes "é" and an "ú" becomes "ú". Is this a Unicode problem or something? If yes, how can I use Unicode in ABAP mapping?
    As the XML-IDoc is transfered correctly to XI the problem is not in communication channels... it's in the ABAP mapping.
    Best regards,
    David

    Hi David,
    As michal said the problem needs to be isolated whether it is at the mapping level or at the file adapter level.
    In case it the file adapter then you can mention the encoding standard and if its at the abap mapping the your objects should be unicode enabled.
    Regards
    joel

  • ABAP Mapping error

    Hi,
         My system is running on XI 3.0 SP9, I am using abap mapping for conversion idoc xml structure to flat file structure. But I am getting the error as shown below.
    Appreciate for your response.
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Request Message Mapping
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">APPLICATION_PROGRAM_ERROR</SAP:Code>
      <SAP:P1>ZCL_ABAP_MAPPING4X</SAP:P1>
      <SAP:P2>R3_ABAP</SAP:P2>
      <SAP:P3>UNCAUGHT_EXCEPTION</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Error in mapping program ZCL_ABAP_MAPPING4X (type R3_ABAP, kernel error ID UNCAUGHT_EXCEPTION)</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Regardsm
    Mallikarjun.M

    Have u seen the ABAP mapping guide?
    Refer this series to the ABAP mapping section.https:///people/sravya.talanki2/blog/2006/12/26/aspirant-to-learn-sap-xiyou-won-the-jackpot-if-you-read-this-part-ii
    It will be very handy and useful.

  • How to convert xml file into internal table in ABAP Mapping.

    Hi All,
    I am trying with ABAP mapping. I have one scenario in which I'm using below xml file as a sender from my FTP server.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MTO_ABAP_MAPPING xmlns:ns0="http://Capgemini/Mumbai/sarsingh">
      <BookingCode>2KY34R</BookingCode>
    - <Passenger>
      <Name>SARVESH</Name>
      <Address>THANE</Address>
      </Passenger>
    - <Passenger>
      <Name>RAJESH</Name>
      <Address>POWAI</Address>
      </Passenger>
    - <Passenger>
      <Name>CARRON</Name>
      <Address>JUHU</Address>
      </Passenger>
    - <Flight>
      <Date>03/03/07</Date>
      <AirlineID>UA</AirlineID>
      <FlightNumber>125</FlightNumber>
      <From>LAS</From>
      <To>SFO</To>
      </Flight>
      </ns0:MTO_ABAP_MAPPING>
    AT the receiver side I wnat to concatenate the NAME & ADDRESS.
    I tried Robert Eijpe's weblog (/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach)
    but couldnt succeed to convert the xml file into internal table perfectly.
    Can anybody help on this. 
    Thanks in advance!!
    Sarvesh

    Hi Sarvesh,
    The pdf has details of ABAP mapping. The example given almost matches the xml file you want to be converted.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how to use abap-mapping in xi 3.0.pdf
    Just in case you have not seen this
    regards
    Vijaya

  • XSLT samples for XML- ABAP mapping

    Hi all,
    Does anyone have a XSLT samples for XML->ABAP mapping ?
    regards

    first create XSLT program by copy pasting the below given code and give the program name as "Y_TEST"
    <b>XSLT code</b>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:strip-space elements="*"/>
      <xsl:output indent="yes"/>
      <xsl:template match="NewDataSet">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <OUTTAB>
              <xsl:for-each select="Table">
                <OUTTAB1>
                  <AIRPORTCODE>
                    <xsl:value-of select="AirportCode"/>
                  </AIRPORTCODE>
                  <CITYOFAIRPORTNAME>
                    <xsl:value-of select="CityOrAirportName"/>
                  </CITYOFAIRPORTNAME>
                  <COUNTRY>
                    <xsl:value-of select="Country"/>
                  </COUNTRY>
                  <COUNTRYABBRIVATION>
                    <xsl:value-of select="CountryAbbrviation"/>
                  </COUNTRYABBRIVATION>
                  <COUNTRYCODE>
                    <xsl:value-of select="CountryCode"/>
                  </COUNTRYCODE>
                  <GMTOFFSET>
                    <xsl:value-of select="GMTOffset"/>
                  </GMTOFFSET>
                  <RUNWAYLENGTHFEET>
                    <xsl:value-of select="RunwayLengthFeet"/>
                  </RUNWAYLENGTHFEET>
                  <RUNWAYELEVATIONFEET>
                    <xsl:value-of select="RunwayElevationFeet"/>
                  </RUNWAYELEVATIONFEET>
                  <LATITUDEDEGREE>
                    <xsl:value-of select="LatitudeDegree"/>
                  </LATITUDEDEGREE>
                  <LATITUDEMINUTE>
                    <xsl:value-of select="LatitudeMinute"/>
                  </LATITUDEMINUTE>
                  <LATITUDESECOND>
                    <xsl:value-of select="LatitudeSecond"/>
                  </LATITUDESECOND>
                  <LATITUDENPEERS>
                    <xsl:value-of select="LatitudeNpeerS"/>
                  </LATITUDENPEERS>
                  <LONGITUDEDEGREE>
                    <xsl:value-of select="LongitudeDegree"/>
                  </LONGITUDEDEGREE>
                  <LONGITUDEMINUTE>
                    <xsl:value-of select="LongitudeMinute"/>
                  </LONGITUDEMINUTE>
                  <LONGITUDESECONDS>
                    <xsl:value-of select="LongitudeSeconds"/>
                  </LONGITUDESECONDS>
                  <LONGITUDEEPERW>
                    <xsl:value-of select="LongitudeEperW"/>
                  </LONGITUDEEPERW>
                </OUTTAB1>
              </xsl:for-each>
            </OUTTAB>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:stylesheet>
    <b>just create a type 1 program and paste the below given code.</b>
    report y_consume_webservice .
    data: wf_user type string .
    data: wf_password type string .
    types: begin of outtab1 ,
       airportcode(6)  ,
       cityofairportname(50),
       country(30)  ,
       countryabbrivation(10),
       countrycode(6)  ,
       gmtoffset(10)  ,
       runwaylengthfeet(15),
       runwayelevationfeet(15),
       latitudedegree(10)  ,
       latitudeminute(10)  ,
       latitudesecond(10)  ,
       latitudenpeers(10)  ,
       longitudedegree(10)  ,
       longitudeminute(10)  ,
       longitudeseconds(10)  ,
       longitudeeperw(10) ,
       end of outtab1 .
    data: outtab type  table of outtab1.
    data: wf_o like line of outtab .
    data: g_okcode like sy-ucomm .
    data: my_container   type ref to cl_gui_custom_container .
    data: g_dock type ref to cl_gui_docking_container .
    data: mygrid type ref to cl_gui_alv_grid .
    data: wf_field_cat type lvc_t_fcat .
    data: wf_field_cat_wa like line of wf_field_cat ,
          wf_is_layout type lvc_s_layo .
    data: wf_fld_cat type slis_t_fieldcat_alv .
    data: wf_fld_cat_wa like line of wf_fld_cat .
    data: wf_repid like sy-repid .
    data: int_tab_name type slis_tabname .
    data: xslt_err type ref to cx_xslt_exception .
    constants:
    * encoding for download of XML files
    encoding     type string value 'utf-8' .
    data: rlength type i,
          txlen type string  .
    data: http_client type ref to if_http_client .
    data: wf_string type string .
    data: wf_string1 type string .
    data: wf_proxy type string ,
          wf_port type string .
    selection-screen: begin of block a with frame .
    parameters: uri2(132) type c lower case .
    selection-screen skip 1.
    parameters: user(50) lower case,
                password(50) lower case ,
                p_proxy(100) lower case default 'proxy.xxx.com' ,
                p_port(4) default '80'.
    selection-screen: end of block a .
    at selection-screen output.
      loop at screen.
        if screen-name = 'PASSWORD'.
          screen-invisible = '1'.
          modify screen.
        endif.
      endloop.
    start-of-selection .
    clear wf_string .
    concatenate
    '<?xml version="1.0" encoding="utf-8"?>'
    '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
    '<soap:Body>'
    '<GetAirportInformationByCountry xmlns="http://www.webserviceX.NET">'
    '<country>' uri2 '</country>'
    '</GetAirportInformationByCountry>'
    '</soap:Body>'
    '</soap:Envelope>'
    into wf_string .
    clear :rlength , txlen .
    rlength = strlen( wf_string ) .
    move: rlength to txlen .
    clear: wf_proxy, wf_port .
    move: p_proxy to wf_proxy ,
          p_port to wf_port .
    call method cl_http_client=>create
      exporting
        host          = 'www.webservicex.net'
        service       = '80'
        scheme        = '1'
        proxy_host    =  wf_proxy
        proxy_service =  wf_port
      importing
        client        = http_client.
    http_client->propertytype_logon_popup = http_client->co_disabled.
    wf_user = user .
    wf_password = password .
    call method http_client->authenticate
      exporting
        proxy_authentication = 'X'
        username             = wf_user
        password             = wf_password.
    call method http_client->request->set_header_field
      exporting
        name  = '~request_method'
        value = 'POST'.
    call method http_client->request->set_header_field
      exporting
        name  = '~server_protocol'
        value = 'HTTP/1.1'.
    call method http_client->request->set_header_field
      exporting
        name  = '~request_uri'
        value = '/airport.asmx'.
    call method http_client->request->set_header_field
      exporting
        name  = 'Content-Type'
        value = 'text/xml; charset=utf-8'.
    call method http_client->request->set_header_field
      exporting
        name  = 'Content-Length'
        value = txlen.
    call method http_client->request->set_header_field
      exporting
        name  = 'SOAPAction'
        value = 'http://www.webserviceX.NET/GetAirportInformationByCountry'.
    call method http_client->request->set_cdata
      exporting
        data   = wf_string
        offset = 0
        length = rlength.
    call method http_client->send
      exceptions
        http_communication_failure = 1
        http_invalid_state         = 2.
    call method http_client->receive
      exceptions
        http_communication_failure = 1
        http_invalid_state         = 2
        http_processing_failed     = 3.
    clear wf_string1 .
    wf_string1 = http_client->response->get_cdata( ).
    replace all occurrences of
        '<' in wf_string1 with '<' .
    replace all occurrences of
    '>' in wf_string1 with '>' .
    replace all occurrences of
    'xmlns=' in wf_string1 with 'xmlns:xsl=' .
    try .
        call transformation (`Y_TEST`)
                source xml wf_string1
                result     outtab = outtab.
      catch cx_xslt_exception into xslt_err.
        data: s type string.
        s = xslt_err->get_text( ).
        write: ': ', s.
        stop.
    endtry .
    break-point .
    Try this and give me your feedback.
    Regards
    Raja

  • 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

  • Processing xml in abap mapping

    Hi all,
    I use abap mapping to create XML from Idoc, I use if_ixml interface to do it.
    In my code I use method get_elements_by_tag_name (on object if_ixml_document)
    to find all elements with the same name:
    I checked my mapping in  SXI_MAPPING_TEST and it is working when I put formatted idoc
    (with many lines, one tag in one line).
    But when I put one long line with all tags in one line (XI receives idoc in such format from ECC)
    method get_elements_by_tag_name does not return any result.
    I checked also others searching methods but without results.
    It looks like only first 255 characters are processed. When element, which I am looking for,
    is in further position, it is not finding.
    Does anyone know what is a root cause of such situation and how can I resolve my problem?
    Best Regards,
    Przemek

    Hi,
    get_elements_by_tag_name work fine for all my abap mappings so you must be doing wrong something else
    the code from this page works for IDOCs also:
    http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/content.htm
    with small changes to the nodes so maybe compare it with yours
    Regards,
    Michal Krawczyk

  • Checking Well-Formed XML files with ABAP Mapping

    Hi guys,
    Anybody knows which is the best way to check (well-formed) incoming XML files trough XI?
    I’m using ABAP Mapping and before I check the value of the XML fields I want to check if the XML is well-formed. For this reason I need to know which is the class or classes that I need to use to checking the format of XML using an XSD file?
    That is also possible using a DTD file instead of XSD?
    Which is better XSD or DTD?
    Thanks in advance,
    Ricardo.

    Hi Ricardo,
      try out these links.
    /people/r.eijpe/blog/2005/11/04/using-abap-xslt-extensions-for-xi-mapping
    /people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
    /people/sap.user72/blog/2003/09/18/xsl-and-abap
    Thanks and Regards
    Vishal Kumar

  • XML to internal table conversion within ABAP mapping class

    I am doing a ABAP mapping for file to Idoc. My requirement is to convert XML file into ABAP internal table (within ABAP mapping class). Is there any standard FM, method, transformation etc, which can be used here.
    Thanks, Dehra

    Dehra,
    Have you seen this weblogs which talks about this:
    /people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach
    /people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach
    /people/r.eijpe/blog/2006/02/19/xml-dom-processing-in-abap-part-iiia150-xml-dom-within-sap-xi-abap-mapping
    /people/r.eijpe/blog/2006/02/20/xml-dom-processing-in-abap-part-iiib150-xml-dom-within-sap-xi-abap-mapping
    Hope this helps you....
    ---Satish

Maybe you are looking for

  • Unable to start new project in Premiere elements 10

    I have had elements 10 (both photoshop and premiere) downloaded for a while from a multi-pack and have been using photoshop with no problems at all.  Tried to use premiere and start a new project from the welcome screen, but it starts loading, gets t

  • Macbook pro wireless won't turn on

    Ever since Yosemite (sound familiar?) I've been having wireless issues. At random times, wireless will simply stop working. Instead of showing the network name, it doesn't show anything. Turning off wireless results in wireless unable to be turned on

  • Bank transfers: the file DME doesn't display the name of the company

    Hi all, In the DME file created by t.code F110, the record 20, doesn't display the name of the company which orders the bank transfer. Where should I put it? Thanks

  • Using AppBuilder, how to get addressability to  Radio buttons???

    Trying top test is any of the Radio Buttons have been selected? When I press the "Test Connection" button and go into the Event method, I am tryiing to get addressability to the  see if any of the Radio Buttons where pressed? I have added this Code b

  • Populated dense dimension member failed ?

    Hi, I have a scenario dimension which is dense with this member : Actual and Budget, and I would like to copy Budget to Actual. Actual member are already populated on month M1, M2, M3 ACTUAL BUDGET M1 100 M2 200 M3 300 I wrote a HBR like this : Fix(M