Create a xml file from an internal table: CALL TRANSFORMATION

Hello gurus,
I want to create a xml file using data from scustom table. I will create an internal table and will select some records to it.
I searched the forum and i discovered the call transformation, but when i execute the example program at the CALL TRANSFORMATION shows a dump screen.
How we create a xml file from internal table??
Please help me. I will mark the useful answers.

I'm using if_ixml class to create xml documents
TYPES: BEGIN OF xml_line,
         data(256) TYPE x,
       END OF xml_line.
DATA: o_ixml          TYPE REF TO if_ixml,
      o_document      TYPE REF TO if_ixml_document,
      o_element       TYPE REF TO if_ixml_element,
      o_streamfactory TYPE REF TO if_ixml_stream_factory,
      o_ostream       TYPE REF TO if_ixml_ostream,
      o_renderer      TYPE REF TO if_ixml_renderer.
DATA: t_xml_table     TYPE TABLE OF xml_line,
      v_xml_size      TYPE i.
o_ixml = cl_ixml=>create( ).
o_document = o_ixml->create_document( ).
* The o_document have a set of methods to add elements, attributes, etc.
o_element  = o_document->create_simple_element(
                  name = 'RootNode'
                  value = 'some text'
                  parent = o_document ).
o_streamfactory = o_ixml->create_stream_factory( ).
o_ostream = o_streamfactory->create_ostream_itable( table = t_xml_table ).
o_renderer = o_ixml->create_renderer( ostream  = o_ostream document = o_document ).
o_renderer->render( ).
v_xml_size = o_ostream->get_num_written_raw( ).
CALL METHOD cl_gui_frontend_services=>gui_download
  EXPORTING
    bin_filesize = v_xml_size
    filename     = 'C:a.xml'
    filetype     = 'BIN'
  CHANGING
    data_tab     = t_xml_table.

