ABAP to XML with several internal tables

hi,
i have to make a XML file with this structure :
<Order>
  <OrderHeader>
      <i>...[fields of header]...</i>
  </OrderHeader>
  <OrderItem>
      <i>...[fields of item 10]...</i>
  </OrderItem>
  <OrderItem>
      <i>...[fields of item n]...</i>
  </OrderItem>
</Order> 
and that for several orders...
I don't know anything about XML, XLST and since 1 day just start to read doc, tutorial.. and i can't say i'm understanding everythings..
so, in a first step, i have tried to export several Order headers :
I have done a XSLT (thanks to another topic/replies in the forum) and call it with CALL TRANSFORMATION and it works good...
now,and here i need a little help, i would like to know :
1-is it possible to work with 2 internal tables and in this case, how to make XLST looping all item for each header?
2-or should i use only one internal table with deep structure?
Regards,
Christophe
The XSLT
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl="http://www.sap.com/sapxsl" version="1.0">
  <xsl:strip-space elements="*"/>
  <xsl:template match="/">
    <Order>
      <xsl:for-each select="//item">
        <OrderHeader>
          <OrderNo>
            <xsl:value-of select="AUFNR"/>
          </NoOT>
        </OrderHeader>
      </xsl:for-each>
    </Order>
  </xsl:template>
</xsl:transform>

Hi,
Here is the sample code.
* Databases
TABLES:
  makt,                                "Mat description
  marc,                                "Material / plant
  t001w,                               "plant name
  bhdgd.                               "Batch heading
* Internal tables
DATA:
  BEGIN OF gt_marc OCCURS 0,
    werks LIKE marc-werks,
    matnr LIKE marc-matnr,
  END OF gt_marc,
* Table to be downloaded as xml. Each line stores start and end tags
* and the value
  BEGIN OF gt_xml OCCURS 0,
    line(120),
  END OF gt_xml,
  g_maktx(120).
* User-input
SELECT-OPTIONS:
  s_werks FOR marc-werks,
  s_matnr FOR marc-matnr.
START-OF-SELECTION.
* Extract all required data
  PERFORM main_processing.
END-OF-SELECTION.
  SORT gt_marc BY werks matnr.
  LOOP AT gt_marc.
    AT FIRST.                          "First tag must be root
      CLEAR gt_xml.
      gt_xml-line = '<LOCATIONS>'.
      APPEND gt_xml.
      CLEAR gt_xml.
    ENDAT.
    AT NEW werks.                      "At new plant
      PERFORM read_plant.
      FORMAT COLOR 4 ON.
      SKIP 1.
      WRITE :/ gt_marc-werks, t001w-name1.
      FORMAT COLOR 4 OFF.
      CLEAR gt_xml.
      gt_xml-line = ' <PLANT>'.
      APPEND gt_xml.
      CLEAR gt_xml.
      CONCATENATE ' <NUMBER>' gt_marc-werks '</NUMBER>'
      INTO gt_xml-line.
      APPEND gt_xml.
      CLEAR gt_xml.
      CONCATENATE ' <NAME>' t001w-name1 '</NAME>' INTO gt_xml-line.
      APPEND gt_xml.
      CLEAR gt_xml.
      gt_xml-line = ' </PLANT>'.
      APPEND gt_xml.
      CLEAR gt_xml.
    ENDAT.
    PERFORM read_description.
    CLEAR gt_xml.
    gt_xml-line = ' <MATERIAL>'.
    APPEND gt_xml.
    CLEAR gt_xml.
    CONCATENATE ' <NAME>' g_maktx '</NAME>'
    INTO gt_xml-line.
    APPEND gt_xml.
    CLEAR gt_xml.
    CONCATENATE ' <NUMBER>' gt_marc-matnr '</NUMBER>'
    INTO gt_xml-line.
    APPEND gt_xml.
    CLEAR gt_xml.
    gt_xml-line = ' </MATERIAL>'.
    APPEND gt_xml.
    CLEAR gt_xml.
* display data
    FORMAT COLOR 2 ON.
    WRITE :/ gt_marc-matnr, makt-maktx.
    FORMAT COLOR 2 OFF.
  ENDLOOP.
* The last tag must be the root closing tag --*
  gt_xml-line = '</LOCATIONS>'.
  APPEND gt_xml.
  CLEAR gt_xml.
  CALL FUNCTION 'DOWNLOAD'
       EXPORTING
            filename = 'C:PLANT1.XML'
            filetype = 'ASC'
       TABLES
            data_tab = gt_xml.
TOP-OF-PAGE.
  MOVE sy-title TO bhdgd-line1.
  MOVE sy-repid TO bhdgd-repid.
  MOVE sy-uname TO bhdgd-uname.
  MOVE sy-datum TO bhdgd-datum.
  MOVE '0' TO bhdgd-inifl.
  MOVE '132' TO bhdgd-lines.
  FORMAT INTENSIFIED ON COLOR COL_HEADING.
  PERFORM batch-heading(rsbtchh0).     "report header
