Xml data to abap internal table

I'm presently working on a interface where data in abap internal table is converted into xml format and placed in the frontend and vice versa.
I'm through with the first part and in secodn part also I'm able to transfer the data from frontend to Document Object Model(DOM) by parsing but finally am not able to put it into an internal table.
Please help (Urgent).
Thanks and regards,
S.K.Tripathy

Hi sitakant,
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.

Similar Messages

  • Xml string to abap internal  table

    HI Experts ,
    I want to parse this XML file to abap internal table ,i read as usual  the Help and i think
    that something is missing on my code.
    There is someone can help.
    The fields is type string and the value is :
    <Containers> <Container workitemid = "00000017" IsParent = "X"><Element name = "_WF" value = "USI029"/><Element name = "_WF_PRIOR" value = "5"/><Element name = "_WF_VERSION" value = "0000"/><Element name = "_WF_NESTING_LEVEL" value = ""/><Element name = "XUBNAME" value = ""/><Element name = "XUACCNT" value = ""/><Element name = "SHORTTEXT" value = ""/><Element name =
    i use the call transformation code and there i put this code:
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
    <tt:root name="XML_TAB"/>
      <tt:template>
        <Containers>
          <tt:loop name="a" ref=".XML_TAB">
            <Container>
              <tt:attribute name="Element name" value-ref="$a.name"/>
              <tt:attribute name="value" value-ref="$a.value"/>
            </Container>
          </tt:loop>
        </Containers>
      </tt:template>
    </tt:transform>
    I think that i miss something with the line :<Container workitemid = "0000007" IsParent = "X">
    the dump is:
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_ST_MATCH_ATTRIBUTE', was not
      caught and
    therefore caused a runtime error.
    The reason for the exception is:
    XML matching error
    Expected was attribute: "Elementname" [ ] Read was element-start: "Container" [
    Please help
    Regards
    Chris
    Edited by: Chris Teb on Aug 6, 2009 9:57 AM

    H Siva,
    Thanks ,
    I try exactly like u tell and i get this dump:
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_ST_MATCH_ELEMENT', was not caught
      and
    therefore caused a runtime error.
    The reason for the exception is:
    XML matching error
    Expected was element-end: "Containers" [ ] Read was element-start: "Container"
    <Containers>
        <Container>
            <tt:loop name="a" ref=".XML_TAB">
            <Element >
              <tt:attribute name="name" value-ref="$a.name"/>
              <tt:attribute name="value" value-ref="$a.value"/>
              </Element>
              </tt:loop>
            </Container>
        </Containers> ->**the dump in the debugger is here .**
      </tt:template>
    </tt:transform>
    Any Idea?
    Regards
    Chris

  • Question about XML mapping to ABAP internal table

    Hi experts.
    I'm trying to XML mapping. But it doesn't work well. Assume there are XML file as below.
    <HEADER>
      <ITEM>
        <FOO>123</FOO>
        <BAR>ABC</BAR>
      </ITEM>
      <ITEM>
        <FOO>456</FOO>
        <BAR>DEF</BAR>
      </ITEM>
    <HEADER>
    and I want to trasformation it as below.
    ITAB
    FOO       |      BAR
    123         |  ABC
    456         | DEF
    How could I trasformation using "call transformation"?
    Regards.

    Hi,
    REPORT  zind_xml_to_sap NO STANDARD PAGE HEADING.
    Data Declaration                                                    *
    DATA: client      TYPE REF TO if_http_client, "Interface
          host        TYPE string,
          port        TYPE string,
          proxy_host  TYPE string,
          proxy_port  TYPE string,
          path        TYPE string,
          scheme      TYPE i,
          xml         TYPE xstring,
          response    TYPE string.
    DATA: t_xml       TYPE smum_xmltb OCCURS 0 WITH HEADER LINE.  "XML Table structure used
                                                                  "for retreive and output XML doc
    DATA: g_stream_factory TYPE REF TO if_ixml_stream_factory.    "Interface
    DATA : return  LIKE  bapiret2 OCCURS 0 WITH HEADER LINE.      "XML Table structure used for retreive
                                                                  "and output XML doc
    Parameters                                                          *
    PARAMETER : p_add TYPE string LOWER CASE ,
                p_dfile   LIKE rlgrap-filename.
    AT Selection-Screen on value-request for file                       *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dfile.
    Get file
      PERFORM 100_get_file.
    Start-of-Selection                                                  *
    START-OF-SELECTION.
    Perform to upload xml data from URL to SAP internal table
      PERFORM 200_xml_upload.
      IF t_xml[] IS NOT INITIAL.
      Perform to Download data from Internal Table to a text file in local drive
        PERFORM 300_download.
        write : / 'Data Uploaded to Internal Table Successfully'.
        write : / 'XML Data Downloaded to Local path', p_dfile.
      else.
        write : / 'No Data for upload'.
      ENDIF.
    *if t_xml[] is INITIAL.
    WRITE : address, 'Given URl cannot be Converted' .
    else.
    LOOP AT t_xml .
       WRITE:  t_xml-cname, t_xml-cvalue.
    ENDLOOP.
    endif.
    *&      Form  get_file
          Get File
    FORM 100_get_file .
      CALL FUNCTION 'F4_FILENAME'
      EXPORTING
        PROGRAM_NAME        = SYST-CPROG
        DYNPRO_NUMBER       = SYST-DYNNR
        FIELD_NAME          = ' '
       IMPORTING
         file_name           = p_dfile
    ENDFORM.                    " 100_get_file
    *&      Form  200_xml_upload
          form to upload xml data from URL to SAP internal table
    FORM 200_xml_upload .
    *Check HTTP:// and concatenate
      IF p_add NS 'http://' OR p_add NS 'HTTP://'.
        CONCATENATE 'http://' p_add
                    INTO p_add.
      ENDIF.
    Fetching the address of the URL
      CALL METHOD cl_http_client=>create_by_url
        EXPORTING
          url    = p_add
        IMPORTING
          client = client.
    *Structure of HTTP Connection and Dispatch of Data
      client->send( ).
    *Receipt of HTTP Response
      CALL METHOD client->receive
        EXCEPTIONS
          http_communication_failure = 1
          http_invalid_state         = 2
          http_processing_failed     = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        IF sy-subrc = 1.
          MESSAGE 'HTTP COMMUNICATION FAILURE' TYPE 'I' DISPLAY LIKE 'E'.
          EXIT.
        ELSEIF sy-subrc = 2.
          MESSAGE 'HTTP INVALID STATE' TYPE 'I' DISPLAY LIKE 'E'.
          EXIT.
        ELSEIF sy-subrc = 3.
          MESSAGE 'HTTP PROCESSING FAILED' TYPE 'I' DISPLAY LIKE 'E'.
          EXIT.
        ELSE.
          MESSAGE 'Problem in HTTP Request' TYPE 'I' DISPLAY LIKE 'E'.
          EXIT.
        ENDIF.
      ENDIF.
    Get data of the xml to Response
      response = client->response->get_cdata( ).
    *FM converting the XML format to abap
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          text   = response
        IMPORTING
          buffer = xml.
    *FM converting XMl to readable format to a internal table.
      CALL FUNCTION 'SMUM_XML_PARSE'
        EXPORTING
          xml_input = xml
        TABLES
          xml_table = t_xml
          return    = return.
    ENDFORM.                    " 200_xml_upload
    *&      Form  300_download
    *form to Download data from Internal Table to a text file in local drive
    FORM 300_download .
      DATA filename TYPE string.
      filename = p_dfile.
      CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = filename
        WRITE_FIELD_SEPARATOR           = 'X'
      TABLES
        data_tab                        = t_xml
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22
      IF sy-subrc <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.

  • Reading XML file to ABAP internal table

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

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

  • Read dimension member(master data) to ABAP internal table  in BPC 10.0 NW

    Hi all,
    I manage to read transaction data using this example [replacement for IF_UJ_MODEL~GET_APPL_DATA;
    I am now trying to read members(master data) from a dimension to a ABAP internal table but I have no idea how to.
    Can anyone advise me on how to read members(master data) from a dimension to a ABAP internal table.
    Some sample code would be really appreciated.
    Regards
    Edited by: HK Kang on Jan 3, 2012 4:26 AM

    Hi Chanaveer,
    UJD_ADMIN_RUN_OPTIMIZE can be used only for executing the FULL & LITE OPTIMIZER packages.
    Looking at the code of UJD_RUN_OPTIMIZE_PACKAGE it seems this FM can be used to trigger process chain from BW.
    Please refer below link on SDN showing how to load Master Data on FLY in SAP BPC 10.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2020b522-cdb9-2e10-a1b1-873309454fce?QuickLink=index&overridelayout=true
    Thanks,
    Rohit

  • XML Processing (XML file data to ABAP internal table).

    Hi,
    I have a an XML file and i need to send the data to internal table. I suppose i have written the program correctly.
    But the transformation program may not be correct.
    So can one please tell me the transformation program c o d e or guide me to write the transformation code. Below are details of XML file and my program.
    XML File
    <?xml version="1.0" encoding="UTF-8" ?>
    - <aeRequestOutputType>
    + <trackingInfo>
    + <JMSHeaders>
    - <ns:__caret_reply_caret_ZBAPI xmlns:ae="http://www.tibco.com/" xsi:type="ns:__caret_reply_caret_ZBAPI_">
    + <RETURN>
    - <T__TRADE__DATA>
    - <item>
      <BUKRS>1111</BUKRS>
      <HKONT>22222</HKONT>
      </item>
    - <item>
      <BUKRS>3333</BUKRS>
      <HKONT>44444</HKONT>
      </item>
      </T__TRADE__DATA>
      </ns:__caret_reply_caret_ZBAPI__TRADE__ACC__DOC__POST_caret_ZBAPI__TRADE__ACC__DOC__POST>
      </aeRequestOutputType>
    My Program
    REPORT  ZTEST13.
    DATA : BEGIN OF itab OCCURS 0,
              f(255) TYPE c,
         END OF itab.
    DATA : t001 TYPE TABLE OF ZTEST_ST_UB. "(structure has few variables like hkont,bukrs)
    DATA: xmlupl TYPE string .
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                       =  'c:\sap_output_xml.txt'
       FILETYPE                        = 'ASC'
      tables
        data_tab                      = itab          .
    LOOP AT itab.
    CONCATENATE xmlupl itab-f INTO xmlupl.
    ENDLOOP.
    CALL TRANSFORMATION ZTEST_ST_UB2
    SOURCE XML xmlupl
    RESULT root = t001.

    Hi,
    use class cl_xml_document and method import_from_file inorder to read the xml file to internal table.
    go trough this [LINK|http://wiki.sdn.sap.com/wiki/display/ABAP/UploadXMLfiletointernal+table] for detial code.
    Regards,
    Shanmugavel chandrasekaran

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

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

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

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

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

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

  • Conversion of PDF file data  into ABAP internal table

    Hi all,
    I am unable to convert the binary data into text format by using some function modules and classes .please find tthe function modules names and classes:
    SCMS_BINARY_TO_TEXT,SCMS_BIN_TO_TEXT, CL_ABAP_CONV_IN_CE,CL_ABAP_CONV_OBJ. But these are not working as per my requirement.
    My requirement is we need to upload PDF file (legecy file)which is saved under the PC into SAP and display the same PDF data into the adobe interactive form. For thise i have done coding by using above function modules and classes but i got the unwant on the adobe form i.e display lke "##############$$%%^^&&*((((()))%%%%%%###*^^&&***"
    Thanks,
    Ramana

    I don't understand, the pdf is put into an internal table at
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF
    the table is pdf and all info for the pdf is there already in a table?
    if you continue the source code the only thing is that the table is combined with a file name and makes it happen that you get an actual file.
    or do you want to have the pdf in a single field ?
    or do you want to store the document on a server where the location is stored in an internal table ??
    kind regards
    arthur de smidt

  • Generating an XML Document from an internal table in ABAP

    Good day to all of you;
    With ABAP, in the R/3 system, I'm trying to figure out a way to accomplish the following:
    1) SELECT a set of Purchase Order data into an internal table.
    2) Generate an XML document, containing the above data, using a specific schema.
    I've been playing around with function module SAP_CONVERT_TO_XML_FORMAT which has the following interface:
    CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
          EXPORTING
          I_FIELD_SEPERATOR    = ''
          I_LINE_HEADER        = ''
            I_FILENAME           = v_fname
          I_APPL_KEEP          = ''
          I_XML_DOC_NAME      = v_docname
          IMPORTING
            PE_BIN_FILESIZE      = v_byte
          TABLES
            I_TAB_SAP_DATA       = i_SapData
          CHANGING
            I_TAB_CONVERTED_DATA = i_XMLData
          EXCEPTIONS
            CONVERSION_FAILED    = 1
            OTHERS               = 2.
    I'm uncertain as to whether or not the Export parameter, I_XML_DOC_NAME refers to some schema or definition and therefore have been excluding it.  In doing so, the generated XML document seems to use the field name/type information from my itab for the tags.
    If this function module requires an XML Document Name, how do I create one and where do I store it in R/3?  If this is not the recommended solution, is anyone familiar with a way to load an XML schema, retrieve some data then have SAP generate an XML document using the schema?
    Many thanks for any help available.
    T

    Hai Phillips
    Try with the following Code
    This program exports an internal table to an XML file.
    Report ZPRUEBA_MML_13 *
    Export an internal table to XML document *
    NO BORRAR ESTE CODIGO *
    REPORT ZPRUEBA_MML_13.
    PANTALLA SELECCION *
        PARAMETERS: GK_RUTA TYPE RLGRAP-FILENAME.
    PANTALLA SELECCION *
    TYPE TURNOS *
    TYPES: BEGIN OF TURNOS,
        LU LIKE T552A-TPR01,
        MA LIKE T552A-TPR01,
        MI LIKE T552A-TPR01,
        JU LIKE T552A-TPR01,
        VI LIKE T552A-TPR01,
        SA LIKE T552A-TPR01,
        DO LIKE T552A-TPR01,
    END OF TURNOS.
    TYPE TURNOS *
    TYPE SOCIO *
    TYPES: BEGIN OF SOCIO,
        NUMERO LIKE PERNR-PERNR,
        REPOSICION LIKE PA0050-ZAUVE,
        NOMBRE LIKE PA0002-VORNA,
        TURNOS TYPE TURNOS,
    END OF SOCIO.
    TYPE SOCIO *
    ESTRUCTURA ACCESOS *
    DATA: BEGIN OF ACCESOS OCCURS 0,
        SOCIO TYPE SOCIO,
    END OF ACCESOS.
    ESTRUCTURA ACCESOS *
    START OF SELECTION *
    START-OF-SELECTION.
        PERFORM LLENA_ACCESOS.
        PERFORM DESCARGA_XML.
    END-OF-SELECTION.
    END OF SELECTION *
    FORM LLENA_ACCESOS *
    FORM LLENA_ACCESOS.
    REFRESH ACCESOS.
    CLEAR ACCESOS.
    MOVE: '45050' TO ACCESOS-SOCIO-NUMERO,
                  'MOISES MORENO' TO ACCESOS-SOCIO-NOMBRE,
                  '0' TO ACCESOS-SOCIO-REPOSICION,
                  'T1' TO ACCESOS-SOCIO-TURNOS-LU,
                  'T2' TO ACCESOS-SOCIO-TURNOS-MA,
                  'T3' TO ACCESOS-SOCIO-TURNOS-MI,
                  'T4' TO ACCESOS-SOCIO-TURNOS-JU,
                  'T5' TO ACCESOS-SOCIO-TURNOS-VI,
                  'T6' TO ACCESOS-SOCIO-TURNOS-SA,
                  'T7' TO ACCESOS-SOCIO-TURNOS-DO.
    APPEND ACCESOS.
    CLEAR ACCESOS.
    MOVE: '45051' TO ACCESOS-SOCIO-NUMERO,
                  'RUTH PEÑA' TO ACCESOS-SOCIO-NOMBRE,
                  '0' TO ACCESOS-SOCIO-REPOSICION,
                  'T1' TO ACCESOS-SOCIO-TURNOS-LU,
                  'T2' TO ACCESOS-SOCIO-TURNOS-MA,
                  'T3' TO ACCESOS-SOCIO-TURNOS-MI,
                  'T4' TO ACCESOS-SOCIO-TURNOS-JU,
                  'T5' TO ACCESOS-SOCIO-TURNOS-VI,
                  'T6' TO ACCESOS-SOCIO-TURNOS-SA,
                  'T7' TO ACCESOS-SOCIO-TURNOS-DO.
    APPEND ACCESOS.
    ENDFORM.
    FORM LLENA_ACCESOS *
    FORM DESCARGA_XML *
    FORM DESCARGA_XML.
    DATA: L_DOM TYPE REF TO IF_IXML_ELEMENT,
                  M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
                  G_IXML TYPE REF TO IF_IXML,
                  W_STRING TYPE XSTRING,
                  W_SIZE TYPE I,
                  W_RESULT TYPE I,
                  W_LINE TYPE STRING,
                  IT_XML TYPE DCXMLLINES,
                  S_XML LIKE LINE OF IT_XML,
                  W_RC LIKE SY-SUBRC.
    DATA: XML TYPE DCXMLLINES.
    DATA: RC TYPE SY-SUBRC,
    BEGIN OF XML_TAB OCCURS 0,
                  D LIKE LINE OF XML,
    END OF XML_TAB.
    CLASS CL_IXML DEFINITION LOAD.
    G_IXML = CL_IXML=>CREATE( ).
    CHECK NOT G_IXML IS INITIAL.
    M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
    CHECK NOT M_DOCUMENT IS INITIAL.
    WRITE: / 'Converting DATA TO DOM 1:'.
    CALL FUNCTION 'SDIXML_DATA_TO_DOM'
    EXPORTING
                  NAME = 'ACCESOS'
                  DATAOBJECT = ACCESOS[]
    IMPORTING
                  DATA_AS_DOM = L_DOM
    CHANGING
                  DOCUMENT = M_DOCUMENT
    EXCEPTIONS
                  ILLEGAL_NAME = 1
                  OTHERS = 2.
    IF SY-SUBRC = 0.
                  WRITE 'Ok'.
    ELSE.
                  WRITE: 'Err =',
                  SY-SUBRC.
    ENDIF.
    CHECK NOT L_DOM IS INITIAL.
    W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
    IF W_RC IS INITIAL.
                  WRITE 'Ok'.
    ELSE.
                  WRITE: 'Err =',
                  W_RC.
    ENDIF.
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
    EXPORTING
                  DOCUMENT = M_DOCUMENT
    IMPORTING
                  XML_AS_STRING = W_STRING
                  SIZE = W_SIZE
    TABLES
                  XML_AS_TABLE = IT_XML
    EXCEPTIONS
                  NO_DOCUMENT = 1
                  OTHERS = 2.
    IF SY-SUBRC = 0.
                  WRITE 'Ok'.
    ELSE.
                  WRITE: 'Err =',
                  SY-SUBRC.
    ENDIF.
    LOOP AT IT_XML INTO XML_TAB-D.
                  APPEND XML_TAB.
    ENDLOOP.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
                  BIN_FILESIZE = W_SIZE
                  FILENAME = GK_RUTA
                  FILETYPE = 'BIN'
    TABLES
                  DATA_TAB = XML_TAB
    EXCEPTIONS
                  OTHERS = 10.
    IF SY-SUBRC <> 0.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    FORM DESCARGA_XML *
    Thanks & regards
    Sreenivasulu P

  • To convert XML to ABAP internal table can we do it with DOM or we need XSLT

    I have a requirement where I need to collect the data from XML file into an internal table.
    I need to collect this data into an internal table as I should make use of this data and do Goods Receipt in SAP.
    My XML file is very very complex and the child nodes in my XML file may occur ones or 10 times and change dynamically.
    I want to know if XML to ABAP internal table is possible with DOM or does it need XSLT too.
    I used the blog of Robert which uses DOM, but it I am unable to collect the data in internal table. The blog explains only how to wtite the out put to screen as element and value.
    I want to know if XML to ABAP internal table is possible with DOM or do I need XSLT too? I am confused please help.
    Any help will be highly appreciated.
    Regards,
    Jessica Sam

    Hello Jessica
    Why not using the DOM itself for processing?
    Below you see the post-processing coding which I use to add the interchange control number (ICN) into an EDI message (which at this stage is still an XML-EDI stream). This is done on SAP-XI yet on the ABAP stack so you could use this approach on your R/3 system as well.
    method POSTPROCESSING.
    * Post-Processing of outbound EDI invoices & dispatch advices
      me->map_icn( ).
    endmethod.
    method MAP_ICN.
    * define local data
      DATA: lo_node       TYPE REF TO if_ixml_node,
            ld_name       TYPE string,
            ld_value      TYPE string,
            ld_error_code type MPG_ERRCODE,
    **        ld_control_number   TYPE char13,
            ld_rc         TYPE i,
            ld_msg        TYPE string.  " bapi_msg.
      DATA: ld_interface  TYPE string.
      DATA: incode TYPE REF TO if_ixml_node_collection.
      LOG-POINT ID zedi
        SUBKEY mc_subkey_method_trace.
      ld_error_code = md_clsname.
    * Get next interchange control number (ICN)
      me->md_next_number = me->get_next_number(
          id_nrobj  = me->md_nrobj   " Object (SNRO)
          id_nrnr   = me->md_nrnr ). " Number Range
      CALL METHOD zcl_edi_uk_counter=>calculate_modulo_n09
        EXPORTING
          id_input  = me->md_next_number
        receiving
          rd_output = me->md_next_number.
    * Build ICN according to naming conventions agreed with EDI customer
      me->md_icn = me->generate_icn( me->md_next_number ).
      ld_value = me->md_icn.  " type conversion to string
      CLEAR: incode,
             lo_node.
      incode  = me->mo_document->get_elements_by_tag_name( mc_d_0020 ).
      lo_node = incode->get_item( index = 0 ).
      CALL METHOD lo_node->set_value
        EXPORTING
          value = ld_value
        RECEIVING
          rval  = ld_rc.
      IF ( ld_rc NE 0 ).
        CONCATENATE 'Error [' mc_d_0020
                    ']: Method SET_VALUE (IF_IXML_NODE)'
                    INTO ld_msg.
        CONDENSE ld_msg.
        me->mif_trace->trace2( message = ld_msg ).
        RAISE EXCEPTION TYPE cx_mapping_fault
          EXPORTING
    *        textid =
    *        previous =
            error_code = ld_error_code
            error_text = ld_msg.
    **    MESSAGE ld_msg TYPE 'A'.
      ENDIF.
      CLEAR: incode,
             lo_node.
      incode  = me->mo_document->get_elements_by_tag_name( mc_d_0020_2 ).  " element for ICN
      lo_node = incode->get_item( index = 0 ).
      CALL METHOD lo_node->set_value
        EXPORTING
          value = ld_value
        RECEIVING
          rval  = ld_rc.
      IF ( ld_rc NE 0 ).
        CONCATENATE 'Error [' mc_d_0020_2
                    ']: Method SET_VALUE (IF_IXML_NODE)'
                    INTO ld_msg.
        CONDENSE ld_msg.
        me->mif_trace->trace2( message = ld_msg ).
        RAISE EXCEPTION TYPE cx_mapping_fault
          EXPORTING
    *        textid =
    *        previous =
            error_code = ld_error_code
            error_text = ld_msg.
    **    MESSAGE ld_msg TYPE 'A'.
      ENDIF.
    * define local data
      DATA: ls_record       TYPE mpp_dynamic.
      CLEAR: ls_record.
      ls_record-namespace = mc_dynamic_namespace.
      ls_record-name      = mc_icn.
      ls_record-value     = ld_value.
      mif_dynamic->add_record( ls_record ).
    endmethod.
    In your case you would need to do a DO...ENDDO loop until you parsed all required nodes.
    NOTE: ME->MO_DOCUMENT is of TYPE REF TO IF_IXML_DOCUMENT.
    Regards
       Uwe

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

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

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

  • Read data from xml files and  populate internal table

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

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

  • Sending data from final internal table  to application server in xml format

    hi to all ,
    can anyone send details about send data from final internal table to application server in xml format.right now i am able to download data to presentation server in xml format . love to here soon from all the abap gigs.

    welcome to SDN.
    are you using call transformation to convert itab to XML? the XML string is in which format?
    convert it to xstring and then use the following code to store it in application server.
    OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
    TRANSFER XML_content TO FNAME.
    CLOSE DATASET FNAME.
    where fname is the path to the file name.
    Regards
    Raja

  • Xml to abap internal table by using a dynamic internal table at runtime

    Hi ,
          I have a requirement to convert xml to abap internal table . But the requirement is that i need to create internal table according to the XML .
    Ex : If my XML is :
    <?xml version="1.0" ?>
    - <flights>
    - <airline code="AA" name="American Airlines">
    - <flight number="0017">
      <from airport="JFK">NEW YORK,US</from>
      <to airport="SFO">SAN FRANCISCO,US</to>
      <departure>110000</departure>
      <arrival>140100</arrival>
      <type>Scheduled</type>
      </flight>
    - <flight number="0064">
      <from airport="SFO">SAN FRANCISCO,US</from>
      <to airport="JFK">NEW YORK,US</to>
      <departure>090000</departure>
      <arrival>172100</arrival>
      <type>Scheduled</type>
      </flight>
      </airline>
    So after conversion my abap internal table shoul have fields as :
    airline_code     Name      flight_number   from_airport    to_airport      departure         arrival      type
    and the field values should be corresponding field values .
    Thanks in advance .
    Regards .

    Hi Ujjwal,
    use
    CALL TRANSFORMATION
    Study the online documentation and if required do some search for CALL TRANSFORMATION and/or XML PARSER
    And, when coming back here with next question, tell us what searches you did with what results - please always follow the 'search before post' rule, thank you.
    Regards,
    Clemens

Maybe you are looking for

  • Re: [iPlanet-JATO] using begin childName Display method

    Oops. Sorry about that, Craig. I didn't realize I might leave that impression. I'm sure the tiled views work since you have so many examples of these and it's a relatively simple concept, isn't it? Not to mention a necessary one. I didn't have time t

  • How do i import photos from iphone to windows pc without the autoplay

    My phone doesnt have space anymore for me to upgrade IOS7 and would really appreacite if someone could help. i have to import pictures to my computer and somehow that autoplay option is not coming on and also the phone is not showling under the remov

  • The stock in transit field is not visible in MD04

    Hi Team Stock in transit visible on MD04 STPO 28801084 is internal stock transfer from FI25 to FI28. Qty of PO is visible in the ´stock in transit´ field on SAO transaction MD04 under plant FI28 when corresponding delivery  1202400481 have been PGId 

  • Did copy paste between projects get lost in LG 9?

    A thing I often did in LG 8, was copying a bunch of midi regions from one LG project to another. It was brilliant, as you just select the regions in one sequence, copy them, go to the other sequence, hit paste and it would ask if I wanted to paste th

  • Error when calling the method in service

    Now I know how to give certain parameters to the service when invoking the call asked in the previous thread, but I got errors when I try to run it: namespace mismatch require http://myservices.supermarket found none java.net.MalformedURLException