Saving xml in abap table

Hello,
as a novice to abap, i have the following question:
I want to save a string containing a large xml content into an abap table and also additional fields to the same table.
Could you provide some advice?
Thanks in advance,
Peter Ha

do you mean storing it in DB table. if so check out the sample code given in the following thread
Re: How to store big XML string  in ABAB DB
Regards
Raja

Similar Messages

  • Error while saving xml document in table

    I am using dbms_xmlsave.insert to
    insert records in the table.
    The procedure works fine when the xml file size is less then 1 Mb.
    But when the file size is around 4 MB
    I get the error java.lang.outofMemoryError.
    Is there any limitation of number of records that can be saved or is there any parameter or any file required to be tuned.
    null

    Try increase JAVA_POOL size or set BATCH_SIZE
    to be small.

  • 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

  • XML to ABAP internal table conversion

    Hi Guys,
      Via debugging,I downloaded the context of an ABAP webdynpro application into an XML file on my desktop. Now I want to use this file as an input to a FM. This is what I have done for it
    1) Used the GUI_UPLOAD fm to convert the xml file on my desktop into xstring
    2)  used transformation like this
      CALL TRANSFORMATION id
      SOURCE xml  = ls_xml_xstring
      RESULT para = lt_result.
    lt_result is of the type that the FM input expects
    step 2 does not work. I know I am missing something there. Pls tell me what it is. Its a huge file and I dont want to manually create the input.
    BR,
    Girish

    Hi,
    Have you seen this weblogs which talks about this:
    /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
    /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
    /people/r.eijpe/blog/2006/02/19/xml-dom-processing-in-abap-part-iiia150-xml-dom-within-sap-xi-abap-mapping
    /people/r.eijpe/blog/2006/02/20/xml-dom-processing-in-abap-part-iiib150-xml-dom-within-sap-xi-abap-mapping
    Hope this helps you....
    Regards
    Nishant Malhotra

  • 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

  • XML to internal table conversion within ABAP mapping class

    I am doing a ABAP mapping for file to Idoc. My requirement is to convert XML file into ABAP internal table (within ABAP mapping class). Is there any standard FM, method, transformation etc, which can be used here.
    Thanks, Dehra

    Dehra,
    Have you seen this weblogs which talks about this:
    /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
    /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
    /people/r.eijpe/blog/2006/02/19/xml-dom-processing-in-abap-part-iiia150-xml-dom-within-sap-xi-abap-mapping
    /people/r.eijpe/blog/2006/02/20/xml-dom-processing-in-abap-part-iiib150-xml-dom-within-sap-xi-abap-mapping
    Hope this helps you....
    ---Satish

  • XSLT transformation for XML to ABAP internal table

    Hi, can anyone please tell me how it should be the xslt tranformation to conver this xml
    <Embargos_ARBA_DOC>
         <ns:Embargos_ARBA_MT
              xmlns:ns="un:swissmedical:sap:proxy:embargos_arba:file">
              <Embargos_ARBA_MT>
                   <FECHA>20081101</FECHA>
                   <CUIT>50000002124</CUIT>
                   <MONTO>0000013794090</MONTO>
                   <RAZON_SOCIAL>RAUL ARMANDO CUNQUEIRO S.A.C.I.</RAZON_SOCIAL>
              </Embargos_ARBA_MT>
              <Embargos_ARBA_MT>
                   <FECHA>20081101</FECHA>
                   <CUIT>55000001456</CUIT>
                   <MONTO>0000001144410</MONTO>
                   <RAZON_SOCIAL>PARODI ESTEBAN ARMANDO</RAZON_SOCIAL>
              </Embargos_ARBA_MT>
         </ns:Embargos_ARBA_MT>
    </Embargos_ARBA_DOC>
    to this abap Table....
      DATA: BEGIN OF i_embargos_arba_doc occurs 0,
              fecha TYPE d,
              cuit TYPE char11,
              monto TYPE char13,
              razon_social(120),
            END OF i_embargos_arba_mt.
    so i can transform it with this sentence
          CALL TRANSFORMATION ('embargos_transformation')
            SOURCE XML source
            RESULT Embargos_ARBA_DOC = embargos.
    pls i need help because i am unable to create this xslt transformation...
    I will give the highest rewards points to the one who can help me.
    thanks!
    mariano

    Hi Mariano
    Why you need to use XSLT for transforming XML file into ABAP table
    Code is a part of some ABAP report. Looks like it is reading a file from file system and updating table after transformation
    If you have requirement like you need to read XML file and then insert the data into a SAP table
    You can use
    File to RFC
    File to Proxy scenario using SAP PI.
    Please provide more inputs on requirement to help
    Thanks
    Gaurav

  • Defining XSLT from Abap to XML and XML to Abap (Internal Table)

    Hi Experts, I need help with this XSLT for call transformation. I have defined an internal table and intend to use it as a source for Call Tranformation. But I have a Problem defining its XSLT and help would be greatly appreciated! I also wonder if this XSLT can be used for XML to internal table? Or do I have to define another XSLT again.... Hope to hear from any of u soon!
    CODES->>>
    TYPES: BEGIN OF CONTENT,
             CONTENT1(20),
             CONTENT2(20),
           END OF CONTENT.
    TYPES: T_CONTENT TYPE TABLE OF CONTENT.
    DATA: BEGIN OF I_DATA OCCURS 0,
            KEY1(10),
            KEY2(10),
            CONT TYPE T_CONTENT,
          END OF I_DATA.
    DATA: WA_TBL TYPE CONTENT.
    DATA: LI_TBL TYPE T_CONTENT.
    START-OF-SELECTION.
    populate data 1
      CLEAR I_DATA.
      I_DATA-KEY1 = 'AMI'.
      I_DATA-KEY2 = 'LEE'.
      CLEAR WA_TBL.
      REFRESH LI_TBL.
      WA_TBL-CONTENT1 = 'PENHAS ROAD'.
      WA_TBL-CONTENT2 = 'SG'.
      APPEND WA_TBL TO LI_TBL.
      WA_TBL-CONTENT1 = 'GILLMAN ROAD'.
      WA_TBL-CONTENT2 = 'SG'.
      APPEND WA_TBL TO LI_TBL.
      I_DATA-CONT = LI_TBL.
      APPEND I_DATA.
    populate data 1
      CLEAR I_DATA.
      I_DATA-KEY1 = 'KAI'.
      I_DATA-KEY2 = 'LEE'.
      CLEAR WA_TBL.
      REFRESH LI_TBL.
      WA_TBL-CONTENT1 = 'SUNSET WAY'.
      WA_TBL-CONTENT2 = 'SG'.
      APPEND WA_TBL TO LI_TBL.
      WA_TBL-CONTENT1 = 'BEDOK NORTH'.
      WA_TBL-CONTENT2 = 'SG'.
      APPEND WA_TBL TO LI_TBL.
      I_DATA-CONT = LI_TBL.
      APPEND I_DATA.
    call transformation (xslt)
        source i_data = i_data
        result xml xmlstr.

    here is the code sample using ixml library .
    just create a report program and copy paste the following code.
    if time permits, later on i will post the xslt program which you can use it call transformation.
    REPORT  y_test_xml.
    DATA: l_ixml                                 TYPE REF TO if_ixml,
            l_ixml_sf                              TYPE REF TO if_ixml_stream_factory,
            l_istream                              TYPE REF TO if_ixml_istream,
            l_ostream                              TYPE REF TO if_ixml_ostream,
            l_booklist                   TYPE REF TO if_ixml_element,
            l_document                             TYPE REF TO if_ixml_document,
            l_parser                               TYPE REF TO if_ixml_parser,
            l_root_element                         TYPE REF TO if_ixml_element,
            l_book_record                            TYPE REF TO if_ixml_element,
            l_date TYPE REF TO if_ixml_element ,
                    l_time TYPE REF TO if_ixml_element ,
            l_book_group                            TYPE REF TO if_ixml_element,
            l_book_cat                            TYPE REF TO if_ixml_element ,
            others                                  TYPE REF TO if_ixml_element ,
            link                                    TYPE REF TO if_ixml_element ,
            description                            TYPE REF TO if_ixml_element ,
            xml                                    TYPE xstring ,
            size TYPE  i ,
             l_xml  TYPE REF TO cl_xml_document  .
    DATA: xml_out TYPE string ,
          temp_string TYPE string .
    TYPES: BEGIN OF add_category,
    category_id(10),
    category_desc(40),
    END OF add_category,
    add_t_category TYPE add_category OCCURS 0 .
    TYPES: BEGIN OF add_book_grp,
    book_category TYPE add_t_category,
    END OF add_book_grp,
    add_t_book_grp TYPE add_book_grp OCCURS 0.
    TYPES: BEGIN OF add_book,
    book_num(10) TYPE c,
    short_desc(40) TYPE c,
    book_group TYPE add_t_book_grp,
    END OF add_book,
    add_t_book TYPE add_book OCCURS 0.
    TYPES: BEGIN OF type_data,
    date TYPE sy-datum,
    time TYPE sy-uzeit,
    book_record TYPE add_t_book,
    END OF type_data.
    DATA: i_data TYPE type_data OCCURS 0 WITH HEADER LINE.
    DATA: itab LIKE soli OCCURS 0 WITH HEADER LINE.
    DATA: cat_wa TYPE add_category ,
          bk_gp_wa TYPE add_book_grp ,
          bk_rec_wa TYPE add_book ,
          bk_wa LIKE LINE OF i_data .
    DATA: cat_tab TYPE STANDARD TABLE OF add_category ,
          bk_gp_tab TYPE STANDARD TABLE OF add_book_grp ,
          bk_rec_tab TYPE STANDARD TABLE OF add_book .
    MOVE: '03' TO cat_wa-category_id  ,
          ' BK GP 3' TO cat_wa-category_desc .
    APPEND cat_wa TO cat_tab .
    MOVE: '02' TO cat_wa-category_id  ,
          ' BK GP 2' TO cat_wa-category_desc .
    APPEND cat_wa TO cat_tab .
    bk_gp_wa-book_category  = cat_tab.
    APPEND bk_gp_wa TO bk_gp_tab .
    MOVE: '0012345678' TO bk_rec_wa-book_num ,
          'OMS book' TO bk_rec_wa-short_desc .
    bk_rec_wa-book_group = bk_gp_tab .
    APPEND bk_rec_wa TO bk_rec_tab .
    CLEAR:bk_gp_tab, cat_tab .
    REFRESH :bk_gp_tab, cat_tab .
    MOVE: '01' TO cat_wa-category_id  ,
          ' BK GP 1' TO cat_wa-category_desc .
    APPEND cat_wa TO cat_tab .
    MOVE: '09' TO cat_wa-category_id  ,
          ' BK GP 9' TO cat_wa-category_desc .
    APPEND cat_wa TO cat_tab .
    bk_gp_wa-book_category  = cat_tab.
    APPEND bk_gp_wa TO bk_gp_tab .
    MOVE: '00123456789' TO bk_rec_wa-book_num ,
          'SAP book' TO bk_rec_wa-short_desc .
    bk_rec_wa-book_group = bk_gp_tab .
    APPEND bk_rec_wa TO bk_rec_tab .
    MOVE: sy-datum TO bk_wa-date ,
          sy-uzeit TO bk_wa-time .
    bk_wa-book_record = bk_rec_tab .
    APPEND bk_wa TO i_data .
    CLEAR: cat_wa , bk_gp_wa ,bk_rec_wa , bk_wa .
    l_ixml = cl_ixml=>create( ).
    l_ixml_sf = l_ixml->create_stream_factory( ).
    l_document = l_ixml->create_document( ).
    l_root_element = l_document->create_element( name = 'asx:abap' ).
    l_root_element->set_attribute( name = 'xmlns:asx' value = 'http://www.sap.com/abapxml' ) .
    l_root_element->set_attribute( name = 'version' value = '1.0' ).
    l_document->append_child( new_child = l_root_element ).
    others = l_document->create_simple_element( parent = l_root_element name = 'asx:values' ).
    l_booklist = l_document->create_simple_element( parent = others name = 'BOOKLIST' ).
    LOOP AT i_data INTO bk_wa .
      CLEAR temp_string .
      MOVE: bk_wa-date TO temp_string .
      l_date = l_document->create_simple_element( parent = l_booklist name = 'DATE' value = temp_string  ).
      CLEAR temp_string .
      MOVE: bk_wa-time TO temp_string .
      l_time = l_document->create_simple_element( parent = l_booklist name = 'TIME' value = temp_string ).
      LOOP AT bk_wa-book_record INTO bk_rec_wa .
        l_book_record = l_document->create_simple_element( parent = l_booklist name = 'BOOK_RECORD' ) .
        CLEAR temp_string .
        MOVE: bk_rec_wa-book_num TO temp_string .
        l_date = l_document->create_simple_element( parent = l_book_record name = 'BOOK_NUM' value = temp_string ).
        CLEAR temp_string .
        MOVE: bk_rec_wa-short_desc TO temp_string .
        l_time = l_document->create_simple_element( parent = l_book_record name = 'SHORT_DESC' value = temp_string ).
        l_book_group = l_document->create_simple_element( parent = l_book_record name = 'BOOK_GROUP' ).
        LOOP AT bk_rec_wa-book_group INTO bk_gp_wa .
          LOOP AT bk_gp_wa-book_category INTO cat_wa .
            l_book_cat = l_document->create_simple_element( parent = l_book_group name = 'BOOK_CATEGORY' ).
            CLEAR temp_string .
            MOVE: cat_wa-category_id TO temp_string .
            l_date = l_document->create_simple_element( parent = l_book_cat name = 'CATEGORY_ID' value = temp_string ).
            CLEAR temp_string .
            MOVE: cat_wa-category_desc TO temp_string .
            l_time = l_document->create_simple_element( parent = l_book_cat name = 'CATEGORY_DESC' value = temp_string ).
          ENDLOOP .
        ENDLOOP .
      ENDLOOP .
    ENDLOOP .
    l_ostream = l_ixml_sf->create_ostream_xstring( xml ).
    l_document->render( ostream = l_ostream ).
    CREATE OBJECT l_xml.
    CALL METHOD l_xml->parse_xstring
      EXPORTING
        stream = xml.
    l_xml->render_2_string(
      EXPORTING
        pretty_print = 'X'
      IMPORTING
    *    RETCODE      = RETCODE
        stream       = xml_out
        size         = size
    CALL METHOD l_xml->display.
    Hope this is helpful.
    do let us know how it goes.
    Regards
    Raja

  • ABAP Table for DynamicConfiguration details of XML message in SXMB_MONI

    Dear All
    I have a requirement where I have to read the value from DCJMSCorreleationID property of message which is recorded in SXMB_MONI based on the SAP PI message ID.
    I have 2 interfaces as below
    Interface one (INT1) : JMS-PI-ECC --->Inbound interface to ECC when message is received on PI it will have DCJMSCorreleationID populated with some ID as shown below
    Go to SXMB_MONI -->Inbound Message ---> SOAP Header --->DynamicConfiguration
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <SAP:DynamicConfiguration SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
    <SAP:Record namespace="http://sap.com/xi/XI/System/JMS" name="DCJMSCorreleationID">
    a26c4276-9d5e-11e3-ba87-000004238292
    </SAP:Record>
    <SAP:Record namespace="http://sap.com/xi/XI/Message/30/general" name="senderAgreementGUID">dd3fb7c6b983314293e14ba59df1ad45</SAP:Record></SAP:DynamicConfiguration>
    Interface Two (INT2):-ECC-PI-JMS----> Outbound from ECC where I am passing a SAP PI Message ID for INT1 in one of the field
    Can I read this DCJMSCorreleationID for INT1 when INT2 is executed and have message ID for INT1 ?
    Where are these SOAP hearder porperties like DCJMSCorreleationID are stored on ABAP table?

    Thanks Jörg for your reply
    I have a back up plan for ZTable approach but the only concern there is RFC calls for read and write
    we have implemented a FM which gives the original payload using a std SAP functional modules FM SXMB_GET_XI_MESSAGE_INT and  ECATT_CONV_XSTRING_TO_STRING
    But I am looking for the SOAP Header information for DCJMSCorreleationID
    So if there is anything which will help to read this DCJMSCorreleationID property easily form existing message SOAP header is really helpful

  • Dynamic configuration- Is file name stored in any abap table in PI

    Hi.
    Is there any ABAP table in XI containing the dynamic configuration's xml of a message.
    For any file scenario Can I get the file name from any of the abap table in PI
    Regards,
    Deepak

    Interesting ABAP tables in XI
    Interesting ABAP tables in XI – Part I
    Regards,
    Phani

  • Dynamic configuration in ABAP tables

    Hi,
    is there any ABAP table in XI containing the dynamic configuration's xml of a message (or an equivalent information in any format)?
    Thanks,
    Daniele

    hi
    Dynamic configurations will be a part of the xi message header
    chk these tables
    1.SXMSPMAST: (Integration Engine: Message Queue (Master)) The table is the master table for the monitoring information. You can get the timestamp, interface status, message id, and many more information.
    2.SXMSPEMAS: (Integration Engine: Enhanced Message Queue (Master)) The table provides the namespaces, the business systems and message interfaces involved in the interface.
    3.SXMSMSTATT: (Exchange Infrastructure: Message Status Description) This table provides a message status description.
    4.SXMSMSTAT: (Exchange Infrastructure: Message Status) This table is helpful if you want to show the process status icon for the corresponding message state.
    refer this for code sample
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/909760cb-0ec8-2a10-4a96-ee8417acfbc9
    rgds
    arun

  • Transforming XML  into Internal Table

    Hi guys, I have tried a simple nested code but i fail to write in the Name, Phone and Email portion ... I manage to get to the header level... Can any one gimme some pointers?
    PS: I have read to those threads posted here already before I got this far
    <b><u>MAIN CODE</u></b>
    REPORT  ZTESTJASON11.
    TYPES: BEGIN OF T_HEADER,
            NAME(140),
            PHONE(23),
            EMAIL(100),
           END OF T_HEADER,
           D_HEADER TYPE T_HEADER OCCURS 0.
    TYPES: BEGIN OF T_ITEM,
            HEADER TYPE D_HEADER,
           END OF T_ITEM,
           D_ITEM TYPE T_ITEM OCCURS 0.
    TYPES: BEGIN OF T_LIST,
            ITEM TYPE D_ITEM,
           END OF T_LIST,
           D_LIST TYPE T_LIST OCCURS 0.
    TYPES: BEGIN OF TYPE_DATA,
            LIST TYPE D_LIST,
           END OF TYPE_DATA.
    DATA: RESPONSE TYPE TABLE OF TYPE_DATA.
    DATA: XMLOUT TYPE STRING.
    DATA: ITAB LIKE SOLI OCCURS 0 WITH HEADER LINE.
    DATA: HEADER_WA    TYPE T_HEADER,
          HEADER_LN    TYPE D_HEADER,
          ITEM_WA      TYPE T_ITEM,
          ITEM_LN      TYPE D_ITEM,
          LIST_WA      TYPE T_LIST,
          LIST_LN      TYPE D_LIST.
    MOVE:   'JIM BEAN' TO HEADER_WA-NAME,
            '+6512345678' TO HEADER_WA-PHONE,
            '[email protected]' TO HEADER_WA-EMAIL.
    APPEND HEADER_WA TO HEADER_LN.
    ITEM_WA-HEADER = HEADER_LN.
    APPEND ITEM_WA TO ITEM_LN.
    LIST_WA-ITEM = ITEM_LN.
    APPEND LIST_WA TO LIST_LN.
    myXML-LIST = LIST_LN.
    PERFORM UPLOAD_XML.
    FORM UPLOAD_XML .
    REFRESH ITAB.
    clear RESPONSE.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'C:test11.XML'
    filetype = 'BIN'
    TABLES
    data_tab = ITAB.
    LOOP AT ITAB.
      CONCATENATE XMLOUT ITAB-LINE INTO XMLOUT.
    ENDLOOP.
    CALL TRANSFORMATION ('ZTEST11X2A')
    SOURCE XML XMLOUT
    RESULT RESPONSE = RESPONSE.
    BREAK-POINT.
    ENDFORM.
    <b><u>XML CODE (test11.xml)</u></b>
    <?xml version="1.0" encoding="iso-8859-1"?>
    <myXML>
      <LIST>
        <ITEM>
          <HEADER>
            <NAME>JIM BEAN</NAME>
            <PHONE>+6512345678</PHONE>
            <EMAIL>[email protected]</EMAIL>
          </HEADER>
        </ITEM>
      </LIST>
    </myXML>           
    <b><u>XSLT CODE (ZTEST11X2A)</u></b>
    <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>
        <RESPONSE>
          <myXML>
           <LIST>
           <ITEM>
            <xsl:for-each select="ITEM">
                <I>
                    <HEADER>
                        <NAME> <xsl:value-of select="NAME"/> </NAME>
                        <PHONE> <xsl:value-of select="PHONE"/> </PHONE>
                        <EMAIL> <xsl:value-of select="EMAIL"/> </EMAIL>
                    </HEADER>
                </I>
             </xsl:for-each>
             </ITEM>
            </LIST>
            </myXML>
        </RESPONSE>
    </asx:values>
    </asx:abap>
    </xsl:template>
    </xsl:transform>

    Thanks a million in advance Raja, thanks for ur help, realli appreaciate it! ")
    Here it is...
    <u><b>MAIN CODE (itab declaration)</b></u>
    REPORT  ZTESTJASON11.
    TYPES: BEGIN OF T_HEADER,
            NAME(140),
            PHONE(23),
            EMAIL(100),
           END OF T_HEADER,
           D_HEADER TYPE T_HEADER OCCURS 0.
    TYPES: BEGIN OF T_ITEM,
            HEADER TYPE D_HEADER,
           END OF T_ITEM,
           D_ITEM TYPE T_ITEM OCCURS 0.
    TYPES: BEGIN OF T_LIST,
            ITEM TYPE D_ITEM,
           END OF T_LIST,
           D_LIST TYPE T_LIST OCCURS 0.
    TYPES: BEGIN OF TYPE_DATA,
            LIST TYPE D_LIST,
           END OF TYPE_DATA.
    DATA: RESPONSE TYPE TABLE OF TYPE_DATA.
    DATA: XMLOUT TYPE STRING.
    DATA: ITAB LIKE SOLI OCCURS 0 WITH HEADER LINE.
    DATA: HEADER_WA    TYPE T_HEADER,
          HEADER_LN    TYPE D_HEADER,
          ITEM_WA      TYPE T_ITEM,
          ITEM_LN      TYPE D_ITEM,
          LIST_WA      TYPE T_LIST,
          LIST_LN      TYPE D_LIST.
    MOVE:   'JIM BEAN' TO HEADER_WA-NAME,
            '+6512345678' TO HEADER_WA-PHONE,
            '[email protected]' TO HEADER_WA-EMAIL.
    APPEND HEADER_WA TO HEADER_LN.
    ITEM_WA-HEADER = HEADER_LN.
    APPEND ITEM_WA TO ITEM_LN.
    LIST_WA-ITEM = ITEM_LN.
    APPEND LIST_WA TO LIST_LN.
    myXML-LIST = LIST_LN.
    PERFORM UPLOAD_XML.
    FORM UPLOAD_XML .
    REFRESH ITAB.
    clear RESPONSE.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'C:test11.XML'
    filetype = 'BIN'
    TABLES
    data_tab = ITAB.
    LOOP AT ITAB.
      CONCATENATE XMLOUT ITAB-LINE INTO XMLOUT.
    ENDLOOP.
    CALL TRANSFORMATION ('ZTEST11X2A')
    SOURCE XML XMLOUT
    RESULT RESPONSE = RESPONSE.
    BREAK-POINT.
    ENDFORM.
    <u><b>XML CODE (test11.xml)</b></u>
    <?xml version="1.0" encoding="iso-8859-1"?>
    <myXML>
      <LIST>
        <ITEM>
          <HEADER>
            <NAME>JIM BEAN</NAME>
            <PHONE>+6512345678</PHONE>
            <EMAIL>[email protected]</EMAIL>
          </HEADER>
        </ITEM>
      </LIST>
    </myXML>          
    <u><b>XSLT CODE (ZTEST11X2A)</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>
          <RESPONSE>
          <myXML>
           <LIST>
            <ITEM>
            <xsl:for-each select="ITEM">
                <dataset1>
                        <HEADER>
                        <xsl:for-each select="HEADER">
                        <dataset2>
                                <NAME>
                                    <xsl:value-of select="NAME"/>
                                </NAME>
                                <PHONE>
                                    <xsl:value-of select="PHONE"/>
                                </PHONE>
                                <EMAIL>
                                    <xsl:value-of select="EMAIL"/>
                                </EMAIL>
                       </dataset2>
                       </xsl:for-each>
                       </HEADER>
                </dataset1>
             </xsl:for-each>
            </ITEM>
            </LIST>
            </myXML>
            </RESPONSE>
    </asx:values>
    </asx:abap>
    </xsl:template>
    </xsl:transform>

  • XML to ABAP - where the ABAP mapping?

    Dear experts,
    I have to do an ABAP mapping which I have never done before.
    I found blog:
    /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
    which shows the ABAP code.
    I use PI 7.1
    Questions:
    - But where in XI/PI do I implement this code?
    - How can I test the code while I write it?
    - Can I pick up the XML file to map from an FTP server?
    Thank you very much for your help!
    Best regards,
    Peter

    Hi,
    I dont think you really need to develop ABAP Mapping , you can achive this requirement using standard Graphical Mapping.
    But let me know which IDoc/rfc or table you want to update information.
    if it is bapi use RFC  IDoc go with IDoc adapter.
    elase try with proxies.
    normally it is not a best practive to implement ABAP Mapping,sometimes you experience perfromace issues.
    Regards,
    Raj

  • XML to ABAP Using XSLT

    Hello friends,
        I am trying a ABAP program (posted on SDN) to convert XML into ABAP (internal table) and not having any luck. Either it is my table/structure declaration or XSLT. Could any of you experts give me a hand with it please?
    Thanks in advance..but points on help!
    Here is my XML:
    And my ABAP program:
    REPORT  ZTESTXMLREAD.
    TYPE-POOLS: abap, ixml.
      class cl_ixml definition load.
    TYPES: BEGIN OF t_dc40,
             docnum(17) TYPE  C,
             status(2)  TYPE  C,
           END   OF t_dc40.
    TYPES: BEGIN OF t_emkt,
             spras(2)   TYPE  C,
             maktx(35)  TYPE  C,
           END   OF t_emkt.
    TYPES: BEGIN OF t_emrm,
             matnr(12)  TYPE  C,
             ersda(8)   TYPE  C,
             ernam(25)  TYPE  C,
             emktx      TYPE  t_emkt,
           END   OF t_emrm.
    TYPES: BEGIN OF t_mm,
             dc40   TYPE  t_dc40,
             emrm   TYPE  t_emrm,
           END   OF t_mm.
    DATA: l_ixml            TYPE REF TO if_ixml,
          l_streamfactory   TYPE REF TO if_ixml_stream_factory,
          l_istream         TYPE REF TO if_ixml_istream.
    DATA: l_filename        TYPE string.
    DATA: it_airplus    TYPE STANDARD TABLE OF t_mm,
          wa_airplus    TYPE t_mm.
    *Errorvariables
    DATA: xslt_err   TYPE REF TO cx_xslt_exception,
          err_string TYPE string.
    PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:Test.XML'.
    START-OF-SELECTION.
      Creating the main iXML factory
        l_ixml = cl_ixml=>create( ).
      Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
      Creating input stream
        l_istream = l_streamfactory->create_istream_uri( 'file://c:Test.xml' ).
    here we use the CALL TRANSFORMATION method which calls
    TRY.
        CALL TRANSFORMATION ZTestXSLT
          SOURCE xml l_istream
          RESULT xml_output = it_airplus
    catch any error, very helpful if the XSLT isn't correct
        CATCH cx_xslt_exception INTO xslt_err.
        err_string = xslt_err->get_text( ).
        WRITE: / 'Transformation error: ', err_string.
        EXIT.
      ENDTRY.
    setting a breakpoint to watch the workarea
    by the internal table "it_airplus"
           break-point.
      LOOP AT it_airplus INTO wa_airplus.
      ENDLOOP.

    Thank you Durairaj, as a matter of fact my program is based on your post (one that you pointed me to). For whatever reason I'm not having luck figuring it out (may be just a bit of work pressure) could you please hlep me a bit more by pointing me to where in my program code/xslt I'm going wrong? I somehow feel that it could be my table structure or xslt.
    I would really appreciate it!
    Thanks again,
    erfan.

  • XML to ABAP Conversion

    Hi Experts,
    I am using SFP transaction.
       CALL METHOD cl_gui_frontend_services=>file_open_dialog
    CHANGING
    file_table = lt_file_table
    rc = lv_rc
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    file_open_dialog_failed = 1
    cntl_error = 2
    error_no_gui = 3
    not_supported_by_gui = 4
    OTHERS = 5.
    READ TABLE lt_file_table
    INTO lv_filename
    INDEX 1.
    cl_gui_frontend_services=>gui_upload(
    EXPORTING
    filename = lv_filename
    filetype = 'BIN' "Binary
    IMPORTING
    filelength = lv_filelength
    CHANGING
    data_tab = lt_rawtab
    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 ).
    Get FP reference
    DATA: lo_fp TYPE REF TO if_fp VALUE IS INITIAL.
    lo_fp = cl_fp=>get_reference( ).
    For handling exceptions
    DATA: lo_fpex TYPE REF TO cx_fp_runtime VALUE IS INITIAL.
    TRY.
    Create PDF Object using destination 'ADS' (<-- this is how it is
    defined in SM59)
    DATA: lo_pdfobj TYPE REF TO if_fp_pdf_object VALUE IS INITIAL.
    lo_pdfobj = lo_fp->create_pdf_object( connection = 'ADS' ).
    FIELD-SYMBOLS: <ls_rawtab> LIKE LINE OF lt_rawtab.
    Move to XSTRING
    LOOP AT lt_rawtab ASSIGNING <ls_rawtab>.
    CONCATENATE pdf_data <ls_rawtab>-data INTO pdf_data IN BYTE MODE.
    ENDLOOP.
    Set document
    lo_pdfobj->set_document(
    EXPORTING
    pdfdata = PDF_DATA).
    CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
      EXPORTING
        IM_XSTRING = XML_DATA
      IMPORTING
        EX_STRING  = LV_XML_DATA_STRING.
    Remove NEW-LINE character from XML data in STRING format
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    REPLACE ALL OCCURrENCES OF cl_abap_char_utilities=>newline IN
    lv_xml_data_string WITH ''.
    Make the XML envelope compliant with identity transform
    REPLACE '<?xml version="1.0" encoding="UTF-8"?><data>'
    IN lv_xml_data_string
    WITH '<?xml version="1.0" encoding="iso-8859-1"?><asx:abap xmlns :asx="http://www.sap.com/abapxml" version="1.0"><asx:values>'.
    REPLACE '</data>' IN lv_xml_data_string WITH '</asx:values></asx:abap>'.
    Apply the identity transform and convert XML into ABAP in one step
    CALL TRANSFORMATION ('ID')
    SOURCE XML lv_xml_data_string
    RESULT out = out.
    But getting error
    Short text
        XSLT: No valid XML source
    Runtime Errors         XSLT_BAD_SOURCE_CONTEXT
    Except.                CX_XSLT_RUNTIME_ERROR
    How i call -->call transforamtion...Can any one please tell me how to convert XML to abap internal table?...
    Thanks

    Hi,
       I just catch the exception.
    Regards,
    Mathi

Maybe you are looking for