*  Form READ_PLANT
FORM read_plant.
* Get plant name
  CLEAR t001w.
  SELECT SINGLE name1
    INTO t001w-name1
    FROM t001w
   WHERE werks EQ gt_marc-werks.
ENDFORM.                               " READ_PLANT
*  Form MAIN_PROCESSING
FORM main_processing.
* Material and plant basic data
  SELECT werks matnr
    INTO TABLE gt_marc
    FROM marc
   WHERE werks IN s_werks
     AND matnr IN s_matnr.
ENDFORM.                               " MAIN_PROCESSING
*  Form READ_DESCRIPTION
FORM read_description.
* Material name
  CLEAR g_maktx.
  SELECT SINGLE maktx
    INTO g_maktx
    FROM makt
   WHERE matnr EQ gt_marc-matnr
     AND spras EQ 'E'.
* Replace special character
  DO.
    REPLACE '&' WITH '*ù%;' INTO g_maktx.
    IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
  ENDDO.
  DO.
    REPLACE '*ù%;' WITH '&amp;' INTO g_maktx.
    IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
  ENDDO.
  DO.
    REPLACE '/' WITH '&#47;' INTO g_maktx.
    IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
  ENDDO.
ENDFORM.                               " READ_DESCRIPTION
Hope this helps.If so,kindly reward points.

