Skip to Content
avatar image
Former Member

XML to internal table

Hello guys

I'va an XML with this structure

<ECR>

<change_no>00BAPIECR014</change_no>

<status>01</status>

<valid_from>09012008</valid_from>

<descript>Descripcion</descript>

<reason_chg>Razon Cambio</reason_chg>

<rank>00</rank>

<release_key>00</release_key>

<header_status_list>

<status>

<stat>I0001</stat>

<inact></inact>

</status>

<status>

<stat>I0001</stat>

<inact>X</inact>

</status>

<status>

<stat>I0251</stat>

<inact>X</inact>

</status>

<status>

<stat>I0252</stat>

<inact></inact>

</status>

<status>

<stat>I0253</stat>

<inact></inact>

</status>

<status>

<stat>I0254</stat>

<inact></inact>

</status>

<status>

<stat>I0268</stat>

<inact></inact>

</status>

</header_status_list>

<WBS_BOM>

<material>PR-004</material>

<plant>0002</plant>

<psp_element>LV0081</psp_element>

<wbs_bom_status_list>

<status>

<stat>I0259</stat>

<inact>X</inact>

</status>

<status>

<stat>I0260</stat>

<inact></inact>

</status>

<status>

<stat>I0263</stat>

<inact></inact>

</status>

</wbs_bom_status_list>

</WBS_BOM>

<DIR>

<doc_type>ZEP</doc_type>

<doc_number>TEST_PROT_001</doc_number>

<doc_vers>00</doc_vers>

<doc_part>000</doc_part>

<dir_status_list>

<status>

<stat>I0259</stat>

<inact>X</inact>

</status>

<status>

<stat>I0260</stat>

<inact></inact>

</status>

<status>

<stat>I0263</stat>

<inact></inact>

</status>

</dir_status_list>

</DIR>

</ECR>

and i want to pass it to an internal table i tried to use SDIXML_XML_TO_DOM y SDIXML_DOM_TO_DATA but i don't know how to transform the document that returns SDIXML_XML_TO_DOM into a document that can be passed to SDIXML_DOM_TO_DATA

I've seen the instruction CALL TRANSFORMATION but i can't use it successfull and the only way that remains to me is to use TEXT_CONVERT_XML_TO_SAP but i,ve heard abaout it returns a spool order, can i convert this spool to an internal table?

Hope somebody bring some ligth to me

thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Feb 18, 2008 at 08:03 AM

    Hi,

    the CALL TRANSFORMATION trans.

    is the most used method to convert XML to internal tables and vice versa.

    Why can you use the same. You can also write your own XSL transform if you have format convserion issues in ABAP-XSL

    Regards

    Abhishek

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 18, 2008 at 08:08 AM

    Hi,

    Please refer below link

    /people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1

    XML to Internal table

    Parsing XML file to Internal table.

    XML to Internal Table and Vice-Versa

    Thanks

    Swarup

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 18, 2008 at 08:36 AM

    Hi Alberto,

    please refer to this blog. and its successor blogs.

    /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

    Ranjeet Singh.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 26, 2010 at 07:19 AM

    I meet the same issue and find it can be sovled by such ways:

    --> im_xml_xstring type xstring.

    data: lo_element type ref to if_ixml_element,

    lo_document type ref to if_ixml_document,

    l_problems type dcxmlprbl.

    field-symbols: <tab> type standard table.

    call function 'SDIXML_XML_TO_DOM'

    exporting

    xml = im_xml_xstring

    is_normalizing = 'X'

    importing

    document = lo_document

    exceptions

    invalid_input = 1

    others = 2.

    check sy-subrc = 0.

    lo_element ?= lo_document->get_first_child( ). ---> this is the point

    check lo_element is not initial.

    call function 'SDIXML_DOM_TO_DATA'

    exporting

    data_as_dom = lo_element

    • CONTROL = CONTROL

    importing

    dataobject = <tab>

    problems = l_problems

    exceptions

    illegal_object = 1

    others = 2

    .

    Add comment
    10|10000 characters needed characters exceeded