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

Similar Messages

  • Get XML data into SAP

    Hi ,
    Is there any function module to get XML data into SAP?
    If function module doesnt exist, suggest alternative to do it.
    Thanks,
    Shivaa...

    Hi Shiva ,
    there is lot of stuff regarding ur query in SDN....
    anyways check this link...
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/upload%252bxml%252bfile%252bto%252binternal%252btable
    hope this solves ur problem.
    Regards,
    Anuj

  • 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

  • How to Import XML file into SAP B1

    Dear All,
    I have a scenario like,
    I am receiving a XML file from a 3rd party application for the daily Creation,Update of Item Master,BP Master, Marketing Documents. I want to import this file into SAP B1 through its approp objects. I understand DTW has limitation in its file types (Semicolo,Tab,Comma,ODBC). How do i do this ? Please guide me.
    Thanks,
    Thanga Raj K

    Hy folks,
    I´m frim Brasil and I've been studying the tool EFM (Eletronic File Manager) to learn more about it!
    There I saw that we can extract to XML "any" infomation from the database we want, mainly through the GEP.
    However, as I've seen, this Add-On can not import any XML file into SBO, unless for the BFP wich can be imported in conjunction with the BTHF Add-on.
    So I ask: how is it possible to import XML data into SBO database? Is it possible to be done through the EFM? or  it´s really necessary to write a code specifically to do that?
    Besides, I know that de B1iSN fit to this necessity... but when I tried to use it, by the custom "object" for BP, for example, there are some data wich the mapping conteined in this custom "process" that can not be imported... I tried to understand how to map those other fields not imported by the custom but this has been dificult to me as I am a implementation consultant focused in administrative process not on development...
    Could you please help me with this subject!
    Thanks a lot,
    Denis

  • Option to load XML data into BI 70

    Hi All,
    I have read some postings on forums and also have read the "HOW TO load XML data in BW" guide. I am confused when I read the SAP online help documentation for loading XML data .
    Question : Out of the 3 options listed below which option is best suited for loading XML data into BW . XML file is going to be provided by 3rd party company ?
    Thanks and appreciate any input .
    Smith .
    Here is what I found for BI 70 EHP1 help :
    http://help.sap.com/saphelp_nw04s/helpdata/en/b2/e50138fede083de10000009b38f8cf/frameset.htm
    Data is generally transferred into SAP BW by means of a data request, which is sent from SAP BW to the source system (pull from the scheduler). You can also send the data to SAP BW from outside the system. This is a data push into SAP BW.
    A data push is possible for various scenarios:
    ●     Transferring Data Using the SOAP Service SAP Web AS
    ●     Transferring Data Using Web Services
    ●     Transferring Data Using SAP XI
    In all three scenarios, data transfer takes place using transfer mechanisms that are sufficient for Simple Object Access Protocol (SOAP); the data transfer is also XML-based.
    The SOAP-based transfer of data is only possible for flat structures. You cannot transfer hierarchy data.

    Hi,
    I feel you can go with 2nd option. But still wait for some more inputs from Experts........
    Regards,
    Suman

  • 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

  • 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

  • Read XML file into sap

    hi all can you please tell any way by which i can read my XML file into SAP and store it into a datavase table in SAP

    Try the below link
    Re: Converting Flat file XML format data to SAP
    may help you
    regards
    pradeep

  • Xml data into non-xml database.. solution anyone?

    Hi,
    My current project requires me to store the client's data on our servers. We're using Oracle9i. Daily, I will download the client's data for that day and load it into our database. My problem is that the data file is not a flat file so I can't use sql*loader to load the data. Instead, the data file is an xml file. What is the best way to load xml data into a non-xml database? Are there any tools similar to sql*Loader that will load xml data into non-xml database? Is it the best solution for the client to give me an XML dump of their data to load into our database, or should I request a flat file? My last resort would be to write some sort of a script to parse the xml data into a flat file, and then run it through sql*loader. Is this the best solution? One thing to note is that these files could be very large.
    Thanks in advance.
    -PV

    I assume that just putting the XML file into an
    extremely large VARCHAR field is not what you want.
    Instead, you want to extract data elements from the
    XML and write them to columns in a table in your
    database. Right?Yes. Your assumption is correct.
    It sounds like you already have a script that loads a
    flat file into your database. In that case I would
    write an XSL transformation that converts the client's
    XML into a correctly-formatted flat file.Thank you. I'll look into that. Other suggestions are welcome.

  • Xml data into dynamic texttield

    Hello there
    I was trying to get xml data into a listBox and textArea. Then when I try to get it into a dyamic textField it gets the first one and not changing as i select different item in the listbox. sure there is a way. also i want to make it clickable so it go to a web page. can you help me please.
    Appreciate your time and help
    Krish

    hi
    here is the flahttp://www.naturecareasia.com/test/learnCS4.flv.fla
    Thank you

  • How to insert more than 32k xml data into oracle clob column

    how to insert more than 32k xml data into oracle clob column.
    xml data is coming from java front end
    if we cannot use clob than what are the different options available

    Are you facing any issue with my code?
    String lateral size error will come when you try to insert the full xml in string format.
    public static boolean writeCLOBData(String tableName, String id, String columnName, String strContents) throws DataAccessException{
      boolean isUpdated = true;
      Connection connection = null;
      try {
      connection = ConnectionManager.getConnection ();
      //connection.setAutoCommit ( false );
      PreparedStatement PREPARE_STATEMENT = null;
      String sqlQuery = "UPDATE " + tableName + " SET " + columnName + "  = ?  WHERE ID =" + id;
      PREPARE_STATEMENT = connection.prepareStatement ( sqlQuery );
      // converting string to reader stream
      Reader reader = new StringReader ( strContents );
      PREPARE_STATEMENT.setClob ( 1, reader );
      // return false after updating the clob data to DB
      isUpdated = PREPARE_STATEMENT.execute ();
      PREPARE_STATEMENT.close ();
      } catch ( SQLException e ) {
      e.printStackTrace ();
      finally{
      return isUpdated;
    Try this JAVA code.

  • How to upload data into SAP BW Info Objects using SAP XI

    Hi,
    I need to upload master and hierarchy data into SAP BW Info Objects using SAP XI as EAI.
    Can anyone suggest me the best solution to do it.
    Thanks in Advance,
    Volker.

    Hi! Have you not checked the BW-XI Integration document? It is available on the main page of the SDN section for XI. Almost all the steps for the integration are there...

  • Upload data into SAP through standard program

    hi!
    why don't we prefer to upload data into sap through standard program like RFBIKR00 to upload for vendor master or other standard programs to upload durectly without using BDC or LSMW and how do we upload data into SAP through BAPI.
    pls help me with a sample program.
    regards
    Amit

    It totally depends upon the requierment which fields your want to update in transaction if it works with program then use program else go for bdc .
    If there is some any screen enhancement with z fields then program will not solve the problem.
    For BAPI you check these links:
    http://www.sap-img.com/abap/bapi-step-by-step-guidance.htm
    http://sap-img.com/bapi.htm
    Edited by: shilpi agarwal on Aug 22, 2008 7:28 AM

  • Steps to insert xml data into oracle

    Please give me next steps to insert xml data into oracle 9i:
    i've been doing this steps :
    1. create folder in oracle port:8080
    2. copy xsd into folder
    3. register schema
    4. Give me next step...
    5.
    6.
    Thanks

    this is my complete xmlschema
    <?xml version = "1.0" encoding = "UTF-8"?>
    <xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema">
         <xs:element name = "A3A8Vers" type = "xs:string"/>
         <xs:element name = "F1F5Vers" type = "xs:string">
         </xs:element>
         <xs:element name = "sequence" type = "xs:string">
         </xs:element>
         <xs:element name = "amf" type = "xs:string">
         </xs:element>
         <xs:element name = "trnsKeyNumber" type = "xs:string">
         </xs:element>
         <xs:element name = "mac" type = "xs:string">
         </xs:element>
         <xs:element name = "encryptionKey" type = "xs:string">
         </xs:element>
         <xs:element name = "signature" type = "xs:string">
         </xs:element>
         <xs:element name = "signer">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref = "entityNumber"/>
                        <xs:element ref = "keyNumber"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name = "entityNumber" type = "xs:string">
         </xs:element>
         <xs:element name = "keyNumber" type = "xs:string">
         </xs:element>
         <xs:element name = "pblKey">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref = "entityNumber"/>
                        <xs:element ref = "entityRole"/>
                        <xs:element ref = "keyNumber"/>
                        <xs:element ref = "publicKeyVal"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name = "ntrTime" type = "xs:string">
         </xs:element>
         <xs:element name = "deActionTime" type = "xs:string">
         </xs:element>
         <xs:element name = "actionTime" type = "xs:string">
         </xs:element>
         <xs:element name = "entityRole">
              <xs:complexType>
                   <xs:attribute name = "role" default = "INVALID">
                        <xs:simpleType>
                             <xs:restriction base = "xs:NMTOKEN">
                                  <xs:enumeration value = "TKD"/>
                                  <xs:enumeration value = "SKD"/>
                                  <xs:enumeration value = "INVALID"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:attribute>
              </xs:complexType>
         </xs:element>
         <xs:element name = "publicKeyVal">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref = "exponent"/>
                        <xs:element ref = "mod"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name = "exponent" type = "xs:string">
         </xs:element>
         <xs:element name = "mod" type = "xs:string">
         </xs:element>
         <xs:element name = "encriptionTransKey" type = "xs:string">
         </xs:element>
         <xs:element name = "keyType" type = "xs:string">
         </xs:element>
    </xs:schema>.
    I use command to create table :
    create table elements of xmltype
    xmlschema "http://192.168.1.1:8080/test.xsd"
    element "publicKey"
    . But why the result,table as object type. so i cant use command "desc <table_name>;"

  • How to transfer the Legacy Transaction Data into SAP R/3

    Hi Experts,
    I  have  issue with legacy transaction data transfer  to R/3 system. My clients want to see  last 3 years legacy transaction data into SAP R/3 system.  But I am not sure whether it is possible or not.
    Please let  me know any possibilities to transfer the legacy tansaction data into SAP.
    Please help me out from this issue.
    Advanced Thanks,
    Chandra

    Hi Sunitha,
    Here legacy sytem is MRP for Retail Sales.
    And format is excel. Since three years data available in
    existing system.
    Please let me know if any further information required.
    Regards,
    Chandra

Maybe you are looking for