Similar Messages

  • 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

  • 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

  • How to Download XML File to internal table

    Hi Friends,
    This is my urgent requirement. How to download XML File to Internal table.
    regards
    pauldharma

    Hai,
    Please check this Link
    http://www.sap-img.com/abap/upload-direct-excel.htm
    PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
                begcol TYPE i DEFAULT 1 NO-DISPLAY,
                begrow TYPE i DEFAULT 1 NO-DISPLAY,
                endcol TYPE i DEFAULT 100 NO-DISPLAY,
                endrow TYPE i DEFAULT 32000 NO-DISPLAY.
    * Tick don't append header
    PARAMETERS: kzheader AS CHECKBOX.
    DATA: BEGIN OF intern OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern.
    DATA: BEGIN OF intern1 OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern1.
    DATA: BEGIN OF t_col OCCURS 0,
           col LIKE alsmex_tabline-col,
           size TYPE i.
    DATA: END OF t_col.
    DATA: zwlen TYPE i,
          zwlines TYPE i.
    DATA: BEGIN OF fieldnames OCCURS 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          END OF fieldnames.
    * No of columns
    DATA: BEGIN OF data_tab OCCURS 0,
           value_0001(50),
           value_0002(50),
           value_0003(50),
           value_0004(50),
           value_0005(50),
           value_0006(50),
           value_0007(50),
           value_0008(50),
           value_0009(50),
           value_0010(50),
           value_0011(50),
           value_0012(50),
           value_0013(50),
           value_0014(50),
           value_0015(50),
           value_0016(50),
           value_0017(50),
           value_0018(50),
           value_0019(50),
           value_0020(50),
           value_0021(50),
           value_0022(50),
           value_0023(50),
           value_0024(50),
           value_0025(50),
           value_0026(50),
           value_0027(50),
           value_0028(50),
           value_0029(50),
           value_0030(50),
           value_0031(50),
           value_0032(50),
           value_0033(50),
           value_0034(50),
           value_0035(50),
           value_0036(50),
           value_0037(50),
           value_0038(50),
           value_0039(50),
           value_0040(50),
           value_0041(50),
           value_0042(50),
           value_0043(50),
           value_0044(50),
           value_0045(50),
           value_0046(50),
           value_0047(50),
           value_0048(50),
           value_0049(50),
           value_0050(50),
           value_0051(50),
           value_0052(50),
           value_0053(50),
           value_0054(50),
           value_0055(50),
           value_0056(50),
           value_0057(50),
           value_0058(50),
           value_0059(50),
           value_0060(50),
           value_0061(50),
           value_0062(50),
           value_0063(50),
           value_0064(50),
           value_0065(50),
           value_0066(50),
           value_0067(50),
           value_0068(50),
           value_0069(50),
           value_0070(50),
           value_0071(50),
           value_0072(50),
           value_0073(50),
           value_0074(50),
           value_0075(50),
           value_0076(50),
           value_0077(50),
           value_0078(50),
           value_0079(50),
           value_0080(50),
           value_0081(50),
           value_0082(50),
           value_0083(50),
           value_0084(50),
           value_0085(50),
           value_0086(50),
           value_0087(50),
           value_0088(50),
           value_0089(50),
           value_0090(50),
           value_0091(50),
           value_0092(50),
           value_0093(50),
           value_0094(50),
           value_0095(50),
           value_0096(50),
           value_0097(50),
           value_0098(50),
           value_0099(50),
           value_0100(50).
    DATA: END OF data_tab.
    DATA: tind(4) TYPE n.
    DATA: zwfeld(19).
    FIELD-SYMBOLS: <fs1>.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = '*.xls'
                static    = 'X'
           CHANGING
                file_name = filename.
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = filename
                i_begin_col             = begcol
                i_begin_row             = begrow
                i_end_col               = endcol
                i_end_row               = endrow
           TABLES
                intern                  = intern
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/ 'Upload Error ', SY-SUBRC.
      ENDIF.
    END-OF-SELECTION.
      LOOP AT intern.
        intern1 = intern.
        CLEAR intern1-row.
        APPEND intern1.
      ENDLOOP.
      SORT intern1 BY col.
      LOOP AT intern1.
        AT NEW col.
          t_col-col = intern1-col.
          APPEND t_col.
        ENDAT.
        zwlen = strlen( intern1-value ).
        READ TABLE t_col WITH KEY col = intern1-col.
        IF sy-subrc EQ 0.
          IF zwlen > t_col-size.
            t_col-size = zwlen.
    *                          Internal Table, Current Row Index
            MODIFY t_col INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t_col LINES zwlines.
      SORT intern BY row col.
      IF kzheader = 'X'.
        LOOP AT intern.
          fieldnames-title = intern-value.
          APPEND fieldnames.
          AT END OF row.
            EXIT.
          ENDAT.
        ENDLOOP.
      ELSE.
        DO zwlines TIMES.
          WRITE sy-index TO fieldnames-title.
          APPEND fieldnames.
        ENDDO.
      ENDIF.
      SORT intern BY row col.
      LOOP AT intern.
        IF kzheader = 'X'
        AND intern-row = 1.
          CONTINUE.
        ENDIF.
        tind = intern-col.
        CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
        ASSIGN (zwfeld) TO <fs1>.
        <fs1> = intern-value.
        AT END OF row.
          APPEND data_tab.
          CLEAR data_tab.
        ENDAT.
      ENDLOOP.
      CALL FUNCTION 'DISPLAY_BASIC_LIST'
           EXPORTING
                file_name     = filename
           TABLES
                data_tab      = data_tab
                fieldname_tab = fieldnames.
    *-- End of Program
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/excel-file-download-to-an-internal-table-in-sap-crm-1719453#
    tables: zinv_release,
    zpo_release.
    ** decleration of data
    DATA: BEGIN OF my_tab OCCURS 0.
    INCLUDE STRUCTURE zinv_release.
    DATA: END OF my_tab.
    *DATA: hex_tab TYPE x VALUE '09'.
    DATA: rec(200)."'/usr/test.dat'.
    DATA:
    zhours(20) TYPE c,
    MINS(20) type c. "decimals.
    data: coma.
    coma = ','.
    SELECTION-SCREEN BEGIN OF BLOCK txt
    WITH FRAME TITLE text-001.
    PARAMETERS: dsn(60) DEFAULT '\\sapdev01\prod\'.
    SELECTION-SCREEN END
    OF BLOCK txt.
    *using a dataset to get text
    OPEN DATASET dsn FOR INPUT IN TEXT MODE.
    IF sy-subrc = 0.
    DO.
    READ DATASET dsn INTO rec.
    IF sy-subrc <> 0.
    EXIT.
    ENDIF.
    split rec at coma into
    zpo_release-REL_GRP
    zpo_release-REL_CODE
    zpo_release-RESPREL
    zpo_release-ALTREL
    zpo_release-MANAGER
    ZHOURS
    MINS
    zpo_release-FROMTIME
    zpo_release-TOTIME
    zpo_release-EXCLWKENDS.
    move zpo_release-REL_GRP to my_tab-REL_GRP.
    move zpo_release-REL_CODE to my_tab-REL_CODE.
    move zpo_release-RESPREL to my_tab-RESPREL.
    move zpo_release-ALTREL to my_tab-ALTREL.
    move zpo_release-MANAGER to my_tab-MANAGER.
    move ZHOURS to my_tab-ZHOURS.
    move MINS to my_tab-mins.
    move zpo_release-FROMTIME to my_tab-fromtime.
    move zpo_release-TOTIME to my_tab-totime.
    move zpo_release-EXCLWKENDS to my_tab-exclwkends.
    APPEND my_tab.
    ENDDO.
    INSERT zpo_release FROM TABLE my_tab ACCEPTING DUPLICATE KEYS.
    ** DELETE zmm_ppa_cc FROM TABLE tab.
    ** INSERT zzzak_emp FROM TABLE my_tab ACCEPTING DUPLICATE KEYS.
    IF sy-subrc = 0.
    MESSAGE i000(zv) WITH 'File Successful stored in DB.' '' '' ''.
    ** ELSE.
    MESSAGE i000(zv) WITH 'File already stored in DB.' '' '' ''.
    endif.
    ENDIF.
    reward if helpful
    raam

  • Convert XML values to internal table

    Hi Experts
    How can i convert XML values to internal table . i am getting all the values into the string.
    this is my example
    <?xml version="1.0" encoding="UTF-8"?><TEST><ZTEST><DEPTNO>HEADOFFICE</DEPTNO><DNAME>IT</DNAME><LOC>HYD</LOC><MANDT>003</MANDT></ZTEST></TEST>
    i did create internal table with 4 fields.
    Please help.

    XML DOM Processing in ABAP part I -  Convert an ABAP table into XML file using SAP DOM Approach.

  • Create XML file from internal table and vise a versa

    Hi Friends,
    I have requirement to create an XML string from internal table data and also read XML string data to internal table.
    Can anybody tell are there any Function Modules or methods existing for this?
    Thanks.
    Krishna Yerram.

    1. Write XSLT program. T.code XSLT . e.g. XSLT name "ZTRANS".
    2. Write ABAP program
    Which includes declaration of internal tables
    that you need "IT_DATA".
    Upload XML data to an internal table "IT_XML "
    use below statement to convert XML to internal table.
    Call transformation ZTRANS
    source XML IT_XML
    result IT_DATA.

  • Error "Error in ABAP statement when processing an internal table. table."

    Hello,
    I am facing the error when tried for GR from SRM portal for my shopping cart and for others created shopping cart. The error is
    "Error in ABAP statement when processing an internal table. table."
    I have the central receipient role. Couold any body assist me?
    Thanks,
    Pijush

    Hi Harish,
    Execute the query in RSRT and check whether you have any short dump is in ST22. This would give a clear idea at what might have gone wrong.
    Another thing is to check whether the code for the variable is fine in the user exit.
    Hope this helps.
    Bye
    Dinesh

  • Using where condition with dynamic internal table

    Hi Friends.
    How to use where condition with dynamic internal table ?
    Regards,
    Amit Raut

    Hai Amit
    REPORT  ZDYNAMIC_SELECT                         .
    TABLES: VBAK.
    DATA: CONDITION TYPE STRING.
    DATA: BEGIN OF ITAB OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    END OF ITAB.
    SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
    CONCATENATE 'VBELN' 'IN' 'S_VBELN.'
    INTO CONDITION SEPARATED BY SPACE.
    SELECT VBELN POSNR FROM VBAP INTO TABLE ITAB
    WHERE (CONDITION).
    LOOP AT ITAB.
    WRITE 'hello'.
    ENDLOOP.
    Thanks & Regards
    Sreenivasulu P

  • Im trying to update db table in  user exit, with the internal table

    Im trying to update db table in user exit, with the internal table
    my scenario:
    loop at itekpo.
    updating itekpo -
    > at the end of user exit the db table ekpo have to be updated
    endloop.
    Im updating internal table, using 
    MODIFY itekpo TRANSPORTING INCO1 INCO2  WHERE ebeln = itekpo-ebeln
    where itekpo is internal table, but it is not updating the db table 'ekpo'.
    i also tried updating ekpo directly !
    Thanks in advance

    Hi,
    you can search in the forum itself,
    Try this link for instance
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=tocreateaBADI&adv=false&sortby=cm_rnd_rankvalue
    You can find a code for finding BADI as a report with the following Transaction
    finding badis
    How to find BADIs
    Reward if helpful
    Regards
    Byju

  • 2 different  tables   in the main window with same internal table data

    Hi All,
    can we have 2 diffterent  tables with same internal table data into its work area in the main window.Is it possible or we will get any run time error.?
    is it like having 2 nested loop with same internal table ?
    ex : loop at itab1 into wa_itab.
           loop at itab1 into wa_itab.
    endloop.
    endloop.
    can we use like this?

    Hi,
    there will not be any error ...but what is the use of it...
    do you need to have a controlled way of display ...of the data...
    If so then you create another workarea in the global definitions of the same type and then use it...
    Regards,
    Ram

  • Regarding 'FREE' ABAP Keyword in the local internal table

    Hi Experts,
    //sorry for my english ;(
    Our ABAP Development leader forced us to use  FREE ABAP Keyword on Local internal table like below situation.
    and I really don't get it.
    -below-
    FORM GET_DATA.
      DATA: LT_ITAB TYPE TABLE OF SFLIGHT.
      SELECT * FROM ZTABLE INTO TABLE LT_TABLE
            FOR ALL ENTRIES IN LT_ITAB
        WHERE KKEY = LT_ITAB-CARRID.
    "// WHY DO I HAVE TO USE THIS CODE
        FREE LT_ITAB.
    ENDFORM.
    I know that GC(garbage collector) will release memory area of LT_ITAB.
    but why do i have to release directly FREE LT_ITAB memory area?
    cause to take in short time memory advantage of before GC calling?
    thanks.

    Guys, why don't you read ABAP help?
    From ABAP help about FREE:
    For internal tables, FREE has the same effect as the REFRESH statement, though the entire memory area occupied by the table rows is released, and the initial memory area remains unoccupied
    About REFRESH:
    This statement sets an internal table itab to its initial value, meaning that it deletes all rows of the internal table. The memory space required for the table is freed up to the initial memory size INITIAL SIZE. For itab, you must specify an internal table.
    To delete all rows and free the entire memory space occupied by rows, you can use the statement FREE.
    About INITAIL SIZE:
    After the optional addition INITIAL SIZE, you can specify a number of rows n as a numeric literal or numeric constant to adjust the size of the first block in the memory that is reserved by the system for an internal table of the table type. Without this addition, if the number 0 is entered, or the value of n exceeds a maximum value, the system automatically allocates an appropriate memory area.
    To summarize:
    Using free allows you to immediately free the initial space reserved by the kernel for an internal table.
    I am lazy to look for it, but I don't think it ever exceeds few Kb.
    regards,
      Yuri

  • How to join several internal tables?

    Hi,
    I have several internal tables. And there is a very complex LOOP to extract data from these internal tables and many other logic inside it. The LOOP is very time-consuming.
    I am thinking to join these internal tables into one big internal table, to save some logic inside the complex LOOP. But as I know there is no "join" function for internal tables.
    So is there any workaround method to perform a "join" operation on internal tables?
    Thanks a lot!

    Hi,
    I have several internal tables. And there is a very complex LOOP to extract data from these internal tables and many other logic inside it. The LOOP is very time-consuming.
    I am thinking to join these internal tables into one big internal table, to save some logic inside the complex LOOP. But as I know there is no "join" function for internal tables.
    So is there any workaround method to perform a "join" operation on internal tables?
    Thanks a lot!

  • Simple Transformation ST, upload xml file to internal table

    Hi.
    I want to upload some parts of an xml file into an sap internal table, especially the part "trackingnumber" which can occur several times.
    the xml looks like this:
    <?xml version="1.0" encoding="windows-1252"?>
    <OpenShipments xmlns="x-schema:OpenShipments.xdr">
         <OpenShipment ProcessStatus="Processed">
              <ShipTo>
              </ShipTo>
              <ShipFrom>
              </ShipFrom>
              <ShipmentInformation>
              </ShipmentInformation>
              <Package>
              </Package>
              <InternationalDocumentation>
              </InternationalDocumentation>
              <Goods>
              </Goods>
              <ProcessMessage>
                   <TrackingNumbers>
                        <TrackingNumber>1Z1234563330702444</TrackingNumber>
                        <TrackingNumber>1Z1234566644402555</TrackingNumber>
                   </TrackingNumbers>
              </ProcessMessage>
         </OpenShipment>
    </OpenShipments>
    The ST looks like this:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
    <tt:root name="ROOT"/>
    <tt:template>
    <OpenShipments xmlns="x-schema:OpenShipments.xdr">
    <OpenShipment>
    <ShipTo>
    <tt:skip/>
    </ShipTo>
    <ShipFrom>
    <tt:skip/>
    </ShipFrom>
    <ShipmentInformation>
    <tt:skip/>
    </ShipmentInformation>
    <tt:group>
    <tt:cond frq="*">
    <Package>
    <tt:skip/>
    </Package>
    </tt:cond>
    </tt:group>
    <InternationalDocumentation>
    <tt:skip/>
    </InternationalDocumentation>
    <tt:group>
    <tt:cond frq="*">
    <Goods>
    <tt:skip/>
    </Goods>
    </tt:cond>
    </tt:group>
    <ProcessMessage>
    <ShipmentRates>
    <tt:skip/>
    </ShipmentRates>
    <TrackingNumbers>
    <tt:group>
    <tt:cond frq="*">
    <TrackingNumber>
    <tt:loop ref="ROOT">
    <tt:value ref="ROOT" />
    </tt:loop>
    </TrackingNumber>
    </tt:cond>
    </tt:group>
    </TrackingNumbers>
    <ImportID>
    <tt:skip/>
    </ImportID>
    <Reference1>
    <tt:skip/>
    </Reference1>
    <Reference2>
    <tt:skip/>
    </Reference2>
    </ProcessMessage>
    </OpenShipment>
    </OpenShipments>
    </tt:template>
    </tt:transform>
    The ABAP Code looks like this:
    REPORT  z_xml_to_abap_test.
    TYPES: t_xmllin_src(4096) TYPE x,
           t_xmltab_src TYPE STANDARD TABLE OF t_xmllin_src.
    DATA: xmlstr_src TYPE xstring,
          xmltab_src TYPE t_xmltab_src,
          result1(254) TYPE c,
          BEGIN OF ROOT,
            TrackingNumber(254) type c,
          END OF ROOT.
    FIELD-SYMBOLS: <xmlline> LIKE LINE OF xmltab_src.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
       filename                      = 'e:\20100601_132212.Out'
       filetype                      = 'BIN'
       has_field_separator           = ''
       header_length                 = 0
       read_by_line                  = 'X'
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
    TABLES
       data_tab                      = xmltab_src
    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
       OTHERS                        = 17.
    LOOP AT xmltab_src ASSIGNING <xmlline>.
      CONCATENATE xmlstr_src <xmlline> INTO xmlstr_src IN BYTE MODE.
    ENDLOOP.
    CALL TRANSFORMATION z_ups_xml_upload
      SOURCE XML xmlstr_src
      RESULT ROOT = ROOT.
    When i run the program i got the following error message:
    "The goal was to access variable "ROOT". However, this access was not possible.
    Anybody has an idea, why this happens, this is my first ST and have no clue at the moment why this happens?

    Hi.
    I want to upload some parts of an xml file into an sap internal table, especially the part "trackingnumber" which can occur several times.
    the xml looks like this:
    <?xml version="1.0" encoding="windows-1252"?>
    <OpenShipments xmlns="x-schema:OpenShipments.xdr">
         <OpenShipment ProcessStatus="Processed">
              <ShipTo>
              </ShipTo>
              <ShipFrom>
              </ShipFrom>
              <ShipmentInformation>
              </ShipmentInformation>
              <Package>
              </Package>
              <InternationalDocumentation>
              </InternationalDocumentation>
              <Goods>
              </Goods>
              <ProcessMessage>
                   <TrackingNumbers>
                        <TrackingNumber>1Z1234563330702444</TrackingNumber>
                        <TrackingNumber>1Z1234566644402555</TrackingNumber>
                   </TrackingNumbers>
              </ProcessMessage>
         </OpenShipment>
    </OpenShipments>
    The ST looks like this:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
    <tt:root name="ROOT"/>
    <tt:template>
    <OpenShipments xmlns="x-schema:OpenShipments.xdr">
    <OpenShipment>
    <ShipTo>
    <tt:skip/>
    </ShipTo>
    <ShipFrom>
    <tt:skip/>
    </ShipFrom>
    <ShipmentInformation>
    <tt:skip/>
    </ShipmentInformation>
    <tt:group>
    <tt:cond frq="*">
    <Package>
    <tt:skip/>
    </Package>
    </tt:cond>
    </tt:group>
    <InternationalDocumentation>
    <tt:skip/>
    </InternationalDocumentation>
    <tt:group>
    <tt:cond frq="*">
    <Goods>
    <tt:skip/>
    </Goods>
    </tt:cond>
    </tt:group>
    <ProcessMessage>
    <ShipmentRates>
    <tt:skip/>
    </ShipmentRates>
    <TrackingNumbers>
    <tt:group>
    <tt:cond frq="*">
    <TrackingNumber>
    <tt:loop ref="ROOT">
    <tt:value ref="ROOT" />
    </tt:loop>
    </TrackingNumber>
    </tt:cond>
    </tt:group>
    </TrackingNumbers>
    <ImportID>
    <tt:skip/>
    </ImportID>
    <Reference1>
    <tt:skip/>
    </Reference1>
    <Reference2>
    <tt:skip/>
    </Reference2>
    </ProcessMessage>
    </OpenShipment>
    </OpenShipments>
    </tt:template>
    </tt:transform>
    The ABAP Code looks like this:
    REPORT  z_xml_to_abap_test.
    TYPES: t_xmllin_src(4096) TYPE x,
           t_xmltab_src TYPE STANDARD TABLE OF t_xmllin_src.
    DATA: xmlstr_src TYPE xstring,
          xmltab_src TYPE t_xmltab_src,
          result1(254) TYPE c,
          BEGIN OF ROOT,
            TrackingNumber(254) type c,
          END OF ROOT.
    FIELD-SYMBOLS: <xmlline> LIKE LINE OF xmltab_src.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
       filename                      = 'e:\20100601_132212.Out'
       filetype                      = 'BIN'
       has_field_separator           = ''
       header_length                 = 0
       read_by_line                  = 'X'
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
    TABLES
       data_tab                      = xmltab_src
    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
       OTHERS                        = 17.
    LOOP AT xmltab_src ASSIGNING <xmlline>.
      CONCATENATE xmlstr_src <xmlline> INTO xmlstr_src IN BYTE MODE.
    ENDLOOP.
    CALL TRANSFORMATION z_ups_xml_upload
      SOURCE XML xmlstr_src
      RESULT ROOT = ROOT.
    When i run the program i got the following error message:
    "The goal was to access variable "ROOT". However, this access was not possible.
    Anybody has an idea, why this happens, this is my first ST and have no clue at the moment why this happens?

  • XML file to Internal table through XSLT - Call Transformation

    Hi Friends,
    I am trying to work a scenario where i have a simple XML file and i need to convert the data in to an internal table. When i execute the XSLT seperately, it works fine. I get the output, but when it is invoked through a ABAP program, i am getting the error "The called method START_XSLT_DEBUGGER of the calss CL_WB_XSLT_DEBUGGER returned the exception CX_XSLT_FORMAT_ERROR"
    I feel my XSLT program is not correct, but i am unable to find out what the issue is. Any help is really apreciated. I have gone through the SDN forum replies. But could not figure out what is wrong with my program
    Below given are the details.
    My XML File:
    <?xml version="1.0" encoding="utf-8"?>
    <List>
      <ITEM>
        <ITEMQUALF>ITEM1</ITEMQUALF>
        <MATERIAL>MAT1</MATERIAL>
      </ITEM>
      <ITEM>
        <ITEMQUALF>ITEM2</ITEMQUALF>
        <MATERIAL>MAT2</MATERIAL>
      </ITEM>
      <ITEM>
        <ITEMQUALF>ITEM3</ITEMQUALF>
        <MATERIAL>MAT3</MATERIAL>
      </ITEM>
    </List>
    My XSLT program:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" exclude-result-prefixes="asx" version="1.0">
      <xsl:strip-space elements="*"/>
      <xsl:output encoding="utf-8" indent="yes" omit-xml-declaration="yes"/>
      <!--xsl:template match="/"-->
      <xsl:template match="List">
        <asx:abap version="1.0">
          <asx:values>
            <T_ACTUAL>
              <xsl:for-each select="*">
                <ITEMQUALF>
                  <xsl:value-of select="ITEMQUALF" />
                </ITEMQUALF>
                <MATERIAL>
                  <xsl:value-of select="MATERIAL" />
                </MATERIAL>
              </xsl:for-each>
            </T_ACTUAL>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    In my ABAP program:
    REPORT  z_xslt_abap_2.
    TYPES:
      BEGIN OF ty_actual,
        itemqualf   TYPE char50,
        material    TYPE char50,
      END OF ty_actual,
      line_t(4096)  TYPE x,
      table_t       TYPE STANDARD TABLE OF line_t,
      ty_t_actual   TYPE STANDARD TABLE OF ty_actual.
    DATA:
      t_actual    TYPE ty_t_actual,
      t_srctab    TYPE table_t,
      v_filename  TYPE string.
    DATA: gs_rif_ex     TYPE REF TO cx_root,
          gs_var_text   TYPE string.
    v_filename = 'D:\XML\xslt_test.xml'.
    * Function call
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename = v_filename
        filetype = 'BIN'
      TABLES
        data_tab = t_srctab
      EXCEPTIONS
        OTHERS   = 1.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * Call Transformation
    TRY.
        CALL TRANSFORMATION (`ZXSLT_RAM`)
                SOURCE XML t_srctab
                RESULT     t_actual = t_actual.
      CATCH cx_root INTO gs_rif_ex.
        gs_var_text = gs_rif_ex->get_text( ).
        MESSAGE gs_var_text TYPE 'E'.
    ENDTRY .
    IF t_actual IS NOT INITIAL.
      WRITE: 'Success'.
    ENDIF.
    When i run the XSLT program seperately, this is the output that i get:
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
      <asx:values>
        <T_ACTUAL>
          <ITEMQUALF>ITEM1</ITEMQUALF>
          <MATERIAL>MAT1</MATERIAL>
          <ITEMQUALF>ITEM2</ITEMQUALF>
          <MATERIAL>MAT2</MATERIAL>
          <ITEMQUALF>ITEM3</ITEMQUALF>
          <MATERIAL>MAT3</MATERIAL>
        </T_ACTUAL>
      </asx:values>
    </asx:abap>
    I have been stuck with this for more than two days. If anyone can help me out with this, it would be really great. Please let me know, where i am going wrong.
    Thanks in advance.
    Best Regards,
    Ram.

    Hi,
    You can try this sample program, hopefully will help you.
    <a href="https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/readdatafromXMLfileviaXSLT+program&">Read Data From XML</a>.
    Regards,

  • Transforming XML into nested Internal Table via Call Transformation XSLT

    Hi guys!
    I am relatively new to this XML transformation to Abap Internal table. Hence I got help some help from this thread ABAP Development as well as referencing Txn SSTDEMO1 and SSTDEMO2
    But I tried to attempt on my prog it failed. Heres my sample XML, XSLT & as well as Internal Table.
    The good news is I am able to read in a BID item under bidlist BUT with no fields filled in the table.... Pls help....
    <b><u>XML</u></b>
    <?xml version="1.0" encoding="iso-8859-1"?>
    <myXML>
      <BIDLIST>
        <BID>
          <HEADER>
            <DOC_CODE>4000000343</DOC_CODE>
            <RESPONSE_NO>80000003</RESPONSE_NO>
            <RESPONSE_DATE>2006-10-01</RESPONSE_DATE>
            <SUPP_CODE>44</SUPP_CODE>
            <SUPP_SITE_ID>44</SUPP_SITE_ID>
            <SUPP_CONTACT_NAME>JIM BEAN</SUPP_CONTACT_NAME>
           <SUPP_CONTACT_PHONE>+6512345678</SUPP_CONTACT_PHONE>
            <SUPP_CONTACT_EMAIL>[email protected]</SUPP_CONTACT_EMAIL>
            </HEADER>
          </BID>
        </BIDLIST>
    <myXML>
    <u><b>XSLT</b></u>
    <xsl:transform version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:sap="http://www.sap.com/abapxml"
    >
    <xsl:template match="/">
    <asx:abap xmlns:asx="http://www.sap.com/abapxml">
    <asx:values>
        <BID_RESPONSE>
            <xsl:for-each select="myXML/BIDLIST/BID">
            <LBID>
                <xsl:for-each select="HEADER">
                <LHEADER>
                            <DOC_CODE> <xsl:value-of select="DOC_CODE"/> </DOC_CODE>
                            <RESPONSE_NO> <xsl:value-of select="RESPONSE_NO"/> </RESPONSE_NO>
                            <RESPONSE_DATE> <xsl:value-of select="RESPONSE_DATE"/> </RESPONSE_DATE>
                            <SUPP_CODE> <xsl:value-of select="SUPP_CODE"/> </SUPP_CODE>
                            <SUPP_SITE_ID> <xsl:value-of select="SUPP_SITE_ID"/> </SUPP_SITE_ID>
                            <SUPP_CONTACT_NAME> <xsl:value-of select="SUPP_CONTACT_NAME"/> </SUPP_CONTACT_NAME>
                            <SUPP_CONTACT_PHONE> <xsl:value-of select="SUPP_CONTACT_PHONE"/> </SUPP_CONTACT_PHONE>
                            <SUPP_CONTACT_EMAIL> <xsl:value-of select="SUPP_CONTACT_EMAIL"/> </SUPP_CONTACT_EMAIL>
                </LHEADER>
            </xsl:for-each>
            </LBID>
            </xsl:for-each>
        </BID_RESPONSE>
    </asx:values>
    </asx:abap>
    </xsl:template>
    </xsl:transform>
    <u><b>Internal Table</b></u>
    TYPES: BEGIN OF T_HEADER,
            DOC_CODE(17),
            RESPONSE_NO(8),
            RESPONSE_DATE(10),
            SUPP_CODE(16),
            SUPP_SITE_ID(15),
            SUPP_CONTACT_NAME(140),
            SUPP_CONTACT_PHONE(23),
            SUPP_CONTACT_EMAIL(100),
           D_HEADER TYPE T_HEADER OCCURS 0.
    TYPES: BEGIN OF T_BID,
            HEADER TYPE D_HEADER,
           END OF T_BID,
           D_BID TYPE T_BID OCCURS 0.
    TYPES: BEGIN OF T_BIDLIST,
            BID TYPE D_BID,
           END OF T_BIDLIST,
           D_BIDLIST TYPE T_BIDLIST OCCURS 0.
    TYPES: BEGIN OF TYPE_DATA,
            BIDLIST TYPE D_BIDLIST,
           END OF TYPE_DATA.
    DATA: BID_RESPONSE TYPE TABLE OF TYPE_DATA.

    hi
    good
    go through these links, i hope these ll help you to solve your problem.
    http://sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/15ecdf90-0201-0010-d792-941a3c3c30a4
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/d-f/from%20xml%20to%20abap%20data%20structures%20and%20back%20bridging%20the%20gap%20with%20xslt
    thanks
    mrutyun^