Similar Messages

  • Creating an XML file from multiple sql tables

    I have very little xml experience, but need to generate an xml file from multiple table. I know what the output needs to look like, but do not know how to setup the code. Any help would be appreciated.
    - <Practice SourceID="EPIC" ExternalPracticeID="PPAWB">
    - <Provider ExternalProviderID="TB2" FirstName="THOMAS G" LastName="BREWSTER">
    - <Patient ExternalPatientID="99999" OldExternalPatID="" FirstName="test" MiddleName="J" LastName="test" Gender="M" DateOfBirth="2005-08-12" SocSecNumber="000-00-0000" LanguageID="22" AddressOne="test" AddressTwo="" City="test" StateID="20" ZipCode="99999" DayPhone="" EveningPhone="207-999-9999" StatusID="">
    <Measure MeasureID="2" MeasureValue="5" MeasureDate="2008-10-24 13:43:00" />
    <Measure MeasureID="2" MeasureValue="5" MeasureDate="2008-10-24 14:23:00" />
    <Measure MeasureID="3" MeasureValue="1" MeasureDate="2008-10-24 13:43:00" />
    <Measure MeasureID="3" MeasureValue="1" MeasureDate="2008-10-24 14:23:00" />
    <Measure MeasureID="32" MeasureValue="3" MeasureDate="2008-10-24 13:51:00" />
    <Measure MeasureID="33" MeasureValue="1" MeasureDate="2008-10-24 13:43:00" />
    <Measure MeasureID="33" MeasureValue="1" MeasureDate="2009-02-09 10:09:00" />
    <Measure MeasureID="4" MeasureValue="5" MeasureDate="2008-10-24 13:43:00" />
    <Measure MeasureID="4" MeasureValue="5" MeasureDate="2008-10-24 14:23:00" />
    <Measure MeasureID="40" MeasureValue="2008-10-24 13:43:00" MeasureDate="2008-10-24 13:43:00" />
    <Measure MeasureID="40" MeasureValue="2008-10-24 14:23:00" MeasureDate="2008-10-24 14:23:00" />
    <Measure MeasureID="41" MeasureValue="2008-10-24 13:43:00" MeasureDate="2008-10-24 13:43:00" />
    <Measure MeasureID="41" MeasureValue="2008-10-24 13:51:00" MeasureDate="2008-10-24 13:51:00" />
    </Patient>
    </Provider>
    </Practice>

    You are interested in XMLElement and probably XMLAgg. Since you didn't list a version, I can't provide links to the corresponding documentation. I cringe at all the attributes on the Patient element as that info should really be elements.
    To create the Measure node, your overall SQL statement may look something like (not tested)
    SELECT XMLElement....
              XMLAgg(SELECT XMLElement
                       FROM measures_table
                      WHERE join condition to parent)
      FROM patient,
           provider,
           practice
    WHERE join conditionsFor additional help, please include your version (4 digits), some sample data, and what you have tried.

  • Code to transfer xml file to abap internal table using transformation

    Hi friends
    Given the following xml file .the requirementis to  display and transfer the xml file to internal table usin transformation and gui_upload.If any onehaving simple code on this please send .
    Can any one sugest the steps to be followed to write source code using simple transformation.
    <?xml version="1.0" encoding="utf-8" ?>
    - <Negara>
    - <item>
    - <COUNTRY>
      <MANDT>600</MANDT>
      <ZCODE>500</ZCODE>
      <ZDESC>Pening Lalat</ZDESC>
      <ZSAPCD>T1</ZSAPCD>
      </COUNTRY>
      </item>
    - <item>
    - <COUNTRY>
      <MANDT>600</MANDT>
      <ZCODE>600</ZCODE>
      <ZDESC>Pening Lalat2</ZDESC>
      <ZSAPCD>T2</ZSAPCD>
      </COUNTRY>
      </item>
      </Negara>
    Thaking You

    hi..
    1. itab --- > xml
    xml ---> itab.
    2. This program will do both.
    (just copy paste in new program)
    3.
    REPORT abc.
    DATA
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    DATA : BEGIN OF itab OCCURS 0,
    a(100) TYPE c,
    END OF itab.
    DATA: xml_out TYPE string .
    DATA : BEGIN OF upl OCCURS 0,
    f(255) TYPE c,
    END OF upl.
    DATA: xmlupl TYPE string .
    FIRST PHASE
    FIRST PHASE
    FIRST PHASE
    Fetch Data
    SELECT * FROM t001 INTO TABLE t001.
    XML
    CALL TRANSFORMATION ('ID')
    SOURCE tab = t001[]
    RESULT XML xml_out.
    Convert to TABLE
    CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
    EXPORTING
    i_string = xml_out
    i_tabline_length = 100
    TABLES
    et_table = itab.
    Download
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filetype = 'BIN'
    filename = 'd:\xx.xml'
    TABLES
    data_tab = itab.
    SECOND PHASE
    SECOND PHASE
    SECOND PHASE
    REFRESH t001.
    CLEAR t001.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'D:\XX.XML'
    filetype = 'BIN'
    TABLES
    data_tab = upl.
    LOOP AT upl.
    CONCATENATE xmlupl upl-f INTO xmlupl.
    ENDLOOP.
    XML
    CALL TRANSFORMATION ('ID')
    SOURCE XML xmlupl
    RESULT tab = t001[].
    <b>Reward points if useful</b>
    Regards
    Ashu

  • Creating XML file from ABAP internal table data....

    Hello,
    I am fethcing data froma  custom table and I have to write data in XMl format. Following is the XML format in which I want data. Is there any function module iN SAP which will help me in writing data from internal table to XML file ?
    <batch>
      <invoice>
        <StatusCode>10</StatusCode>
        <paymentamount>122.00</paymentamount>
         <ReferenceNumber>70980934</ReferenceNumber>
      </invoice>
      <invoice>
         <StatusCode>90</StatusCode>
        <paymentamount>122.00</paymentamount>
         <ReferenceNumber>70980934</ReferenceNumber>
      </invoice>
      <control>
        <InvoiceCount>2</InvoiceCount>
      </control>
    </batch>
    Please help.
    Regards,
    Jainam.

    I suggest you look into "simple transformations". That's SAP's most recent technology for such purposes, as far as I know.
    http://help.sap.com/abapdocu_70/en/ABENABAP_ST.htm
    Thomas

  • Collect data from a dynamic XML file into multiple internal tables

    I need to convert the XML file into multiple internal tables. I tried many links and posts in SDN but still was facing difficulty in achieving this. Can some one tell me where I am going wrong.
    My XML file is of the following type.It is very complex and the dynamice.
    The following tags occur more than once in the XML file. The "I" and "L" tags and its child tags can occur ones or more than once for each XML file and it is not constant. i.e in one file they can occur 1 time and in another they can occur 100 times.
    "I" and "L" are child tags of <C>
    <I>
           <J>10</J>
             <K>EN</K>
      </I>
    <L>
             <J>20</J>
              <N>BB</N>
      </L>
    Tags <C> and <F> occur only ones for each XML file. <C> is the child tag of "A" and "F" is the child tag of <C>.
    I need to collect <D>, <E> in one internal table ITAB.
    I need to collect <G>, <H> in one internal table JTAB.
    I need to collect <J>, <K> in one internal table KTAB.
    I need to collect <J>, <N> in one internal table PTAB.
    Below is the complete XML file.
    ?xml version="1.0" encoding="iso-8859-1" ?>
    <A>
        <B/>
        <C>
           <D>RED</D>
           <E>999</E>
        <F>
           <G>TRACK</G>
           <H>PACK</H>
        </F>
        <I>
           <J>10</J>
           <K>EN</K>
        </I>
        <I>
           <J>20</J>
           <K>TN</K>
        </I>
        <I>
           <J>30</J>
           <K>KN</K>
        </I>
        <L>
           <J>10</J>
           <N>AA</N>
        </L>
        <L>
           <J>20</J>
           <N>BB</N>
        </L>
        <L>
           <J>30</J>
           <N>CC</N>
        </L>
        </C>
      </A>
    With the help of SDN I am able to gather the values of <D> <E> in one internal table.
    Now if I need to gather
    <G>, <H> in one internal table JTAB.
    <J>, <K> in one internal table KTAB.
    <J>, <N> in one internal table PTAB.
    I am unable to do. I am following  XSLT transformation method. If some one has some suggestions. Please help.
    Here is my ABAP program
    TYPE-POOLS abap.
    CONSTANTS gs_file TYPE string VALUE 'C:\TEMP\ABCD.xml'.
    * This is the structure for the data from the XML file
    TYPES: BEGIN OF ITAB,
             D(10) TYPE C,
             E(10) TYPE C,
           END OF ITAB.
    * Table for the XML content
    DATA: gt_itab       TYPE STANDARD TABLE OF char2048.
    * Table and work ares for the data from the XML file
    DATA: gt_ITAB     TYPE STANDARD TABLE OF ts_ITAB,
          gs_ITAB     TYPE ts_ITAB.
    * Result table that contains references
    * of the internal tables to be filled
    DATA: gt_result_xml TYPE abap_trans_resbind_tab,
          gs_result_xml TYPE abap_trans_resbind.
    * For error handling
    DATA: gs_rif_ex     TYPE REF TO cx_root,
          gs_var_text   TYPE string.
    * Get the XML file from your client
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename                = gs_file
      CHANGING
        data_tab                = gt_itab1
      EXCEPTIONS
        file_open_error         = 1
        file_read_error         = 2
        no_batch                = 3
        gui_refuse_filetransfer = 4
        invalid_type            = 5
        no_authority            = 6
        unknown_error           = 7
        bad_data_format         = 8
        header_not_allowed      = 9
        separator_not_allowed   = 10
        header_too_long         = 11
        unknown_dp_error        = 12
        access_denied           = 13
        dp_out_of_memory        = 14
        disk_full               = 15
        dp_timeout              = 16
        not_supported_by_gui    = 17
        error_no_gui            = 18
        OTHERS                  = 19.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * Fill the result table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "IITAB".
    GET REFERENCE OF gt_shipment INTO gs_result_xml-value.
    gs_result_xml-name = 'IITAB'.
    APPEND gs_result_xml TO gt_result_xml.
    * Perform the XSLT stylesheet
    TRY.
        CALL TRANSFORMATION zxslt
        SOURCE XML gt_itab1
        RESULT (gt_result_xml).
      CATCH cx_root INTO gs_rif_ex.
        gs_var_text = gs_rif_ex->get_text( ).
        MESSAGE gs_var_text TYPE 'E'.
    ENDTRY.
    * Now let's see what we got from the file
    LOOP AT gt_ITAB INTO gs_ITAB.
      WRITE: / 'D:', gs_ITAB-D.
      WRITE: / 'E :', gs_ITAB-E.
    ENDLOOP.
    Transformation
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
      <xsl:strip-space elements="*"/>
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <IITAB>
              <xsl:apply-templates select="//C"/>
            </IITAB>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <item>
          <D>
            <xsl:value-of select="D"/>
          </D>
          <E>
            <xsl:value-of select="E"/>
          </E>
        </item>
      </xsl:template>
    </xsl:transform>
    Now the above pgm and transformation work well and I am able to extract data into the ITAB. Now what changes should I make in transformation and in pgm to collect
    <G>, <H> in one internal table JTAB.
    <J>, <K> in one internal table KTAB.
    <J>, <N> in one internal table PTAB.
    Please help..i am really tring hard to figure this out. I am found lot of threads addressing this issue but not my problem.
    Kindly help.
    Regards,
    VS

    Hi Rammohan,
    Thanks for the effort!
    But I don't need to use GUI upload because my functionality does not require to fetch data from presentation server.
    Moreover, the split command advised by you contains separate fields...f1, f2, f3... and I cannot use it because I have 164 fields.  I will have to split into 164 fields and assign the values back to 164 fields in the work area/header line.
    Moreover I have about 10 such work areas.  so the effort would be ten times the above effort! I want to avoid this! Please help!
    I would be very grateful if you could provide an alternative solution.
    Thanks once again,
    Best Regards,
    Vinod.V

  • Read data from xml files and  populate internal table

    Hi.
    How to read data from xml files into internal tables?
    Can u tell me the classes and methods to read xml data..
    Can u  explain it with a sample program...

    <pre>DATA itab_accontextdir TYPE TABLE OF ACCONTEXTDIR.
    DATA struct_accontextdir LIKE LINE OF itab_accontextdir.
    DATA l_o_error TYPE REF TO cx_root.
    DATA: filename type string ,
                 xmldata type xstring .
    DATA: mr      TYPE REF TO if_mr_api.
    mr = cl_mime_repository_api=>get_api( ).
    mr->get( EXPORTING  i_url     = 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'
                  IMPORTING  e_content = xmldata ).
    WRITE xmldata.
    TRY.
    CALL TRANSFORMATION id
          SOURCE XML xmldata
          RESULT shiva = itab_accontextdir.
      CATCH cx_root INTO l_o_error.
    ENDTRY.
    LOOP AT itab_accontextdir INTO struct_accontextdir.
        WRITE: / struct_accontextdir-context_id,
               struct_accontextdir-context_name,
               struct_accontextdir-context_type.
        NEW-LINE.
        ENDLOOP.</pre>
    <br/>
    Description:   
    In the above code snippet I am storing the data in an xml file(you know xml is used to store and transport data ) called 'xml_accontextdir.xml' that is uploaded into the MIME repository at path 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'.
    The below API is used to read a file in MIME repo and convert it into a string that is stored in ' xmldata'. (This is just a raw data that is got by appending the each line of  xml file).
    mr = cl_mime_repository_api=>get_api( ).
    mr->get( EXPORTING  i_url     = 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'
                  IMPORTING  e_content = xmldata ).
        Once the 'xmldata' string is available we use the tranformation to parse the xml string that we have got from the above API and convert it into the internal table.
    <pre>TRY.
    CALL TRANSFORMATION id
          SOURCE XML xmldata
          RESULT shiva = itab_accontextdir.
      CATCH cx_root INTO l_o_error.
    ENDTRY.</pre>
    Here the trasnsformation 'id ' is used to conververt the source xml 'xmldata' to resulting internal table itab_accontextdir, that have same structure as our xml file 'xml_accontextdir.xml'.  In the RESULT root of the xml file has to be specified. (In my the root is 'shiva'). 
    Things to be taken care:
    One of the major problem that occurs when reading the xml file is 'format not compatible with the internal table' that you are reading into internal table.  Iin order to get rid of this issue use one more tranformation to convert the data from the internal table into the xml file.    
    <pre>TRY.
          CALL TRANSFORMATION id
            SOURCE shiv = t_internal_tab
            RESULT XML xml.
        CATCH cx_root INTO l_o_error.
      ENDTRY.
      WRITE xml.
      NEW-LINE.</pre>
    <br/>
    This is the same transformation that we used above but the differnce is that the SOURCE and RESULT parameters are changed the source is now the internal table and result is *xml *string. Use xml browser that is available with the ABAP workbench to read the xml string displayed with proper indentation. In this way we get the format of xml file to be used that is compatable with the given internal table. 
    Thank you, Hope this will help you!!!
    Edited by: Shiva Prasad L on Jun 15, 2009 7:30 AM
    Edited by: Shiva Prasad L on Jun 15, 2009 11:56 AM
    Edited by: Shiva Prasad L on Jun 15, 2009 12:06 PM

  • Creating an xml file from abap code

    Hello All,
    Please let me know which FM do I need to execute in order to create an XML file from my ABAP code ?
    Thanks in advance,
    Paul.

    This has been discussed before
    XML files from ABAP programs

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • Creating an xml file from recordset

    Hi...
    XML newbie here - so.
    Is it possible to create and xml file from a recordset?
    I need to create a datafeed of our e-commerce products.
    Also, some of the db data contains HTML Code (product
    description field),
    how will this effect the xml file?
    Another problem is that my xml file needs to contain url's
    for the products
    and product images. My ASP pages contain these URL in hard
    code and then
    pull the actual file names from the db
    Hope that makes some sense
    Thanks for any help
    Andy

    Hi David
    Thanks for your help.
    I think it will have to be option 1 as i am using Access DB.
    I don't know how to go about it but will serach good old
    Google.
    Here is my recordset below, that pulls the required data from
    Access.
    The product and product image URL's need to be in the xml
    file but only the
    product image name and product id are in the database, e.g
    image name
    (imagename.jpg) productid (21)
    The actual URL's are hardcoded in my ASP pages, e.g <img
    src="products/medium/<%=(RSDetails.Fields.Item("Image").Value)%>"
    Not sure if this makes things any clearer :-|
    Thanks Again
    Andy
    <%
    Dim RSdatafeed
    Dim RSdatafeed_numRows
    Set RSdatafeed = Server.CreateObject("ADODB.Recordset")
    RSdatafeed.ActiveConnection = MM_shoppingcart_STRING
    RSdatafeed.Source = "SELECT Products.Product,
    Products.Description,
    Products.Image, Products.image2, Products.ListPrice,
    Products.Price,
    Products.xml_feed, Manufacturers.Manufacturer,
    Shipping.ShippingCost FROM
    Shipping, Products INNER JOIN Manufacturers ON
    Products.ManufacturerID =
    Manufacturers.ManufacturerID WHERE
    (((Products.xml_feed)=No));"
    RSdatafeed.CursorType = 0
    RSdatafeed.CursorLocation = 2
    RSdatafeed.LockType = 1
    RSdatafeed.Open()
    RSdatafeed_numRows = 0
    %>
    "DEPearson" <[email protected]> wrote in
    message
    news:[email protected]...
    > Andy,
    >
    > There are two ways you can create a xml file from a
    recordset
    >
    > 1. Is to code it using Server.CreateObject(XMLDOM)
    > 2. If you are using SQL server 2005, just request the RS
    returns as XML
    > data. using FOR XML AUTO after the where cause ( the
    best way with 2005
    > and
    > higher sql server)
    >
    > The db data containing HTML code should not effect your
    xml file, unless
    > it
    > is bad markup. You could wrap the data with
    <![CDATA[the data or html
    > markup, or javascript]]>
    >
    > If the url is a recordset field, then it will return
    with the xml data.
    > If
    > not you can create a storage procedure that will build
    your URL from the
    > data
    > in the database.
    >
    > It is best to use storage procedure (SP )for security
    reason when pulling
    > data
    > from a MS Sql server, make all calls to the database in
    a SP. Also be sure
    > to
    > validate the values in the querystrings before accepting
    them, check for
    > hack
    > code.
    >
    > David
    >

  • Upload an XML file into the Internal table

    Hi Guys,
    I want to know, how to upload an xml file into the Internal table through ABAP programming

    you just wanted to load the xml file into internal table (as a table of binary strings)or load the xml data mapped to itab row columns
    for the first one you can simply use gui_upload
    and for the second one you need to load the xml file using gui_upload and use XLST program to transform into an itab
    Regards
    Raja

  • How I can create a XML file from java Aplication

    How I can create a XML file from java Aplication
    whith have a the following structure
    <users>
    <user>
    <login>anyName</login>     
    <password>xxxx</password>
    </user>
    </users>
    the password label must be encripted
    accept any suggestion

    Let us assume you have all the data from the jsp form in an java bean object..
    Now you want a xml file. This can be acheived in 2 ways
    1. Write it into a file using java.io classes. Say you have a class with name
    write("<name>"+obj.getName+</name>);
    bingo you have a flat file with the xml
    2. Use data binding to do the trick
    will recommend JiBx and Castor for the 2nd option
    Regards,
    Rajagopal

  • Creating an xml file from a playlist - message for iTunes staff

    When I created an xml file from a playlist I noticed that in the xml file the track name was merged with the artist name in this manner "I want you - Bob Dylan".
    That was hardly a problem as I could easily correct this in the FileMaker Pro environment.
    But subsequently I found out, that within iTunes the track name was similarly changed to the same format. Apparently this happened when iTunes created the xml file and inadvertently also changed the track name within iTunes.
    It can easily be corrected by entering File/Info, but I had over 10.000 songs in that list and it will take a lot of time. I have to do this, as I created earlier for each song a file path in FileMaker Pro, which are unrecognizable now.
    Could you please correct the xml file creating procedure?

    I must confess that I can't reproduce this result myself anymore.
    I created the xml file in iTunes via File/Library/Export Playlist/xml structure (I translate the Dutch terms loosely) and subsequently I imported the xml file into a Filemaker Pro via File/Import/xml.
    The xsl style sheet looks ok.
    It looks like a freak of nature.
    Still I have the evidence in my iTunes playlist, where I have another 9000 clicks to go to repair the damage.
    Let's forget about it, until it happens again.
    Thanks for your time.

  • Is there anyway to create a xml file from a list so that xml file is available like an RSS.xml

    Hello
    My objective is to have a xml file created from a list for anonymous access.  The SharePoint RSS feed is a .aspx file not xml, as shown below: 
    _layouts/listfeed.aspx?List=21c2cdaa%2D52f3%2D4057%2Db674%2D45e63ba77e31&View=535eb328%2Db5fb%2D45c5%2D8fe8%2Da130e92afc41
    Also, is there a way to do this so that the xml content has current data like the list.
    Thank you for any insight and direction.

    Hi,
    According to your post, my understanding is that you wanted to create a xml file from a SharePoint list.
    To generate a XML file, we can use the SharePoint Object Model or PowerShell to achieve it.
    Generate a hierarchical XML file from SharePoint list using Client Object Model.
    http://maxderungs.wordpress.com/2012/05/12/generate-a-hierarchical-xml-file-from-sharepoint-list/
    Get SharePoint list items and export them to XML using PowerShell
    http://www.robertkuzma.com/2012/09/get-sharepoint-list-items-and-export-them-to-xml-using-powershell/
    More reference:
    http://www.robertkuzma.com/2010/08/how-to-create-a-custom-xml-output-using-sharepoint-services-3-0/
    http://traceynolte.com/blog/convert-sharepoint-list-to-xml/
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Upload XML file data into internal table

    Hi,
    I need help from you.
    I am uploading XML file from Application server.
    1.In application server under directory it may have several XML files and i need to upload all the XML files  when we gave only directory name. So, what is the function module for that logic . If possible code also.
    2.Once we get the files into some internal table we need to upload data from that files to internal table.
    So what is the logic for that , if possible code also.
    I am giving sample directory:    
    For example in this directory assume 3 xml files are there.
    I need to upload those files and data from that in to internal table.
    Thanks & Regards
    VSR

    Below code will give you an idea.
    TYPE-POOLS: ixml. "iXML Library Types
    *TABLES : rbkp.
    TYPE DECLERATIION
    TYPES: BEGIN OF type_tabpo,
    ebeln TYPE ekko-ebeln, "PO document number
    ebelp TYPE ekpo-ebelp, "PO line item
    END OF type_tabpo.
    TYPES: BEGIN OF type_ekbe,
    belnr TYPE rbkp-belnr, "Invoice document
    gjahr TYPE rbkp-gjahr, "fiscal year
    END OF type_ekbe.
    TYPES: BEGIN OF type_invoice,
    belnr TYPE rbkp-belnr, "PO document number
    gjahr TYPE rbkp-gjahr, "Fiscal Year
    rbstat TYPE rbkp-rbstat, "invoice status
    END OF type_invoice.
    TYPES: BEGIN OF t_xml_line, "Structure for holding XML data
    data(256) TYPE x,
    END OF t_xml_line.
    INTERNAL TABLE DECLERATIION
    DATA: gi_tabpo TYPE STANDARD TABLE OF type_tabpo,
    gi_ekbe TYPE STANDARD TABLE OF type_ekbe,
    gi_invoice TYPE STANDARD TABLE OF type_invoice,
    gi_bapiret2 TYPE STANDARD TABLE OF bapiret2.
    DATA: l_ixml TYPE REF TO if_ixml,
    l_streamfactory TYPE REF TO if_ixml_stream_factory.
    DATA: l_xml_table TYPE TABLE OF t_xml_line, " XML Table of the structure
    l_xml_line TYPE t_xml_line, " Record of structure t_xml_line
    l_xml_table_size TYPE i. " XML table size
    DATA: l_filename TYPE string.
    WORK AREA DECLARATION
    DATA: gw_tabpo TYPE type_tabpo,
    gw_ekbe TYPE type_ekbe,
    gw_invoice TYPE type_invoice,
    gw_bapiret2 TYPE bapiret2.
    BEGIN OF SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    PARAMETERS: p_file TYPE pathintern LOWER CASE DEFAULT '/usr/sap/tmp/'.
    Validation of XML file: Only DTD included in XML document is supported
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION SCREEN VALIDATION
    AT SELECTION-SCREEN.
    To validate p_file is not initial
    PERFORM sub_validate_file.
    PERFORM sub_validate_path.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Request for filename for xml file from the application server
    PERFORM sub_get_filename_appl USING p_file.
    START OF SELECTION SCREEN
    START-OF-SELECTION.
    PERFORM sub_fetch_po_details.
    PERFORM sub_get_invoice.
    PERFORM sub_rel_invoice.
    END OF SELECTION SCREEN
    END-OF-SELECTION.
    *& Form sub_validate_file
    To Validate the file
    FORM sub_validate_file .
    IF p_file IS INITIAL.
    MESSAGE e000. "specify the file path
    ENDIF.
    ENDFORM. " sub_validate_file
    *& Form sub_get_filename_appl
    form sub_get_filename_appl USING l_fname TYPE any.
    DATA: l_fname TYPE filename-fileintern. " File name
    *GET THE FILENAME FROM THE APPLICATION SERVER
    CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
    EXPORTING
    directory = l_fname
    filemask = '*'
    IMPORTING
    serverfile = l_fname
    EXCEPTIONS
    canceled_by_user = 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.
    ENDFORM. " sub_get_filename_appl
    *& Form sub_fetch_po_details
    To fetch the PO details from the application server
    Format of file is XML
    FORM sub_fetch_po_details .
    TYPE DECLERATIION
    l_ixml = cl_ixml=>create( ).
    Creating a stream factory
    l_streamfactory = l_ixml->create_stream_factory( ).
    PERFORM get_xml_table.
    LOOP AT gi_tabpo INTO gw_tabpo.
    WRITE:/ gw_tabpo.
    ENDLOOP.
    ENDFORM. " sub_fetch_po_details
    *& Form get_xml_table
    Read from the xml file
    FORM get_xml_table .
    Local variable declarations
    DATA: l_len TYPE i,
    l_len2 TYPE i,
    l_tab TYPE tsfixml,
    l_content TYPE string,
    l_str1 TYPE string,
    c_conv TYPE REF TO cl_abap_conv_in_ce,
    l_itab TYPE TABLE OF string.
    l_filename = p_file.
    code to upload data from application server
    OPEN DATASET l_filename FOR INPUT IN BINARY MODE.
    IF sy-subrc 0.
    WRITE:/ 'invalid file path'.
    ENDIF.
    DO.
    READ DATASET l_filename INTO l_xml_line.
    IF sy-subrc EQ 0.
    APPEND l_xml_line TO l_xml_table.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    CLOSE DATASET l_filename.
    code to find the table size
    DESCRIBE TABLE l_xml_table.
    l_xml_table_size = ( sy-tleng ) * ( sy-tfill ).
    *code to convert hexadecimal to XML
    LOOP AT l_xml_table INTO l_xml_line.
    c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data
    replacement
    = space ).
    c_conv->read( IMPORTING data = l_content len = l_len ).
    CONCATENATE l_str1 l_content INTO l_str1.
    ENDLOOP.
    l_str1 = l_str1+0(l_xml_table_size).
    SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
    LOOP AT l_itab INTO l_str1.
    REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
    l_str1 WITH space.
    ENDLOOP.
    CALL TRANSFORMATION ('ID') " code to put in internal table
    SOURCE XML l_str1
    RESULT tab = gi_tabpo[].
    ENDFORM. " get_xml_table

  • Reading XML file to ABAP internal table

    Hi all,
    Iam trying to convert a XLM file into abap internal table , am using XSLT transformation to parse the XML file and i am using "CALL METHOD cl_gui_frontend_services=>gui_upload" for reading the XML file.
    below is the XML file.
    ===========================================================================
    - <PIXBridge version="2.2" timestamp="2003-04-09T15:27:00">
    - <PIX>
      <TransactionType>605</TransactionType>
      <TransactionCode>98</TransactionCode>
      <TransactionNumber>6888965</TransactionNumber>
      <SequenceNumber>40001</SequenceNumber>
    - <SKUDefinition>
      <Company>GZL</Company>
      <Division>BMD</Division>
      <Season />
      <SeasonYear />
      <Style>ORT002A</Style>
      <StyleSuffix />
      <Color>K13</Color>
      <ColorSuffix />
      <SecDimension />
      <Quality />
      <SizeRangeCode />
      <SizeDesc>M</SizeDesc>
      <SkuID>200140577</SkuID>
      </SKUDefinition>
      </PIX>
      </PIXBridge>
    =================================================================
    and my Transformation code is as below
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
      <xsl:strip-space elements="*"/>
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <IPIX>
              <xsl:apply-templates select="//PIX"/>
            </IPIX>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <xsl:template match="PIX">
        <item>
          <TRANSACTIONTYPE>
            <xsl:value-of select="TransactionType"/>
          </TRANSACTIONTYPE>
          <TRANSACTIONCODE>
            <xsl:value-of select="TransactionCode"/>
          </TRANSACTIONCODE>
          <TRANSACTIONNUMBER>
            <xsl:value-of select="TransactionNumber"/>
          </TRANSACTIONNUMBER>
          <SEQUENCENUMBER>
            <xsl:value-of select="SequenceNumber"/>
          </SEQUENCENUMBER>
          <SKUDEFINITION>
            <COMPANY>
              <xsl:value-of select="Company"/>
            </COMPANY>
            <DIVISION>
              <xsl:value-of select="Division"/>
            </DIVISION>
            <SEASON/>
            <SEASONYEAR/>
            <STYLE>
              <xsl:value-of select="Style"/>
            </STYLE>
            <STYLESUFFIX/>
            <COLOR>
            <xsl:value-of select="Color"/>
            </COLOR>
            <COLORSUFFIX/>
            <SECDIMENSION/>
            <QUANTITY/>
            <SIZERANGECODE/>
            <SIZEDESC>
              <xsl:value-of select="SizeDesc"/>
            </SIZEDESC>
            <SKUID>
              <xsl:value-of select="SkuID"/>
            </SKUID>
          </SKUDEFINITION>
          </item>
        </xsl:template>
    When i run my program i am getting the values only till the sequence number part and im not getting any values  that is read in between <SKUDEFINITION> ..... </SKUDEFINITION>
    I need help to sort this , kindly help me in this.
    regs,
    raja

    I am not able to get a clue out of that, can Get Durairaj Athavan Raja in to loop for sorting this out.
    I made changes to my transformation program , but still not getting the output of the components inside the
    <SKUDefinition> , but when i debug  the transformation i can able to see the output values for those components but when i get the values in the result table im not getting values of those components.
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
      <xsl:strip-space elements="*"/>
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <IPIX>
              <xsl:apply-templates select="//PIX"/>
            </IPIX>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <xsl:template match="PIX">
        <item>
          <TRANSACTIONTYPE>
            <xsl:value-of select="TransactionType"/>
          </TRANSACTIONTYPE>
          <TRANSACTIONCODE>
            <xsl:value-of select="TransactionCode"/>
          </TRANSACTIONCODE>
          <TRANSACTIONNUMBER>
            <xsl:value-of select="TransactionNumber"/>
          </TRANSACTIONNUMBER>
          <SEQUENCENUMBER>
            <xsl:value-of select="SequenceNumber"/>
          </SEQUENCENUMBER>
          <xsl:for-each select="SKUDefinition">
          <SKUDEFINITION>
          <COMPANY>
              <xsl:value-of select="Company"/>
          </COMPANY>
          <DIVISION>
              <xsl:value-of select="Division"/>
          </DIVISION>
          <SEASON/>
          <SEASONYEAR/>
          <STYLE>
            <xsl:value-of select="Style"/>
          </STYLE>
          <STYLESUFFIX/>
          <COLOR>
            <xsl:value-of select="Color"/>
          </COLOR>
          <COLORSUFFIX/>
          <SECDIMENSION/>
          <QUANTITY/>
          <SIZERANGECODE/>
          <SIZEDESC>
              <xsl:value-of select="SizeDesc"/>
          </SIZEDESC>
          <SKUID>
              <xsl:value-of select="SkuID"/>
          </SKUID>
          </SKUDEFINITION>
          </xsl:for-each>
        </item>
      </xsl:template>
    </xsl:transform>
    ==================
    Below is my main program
    ===================
    TYPE-POOLS abap.
    CONSTANTS gs_file TYPE string VALUE 'C:\XMLABAP1.xml'.
    This is the structure for the data from the XML file
    TYPES: BEGIN OF ty_text,
             TransactionType(3) type n,
             TransactionCode(2) type n,
             TransactionNumber(7) type n,
             SequenceNumber(5) type n,
             Company(3) type c,
             Division(3) type c,
             Season(3) type c,
             SeasonYear(4) type c,
             Style(8) type c,
             Color(3) type c,
             SecDimension(3) type c,
             Quality(3) type n,
             SizeRangeCode(2) type c,
             SizeDesc(1) type c,
             SkuID(10) type c,
           END OF ty_text.
    Table for the XML content
    DATA: gt_itab       TYPE STANDARD TABLE OF char2048.
    data: xmlstr        TYPE XSTRING.
    Table and work ares for the data from the XML file
    DATA: gt_person     TYPE STANDARD TABLE OF ty_text,
          gs_person     TYPE ty_text.
    Result table that contains references
    of the internal tables to be filled
    DATA: gt_result_xml TYPE abap_trans_resbind_tab,
          gs_result_xml TYPE abap_trans_resbind.
    For error handling
    DATA: gs_rif_ex     TYPE REF TO cx_root,
          gs_var_text   TYPE string.
    Get the XML file from your client
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename                = gs_file
      CHANGING
        data_tab                = gt_itab
      EXCEPTIONS
        file_open_error         = 1
        file_read_error         = 2
        no_batch                = 3
        gui_refuse_filetransfer = 4
        invalid_type            = 5
        no_authority            = 6
        unknown_error           = 7
        bad_data_format         = 8
        header_not_allowed      = 9
        separator_not_allowed   = 10
        header_too_long         = 11
        unknown_dp_error        = 12
        access_denied           = 13
        dp_out_of_memory        = 14
        disk_full               = 15
        dp_timeout              = 16
        not_supported_by_gui    = 17
        error_no_gui            = 18
        OTHERS                  = 19.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Fill the result table with a reference to the data table.
    Within the XSLT stylesheet, the data table can be accessed with
    "IPERSON".
    GET REFERENCE OF gt_person INTO gs_result_xml-value.
    gs_result_xml-name = 'IPIX'.
    APPEND gs_result_xml TO gt_result_xml.
    Perform the XSLT stylesheet
    TRY.
        CALL TRANSFORMATION ZAUM_MANH_SYNC_RPT
        SOURCE XML XMLSTR
        RESULT (gt_result_xml).
      CATCH cx_root INTO gs_rif_ex.
        gs_var_text = gs_rif_ex->get_text( ).
        MESSAGE gs_var_text TYPE 'E'.
    ENDTRY.
    Now let's see what we got from the file
    LOOP AT gt_person INTO gs_person.
    WRITE: / 'Transaction Type:', gs_person-TransactionType.
      WRITE: / 'Transaction Code :', gs_person-TransactionCode.
      WRITE: / 'Transaction Number :', gs_person-TransactionNumber.
       WRITE: / 'SequenceNumber :', gs_person-SequenceNumber.
       WRITE: / 'Company : ', gs_person-Company.
      WRITE : /.
    ENDLOOP. "gt_person.

