Rendering xml-table into logical filename in SAP R/3

Hi,
I am trying to translate an xml-table with bytes into a logical filepath in SAP R3.
Do I have to use the method gui-download or shall I loop the internal xml-table?
When I tried to loop the xml-table into a structure, and then transfering the structure into the logical filename, I get problems with the line breaks in my xml-file. How do I get the lines to break exactly the same as I wrote them in my ABAP-code?
Edited by: Kristina Hellberg on Jan 10, 2008 4:24 PM

I believe you posted in the wrong forum.
This forum is dedicated to development and deployment of .Net applications that connect and interact with BusinessObjects Enterprise, BusinessObjects Edge, or Crystal Reports Server. This includes the development of applications using the BusinessObjects Enterprise, Report Application Server, Report Engine, and Web Services SDKs.
Ludek

Similar Messages

  • How do I import my Final Cut Pro 10 (FCPX) XML files into Logic 9?

    I am using 10.0.5. Which is the latest version Of Final Cut Pro X. I export my project out as a XML in FCPX. Then went into Logic 9 clicked on import then selected XML how ever the XML file was grey and Logic wouldn't  come up as a valid XML to import. Please help me! Thanks

    AFAIK Logic 9 can't import the form of XML that FCP X outputs.
    There may be other ways to bridge the gap, but since I don't  use Logic 9 I can't help further.

  • How to load SAP R/3 tables into a schema in SAP HANA Cloud Platform

    Hello, everyone.
    First of all, my apologies for any basic mistakes, I'm new here, so there's a lot of stuff I don't know yet.
    I need to upload some tables to a schema in my HANA trial account to test some algorithms and see if the kind of application I want to build is possible, but I don't know the best way to do this.
    To my understanding, using the Cloud Connector would merely make my tables visible to my application in the cloud, but it would not actually upload them (or rather, I'm sure there's a way to upload them using it, but I suspect there are far simpler methods out there).
    I think one of the simplest possible methods would be to create the schema, open a tunnel using the console client, and to import the tables to the schema via the HANA Studio. Maybe, if that doesn't work, a CMIS repository could be used (although I'm somewhat skeptical, as I think something like this it's not its intended use). Or maybe there's another possibility I'm not seeing. Either way, I would love to hear some answers that could shed some light on this.
    Also, as I mentioned earlier I'm only using a trial account for this, I don't know if there's any limitation that could prevent me from doing this. I'd also like to hear your opinion on this matter.
    Thank you.

    BUDAT is the technical name for Posting Date field. This field is used many DB Tables/ Strucutres. Using where used option you can find the required tables.
    I suggest you to look at BSEG table for Finace Document postings by Posting Date.

  • How can I generate IDOC(WPUUMS) from XML file in POSDM or in SAP Retail

    Hallo Retail expert,
                                I have following scenario,
    I have Retail Store who send me their daily sales report through Wincor Nixdorf Point of sale. There i am using standard POSLOG2 to SEEBURGER(its a middleware which act as Converter) xml format and then i post that data first in POSDM and then with BAPI i transfer or book that data to SAP Retail.
    Above is the one scenario which is working.
    This is the Second scenario.......
    I have some external Retail store, they dont have Wincor Nixdorf POS, so they send me their Sales Report through SEEBURGER(its a middle Hardware which act as Converter) and SEEBURGER Convert that Sales data to XML format. My question is....
    How can i upload or Convert a XML File into IDOC (WPUUMS)in SAP or in POSDM?
    any new suggestion are welcome.
    Thank you all in advance.
    regards,
    Niel

    Hi,
    1. To get the required XML Schema, use transaction code WE60 to go to the IDoc documentation -> enter the IDoc type you want to use (WPUUMS01). Flag control and data record. Then display the XSD by choosing Documentation -> XML Schema from the menue bar. Now you can donwload the XSD for usage in Seeburger.
    2. Create your mapping from the POS format into the IDoc XML format in Seeburger.
    3. Create an XML File Port in ERP or POS DM using transaction code WE21.
    3. To inbound the XML file from Seeburger into POS DM or SAP Retail Seeburger should trigger the function module EDI_DATA_INCOMING. Parameters for this FM are the Pathname to the XML file and the Portname you just created. Based on the port name the FM can derive the port type xml and the data will be handled as XML data.
    Regards Carsten

  • How do I upload XML files into sap table?

    Dear all,
    I found some methods that upload xml into SAP,
    but there doesn’t work under 4.6c.
    Can someone tell me how to upload XML files into
    sap under 4.6c?
    THX!

    hi,
    You can convert XML to abap using transformations. Simple transformations is a proprietary SAP programming language that describes the transformation of ABAP data to XML (serialization) and from XML to ABAP data (deserialization).
    goto SE80->workbench->edit object(or other objects)->in object selection chose more tab and then choose the transformation radio button and write a name and click create new.
    Here you enter your transformation like
    <xsl:transform version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:sap="http://www.sap.com/sapxsl"
    >
    <xsl:strip-space elements="*"/>
    <xsl:template match="/">
      <xsl:copy-of select="."/>
    </xsl:template>
    </xsl:transform>
    You can use this transfomation in your program using call transformation. You can find more info on call transformation in help.
    Hope this helps.
    Regards,
    Richa

  • Error while downloading data from internal table into XML file

    hi all,
    i developed a program to download data from into internal table to xml file like this.
    tables: mara.
    parameters: p_matnr like mara-matnr.
    data: begin of itab_mara occurs 0,
                matnr like mara-matnr,
                ernam like mara-ernam,
                aenam like mara-aenam,
                vpsta like mara-vpsta,
          end of itab_mara.
    data: lv_field_seperator type c,     " value 'X',
          lv_xml_doc_name(30) type c,    " string value ‘my xml file’,
          lv_result type i.
          lv_field_seperator = 'x'.
          lv_xml_doc_name = 'my xml file'.
    types: begin of truxs_xml_line,
              data(256) type x,
          end of truxs_xml_line.
    types:truxs_xml_table type table of truxs_xml_line.
    data:lv_tab_converted_data type truxs_xml_line,
         lt_tab_converted_data type truxs_xml_table.
    data: lv_xml_file type rlgrap-filename value 'c:\simp.xml'.
    select matnr ernam aenam vpsta from mara into table itab_mara up to 5
           rows where matnr = p_matnr.
    CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
    EXPORTING
       I_FIELD_SEPERATOR          = lv_field_seperator
      I_LINE_HEADER              =
      I_FILENAME                 =
      I_APPL_KEEP                = ' '
       I_XML_DOC_NAME             = lv_xml_doc_name
    IMPORTING
       PE_BIN_FILESIZE            = lv_result
      TABLES
        I_TAB_SAP_DATA             = itab_mara
    CHANGING
       I_TAB_CONVERTED_DATA       = lt_tab_converted_data
    EXCEPTIONS
      CONVERSION_FAILED          = 1
      OTHERS                     = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    open dataset lv_xml_file for output in binary mode.
    loop at lt_tab_converted_data into lv_tab_converted_data.
    transfer lv_tab_converted_data to lv_xml_file.
    endloop.
    close dataset lv_xml_file.
    this program is syntactically correct and getting executed, but when i open the target xml file it is showing the following error.
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    XML document must have a top level element. Error processing resource 'file:///C:/simp.xml'.
    will anyone show me the possible solution to rectify this error
    thanks and regards,
    anil.

    Hi,
    Here is a small sample program to convert data in an internal table into XML format and display it.
    DATA: itab  TYPE TABLE OF spfli,
          l_xml TYPE REF TO cl_xml_document.
    * Read data into a ITAB
    SELECT * FROM spfli INTO TABLE itab.
    * Create the XML Object
    CREATE OBJECT l_xml.
    * Convert data in ITAB to XML
    CALL METHOD l_xml->create_with_data( name = 'Test1'
                                         dataobject = t_goal[] ).
    * Display XML Document
    CALL METHOD l_xml->display.
    Here are some other sample SAP programs to handle XML in ABAP:
    BCCIIXMLT1, BCCIIXMLT2, and BCCIIXMLT3.
    Hope this helps,
    Sumant.

  • XML data into sap

    Hi guys,
    How to upload a XML file into sap?
    is there any function module?
    can anybody give me an example program for converting or uploading XML data into sap.
    regards,
    vinoth.

    Hi all,
    The XML code and XML file given is running fine for me, but when i am using it, my XML file and code, the tables GV_header and GT_item are filling in the perform but outside perform it's empty.  Please find the code and XML file , PLease give the answer its urgent, points will be given for sure.
    My function module code is:-
    FUNCTION Z_MMI_XML_EXTRACT_COPY.
    ""Local interface:
    *"       IMPORTING
    *"             REFERENCE(DOCTYPE) LIKE  DRAW-DOKAR
    *"             REFERENCE(DOCNUM) LIKE  DRAW-DOKNR
    *"             REFERENCE(DOCVER) LIKE  DRAW-DOKVR
    *"             REFERENCE(DOCPART) LIKE  DRAW-DOKTL
    *"       TABLES
    *"              T_HEADER STRUCTURE  ZFI_HEADER
    *"              T_ITEMS STRUCTURE  ZFI_ITEMS
    Load iXML Lib.
    type-pools: ixml.
    class cl_ixml definition load.
    data: G_IXML type ref to if_ixml.
    data: STREAMFACTORY type ref to if_ixml_stream_factory.
    data: ISTREAM type ref to if_ixml_istream.
    data: DOCUMENT type ref to if_ixml_document.
    data: PARSER type ref to if_ixml_parser.
    You should provide the parameter for file name
    *LV_FILE_URL = 'C:input_xml.xml'.
    types: begin of XML_LINE,
            DATA(256) type x,
          end of XML_LINE.
    ***types: begin of TY_HEADER,
            CUST_NAME(20)     type c,
            CARD_NO(20)       type c,
            TAX_AMOUNT(10)    type c,
            TOTAL_AMOUNT(10)  type c,
          end of TY_HEADER.
    ***types: begin of TY_ITEM,
            ITEM_NO(4)      type n,
            ITEM_ID(20)     type c,
            ITEM_TITLE(50)  type c,
            ITEM_QTY(10)    type c,
            ITEM_UPRICE(10) type c,
          end of TY_ITEM.
    *data: GV_HEADER type TY_HEADER.
    *data: GV_HEADER like zfi_header occurs 0 with header line.
    data : GV_HEADER LIKE ZFI_HEADER.
    *data: GT_ITEM   type standard table of TY_ITEM   with header line.
    *data: GT_ITEM type standard table of zfi_items with header line.
    data: GT_ITEM type standard table of zfi_items with header line.
    data: XML_TABLE      type table of XML_LINE,
          XML_TABLE_SIZE type i.
    data: LV_FILE_URL type rlgrap-filename.
      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 .
      DATA : BEGIN OF wa_draw OCCURS 0,
             dokar LIKE draw-dokar,
             doknr LIKE draw-doknr,
             dokvr LIKE draw-dokvr,
             doktl LIKE draw-doktl,
             END OF wa_draw.
      DATA : g_documenttype LIKE bapi_doc_aux-doctype,
             g_documentnumber LIKE bapi_doc_aux-docnumber,
             g_documentpart LIKE bapi_doc_aux-docpart,
             g_documentversion LIKE bapi_doc_aux-docversion.
    *" Itab required in IMPORTING parameter of BAPI
      DATA : t_documentfile LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE.
    DATA : t_documentstructure LIKE bapi_doc_structure OCCURS 0 WITH HEADER
    LINE,
    itab required in TABLES parameters of BAPI
           t_documentfiles LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,
           t_components LIKE bapi_doc_comp OCCURS 0 WITH HEADER LINE,
           t_return LIKE bapiret2.
      DATA : l_docfile TYPE string.
    ***FILL THE TYPE OF ATTACHMENT in IMPORTING itab**
      t_documentfile-wsapplication = 'XML'.
      APPEND t_documentfile.
      wa_draw-dokar = DOCTYPE.
      wa_draw-doknr = DOCNUM.
      wa_draw-doktl = DOCPART.
      wa_draw-dokvr = DOCVER.
      CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2'
        EXPORTING
          documenttype              = wa_draw-dokar
          documentnumber            = wa_draw-doknr
          documentpart              = wa_draw-doktl
          documentversion           = wa_draw-dokvr
          documentfile              = t_documentfile "IMPORTING itab of BAPI
         getstructure              = '1'
         getcomponents             = 'X'
      ORIGINALPATH              = ' '
      HOSTNAME                  = ' '
         getheader                 = 'X'
      DOCBOMCHANGENUMBER        =
      DOCBOMVALIDFROM           =
      DOCBOMREVISIONLEVEL       =
       IMPORTING
         return                    = t_return
       TABLES
         documentstructure         = t_documentstructure
         documentfiles             = t_documentfiles "TABLES itab of BAPI
         components                = t_components
      LOOP AT t_documentfiles .
      ENDLOOP.
      l_docfile = t_documentfiles-docfile.
    The next step is creating the main factory for the iXML library:
    G_IXML = cl_ixml=>create( ).
    Now Create Stream Factory
    STREAMFACTORY = G_IXML->create_stream_factory( ).
      CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
    *filename = 'C:DMS_SPA.XML'
      filename = l_docfile
      filetype = 'BIN'
      IMPORTING
       FILELENGTH = XML_TABLE_SIZE
      TABLES
      data_tab = XML_TABLE.
    ISTREAM = STREAMFACTORY->create_istream_itable( table = XML_TABLE
                                                    size  = XML_TABLE_SIZE )
    Create XML Document instance
    DOCUMENT = G_IXML->create_document( ).
    Create parser Object
    PARSER = G_IXML->create_parser( stream_factory = STREAMFACTORY
                                    ISTREAM = istream
                                    DOCUMENT = document ).
    Parse an XML document into a DOM tree
    *parser->parse( ).
    Parsing Error Processing
    if PARSER->parse( ) ne 0.
      if 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 = PARSER->num_errors( ).
        write: COUNT, ' parse errors have occured:'.
        INDEX = 0.
        while INDEX < COUNT.
          PARSEERROR = 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.
    Close the stream since it �s not needed anymore
    call method ISTREAM->close( ).
    clear ISTREAM.
    DATA : GV_NODE type ref to if_ixml_node.
    DATA : GV_NODETEXT type STRING.
    data:  GV_FIRST_TIME.
    GV_FIRST_TIME = 'X'.
    GV_NODE = DOCUMENT.
    *GT_ITEM-item_no = 1.
    GT_ITEM-itemno_acc = 1.
    perform GET_DATA tables     GT_ITEM
                     using      GV_NODE
                     changing   GV_HEADER.
    Last item is still not added.
      append GT_ITEM.
    APPEND GV_HEADER.
    *T_HEADER[] = gv_header[].
    t_items[] = gt_item[].
    **write  : GV_HEADER-cust_name,
            GV_HEADER-card_no,
            GV_HEADER-tax_amount,
            GV_HEADER-total_amount.
    **loop at GT_ITEM.
    write  /:.
    write  : GT_ITEM-item_no,
              GT_ITEM-item_id,
              GT_ITEM-item_title,
              GT_ITEM-item_qty,
              GT_ITEM-item_uprice.
    **endloop.
    ENDFUNCTION.
          FORM Get_data                                                 *
    ***form get_data tables   YT_ITEM    structure gt_ITEM
                 using value(x_node) type ref to if_ixml_node
                 changing Y_HEADER   type TY_HEADER.
    form get_data1 tables   YT_ITEM    structure zfi_items
                  using value(x_node) type ref to if_ixml_node
                  changing Y_HEADER   type zfi_header.
    ***form get_data tables   YT_ITEM    structure GT_ITEM
                 using value(x_node) type ref to if_ixml_node
                 changing Y_HEADER   type TY_HEADER.
      data: INDENT      type i.
      data: PTEXT       type ref to if_ixml_text.
      data: STRING      type string.
      data: TEMP_STRING(100).
      case X_NODE->get_type( ).
        when if_ixml_node=>co_node_element.
          STRING = X_NODE->get_name( ).
          GV_NODETEXT = STRING.
        when if_ixml_node=>co_node_text.
          PTEXT ?= X_NODE->query_interface( IXML_IID_TEXT ).
          if PTEXT->ws_only( ) is initial.
            STRING = X_NODE->get_value( ).
            case GV_NODETEXT.
             when 'Customer'.
                when 'HEADER'.
                clear GV_HEADER.
             when 'Name'.
               when 'INVOICE_IND'.
               move STRING to GV_HEADER-cust_name.
                move STRING to GV_HEADER-INVOICE_IND.
              when 'CompanyCode'.
                move STRING to GV_HEADER-CompanyCode.
              when 'OBJ_TYPE'.
                move STRING to GV_HEADER-OBJ_TYPE.
              when 'username'.
                move STRING to GV_HEADER-username.
              when 'PO_reference'.
                move STRING to GV_HEADER-PO_reference.
              when 'Invoice_Date'.
                move STRING to GV_HEADER-Invoice_Date.
              when 'Posting_Date'.
                move STRING to GV_HEADER-Posting_Date.
              when 'Amount'.
                move STRING to GV_HEADER-Amount.
              when 'Currency'.
                move STRING to GV_HEADER-Currency.
    *APPEND GV_HEADER.
            Iteam details
              when 'invoice_doc_item'.
                move STRING to GT_ITEM-ITEMNO_ACC.
              when 'currency'.
                move STRING to TEMP_STRING.
                move TEMP_STRING to GT_ITEM-CURRENCY.
              when 'Quantity'.
                move STRING to GT_ITEM-Quantity.
              when 'UoM'.
                move STRING to GT_ITEM-UoM.
            endcase.
          endif.
      endcase.
      if GV_NODETEXT = 'Header'.
        clear GV_HEADER.
      elseif GV_NODETEXT = 'Item'.
        if GV_FIRST_TIME ne 'X'.
           append GT_ITEM.
         clear : gt_item.
           GT_ITEM-ITEMNO_ACC = gt_item-itemno_acc + 1.
        endif.
        GV_FIRST_TIME = ' '.
      endif.
    Get the next child
      X_NODE = x_node->get_first_child( ).
    Recurse
      while not X_NODE is initial.
        perform GET_DATA tables     GT_ITEM
                         using      X_NODE
                         changing   GV_HEADER.
        X_NODE = x_node->get_next( ).
      endwhile.
    endform.
    the XML file is:-
    Thanx in advance

  • Xml data into internal table

    Hi Friends,
    See the followong code which converts xml data into itab.
    *& Report  ZTEST_XML1                                                  *
    REPORT  ZTEST_XML1                              .
    *PURPOSE: This program transfers XML data into SAP internal table format
    *The nodes in DOM can be stored as fields in SAP Internal table
    type pool definitions
    TYPE-POOLS: ixml. "iXML Library Types
    type definitions
    TYPES: BEGIN OF t_xml_line, "Structure for holding XML data
    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, " XML Table of the structure
    *t_xml_line
    l_xml_line TYPE t_xml_line, " Record of structure t_xml_line
    l_xml_table_size TYPE i. " XML table size
    DATA: l_filename TYPE string. " String to hold filename
    data: begin of i_final occurs 0,
          pnumber(20),
          pname(50),
          pdes(70),
          end of i_final.
    PARAMETERS: pa_file TYPE char1024 DEFAULT 'C:\product.xml'.
    Validation of XML file: Only DTD included in XML document is supported
    PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
    start of selection
    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( ).
    Creating a Parser
    l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
    istream = l_istream
    document = l_document ).
    Validate a document
    IF pa_val = 'X'.
    l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
    ENDIF.
    Parse the stream
    IF l_parser->parse( ) <> 0.
    IF l_parser->num_errors( ) <> 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
    text
    <--P_L_XML_TABLE_SIZE text
    <--P_L_XML_TABLE text
    FORM get_xml_table CHANGING p_l_xml_table_size
    p_l_xml_table.
    Local variable declarations
    DATA: l_len TYPE i,
    l_len2 TYPE i,
    l_tab TYPE tsfixml,
    l_content TYPE string,
    l_str1 TYPE string,
    c_conv TYPE REF TO cl_abap_conv_in_ce,
    l_itab TYPE TABLE OF string.
    l_filename = pa_file.
    Upload 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
    text
    -->P_L_DOCUMENT text
    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.
    *delete adjacent duplicates from  i_final.
    *loop at i_final.
    *write:/ i_final-pnumber,i_final-pname,i_final-pdes.
    *endloop.
    *if not i_final[] is initial.
    *modify ztestproduct from table i_final.
    *endif.
    ENDFORM. " process_dom
    in the above code at line no: 268 there is a method:
    value = node->get_value( ).in which actual data from XML file is coming.
    So the varibale "Value" contains the data.
    see line no: 270:
    WRITE: AT indent value COLOR COL_GROUP INVERSE.
    what ever values i am getting here i want to append to a Internal table ...
    Can any body tell me how to do that?
    i am sure of reward points.

    Hai Ravi
    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[].
    Regards
    Sreeni

  • 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

  • Upload XML to internal table and vice versa in SAP 4.6C

    Hi,
       Happy New Year to you all!
       We are using 46C and I am beginning to learn about XML. We have a requirement to (1) upload an XML file into an internal table as well as (2) create an XML file from an internal table.
       I read some of the posted messages about this but they didn't seem to be applicable in 46C (I could be wrong).
       Could someone please help me using the sample file below?
      <?xml version="1.0" ?>
    - <AUCTIONBLOCK>
    - <ITEM>
      <TITLE>Still Life / Onions</TITLE>
      <ARTIST>Linda Mann</ARTIST>
      <DIMENSIONS>20x30 inches</DIMENSIONS>
      <MATERIALS>Oil</MATERIALS>
      <YEAR>1997</YEAR>
      <DESCRIPTION>Still Life</DESCRIPTION>
      <TIMESTAMP>1974</TIMESTAMP>
      </ITEM>
      </AUCTIONBLOCK>
    Many thanks,
    Rosemarie

    Hi,
    Yes I'm on 4.6c. I've to comment several lines. Here is an example:
    *& Report  z_xit_xml_check
      report  z_xit_xml_check.
      class cl_ixml definition load.
      type-pools: ixml.
      types: begin of t_xml_line,
              data(256) type x,
            end of t_xml_line,
            begin of tsfixml,
              data(1024) type c,
            end of tsfixml.
      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
      'd:joaodesenvolvimentos i act     este.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( ).
    Regards,
    Maria João Rocha
        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.
    data: name2 type string,
          name_root type string,
          node_parent      type ref to if_ixml_node,
          node_root        type ref to if_ixml_node,
          num_children     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.
    num_children = node->num_children( ).
          case node->get_type( ).
            when if_ixml_node=>co_node_element.
            element node
              name    = node->get_name( ).
              nodemap = node->get_attributes( ).
              node_root = node->get_root( ).
              name_root = node_root->get_name( ).
                        write: / 'ELEMENT  :'.
              write: at indent name color col_positive inverse.
              write: 'NUM_CHILDREN:', num_children.
              write: 'ROOT:', name_root.
              node_parent = node->get_parent( ).
              name2    = node_parent->get_name( ).
              write: 'NAME2: ' , name2.
              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     :'.
    mjprocha
              node_parent = node->get_parent( ).
              write: at indent value color col_group inverse.
              name2    = node_parent->get_name( ).
              write: 'NAME2: ' , name2.
          endcase.
        advance to next node
          node = iterator->get_next( ).
        endwhile.
      endform.                    "process_dom

  • 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

  • Convert  XML page into Internal Table

    Hi,
    I'm not sure if this post belongs here or not, but here goes.
    I have a requirement to read in data from a xml page and save the contents into a ABAP internal table.
    At the moment, I have extracted the contents of the XML page into a string using the IF_HTTP_CLIENT->RESPONSE->GET_CDATA method.
    Now I underatand that SAP has XSLT documents that can be used to transform XML documents into ABAP Data Structures.
    Can someone explain to me how this works? I have looked in SAP Help about the XSLT Editor, but it still looks like double dutch to me (no offence to the dutch people out there!).
    Thanks,
    Pat.

    You can use either XSLT programming or Simple Transformation to do that job. check out the following weblogs.
    <a href="/people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1">XML processing in ABAP Part 1</a>
    <a href="/people/tobias.trapp/blog/2005/05/17/xml-processing-in-abap-part-2">XML processing in ABAP Part 2</a>
    <a href="/people/tobias.trapp/blog/2005/05/20/xml-processing-in-abap-part-3">XML processing in ABAP Part 3</a>
    <a href="/people/tobias.trapp/blog/2005/05/27/xml-processing-in-abap-part-4">XML processing in ABAP Part 4</a>
    <a href="/people/tobias.trapp/blog/2005/06/15/xml-processing-in-abap--part-5">XML processing in ABAP Part 5</a>
    Regards
    Raja

  • Loading XML file into DB Table

    Hi
    I m quite new to the loading XML file into database table.
    It will be great if anyone could guide me to through.
    Now,
    i have an XML file which has to be loaded into the DB table.
    what are the steps involved in doing this. How do i go from here ??
    your help is greatly appriciated ???
    Thank you so much!!
    -Shashi

    OK - Although you really should read the XMLDB FAQ on this forum, here is some sample code of ONE of the ways of doing it
    (there are multiple ways - and this is not the most simple one)
    Based on Oracle 11gR1
    -- sqlplus /nolog
    clear screen
    set termout on
    set feed on
    set lines 40
    set long 10000000
    set serveroutput on
    set lines 100
    set echo on
    connect / as sysdba
    col filename for a80
    col xml      for a80
    -- Create schema “OTN”
    drop user OTN cascade;
    purge dba_recyclebin;
    create user OTN identified by OTN;
    grant dba, xdbadmin to OTN;
    EXECUTE dbms_java.grant_permission( 'OTN', 'java.io.FilePermission','G:\OTN\xmlstore','read' );
    prompt pause
    pause
    clear screen
    -- Create directory
    connect OTN/OTN;
    show user
    drop directory OTN_USE_CASE;
    CREATE directory OTN_USE_CASE AS 'G:\OTN\xmlstore';
    SELECT extract((XMLTYPE(bfilename('OTN_USE_CASE','ABANDA-20030407215829881GMT.xml'),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
    from   dual;
    prompt pause
    pause
    clear screen
    -- Directory Listing - Tom Kyte
    create global temporary table DIR_LIST
    ( filename varchar2(255) )
    on commit delete rows
    create or replace
      and compile java source named "DirList"
    as
    import java.io.*;
    import java.sql.*;
    public class DirList
    {public static void getList(String directory)
                       throws SQLException
    {   File path = new File( directory );
        String[] list = path.list();
        String element;
        for(int i = 0; i < list.length; i++)
        {   element = list;
    #sql { INSERT INTO DIR_LIST (FILENAME)
    VALUES (:element) };
    create or replace procedure get_dir_list( p_directory in varchar2 )
    as language java
    name 'DirList.getList( java.lang.String )';
    prompt pause
    pause
    clear screen
    -- The content of the global temporary table
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select * from dir_list;
    -- "COMMIT" will clear / truncate the global temporary table...
    prompt pause
    pause
    clear screen
    -- Combined: Reading XML content from multiple XML files
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select * from dir_list where filename like '%.xml'
    and rownum <= 10;
    prompt pause
    pause
    clear screen
    select extract((XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
    from dir_list dl
    where dl.filename like '%.xml' and rownum <= 2;
    prompt pause
    pause
    clear screen
    -- If you can select it you can insert it...
    -- drop table OTN_xml_store purge;
    create table OTN_xml_store of xmltype
    xmltype store as binary xml
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    set time on timing on
    insert into OTN_xml_store
    select XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) AS "XML"
    from dir_list dl
    where dl.filename like '%.xml';
    set time off timing off
    commit;
    select count(*) from OTN_xml_store;
    prompt pause
    pause
    clear screen
    -- If you can select it you can create resources and files
    set time on timing on
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select count(*) from dir_list where filename like '%.xml';
    set serveroutput on size 10000
    DECLARE
    XMLdoc XMLType;
    res BOOLEAN;
    v_foldername varchar2(4000) := '/public/OTN/';
    cursor c1
    is
    select dl.filename FNAME
    , XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) XMLCONTENT
    from dir_list dl
    where dl.filename like '%.xml'
    and rownum <= 100;
    BEGIN
    -- Create XDB repository Folder
    if (dbms_xdb.existsResource(v_foldername))
    then
    dbms_xdb.deleteResource(v_foldername,dbms_xdb.DELETE_RECURSIVE_FORCE);
    end if;
    res:=DBMS_XDB.createFolder(v_foldername);
    -- Create XML files in the XDB Repository
    for r1 in c1
    loop
    if (DBMS_XDB.CREATERESOURCE(v_foldername||r1.fname, r1.xmlcontent))
    then
    dbms_output.put_line(v_foldername||r1.fname);
    null;
    else
    dbms_output.put_line('Loop Exception :'||sqlerrm);
    end if;
    end loop;
    EXCEPTION WHEN OTHERS THEN
    dbms_output.put_line('Others Exception: '||sqlerrm);
    END;
    set time off timing off
    commit;
    prompt pause
    pause
    clear screen
    -- FTP and HTTP
    clear screen
    prompt
    prompt *** FTP - Demo ***
    prompt
    prompt pause
    pause
    host ftp
    -- open localhost 2100
    -- user OTN OTN
    -- cd public
    -- cd OTN
    -- ls
    -- bye
    clear screen
    prompt
    prompt *** Microsoft Internet Explorer - Demo ***
    prompt
    prompt pause
    pause
    host "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://OTN:OTN@localhost:8080/public/OTN/
    prompt pause
    pause
    -- Accessing the XDB Repository content via Resource View
    -- Selecting content from a resource via XBDUriType
    clear screen
    prompt set long 300
    set long 300
    prompt Relative Path - (path)
    SELECT path(1) as filename
    FROM RESOURCE_VIEW
    WHERE under_path(RES, '/public/OTN', 1) = 1
    and rownum <= 10
    prompt pause
    pause
    clear screen
    prompt Absolute Path - (any_path)
    select xdburitype(any_path).getClob() as xml
    FROM RESOURCE_VIEW
    WHERE under_path(RES, '/public/OTN', 1) = 1
    and rownum <= 1;
    prompt pause
    pause
    -- CLEANUP ENVIRONMENT
    clear screen
    prompt
    prompt >>>>> Clean UP !!! <<<<<<
    prompt
    prompt Cleanup environment and drop user...!!!
    prompt
    pause
    clear screen
    conn / as sysdba
    alter session set current_schema=OTN;
    begin
    dbms_xdb.deleteResource('/public/OTN',dbms_xdb.DELETE_RECURSIVE_FORCE);
    commit;
    end;
    alter session set current_schema=sys;
    drop user OTN cascade;
    Based on http://www.liberidu.com/blog/?p=1053

  • BP Cockpit. Standard sap icon (e.g. ICON_OKAY) within a cell of XML table?

    Hello all,
    I have programmed a custom bp cockpit.
    I am able to build up the xml to show the data, but only with texts.
    Does anybody know how could I be able to insert an image (an standard SAP icon like "ICON_OKAY") in any of the table cells?
    Thank you very much in advance.
    Gonzalo Milla Millá

    Hello all again,
    finally, I found the way...
    The problem was that the standard XSLT conversion program 'CRM_CCKPT_CFS_SERVICE_DEFAULT' ignores the tag 'img' so... there's no way to insert images (at least within a table cell).
    I try to explain the solution:
    FIRST: Create own XSLT conversion program
    a. Go to transaction XSLT_TOOL
    b. Copy the standard conversion program 'CRM_CCKPT_CFS_SERVICE_DEFAULT' to a customer one... let's call it 'Z_CCKPT_CFS_SERVICE'.
    c. Modify this Z_CCKPT_CFS_SERVICE adding following lines:
    <xsl:when test="child::img=true()">
      <td class="table7" width="{@width}" nowrap="x">
        <img src="{child::img/@src}"/>
      </td>
    </xsl:when>
    insert this lines just before, and at the same level that
    <xsl:when test="@colspan=true()">
    Here we are telling to the conversion program how to translate XML code for images to HTML code (only when they are found between "td" tags)
    SECOND: Find icon path and insert it within XML code
    a. Go to your Z class for your infoblock (let's say Z_CL_INFOBLOCK) that inherits from CL_CRM_CCKPT_IOS and modify the GET_REPORT method
    b. Get the icon path:
    DATA:
      lc_icono TYPE string.
      lc_icono = cl_bsp_mimes=>sap_icon( 'ICON_OKAY' ).
    This way, we get the physical path to the icon.
    c. insert icon in xml code:
    DATA:
      lv_string TYPE string.
    CONCATENATE '<img src="' lc_icono '"/>'
      INTO lv_string.
    CALL METHOD crmcl_cckpt_templatesplitter=>fill_template
      EXPORTING
        iv_tagname  = 'S1'
        iv_string   = lv_string
      CHANGING
        cv_template = ls_template.
    Here, we are filling contents of tab 'S1' in the XML template LS_TEMPLATE with the line
    <img src="physical/path/of/your/icon.gif"/>
    , that will be "translated" with your Z XSLT conversion program Z_CCKPT_CFS_SERVICE
    THIRD: link Z conversion program ('Z_CCKPT_CFS_SERVICE') to your XML.
    a. Also within the GET_REPORT method, after the creation of the XML code, insert following line as the first one in the XML table (export parameter of the method):
    DATA:
      lw_meta TYPE string.
      lw_meta = '<meta:metadata xmlns:meta="urn:sap-com:document:sap:crm_cckpt:metadata" STYLESHEET="Z_CCKPT_CFS_SERVICE"/>'.
      INSERT lw_meta INTO lt_xml_temp INDEX 1.
      _et_xml_out[] = lt_xml_temp[].
      CLEAR et_xml_out.
      LOOP AT _et_xml_out INTO _ls_xml_out.
        CONCATENATE et_xml_out lv_newline _ls_xml_out INTO
                    et_xml_out.
      ENDLOOP.
    FOURTH: Finally, it works!!!
    You have your icon included as the content of a table cell...
    Hope this helps
    Best Regards
    Gonzalo Milla Millá

  • How to Convert internal table data into xml and xml data into internal tab

    Hi Guys,
          I have a requirement  that  i have to convert the internal table data into xml format and viceversa . for my requirement  i came to know that i have to use Transformations concept.  i done the converting the data from internal table into xml data by using standard Tranformations. My Question is 
    1) Can i use same Transformation to convert the xml data into abap internal table. if it is possible then how ???
    2) Is it possible using the standard Transformation  or I have to go for XSLT approach
    Please help me out from this guys,
    Thanks and Regards
    Koti

    Hi Koti,
    This is possible. There is a link. With the help of this link you can convert ABAP data to XML and vice versa.
    Link: http://www.heidoc.net/joomla/index.php?option=com_content&view=article&id=15:sapxslt&catid=22:sap-xslt&Itemid=31

Maybe you are looking for