Convert JTree to XML file

Hi ,
Can anyone help me in converting a JTree to XML file.
The Jtree is build from an xml file, the user can add, delete nodes in JTree and save to the xml file. Is there any way I can update the same xml file.
Suggestions are greatly appreciated.
Thanks,
SS..

Hi ,
Can anyone help me in converting a JTree to XML file.
The Jtree is build from an xml file, the user can add, delete nodes in JTree and save to the xml file. Is there any way I can update the same xml file.
Suggestions are greatly appreciated.
Thanks,
SS..

Similar Messages

  • Convert ArrayList into XML file

    Hi,
    Can anyone tell me how to convert ArrayList to XML file and save that file.
    Manoj

    There is an easy to understand example here:
    http://totheriver.com/learn/xml/code/XMLCreatorExample.java.
    You only have to replace Book objects from example with objects you need.

  • Problem converting data in XML file to internal table data

    Hi all,
    I have a requirement. I need to convert an XML file to internal table data and based on that data do Goods Receipt in SAP.
    With the help of this blog /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
    I am able to convert the XML file to data in SAP. But this blog will display the output on screen as ELELEMNT = nodename VALUE= value of that node.
    But I donu2019t want in that way, I want to store all the data in XML file in an internal table so that I can make use of those values and do Goods Recipt in SAP.
    Can some one suggest how should I read the data in an internal table.
    Here is my code..what changes should I make?
    *& Report  z_xit_xml_check
      REPORT  z_xit_xml_check.
      TYPE-POOLS: ixml.
      TYPES: BEGIN OF t_xml_line,
              data(256) TYPE x,
            END OF t_xml_line.
      DATA: l_ixml            TYPE REF TO if_ixml,
            l_streamfactory   TYPE REF TO if_ixml_stream_factory,
            l_parser          TYPE REF TO if_ixml_parser,
            l_istream         TYPE REF TO if_ixml_istream,
            l_document        TYPE REF TO if_ixml_document,
            l_node            TYPE REF TO if_ixml_node,
            l_xmldata         TYPE string.
      DATA: l_elem            TYPE REF TO if_ixml_element,
            l_root_node       TYPE REF TO if_ixml_node,
            l_next_node       TYPE REF TO if_ixml_node,
            l_name            TYPE string,
            l_iterator        TYPE REF TO if_ixml_node_iterator.
      DATA: l_xml_table       TYPE TABLE OF t_xml_line,
            l_xml_line        TYPE t_xml_line,
            l_xml_table_size  TYPE i.
      DATA: l_filename        TYPE string.
      PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:\temp\orders_dtd.xml'.
    Validation of XML file: Only DTD included in xml document is supported
      PARAMETERS: pa_val  TYPE char1 AS CHECKBOX.
      START-OF-SELECTION.
      Creating the main iXML factory
        l_ixml = cl_ixml=>create( ).
      Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
        PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
      wrap the table containing the file into a stream
        l_istream = l_streamfactory->create_istream_itable( table = l_xml_table
                                                        size  = l_xml_table_size ).
      Creating a document
        l_document = l_ixml->create_document( ).
      Create a Parser
        l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                          istream        = l_istream
                                          document       = l_document ).
      Validate a document
        IF pa_val EQ 'X'.
          l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
        ENDIF.
      Parse the stream
        IF l_parser->parse( ) NE 0.
          IF l_parser->num_errors( ) NE 0.
            DATA: parseerror TYPE REF TO if_ixml_parse_error,
                  str        TYPE string,
                  i          TYPE i,
                  count      TYPE i,
                  index      TYPE i.
            count = l_parser->num_errors( ).
            WRITE: count, ' parse errors have occured:'.
            index = 0.
            WHILE index < count.
              parseerror = l_parser->get_error( index = index ).
              i = parseerror->get_line( ).
              WRITE: 'line: ', i.
              i = parseerror->get_column( ).
              WRITE: 'column: ', i.
              str = parseerror->get_reason( ).
              WRITE: str.
              index = index + 1.
            ENDWHILE.
          ENDIF.
        ENDIF.
      Process the document
        IF l_parser->is_dom_generating( ) EQ 'X'.
          PERFORM process_dom USING l_document.
        ENDIF.
    *&      Form  get_xml_table
      FORM get_xml_table CHANGING l_xml_table_size TYPE i
                                  l_xml_table      TYPE STANDARD TABLE.
      Local variable declaration
        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 = pa_file.
      upload a file from the client's workstation
        CALL METHOD cl_gui_frontend_services=>gui_upload
          EXPORTING
            filename   = l_filename
            filetype   = 'BIN'
          IMPORTING
            filelength = l_xml_table_size
          CHANGING
            data_tab   = l_xml_table
          EXCEPTIONS
            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.
      Writing the XML document to the screen
        CLEAR l_str1.
        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.
        WRITE: /.
        WRITE: /' XML File'.
        WRITE: /.
        LOOP AT l_itab INTO l_str1.
          REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
            l_str1 WITH space.
          WRITE: / l_str1.
        ENDLOOP.
        WRITE: /.
      ENDFORM.                    "get_xml_table
    *&      Form  process_dom
      FORM process_dom USING document TYPE REF TO if_ixml_document.
        DATA: node      TYPE REF TO if_ixml_node,
              iterator  TYPE REF TO if_ixml_node_iterator,
              nodemap   TYPE REF TO if_ixml_named_node_map,
              attr      TYPE REF TO if_ixml_node,
              name      TYPE string,
              prefix    TYPE string,
              value     TYPE string,
              indent    TYPE i,
              count     TYPE i,
              index     TYPE i.
        node ?= document.
        CHECK NOT node IS INITIAL.
        ULINE.
        WRITE: /.
        WRITE: /' DOM-TREE'.
        WRITE: /.
        IF node IS INITIAL. EXIT. ENDIF.
      create a node iterator
        iterator  = node->create_iterator( ).
      get current node
        node = iterator->get_next( ).
      loop over all nodes
        WHILE NOT node IS INITIAL.
          indent = node->get_height( ) * 2.
          indent = indent + 20.
          CASE node->get_type( ).
            WHEN if_ixml_node=>co_node_element.
            element node
              name    = node->get_name( ).
              nodemap = node->get_attributes( ).
              WRITE: / 'ELEMENT  :'.
              WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
              IF NOT nodemap IS INITIAL.
              attributes
                count = nodemap->get_length( ).
                DO count TIMES.
                  index  = sy-index - 1.
                  attr   = nodemap->get_item( index ).
                  name   = attr->get_name( ).
                  prefix = attr->get_namespace_prefix( ).
                  value  = attr->get_value( ).
                  WRITE: / 'ATTRIBUTE:'.
                  WRITE: AT indent name  COLOR COL_HEADING INVERSE, '=',
                                   value COLOR COL_TOTAL   INVERSE.
                ENDDO.
              ENDIF.
            WHEN if_ixml_node=>co_node_text OR
                 if_ixml_node=>co_node_cdata_section.
            text node
              value  = node->get_value( ).
              WRITE: / 'VALUE     :'.
              WRITE: AT indent value COLOR COL_GROUP INVERSE.
          ENDCASE.
        advance to next node
          node = iterator->get_next( ).
        ENDWHILE.
      ENDFORM.                    "process_dom
    Any help would be highly apperciated.
    regards,
    Jessica Sam

    Pavel Vera,
    With your example i tries doing the following .....
    I tried  to convert the data of XML file to internal table data. I am collecting the data in internal table to do goos recipt with that data.
    Please find my XML file, ABAP pgm and XSLT pgm . I donu2019t know what I am missing I am not getting any output. I donu2019t know what is wrong please help me with this
    Below is my XML file, My code and XSLT Program. In the below XML file I need to collect Vendor Number, Order Number, and Date tags which occur only once for one XML file.
    I also need to collect the following tags from <Shipmentdetail>
    <Shipmentdetail> has following child nodes and I need to collect them
    TrackingNumber
    Freight
    Weight
    ShipmentDate
    ShipmentMethod
    Need to collect to collect the following tags from <ProductInformation>
    <ProductInformation> has following child nodes and I need to collect them
        LineNumber
        SKUNumber
        OrderedQuantity
        ShippedQuantity
        UOM
    The <Shipmentdetail> and <ProductInformation> are child nodes of <OrderShipment>
    The <Shipmentdetail> occurs only ones but the <ProductInformation> can occur once or many times and will be dynamic and differs depening on the input file.
    My XML file is as follows
    <?xml version="1.0" encoding="iso-8859-1" ?>
    - <ShipmentHeader>
      <AccountID />
    - <OrderShipment>
          <VendorNumber>1000</VendorNumber>
          <OrderNumber>P00009238</OrderNumber>
          <OrderType>Stock</OrderType>
          <Company />
          <Division />
         <Department />
         <Date>20061120</Date>
         <CartonCount>2</CartonCount>
         <ShipAllProducts>No</ShipAllProducts>
    -             <ShipmentDetail>
                      <TrackingNumber>1ZR3W891PG47477811</TrackingNumber>
                      <Freight>000000010000</Freight>
                      <ShipmentDate>20061120</ShipmentDate>
                      <ShipmentMethod>UPS1PS</ShipmentMethod>
                 </ShipmentDetail>
    -            <ProductInformation>
                     <LineNumber>000000001</LineNumber>
                     <SKUNumber>110FR</SKUNumber>
                     <AdvSKUNumber>003 4518</AdvSKUNumber>
                     <SKUID />
                     <OrderedQuantity>00000001000000</OrderedQuantity>
                     <ShippedQuantity>00000001000000</ShippedQuantity>
                     <UOM>EA</UOM>
                     <Factor>1</Factor>
                </ProductInformation>
    -           <ProductInformation>
                    <LineNumber>000000002</LineNumber>
                    <SKUNumber>938EN</SKUNumber>
                    <AdvSKUNumber>001 7294</AdvSKUNumber>
                    <SKUID />
                    <OrderedQuantity>00000000450000</OrderedQuantity>
                    <ShippedQuantity>00000000450000</ShippedQuantity>
                    <UOM>EA</UOM>
                    <Factor>1</Factor>
                </ProductInformation>
    -           <CaseInformation>
                   <LineNumber>000000001</LineNumber>
                   <SKUNumber>110FR</SKUNumber>
                   <AdvSKUNumber>003 4518</AdvSKUNumber>
                   <SKUID />
                   <SSCCNumber>00000001668000002487</SSCCNumber>
                   <CaseQuantity>00000001000000</CaseQuantity>
                   <UOM>EA</UOM>
                   <Factor>1</Factor>
                 </CaseInformation>
                 <CaseInformation>
                   <LineNumber>000000001</LineNumber>
                   <SKUNumber>110FR</SKUNumber>
                   <AdvSKUNumber>003 4518</AdvSKUNumber>
                   <SKUID />
                   <SSCCNumber>00000001668000002487</SSCCNumber>
                   <CaseQuantity>00000001000000</CaseQuantity>
                   <UOM>EA</UOM>
                   <Factor>1</Factor>
                 </CaseInformation>
    -  </OrderShipment>
      </ShipmentHeader>
    My Program
    TYPE-POOLS abap.
    CONSTANTS gs_file TYPE string VALUE 'C:\temp\test.xml'.
    * This is the structure for the data from the XML file
    TYPES: BEGIN OF ts_shipment,
             VendorNumber(10)     TYPE n,
             OrderNumber(20)      TYPE n,
             OrderType(8)         TYPE c,
             Date(8)              TYPE c,
           END OF ts_shipment.
    TYPES: BEGIN OF ts_shipmentdetail,
             TrackingNumber(30)     TYPE n,
             Freight(12)            TYPE n,
             Weight(14)             TYPE n,
             ShipmentDate(8)        TYPE c,
             ShipmentMethod(8)      TYPE c,
             END OF ts_shipmentdetail.
    TYPES: BEGIN OF ts_productinformation,
             LineNumber(9)          TYPE n,
             SKUNumber(20)          TYPE c,
             OrderedQuantity(14)    TYPE n,
             ShippedQuantity(14)    TYPE n,
             UOM(4)                 TYPE c,
             END OF ts_productinformation.
    * 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_shipment               TYPE STANDARD TABLE OF ts_shipment,
          gs_shipment               TYPE ts_shipment.
    DATA: gt_shipmentdetail         TYPE STANDARD TABLE OF ts_shipmentdetail,
          gs_shipmentdetail         TYPE ts_shipmentdetail.
    DATA: gt_productinformation     TYPE STANDARD TABLE OF ts_productinformation,
          gs_productinformation     TYPE ts_productinformation.
    * 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
    * "ISHIPMENT".
    GET REFERENCE OF gt_shipment INTO gs_result_xml-value.
    gs_result_xml-name = 'ISHIPMENT'.
    APPEND gs_result_xml TO gt_result_xml.
    * Fill the result table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "ISHIPDET".
    GET REFERENCE OF gt_shipmentdetail INTO gs_result_xml-value.
    gs_result_xml-name = 'ISHIPDET'.
    APPEND gs_result_xml TO gt_result_xml.
    * Fill the result table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "IPRODDET".
    GET REFERENCE OF gt_productinformation  INTO gs_result_xml-value.
    gs_result_xml-name = 'IPRODDET'.
    APPEND gs_result_xml TO gt_result_xml.
    * Perform the XSLT stylesheet
    TRY.
        CALL TRANSFORMATION z_xml_to_abap3
        SOURCE XML gt_itab
        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.
    * Writing the data from file for gt_shipment
    *Collecting the Shipping Data from the XML file to internal table gt_shipment
    *and writing the data to the screen
    LOOP AT gt_shipment INTO gs_shipment.
      WRITE: / 'VendorNumber:', gs_shipment-VendorNumber.
      WRITE: / 'OrderNumber :', gs_shipment-OrderNumber.
      WRITE: / 'OrderType  :', gs_shipment-OrderType.
      WRITE: / 'Date  :',      gs_shipment-Date.
      WRITE : /.
    ENDLOOP. "gt_shipment.
    LOOP AT gt_shipmentdetail INTO gs_shipmentdetail.
      WRITE: / 'TrackingNumber:',     gs_shipmentdetail-TrackingNumber.
      WRITE: / 'Freight :',           gs_shipmentdetail-Freight.
      WRITE: / 'Weight  :',           gs_shipmentdetail-Weight.
      WRITE: / 'ShipmentDate  :',     gs_shipmentdetail-ShipmentDate.
    * WRITE: / 'ShipmentMethod  :'    gs_shipmentdetail-ShipmentMethod
      WRITE : /.
    ENDLOOP. "gt_shipmentdetail.
    LOOP AT gt_productinformation INTO gs_productinformation.
      WRITE: / 'LineNumber:',         gs_productinformation-LineNumber.
      WRITE: / 'SKUNumber :',         gs_productinformation-SKUNumber.
      WRITE: / 'OrderedQuantity  :',  gs_productinformation-OrderedQuantity.
      WRITE: / 'ShippedQuantity  :',  gs_productinformation-ShippedQuantity.
      WRITE: / 'UOM  :',              gs_productinformation-UOM.
      WRITE : /.
    ENDLOOP. "gt_productinformation.
    XSLT Program
    <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>
            <ISHIPMENT>
              <xsl:apply-templates select="//OrderShipment"/>
            </ISHIPMENT>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <xsl:template match="OrderShipment">
        <item>
          <VENDORNUMBER>
            <xsl:value-of select="VendorNumber"/>
          </VENDORNUMBER>
          <ORDERNUMBER>
            <xsl:value-of select="OrderNumber"/>
          </ORDERNUMBER>
          <ORDERTYPE>
            <xsl:value-of select="OrderType"/>
          </ORDERTYPE>
          <DATE>
            <xsl:value-of select="Date"/>
          </DATE>
        </item>
      </xsl:template>
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <ISHIPDET>
              <xsl:apply-templates select="//OrderShipment/ShipmentDetail"/>
            </ISHIPDET>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <xsl:template match="ShipmentDetail">
        <item>
          <TRACKINGNUMBER>
            <xsl:value-of select="TrackingNumber"/>
          </TRACKINGNUMBER>
          <FREIGHT>
            <xsl:value-of select="Freight"/>
          </FREIGHT>
          <SHIPMENTDATE>
            <xsl:value-of select="ShipmentDate"/>
          </SHIPMENTDATE>
          <SHIPMENTMETHOD>
            <xsl:value-of select="ShipmentMethod"/>
          </SHIPMENTMETHOD>
        </item>
      </xsl:template>
    </xsl:transform> .
    Any help is highly appreciated. If anyone encountered this situation before please let me know where i am going wrong in my XSLT transformation.
    Any Help will be highly apppreciated. Thanks in advance
    Regards,
    Jessica   Sam

  • Help needed in converting Excel from XML file

    Hi Can anyone help me in converting XML in to Excel.
    Thanx,
    Ananth.

    well, that still isn't much to go off of. I give it a try though.
    I guess you want to parse out the relevent data out of the xml file and then decide on your favorite delimated file format for Excel. Two popular formats are comma delimated:
    "info1","info2","info3","info4"
    and tab delimeted:
    info <tab> info2 <tab> info3 <tab> info4
    Excel should be able to unsestand either of these formats.

  • Script to convert metadata to xml file - Bridge CS6/InDesign CS6

    I need a script that will convert metadata in Bridge to an xml file I can import into InDesign so that when I export long documents the alt text for photos is already included with the images.  
    Two problems -
    1) I need the scripting for dummies version - from step 1 to end.  I have zero experience with using scripts, as in - did not know they existed until a few days ago. 
    2) If the script needs adapted - see #1; there is very little hope that I will have any idea of how to do that without assistance. 
    I will be grateful for any assistance!!  I do want to learn how to do this, if I can. 

    I need a script that will convert metadata in Bridge to an xml file I can import into InDesign so that when I export long documents the alt text for photos is already included with the images.  
    Two problems -
    1) I need the scripting for dummies version - from step 1 to end.  I have zero experience with using scripts, as in - did not know they existed until a few days ago. 
    2) If the script needs adapted - see #1; there is very little hope that I will have any idea of how to do that without assistance. 
    I will be grateful for any assistance!!  I do want to learn how to do this, if I can. 

  • Regd: Converting Data in XML file

    Hi All,
    We hav a requirement to convert the data from Internal table into a XML file.
    The scenario is we hav developed a program to download the data in XML format,the problem is when the file is converted inot XML format its giving erreor that
    <b>The XML page cannot be displayed
    End tag 'KUN' does not match the start tag 'KUNNR'. Error processing resource 'file:///C:/TEST.xml'. Line 2, Position 1712
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><IT_XML_OUT><item><VBE...</b>
    The code is specified below for understanding.
       TBALES DECLARATION
    TABLES:  VBAK, "Sale Order Header
             VBAP, "Sale Order Item Data
             VBEP, "Schedule Line Data
             KNA1, "General Data in Customer Master
             VBRP. "Billing Document Item Data
       TYPES DECLARATION
    TYPES : BEGIN OF TY_SOSTATUS,
              KUNNR    LIKE VBAK-KUNNR,  "Customer Number
              NAME1    LIKE KNA1-NAME1,  "Customer Name
              BSTNK    LIKE VBAK-BSTNK,  "Customer P.O.
              BSTDK    LIKE VBAK-BSTDK,  "Customer P.O. Date
              VBELN    LIKE VBAK-VBELN,  "Sale Order Number
              ERDAT    LIKE VBAK-ERDAT,  "Sale Order Date
              POSNR    LIKE VBAP-POSNR,  "Sale Order Line Item
              MATNR    LIKE VBAP-MATNR,  "Material Number
              ARKTX    LIKE VBAP-ARKTX,  "Material Description
              KWMENG   LIKE VBAP-KWMENG, "Sale Order Quantity
              VRKME    LIKE VBAP-VRKME,  "Unit of Measurement
              EDATU    LIKE VBEP-EDATU,  "Sale Order Schedule Date
              FKIMG    LIKE VBRP-FKIMG,  "Despatch Quantity
              GBSTA    LIKE VBUP-GBSTA,  "Overall Sale Order Status
              PNDQTY TYPE I,
    END OF TY_SOSTATUS.
    TYPES : BEGIN OF TEMP_DISP,
              VBELN    LIKE VBAK-VBELN,
              AUART    LIKE VBAK-AUART,
              ERDAT    LIKE VBAK-ERDAT,
              KUNNR    LIKE VBAK-KUNNR,
              BSTNK    LIKE VBAK-BSTNK,
              BSTDK    LIKE VBAK-BSTDK,
              POSNR    LIKE VBAP-POSNR,
              MATNR    LIKE VBAP-MATNR,
              ARKTX    LIKE VBAP-ARKTX,
              KWMENG   LIKE VBAP-KWMENG,
              VRKME    LIKE VBAP-VRKME,
    END OF TEMP_DISP.
    DATA: XML_OUT TYPE STRING.
       INTERNAL TABLE DECLARATION
    DATA : IT_SOSTATUS TYPE STANDARD TABLE OF TY_SOSTATUS
                WITH HEADER LINE INITIAL SIZE 100 WITH DEFAULT KEY.
    DATA : IT_TEMP TYPE STANDARD TABLE OF TEMP_DISP
                WITH HEADER LINE INITIAL SIZE 100 WITH DEFAULT KEY.
    DATA : BEGIN OF IT_XML_OUT  OCCURS 0,
           A(1500) TYPE C,
           END OF IT_XML_OUT.
       SELECTION SCREEN DECLARATION
    SELECTION-SCREEN  BEGIN OF BLOCK SOBLOCK WITH FRAME.
    SELECT-OPTIONS:   S_VBELN FOR VBAK-VBELN,
                      S_ERDAT FOR VBAK-ERDAT,
                      S_AUART  FOR VBAK-AUART,
                      S_WERKS FOR VBAP-WERKS.
    SELECTION-SCREEN  END OF BLOCK SOBLOCK.
       START OF SELECTION
    SELECT SVBELN SAUART SERDAT SKUNNR SBSTNK SBSTDK
           LPOSNR LMATNR LARKTX LKWMENG L~VRKME FROM VBAK AS S
                                                        INNER JOIN VBAP AS L
                                                        ON SVBELN = LVBELN
                                                        INTO CORRESPONDING FIELDS OF TABLE IT_TEMP
                                                        WHERE S~AUART IN S_AUART AND
                                                              S~ERDAT IN S_ERDAT AND
                                                              L~WERKS IN S_WERKS .
    CALL TRANSFORMATION (`ID`) SOURCE IT_XML_OUT = IT_TEMP[] RESULT XML XML_OUT.
    CALL FUNCTION 'SOTR_SERV_STRING_TO_TABLE'
      EXPORTING
        TEXT                      = XML_OUT
      FLAG_NO_LINE_BREAKS       = 'X'
       LINE_LENGTH               = 65000
      LANGU                     = SY-LANGU
      TABLES
        TEXT_TAB                  = IT_XML_OUT[].
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filetype = 'BIN'
    filename = 'C:\TEST.xml'
    TABLES
    data_tab = IT_XML_OUT[].
    Is there any other way to process this and download in XML format.
    Help and Suggestions will be much Appreciated.
    Thanks & Regds.
    Ramesh.

    Hi ramesh,
    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
    BREAK-POINT.
    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[]
    BREAK-POINT.
    regards,
    amit m.

  • Convert Excel to XML file

    Hi Guys,
    I need to generate the XML from Excel file. The XML file will have the definition like this:
    <people_list>
    <name>Fred Bloggs</name>
    <birthdate>27/11/2008</birthdate>
    <gender>Male</gender>
    </people_list>
    The Excel file will look like this:
    A B C
    1 Fred Bloggs 10/21/2008 Male
    2 ABC 12/23/2008 Female
    3 XYZ 07/16/2008 Male
    All the values in name,birthdaye,gender will come from the Excel file. I am having 100 rows in the Excel file with the data and I want to parse this excel file and create the XML file with the above template.
    Any ideas how to do this?
    Thanks,
    Mahesh

    Hi Mahesh,
    there are tons of ways to do what you need. It all depends on how your workflow is organized and how complicated it may become.
    Alternative 1:
    Export your Excel file as a cvs and convert cvs to XML (which shouldn't be so hard).
    Pro: Relative easy transformation.
    Con: Every time you want to convert the Excel file to XML you first needs to export it out of Excel by a manual step.
    Alternative 2:
    Save you Excel file as XML (e. g. the new *.xslx documents) and transform it as you like.
    Pro: Very clean way to do this. You can access the single source Excel file directly from Java. No further steps needed.
    Con: It's very very hard to program because the Excel xml structure is ridiculously complex.
    Alternative 3:
    You can create a little Excel VBA Script which generates the XML File.
    Pro: Easy programing.
    Con: Needs some experience in Visual Basic 6 programming.
    Alternative 4:
    Use http://jexcelapi.sourceforge.net/ or any other Excel-API to Access the Excel application out of Java.
    Pro: Clean way to do it. You need no further manual actions to prepare something. (maybe the most flexible and at the same time easyest way)
    Con: Additional license.
    Best Wishes
    esprimo

  • Convert Data to XML File

    Hi all
    I want a sample procedure in which i would to like to fetch data and save the output to a XML File.
    Someone please help me in giving me the sample procedure.
    Regds
    Nirmal

    see this link, may be it will help
    http://blog.oraclecontractors.com/?p=147
    Well that shows you how to extract data on the database as XML, but it doesn't show how to output it to a file.
    I'll give a hint. If you have your data as an XMLTYPE you can convert it via CLOB to and XMLDOMDocument type (as in the DBMS_XMLDOM package). Once you have an XMLDOMDocument you can use one of the DBMS_XMLDOM procedures to write out the XML to a file...
    DBMS_XMLDOM.WRITETOFILE(
    doc IN DOMDOCUMENT,
    filename IN VARCHAR2);
    ;)

  • Convert FMB to XML File on Unix

    Hello,
    I want to convert a FMB-File to XML in my HP-UX-Middletier-Environment.The Script frm2xml.sh is only shipped with IDS.
    Can someone upload the frmf2xml.sh from a linux or Solaris IDS-Enviroment?
    Robert

    So if we were to keep text-based source files, the process would have to be:
    - check-out to local working copy
      - convert XML to FMB
        - make changes using Forms Developer
      - convert FMB to XML
    - commit to svn
    I'm concerned about the side-effects of the conversion process (edge-cases, incompatibilities), and I also expect that even with some automation, the above will be a pretty slow process that will slow the team down. I guess we'll probably stick with fmb.
    I guess as a compromise, it may be worthwhile generating the xml or fmt alongside the fmb and committing both. At least we'd then have a text-based file to compare revisions with. So the process then becomes:
    - check-out to local working copy
      - make changes using Forms Developer
      - generate XML from FMB
    - commit both to svn
    I'm still baffled as to why Oracle has chosen a binary source format, even 15 years ago. This basically precludes a vast number of tools and techniques that are essential to the software craft :(

  • Converting jtree to xml

    hi, i am currently working on a project where i construct a jtree using a java gui....once the user clicks on save button, the jtree has to be read and converted into an xml document....
    for eg, the jtree looks like this
    - process
    ----reply
    ----receive
    etc..
    the xml document should be as follows:
    <process>
    <reply> </reply>
    <receive></receive>
    </process>
    i need your help in this regard....kindly help
    Regards
    Lalitha

    Chapter 23 of the book, constructs a tree XMl editor, and it saves among other things...
    http://www.manning.com/sbe/

  • Error in converting String to XML file

    Hi
    Please see the code below, basically i want to convert the String
    i am having error when parsing xmlFile1, since the xml has some German characters like �
    How do i work around it or what is the best way to do it
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import java.io.*;
    public class TestXMLFile
         public TestXMLFile() throws Exception
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setValidating(false);
              StringBuffer xmlFile = new StringBuffer();
              xmlFile.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
              xmlFile.append("<ITEMSPECIALNOTES><SPECIALNOTE>unvernderter Nachdruck</SPECIALNOTE></ITEMSPECIALNOTES>");
              ByteArrayInputStream byteArray = new ByteArrayInputStream(xmlFile.toString().getBytes());
            Document doc = factory.newDocumentBuilder().parse(byteArray);
              System.out.println ("String parsed in XML ");     
              StringBuffer xmlFile1 = new StringBuffer();
              xmlFile1.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
              xmlFile1.append("<ITEMSPECIALNOTES><SPECIALNOTE>unver�nderter Nachdruck</SPECIALNOTE></ITEMSPECIALNOTES>");
              ByteArrayInputStream byteArray1 = new ByteArrayInputStream(xmlFile1.toString().getBytes());
            Document doc1 = factory.newDocumentBuilder().parse(byteArray1);
              System.out.println ("String1 parsed in XML ");
         public static void main(String args[])throws Exception
             new TestXMLFile();
    }

    Don't convert to bytes using your system's default encoding but tell the parser that the bytes are encoded in UTF-8.
    In fact since you already have chars, don't convert to bytes and make the parser convert back to chars at all. Do this:String string = xmlFile.toString();
    Document doc =
       factory.newDocumentBuilder().parse(new InputSource(new StringReader(string)));

  • Is xml dissembler component can convert flatfile to xml file in biztalk

    Hi please see the subject line

    actually, in disassembler stage only one will execute based on "First match" criteria.
    i don't understand why you are trying to use xml disassembler. for it.
    all that you need is, in your schema at record level, set max occur to 1.
    And create separate header and trailer schemas and set those properties in your flat file disassembler component. that's it, it should debatch all your records in your message. 
    No need to use xml disassmbler.
    Please mark the post as answer if this answers your question. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Convert the IDOC XML file into single string?

    Hello All,
    I have a scenario, where i need to conver the IDOC XML  into single string, to send it to target.
    Please let me know how can we achive this, I dont know java coding.
    Please help me out to write the java code.
    Thanks and Regards,
    Chinna

    Hi Chinna,
    You can do this in two ways -
    1. Java mapping
    https://wiki.sdn.sap.com/wiki/display/XI/JavaMapping-ConverttheInputxmlto+String
    https://wiki.sdn.sap.com/wiki/display/Snippets/JavaMapping-ConverttheInputxmltoString
    2. XSLT mapping
    /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
    Regards,
    Sunil Chandra

  • How should convert text file into XML file?

    I do a project "WEB SERVER LOG ANALYZER" using JSP. For that i copy the content of log file into the other file . how i convert it into XML file . xplain with coding

    Read this [page.|http://www.devx.com/getHelpOn/10MinuteSolution/20356]

  • Issue with uploading XML file from application server into internal table

    i Need to fetch the XML file from the application server and place into internal table and i am getting error message while using the functional module   SMUM_XML_PARSE and the error message is "line   1 col   1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment" and could you please let me know how to resolve this issue?  
        TYPES: BEGIN OF T_XML,
                 raw(2000) TYPE C,
               END OF T_XML.
    DATA:GW_XML_TAB TYPE  T_XML.
    DATA:  GI_XML_TAB TYPE TABLE OF T_XML INITIAL SIZE 0.
    DATA:GI_STR TYPE STRING.
    data:  GV_XML_STRING TYPE XSTRING.
    DATA: GI_XML_DATA TYPE  TABLE OF SMUM_XMLTB INITIAL SIZE 0.
    data:GI_RETURN TYPE STANDARD TABLE OF BAPIRET2.
        OPEN DATASET LV_FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        IF SY-SUBRC NE 0.
          MESSAGE 'File does not exist' TYPE 'E'.
        ELSE.
          DO.
    * Transfer the contents from the file to the work area of the internal table
            READ DATASET LV_FILE1 INTO GW_XML_TAB.
            IF SY-SUBRC EQ 0.
              CONDENSE GW_XML_TAB.
    *       Append the contents of the work area to the internal table
              APPEND GW_XML_TAB TO GI_XML_TAB.
            ELSE.
              EXIT.
            ENDIF.
          ENDDO.
        ENDIF.
    * Close the file after reading the data
        CLOSE DATASET LV_FILE1.
        IF NOT GI_XML_TAB IS INITIAL.
          CONCATENATE LINES OF GI_XML_TAB INTO GI_STR SEPARATED BY SPACE.
        ENDIF.
    * The function module is used to convert string to xstring
        CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
          EXPORTING
            TEXT   = GI_STR
          IMPORTING
            BUFFER = GV_XML_STRING
          EXCEPTIONS
            FAILED = 1
            OTHERS = 2.
        IF SY-SUBRC <> 0.
          MESSAGE 'Error in the XML file' TYPE 'E'.
        ENDIF.
      ENDIF.
      IF GV_SUBRC = 0.
    * Convert XML to internal table
        CALL FUNCTION 'SMUM_XML_PARSE'
          EXPORTING
            XML_INPUT = GV_XML_STRING
          TABLES
            XML_TABLE = GI_XML_DATA
            RETURN    = GI_RETURN.
      ENDIF.
      READ TABLE GI_RETURN TRANSPORTING NO FIELDS WITH KEY TYPE = 'E'.
      IF SY-SUBRC EQ 0.
        MESSAGE 'Error converting the input XML file' TYPE 'E'.
      ELSE.
        DELETE GI_XML_DATA WHERE TYPE <> 'V'.
        REFRESH GI_RETURN.
      ENDIF.

    Could you please tel me  why the first 8 lines were removed, till <Soap:Body and also added the line <?xml version="1.0" encoding="UTF-8"?> in the beggining .
    Becuase there will be lot of  XML files will be coming from the Vendor daily and that should be uploaded in the application server and should update in the SAP tables based on the data in the XML file.
    what information i need to give to vendor that do not add the first 8 lines in the XML file and add the line in the beggining <?xml version="1.0" encoding="UTF-8"?>   ??????
    Is there any other way we can do with out removing the lines?

Maybe you are looking for

  • RFC Lookup using RFC_READ_TABLE

    Hi, I'm doing RFC lookup using RFC_READ_TABLE to read data from table "LIPS". I am getting the following error with the XML signature DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapb16b89b090ec11debb52001e0b450820/source/com/sap/xi/tf/_M

  • No such method error when migrating to 10.3.2

    Howdy! I am migrating a Portal application from 10.0.2 to 10.3.2 and getting the following exception when trying to access any page of the app. The app is using a home grown URI re-write mechanism that worked successfully in 10.0.2 environment. Thank

  • BIC Mapping tool Error

    Hi, Hope you have define your FlatFile strucute first and exported to local directory and then generated the XML messsage for the same... after this generated the mapping for the conversion from FlatFile to CSV using CreateEDItoXML instead of XMLtoED

  • Entity Attribute conditional mandatority

    Hello OTN, I've got an entity object which is used in different projects. In this entity there is an attribute which should be mandatory conditionally: When (attributeA != 1 && attributeA != 2) attributeB should be mandatory. This should be reflected

  • Linking multiple checkboxes to Word docs?

    Hi - I've not used Dreamweaver or done any HTML for a few years so I'm a little rusty. At work I've been asked to add some functionality to our intranet, which is entirely written in HTML. What I want to do is enable our users to select multiple Word