Maybe you are looking for

  • Snowleopard broke my intern Superdrive on MacBook Pro (Original)

    Hello, As by Thomas A Reed sugested (in my first thread, maybe someone can delete the one), i start a new thread, to keep it oversight and clear. Right now, i'm convinced, my case belongs to the 10.6 thread. The main threads about this problems seems

  • Problem with signed SAML assertion and Web Services Manager

    Folks, I’m having some issues trying to generate a proper signed SAML assertion using JDeveloper 10.1.3. I am securing a java proxy class using the wizard as described in http://www.oracle.com/technology/products/jdev/howtos/1013/wssecure/10gwssecuri

  • How to repair/open damaged .nef files on mac?

    Sorry if this is in the wrong place... I am using my sisters Apple refurb Mac Air, OSX 10.8.4 Camera is a Nikon D3100 There are around 3000 pictures. Basically I made the mistake of using a crappy card reader to open my files on her computer. A zeiko

  • AT&T Yahoo Mail Problems since Snow Leopard

    Before my upgrade to SL I used an AT&T Yahoo POP account in Mail. When I upgraded to SL, the account upgraded without a problem. I am now trying to add my husband's AT&T Yahoo POP account and I keep getting the following message: "Logging in to the a

  • TS4002 Need to change the account name (address)

    How do you change the account name (address) that is used to sign on??