Maybe you are looking for

  • Getting Error "Pricing Procedure could not be determined" in CRM Functional

    Hi Experts,     While creating Quotation for Products, am getting error message of  " Pricing Procedure could not be determined". Kindly reply, how 2 resolve this by steps-by-steps. Thanks.. Edited by: poorav4293 on Aug 6, 2011 12:27 PM

  • Move photos to trash from Bridge and can't find them in trash

    Help! When I was doing the selection from Bridge, I delete some of the photos by selecting them then clicked 'move to trash', but I can't find them in trash,I am using Bridge CC, When I was using the previous edition there's no problem, but things ch

  • Does anyone know anything about EchoLink?

    I am using an iMac with wireless Airport, which my husband also uses on his XP. He would like to hook up to EchoLink. The information says: Allow UDP(source port any, destination ports 5198-5199)from Internet to PC Allow UDP(source port any, destinat

  • Joining, NOT extending, a non-apple network

    I just bought an Airport Express (N) for the purpose of using it to do Airplay.  Just Airplay, no extending networks. I have a not-Apple network (ASUS router running Tomato), so I do not expect "extend" to work easily. When I ask airport utility (6.3

  • Query of queries case sensitive

    Hi, I've a question regarding this issue.  I am pulling data from an xml file and dump that data into query of queries then output them.  The problem is when I try to order the query ASC, the upper will be top and the lower will be on the bottom.  Is