GUI_UPLOAD - Problem in uploading xml file

Hi,
I have problem in uploading xml file into itab.
Here is the code
begin of GS_STRING,
        STR(72) type C,
      end of GS_STRING,
      GT_STRING like standard table of GS_STRING,
call function 'GUI_UPLOAD'
      EXPORTING
        FILENAME                = FILE_NAME
        FILETYPE                = 'ASC'
      TABLES
        DATA_TAB                = GT_STRING
      EXCEPTIONS
        FILE_OPEN_ERROR         = 1
        FILE_READ_ERROR         = 2
        NO_BATCH                = 3
        GUI_REFUSE_FILETRANSFER = 4
        INVALID_TYPE            = 5
        NO_AUTHORITY            = 6
        UNKNOWN_ERROR           = 7
        BAD_DATA_FORMAT         = 8
        HEADER_NOT_ALLOWED      = 9
        SEPARATOR_NOT_ALLOWED   = 10
        HEADER_TOO_LONG         = 11
        UNKNOWN_DP_ERROR        = 12
        ACCESS_DENIED           = 13
        DP_OUT_OF_MEMORY        = 14
        DISK_FULL               = 15
        DP_TIMEOUT              = 16
        others                  = 17.
    if SY-SUBRC <> 0.
      message I499(SY) with 'File upload failed'.
      stop.
    endif.
  endif.
In debuggin mode, i can see the itab uploaded with xml payload. But in that same place, the hexadecimal format has double zeros 00 after each character.
XML message : <?xml
Correct Hexadecimal : 3C3F786D6C
Hexadecimal in itab  : 3C003F0078006D006C00
This makes the resultant xml invalid.
can anyone help me to solve this?
Thanks,
Uma
Edited by: Uma Maheswari on May 30, 2008 4:15 PM

what do you want to do with the uploaded XML?
i use the following
constants: line_size type i value 255.
data: begin of xml_tab occurs 0,
           raw(line_size) type x,
        end   of xml_tab,
        file  type string,
        size  type i.
call function 'GUI_UPLOAD'
    exporting
      filename            = filename
      filetype            = 'BIN'
      has_field_separator = ' '
      header_length       = 0
    importing
      filelength          = size
    tables
      data_tab            = xml_tab
    exceptions
      others              = 1.

Similar Messages

  • Error while uploading .xml file for Customer/Vendor List for Italy

    Hi All,
    We are facing problem while uploading the .xml file in DMEE transaction for the new Customer/Vendor List for Italy.
    We have followed the entire process given in the OSS Note(1090857).
    We have SAP 4.6c and followed the below steps:
    1. Created ID-FI-IT Development class
    2. Added domains
    3. Added Data elements
    4. Tried to upload the given .xml file and got any error saying ".xml file could not be interpreted".
    Also there is a .SAR file mentioned to upload if we receive any errors while uploading .xml file.
    Tried uploading the .SAR file also. STill we are recieving the same Error.
    Can any one of you help us out.
    Thanks in Advance.
    Ramesh

    Ok, we upload .SAR file in this way:
    1. unpack .SAR file with SAPCAR.EXE program. Yuo obtain 2 files
    R492445.P9C and K492445.P9C
    2. put K492445.P9C in directory \SAPMNT\TRANS\COFILES and put R492445.P9C in directory \SAPMNT\TRANS\DATA of your system (DEV, TST or PRD)
    3. Use Tx STMS. If You want create DMEE tree in DEV system, go to DEV import queue. Choose menu Extras | Other requests | Add. Insert P9CK492445 in Transp. request field.
    4. Import the request. This creates the DMEE tree. You don't need ti upload XML file after. You can see the DMEE tree created with Tx DMEE and inserting
    Tree type        UMS1            
    Format tree     IT_CUST_VEN_LIST
    5. after continue follow the note
    I hope this help you
    Roberto

  • Problem with uploading a file in Clustered Environment

    Hi,
    I have a problem with uploading a file in a clustered environment. I have an iview component which facilitates an upload action of an xml config file. The problem is that the upload of the modified XML file is reflected only in the central instance of the cluster and not in the dialog instances. The dialog instances hold the old config file.
    Is there any solution to upload the file to all the nodes in the cluster.
    Thanks
    Kiran

    Hi,
    This is a known problem with clustered environment. Remember that your portal component runs on just on dialog instance and it doesn't automatically have access to the other nodes.  However, there are some ways to get around this
    1. Use KM to store files. KM is a common repository for all application servers and therefore you needn't worry more
    2. Use an external batch oriented product (suresync/robocopy) to synch folders on the different DIs. You basically use your existing portal component, but there is a batch job which makes sure the upload folder is identical on all DIs (however, there is a slight delay depending on how often you run the batch job)
    3. Store the files on a shared disk directly from the portal component.
    Cheers
    Dagfinn

  • Problem in Uploading a File by Applet

    Hi Members,
    * I have faced problem while uploading a file from client to server by ftp protocol using APPLET(No JSP) only
    * I am getting exception while running....
    * My source code is as follows,
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLConnection;
    public class UploadAndDownload extends Applet implements ActionListener {
         Button upload;
         Button browse;
         TextField filename;
         File source = null;
         Label name;
         StringBuffer sb;
         BufferedInputStream bis = null;
         BufferedOutputStream bos = null;
         public void init() {
              setLayout(new FlowLayout());
              upload = new Button("Upload");
              browse = new Button("Browse");
              name = new Label("Filename");
              filename = new TextField("", 45);
              add(name);
              add(filename);
              add(upload);
              add(browse);
              upload.addActionListener(this);
              browse.addActionListener(this);
         public void actionPerformed(ActionEvent evt) {
              // Code for browsing a file
              String input_file_name = "";
              if (evt.getSource() == browse)
                   Frame parent = new Frame();
                   FileDialog fd = new FileDialog(parent, "Select a file", FileDialog.LOAD);
                   fd.setVisible(true);
                   input_file_name = fd.getFile();
                   filename.setText(input_file_name);
                   // Gets the file from the file dialog and assign it to the source
                   source = new File(input_file_name);
                   repaint();
              // Code for Uploading a file to the server
              if (evt.getSource() == upload) {
                   // Appending the server pathname in string buffer
                   sb = new StringBuffer("ftp://");
                   sb.append("2847");
                   sb.append(':');
                   sb.append("Websphere25");
                   sb.append("@");
                   sb.append("172.16.1.111");
                   sb.append('/');
                   sb.append(input_file_name);
                   sb.append(";type=i");
                   try {
                        URL url = new URL(sb.toString());
                        URLConnection urlc = url.openConnection();
                        bos = new BufferedOutputStream(urlc.getOutputStream());
                        bis = new BufferedInputStream(new FileInputStream(source));
                        int i;
                        // Read from the inputstream and write it to the outputstream
                        while ((i = bis.read()) != -1) {
                             bos.write(i);
                   } catch (MalformedURLException e) {
                        e.printStackTrace();
                   } catch (IOException e) {
                        e.printStackTrace();
                   } finally {
                        if (bis != null)
                             try {
                                  bis.close();
                             } catch (IOException ioe) {
                                  ioe.printStackTrace();
                        if (bos != null)
                             try {
                                  bos.close();
                             } catch (IOException ioe) {
                                  ioe.printStackTrace();
    MY EXCEPTION IS,
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.net.SocketPermission 172.16.1.111:80 connect,resolve)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkConnect(Unknown Source)
         at sun.net.www.http.HttpClient.openServer(Unknown Source)
         at sun.net.www.http.HttpClient.<init>(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.ftp.FtpURLConnection.getOutputStream(Unknown Source)
         at UploadAndDownload.actionPerformed(UploadAndDownload.java:68)
         at java.awt.Button.processActionEvent(Unknown Source)
         at java.awt.Button.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)* Please let me know what problem in my code....
    * Thanks in advance....

    * Thanks for your reply....
    * I have signed my policy file by giving AllPermission and mentioned in java.security file in bin folder....
    * My question is , by giving AllPermission , can we access and do all permissions like ( SecurityPermission, AWTPermission, SocketPermission, NetPermission, FilePermission, SecurityPermission etc )...
    * My policy file is looks like follow,
    /* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/
    /* DO NOT EDIT */
    grant {
      permission java.security.AllPermission;
    };* If i signed the policy like above, and when i run the applet file in InternetExplorer now , it thorws the following exception on my console,
    java.net.ProtocolException: cannot write to a URLConnection if doOutput=false - call setDoOutput(true)
         at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
         at sun.net.www.protocol.ftp.FtpURLConnection.getOutputStream(Unknown Source)
         at UploadAndDownload.actionPerformed(UploadAndDownload.java:68)
         at java.awt.Button.processActionEvent(Unknown Source)
         at java.awt.Button.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)* Please let me know , how to solve this and give me your suggestion on the above process...
    * Thanks in advance...
    Regards,
    JavaImran

  • Getting error when try to upload xml file into Data Template

    Hi,
    Getting error when try to upload xml file into Data Template.error:"The uploaded file XXSLARPT.xml is invalid. The file should be in XML-DATA-TEMPLATE format."Plz anybody help me.
    Thanks,
    Prasad.

    Hi,
    Anybody Help Plzzzzzz.
    thx,
    Prasad

  • Problem  while reading XML file from Aplication server(Al11)

    Hi Experts
    I am facing a problem while  reading XML file from Aplication server  using open data set.
    OPEN DATASET v_dsn IN BINARY MODE FOR INPUT.
    IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      READ DATASET v_dsn INTO v_rec.
    WHILE sy-subrc <> 0.
      ENDWHILE.
      CLOSE DATASET v_dsn.
    The XML file contains the details from an IDOC number  ,  the expected output  is XML file giving  all the segments details in a single page and send the user in lotus note as an attachment, But in the  present  output  after opening the attachment  i am getting a single XML file  which contains most of the segments ,but in the bottom part it is giving  the below error .
    - <E1EDT13 SEGMENT="1">
      <QUALF>001</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803<The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/SHPORD_0080005842.xml'.
    /SPAN></NTEND>
      <NTENZ>000000</NTENZ>
    for all the xml  its giving the error in bottom part ,  but once we open the source code and  if we saved  in system without changing anything the file giving the xml file without any error in that .
    could any one can help to solve this issue .

    Hi Oliver
    Thanx for your reply.
    see the latest output
    - <E1EDT13 SEGMENT="1">
      <QUALF>003</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803</NTEND>
      <NTENZ>000000</NTENZ>
      <ISDD>00000000</ISDD>
      <ISDZ>000000</ISDZ>
      <IEDD>00000000</IEDD>
      <IEDZ>000000</IEDZ>
      </E1EDT13>
    - <E1EDT13 SEGMENT="1">
      <QUALF>001</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803<The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/~1922011.xml'.
    /SPAN></NTEND>
      <NTENZ>000000</NTENZ>
    E1EDT13 with QUALF>003 and  <E1EDT13 SEGMENT="1">
    with   <QUALF>001 having almost same segment data . but  E1EDT13 with QUALF>003  is populating all segment data
    properly ,but E1EDT13 with QUALF>001  is giving in between.

  • Upload xml file from aplication server using read dataset, parser error.

    Hi,
    I would like to upload xml file from app. server but parser failed. If I upload this xml file from workstation (using ws_upload) it is correct. For uploading xml file from app. server I use open dataset... read dataset. In loop section I remove '#' char. How do You upload xml file from app server? What Could be incorrect.
    I try to open dataset in binary mode, text mode...
    TYPES: BEGIN OF xml_line,
            data(255) TYPE c,
          END OF xml_line.
    DATA: gt_xml_table TYPE TABLE OF xml_line,
          gs_xml_structure TYPE  xml_line,
          gv_xml_table_size TYPE i.
    OPEN DATASET s FOR INPUT IN BINARY MODE.
      IF sy-subrc <> 0.
        MESSAGE e001(zet) WITH '....'.
      ENDIF.
      DO.
        READ DATASET s INTO gs_xml_structure.
        IF sy-subrc <> 0.
          EXIT.
        ELSE.
         len = STRLEN( gs_xml_structure ).
         len = len - 1.
         check len > 0.
         WRITE gs_xml_structure(len) TO gs_xml_structure.
          APPEND gs_xml_structure TO gt_xml_table.
        ENDIF.
      ENDDO.

    You Can do this too
    parameters: p_file like rlgrap-filename.
    data: subrc like sy-subrc.
      create object me.
      REFRESH t_data.
    *  Open XML File
      CALL METHOD me->CREATE_WITH_FILE
        EXPORTING
          filename = p_file
        RECEIVING
          retcode  = subrc.
    * Saves Data in an itab from XML File.
      CALL METHOD me->get_data
        IMPORTING
          retcode    = subrc
        CHANGING
          dataobject = t_data[].
    Regards,
    Claudio.

  • How to upload XML file from Application server.

    Hi,
    How to upload XML file from Application server.Please tell me as early as possible.
    Regards,
    Sagar.

    Hi,
    parameters : p_file type ibipparms-path obligatory.
    ***DOWNLOAD---->SAP INTO EXCEL
    filename1 = p_file.
    call function 'GUI_DOWNLOAD'
      exporting
      BIN_FILESIZE                    =
        filename                        = filename1
        filetype                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = 'X'
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      =
      tables
        data_tab                        = it_stock
      FIELDNAMES                      =
    exceptions
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       others                          = 22
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Regards,
    Deepthi.

  • Problems with reading XML files with ISO-8859-1 encoding

    Hi!
    I try to read a RSS file. The script below works with XML files with UTF-8 encoding but not ISO-8859-1. How to fix so it work with booth?
    Here's the code:
    import java.io.File;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import java.net.*;
    * @author gustav
    public class RSSDocument {
        /** Creates a new instance of RSSDocument */
        public RSSDocument(String inurl) {
            String url = new String(inurl);
            try{
                DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                Document doc = builder.parse(url);
                NodeList nodes = doc.getElementsByTagName("item");
                for (int i = 0; i < nodes.getLength(); i++) {
                    Element element = (Element) nodes.item(i);
                    NodeList title = element.getElementsByTagName("title");
                    Element line = (Element) title.item(0);
                    System.out.println("Title: " + getCharacterDataFromElement(line));
                    NodeList des = element.getElementsByTagName("description");
                    line = (Element) des.item(0);
                    System.out.println("Des: " + getCharacterDataFromElement(line));
            } catch (Exception e) {
                e.printStackTrace();
        public String getCharacterDataFromElement(Element e) {
            Node child = e.getFirstChild();
            if (child instanceof CharacterData) {
                CharacterData cd = (CharacterData) child;
                return cd.getData();
            return "?";
    }And here's the error message:
    org.xml.sax.SAXParseException: Teckenkonverteringsfel: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (radnumret kan vara f�r l�gt).
        at org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
        at org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1072)
        at org.apache.crimson.parser.InputEntity.isXmlDeclOrTextDeclPrefix(InputEntity.java:914)
        at org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:1183)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:653)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
        at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
        at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
        at getrss.RSSDocument.<init>(RSSDocument.java:25)
        at getrss.Main.main(Main.java:25)

    I read files from the web, but there is a XML tag
    with the encoding attribute in the RSS file.If you are quite sure that you have an encoding attribute set to ISO-8859-1 then I expect that your RSS file has non-ISO-8859-1 character though I thought all bytes -128 to 127 were valid ISO-8859-1 characters!
    Many years ago I had a problem with an XML file with invalid characters. I wrote a simple filter (using FilterInputStream) that made sure that all the byes it processed were ASCII. My problem turned out to be characters with value zero which the Microsoft XML parser failed to process. It put the parser in an infinite loop!
    In the filter, as each byte is read you could write out the Hex value. That way you should be able to find the offending character(s).

  • 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

  • Upload XML file data into internal table

    Hi,
    I need help from you.
    I am uploading XML file from Application server.
    1.In application server under directory it may have several XML files and i need to upload all the XML files  when we gave only directory name. So, what is the function module for that logic . If possible code also.
    2.Once we get the files into some internal table we need to upload data from that files to internal table.
    So what is the logic for that , if possible code also.
    I am giving sample directory:    
    For example in this directory assume 3 xml files are there.
    I need to upload those files and data from that in to internal table.
    Thanks & Regards
    VSR

    Below code will give you an idea.
    TYPE-POOLS: ixml. "iXML Library Types
    *TABLES : rbkp.
    TYPE DECLERATIION
    TYPES: BEGIN OF type_tabpo,
    ebeln TYPE ekko-ebeln, "PO document number
    ebelp TYPE ekpo-ebelp, "PO line item
    END OF type_tabpo.
    TYPES: BEGIN OF type_ekbe,
    belnr TYPE rbkp-belnr, "Invoice document
    gjahr TYPE rbkp-gjahr, "fiscal year
    END OF type_ekbe.
    TYPES: BEGIN OF type_invoice,
    belnr TYPE rbkp-belnr, "PO document number
    gjahr TYPE rbkp-gjahr, "Fiscal Year
    rbstat TYPE rbkp-rbstat, "invoice status
    END OF type_invoice.
    TYPES: BEGIN OF t_xml_line, "Structure for holding XML data
    data(256) TYPE x,
    END OF t_xml_line.
    INTERNAL TABLE DECLERATIION
    DATA: gi_tabpo TYPE STANDARD TABLE OF type_tabpo,
    gi_ekbe TYPE STANDARD TABLE OF type_ekbe,
    gi_invoice TYPE STANDARD TABLE OF type_invoice,
    gi_bapiret2 TYPE STANDARD TABLE OF bapiret2.
    DATA: l_ixml TYPE REF TO if_ixml,
    l_streamfactory TYPE REF TO if_ixml_stream_factory.
    DATA: l_xml_table TYPE TABLE OF t_xml_line, " XML Table of the structure
    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.
    WORK AREA DECLARATION
    DATA: gw_tabpo TYPE type_tabpo,
    gw_ekbe TYPE type_ekbe,
    gw_invoice TYPE type_invoice,
    gw_bapiret2 TYPE bapiret2.
    BEGIN OF SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    PARAMETERS: p_file TYPE pathintern LOWER CASE DEFAULT '/usr/sap/tmp/'.
    Validation of XML file: Only DTD included in XML document is supported
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION SCREEN VALIDATION
    AT SELECTION-SCREEN.
    To validate p_file is not initial
    PERFORM sub_validate_file.
    PERFORM sub_validate_path.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Request for filename for xml file from the application server
    PERFORM sub_get_filename_appl USING p_file.
    START OF SELECTION SCREEN
    START-OF-SELECTION.
    PERFORM sub_fetch_po_details.
    PERFORM sub_get_invoice.
    PERFORM sub_rel_invoice.
    END OF SELECTION SCREEN
    END-OF-SELECTION.
    *& Form sub_validate_file
    To Validate the file
    FORM sub_validate_file .
    IF p_file IS INITIAL.
    MESSAGE e000. "specify the file path
    ENDIF.
    ENDFORM. " sub_validate_file
    *& Form sub_get_filename_appl
    form sub_get_filename_appl USING l_fname TYPE any.
    DATA: l_fname TYPE filename-fileintern. " File name
    *GET THE FILENAME FROM THE APPLICATION SERVER
    CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
    EXPORTING
    directory = l_fname
    filemask = '*'
    IMPORTING
    serverfile = l_fname
    EXCEPTIONS
    canceled_by_user = 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.
    ENDFORM. " sub_get_filename_appl
    *& Form sub_fetch_po_details
    To fetch the PO details from the application server
    Format of file is XML
    FORM sub_fetch_po_details .
    TYPE DECLERATIION
    l_ixml = cl_ixml=>create( ).
    Creating a stream factory
    l_streamfactory = l_ixml->create_stream_factory( ).
    PERFORM get_xml_table.
    LOOP AT gi_tabpo INTO gw_tabpo.
    WRITE:/ gw_tabpo.
    ENDLOOP.
    ENDFORM. " sub_fetch_po_details
    *& Form get_xml_table
    Read from the xml file
    FORM get_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 = p_file.
    code to upload data from application server
    OPEN DATASET l_filename FOR INPUT IN BINARY MODE.
    IF sy-subrc 0.
    WRITE:/ 'invalid file path'.
    ENDIF.
    DO.
    READ DATASET l_filename INTO l_xml_line.
    IF sy-subrc EQ 0.
    APPEND l_xml_line TO l_xml_table.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    CLOSE DATASET l_filename.
    code to find the table size
    DESCRIBE TABLE l_xml_table.
    l_xml_table_size = ( sy-tleng ) * ( sy-tfill ).
    *code to convert hexadecimal to XML
    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.
    LOOP AT l_itab INTO l_str1.
    REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
    l_str1 WITH space.
    ENDLOOP.
    CALL TRANSFORMATION ('ID') " code to put in internal table
    SOURCE XML l_str1
    RESULT tab = gi_tabpo[].
    ENDFORM. " get_xml_table

  • Uploading XML File

    Hi All,
    I have a requirement where I need to upload the XML file in one client(or system)
    which has been downloaded using another client(or system)
    I am using
    call method cl_gui_frontend_services=>gui_upload
    to upload the file but it is going for dump.
    I have also tried with
    call method w_xml->import_from_file
    but it is also going for dump as both methods are using the same FM GUI_UPLOAD.
    Can anyone please tell me how to resolve this.
    Regards
    Haritha

    hi
    <b>Please refer to</b>
    Upload XML to internal table and vice versa in SAP 4.6C
    http://www.sap-img.com/abap/abap-object-oriented-spreadsheet-with-unlimited-power.htm
    Visit
    http://help.sap.com/saphelp_47x200/helpdata/en/e9/0be775408e11d1893b0000e8323c4f/frameset.htm
    and
    http://help.sap.com/saphelp_47x200/helpdata/en/e9/0be775408e11d1893b0000e8323c4f/frameset.htm
    You need some basic idea of range object in excel.
    You need to create XLS with named ranges or create ranges dynamically.
    This could be a neat way to upload XLS the OO way!
    The function Module zjnc_get_range reads 1 range into any Internal
    table.
    DATA: BEGIN OF it_test OCCURS 0,
            vpd  LIKE mseg-menge,
            vas  LIKE mkpf-budat,
            vkm  LIKE mseg-matnr,
          END OF it_test.
      CALL FUNCTION 'ZJNC_GET_RANGE'
        EXPORTING
          rangename       = 'test'
          itabname        = 'IT_TEST[]'
          irecname        = 'it_test'
          spreadsheetintf = spreadsheetintf.
    =Work!$A$14:$C$16 is range "test"
    Numbers & Character data are no problem BUT dates are.
    In Excel default date is mm/dd/yyyy but is dependent on PC's
    international setting which is normally default
    To Avoid any 5-March 3-May type mix-up, I have designed the FM so that you need to
    enter dates as 'dd.Mon.yyyy i.e. in Characters in "Internet Date Format"
    FUNCTION zjnc_get_range.
    *"*"Local interface:
    *"  IMPORTING
    *"     REFERENCE(RANGENAME) TYPE  C
    *"     REFERENCE(ITABNAME) TYPE  C
    *"     REFERENCE(IRECNAME) TYPE  C
    *"     REFERENCE(SPREADSHEETINTF) TYPE REF TO  I_OI_SPREADSHEET
    *"     REFERENCE(SPREADSHEETINTF) TYPE REF TO  I_OI_SPREADSHEET
      DATA:
        stru_ref    TYPE REF TO cl_abap_structdescr,
        comp_tab    TYPE abap_compdescr_tab,
        one_comp    TYPE abap_compdescr,
        one_name    TYPE string,
        type_ref    TYPE REF TO cl_abap_typedescr,
        is_ddic     TYPE abap_bool,
        lt_ddic     TYPE dd_x031l_table,
        wa_ddic     TYPE x031l.
      DATA: zjncranges    TYPE soi_range_list,
            zjnccontents  TYPE soi_generic_table,
            zjnconerange  TYPE soi_range_item,
            zjnconeitem   TYPE soi_generic_item,
            prevrow(4)    TYPE n,
            nrow(4)       TYPE n,
            ncolumn(4)    TYPE n,
            mystring      TYPE string,
            mydate        LIKE sy-datum.
      FIELD-SYMBOLS: <fs_type>  TYPE ANY,
                     <fs_table> TYPE STANDARD TABLE,
                     <fs_line>  TYPE ANY.
      CONCATENATE '(' sy-cprog ')' itabname INTO mystring.
      ASSIGN (mystring) TO <fs_table>.
      CONCATENATE '(' sy-cprog ')' irecname INTO mystring.
      ASSIGN (mystring) TO <fs_line>.
      stru_ref ?= cl_abap_structdescr=>describe_by_data( <fs_line> ).
      comp_tab = stru_ref->components.
      REFRESH zjncranges.
      MOVE rangename TO zjnconerange-name.
      APPEND zjnconerange TO zjncranges.
      CALL METHOD spreadsheetintf->get_ranges_data
        IMPORTING
          contents = zjnccontents
          error    = zjncerror
          retcode  = zjncretcode
        CHANGING
          ranges   = zjncranges.
      MOVE 0 TO prevrow.
      LOOP AT zjnccontents INTO zjnconeitem.
        MOVE zjnconeitem-row TO nrow.
        IF nrow <> prevrow.
          IF prevrow <> 0.
            APPEND <fs_line> TO <fs_table>.
          ENDIF.
          CLEAR <fs_line>.
          MOVE nrow TO prevrow.
        ENDIF.
        MOVE zjnconeitem-column TO ncolumn.
        READ TABLE comp_tab INDEX ncolumn INTO one_comp.
        CONCATENATE '(' sy-cprog ')' irecname '-' one_comp-name INTO one_name.
        ASSIGN (one_name) TO <fs_type>.
        IF one_comp-type_kind <> 'D'.
          MOVE zjnconeitem-value TO <fs_type>.
        ELSE.
          TRANSLATE zjnconeitem-value TO UPPER CASE.
          CALL FUNCTION 'CONVERSION_EXIT_SDATE_INPUT'
            EXPORTING
              input  = zjnconeitem-value
            IMPORTING
              output = mydate.
          MOVE mydate TO <fs_type>.
        ENDIF.
      ENDLOOP.
      IF prevrow <> 0.
        APPEND <fs_line> TO <fs_table>.
      ENDIF.
    ENDFUNCTION.
    SAP has a facility called BDS.
    <b>Read</b>
    http://www.intelligententerprise.com/channels/applications/feature/archive/schulze.jhtml
    Read http://www.sappro.com/download03.cfm?session=   
    There is ready code of BDS+DOI -- uses CL_BDS_DOCUMENT_SET global class.
    If you wish to store a Word/Excel/AutoCad or any other document in SAP,
    then you can use the Business Document Service (BDS). I did not - as
    Cluster Data Directory is a simple beginning ...
    <b><u>Uploading data directly from Excel file format </u></b>
    * Upload data direct from excel.xls file to SAP
    REPORT ZEXCELUPLOAD.
    PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
                begcol TYPE i DEFAULT 1 NO-DISPLAY,
                begrow TYPE i DEFAULT 1 NO-DISPLAY,
                endcol TYPE i DEFAULT 100 NO-DISPLAY,
                endrow TYPE i DEFAULT 32000 NO-DISPLAY.
    * Tick don't append header
    PARAMETERS: kzheader AS CHECKBOX.
    DATA: BEGIN OF intern OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern.
    DATA: BEGIN OF intern1 OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern1.
    DATA: BEGIN OF t_col OCCURS 0,
           col LIKE alsmex_tabline-col,
           size TYPE i.
    DATA: END OF t_col.
    DATA: zwlen TYPE i,
          zwlines TYPE i.
    DATA: BEGIN OF fieldnames OCCURS 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          END OF fieldnames.
    * No of columns
    DATA: BEGIN OF data_tab OCCURS 0,
           value_0001(50),
           value_0002(50),
           value_0003(50),
           value_0004(50),
           value_0005(50),
           value_0006(50),
           value_0007(50),
           value_0008(50),
           value_0009(50),
           value_0010(50),
           value_0011(50),
           value_0012(50),
           value_0013(50),
           value_0014(50),
           value_0015(50),
           value_0016(50),
           value_0017(50),
           value_0018(50),
           value_0019(50),
           value_0020(50),
           value_0021(50),
           value_0022(50),
           value_0023(50),
           value_0024(50),
           value_0025(50),
           value_0026(50),
           value_0027(50),
           value_0028(50),
           value_0029(50),
           value_0030(50),
           value_0031(50),
           value_0032(50),
           value_0033(50),
           value_0034(50),
           value_0035(50),
           value_0036(50),
           value_0037(50),
           value_0038(50),
           value_0039(50),
           value_0040(50),
           value_0041(50),
           value_0042(50),
           value_0043(50),
           value_0044(50),
           value_0045(50),
           value_0046(50),
           value_0047(50),
           value_0048(50),
           value_0049(50),
           value_0050(50),
           value_0051(50),
           value_0052(50),
           value_0053(50),
           value_0054(50),
           value_0055(50),
           value_0056(50),
           value_0057(50),
           value_0058(50),
           value_0059(50),
           value_0060(50),
           value_0061(50),
           value_0062(50),
           value_0063(50),
           value_0064(50),
           value_0065(50),
           value_0066(50),
           value_0067(50),
           value_0068(50),
           value_0069(50),
           value_0070(50),
           value_0071(50),
           value_0072(50),
           value_0073(50),
           value_0074(50),
           value_0075(50),
           value_0076(50),
           value_0077(50),
           value_0078(50),
           value_0079(50),
           value_0080(50),
           value_0081(50),
           value_0082(50),
           value_0083(50),
           value_0084(50),
           value_0085(50),
           value_0086(50),
           value_0087(50),
           value_0088(50),
           value_0089(50),
           value_0090(50),
           value_0091(50),
           value_0092(50),
           value_0093(50),
           value_0094(50),
           value_0095(50),
           value_0096(50),
           value_0097(50),
           value_0098(50),
           value_0099(50),
           value_0100(50).
    DATA: END OF data_tab.
    DATA: tind(4) TYPE n.
    DATA: zwfeld(19).
    FIELD-SYMBOLS: <fs1>.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = '*.xls'
                static    = 'X'
           CHANGING
                file_name = filename.
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = filename
                i_begin_col             = begcol
                i_begin_row             = begrow
                i_end_col               = endcol
                i_end_row               = endrow
           TABLES
                intern                  = intern
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/ 'Upload Error ', SY-SUBRC.
      ENDIF.
    END-OF-SELECTION.
      LOOP AT intern.
        intern1 = intern.
        CLEAR intern1-row.
        APPEND intern1.
      ENDLOOP.
      SORT intern1 BY col.
      LOOP AT intern1.
        AT NEW col.
          t_col-col = intern1-col.
          APPEND t_col.
        ENDAT.
        zwlen = strlen( intern1-value ).
        READ TABLE t_col WITH KEY col = intern1-col.
        IF sy-subrc EQ 0.
          IF zwlen > t_col-size.
            t_col-size = zwlen.
    *                          Internal Table, Current Row Index
            MODIFY t_col INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t_col LINES zwlines.
      SORT intern BY row col.
      IF kzheader = 'X'.
        LOOP AT intern.
          fieldnames-title = intern-value.
          APPEND fieldnames.
          AT END OF row.
            EXIT.
          ENDAT.
        ENDLOOP.
      ELSE.
        DO zwlines TIMES.
          WRITE sy-index TO fieldnames-title.
          APPEND fieldnames.
        ENDDO.
      ENDIF.
      SORT intern BY row col.
      LOOP AT intern.
        IF kzheader = 'X'
        AND intern-row = 1.
          CONTINUE.
        ENDIF.
        tind = intern-col.
        CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
        ASSIGN (zwfeld) TO <fs1>.
        <fs1> = intern-value.
        AT END OF row.
          APPEND data_tab.
          CLEAR data_tab.
        ENDAT.
      ENDLOOP.
      CALL FUNCTION 'DISPLAY_BASIC_LIST'
           EXPORTING
                file_name     = filename
           TABLES
                data_tab      = data_tab
                fieldname_tab = fieldnames.
    *-- End of Program
    Reward all helpfull answers
    Regards
    Pavan
    Message was edited by:
            Pavan praveen

  • Uploading xml file in a background job .

    Hi Experts ,
    I am uploading a xml file from application server to internal table .
    While uploading from presentation server I get the value of stream as ( first few lines )
    Case 1 :
    ?<?xml version="1.0" encoding="utf-16" standalone=
    "yes"?><WPUBON01>##  <IDOC BEGIN="1">##    <EDI_DC
    40 SEGMENT="1">##      <TABNAM>EDI_DC40</TABNAM>##
    but while uploading from  application server , I get :
    Case 2 :
    <?xml version="1.0" standalone="yes"?>##<WPUBON01>##  <IDOC BEGIN="1">##    <EDI
    DC40 SEGMENT="1">##      <TABNAM>EDIDC40</TABNAM>##      <MANDT>108</MANDT>##
    Difference is of  unicode 16 as seen in file from presentation server .
    As a result File from Presentation server is getting uploaded in internal table , but not from Application Server . In this case internal table is coming blank .
    I am using :
          CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
              EXPORTING
                text   = stream
              IMPORTING
                buffer = xstring
              EXCEPTIONS
                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.
    here xstring is coming blank when you use same file from application server .
    *Extract data from xsting to internal table
            CALL FUNCTION 'SMUM_XML_PARSE'
              EXPORTING
                xml_input = xstring
              TABLES
                xml_table = it_data
                return    = it_ret.
    I am getting error it it_ret as :
    line   1 col   1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment
    How to get file like case 1 . or how to convert to utf-16 ?
    I am using :
    OPEN DATASET l_filename FOR INPUT IN  BINARY MODE    .
    DO.
    READ DATASET l_filename INTO l_xml_line.
    IF sy-subrc EQ 0.
    APPEND l_xml_line TO l_xml_table.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    CLOSE DATASET l_filename.
    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.
    Help please ......
    regards ,
    SA

    Hi Alpana ,
    Thanks for the reply .
    I already am uploading data in internal table . If you see through my question ,
    My problem is modify  the error in xml file uploaded in  l_xml_table through read dataset .
    My file has been uploaded   from application server as 
    <?xml version="1.0" standalone="yes"?>
    <WPUBON01>
      <IDOC BEGIN="1">
    This file is getting changed while uploading from presentation server as 
    ?<?xml version="1.0" encoding="utf-16" standalone=
    "yes"?><WPUBON01>##  <IDOC BEGIN="1">##    <EDI_DC
    40 SEGMENT="1">##      <TABNAM>EDI_DC40</TABNAM>##
          <MANDT>108</MANDT>##      <DOCNUM>3C10000001
    notice the addition   'encoding="utf-16" '  .
    How to achieve this addition .
    If i am uploading it frompresentation server it is getting uploaded in internal table successfully , but not from application server
    so that i can parse this xml file into xstring successfulyy to get it into internal table thru function module
    CALL FUNCTION 'SMUM_XML_PARSE'
              EXPORTING
                xml_input = xstring
                xml_input = l_string_output
              TABLES
                xml_table = it_data
                return    = it_ret.
    Please help me in hanging the file stream .
    Regards ,
    SA

  • How to upload XML file into the internal table in Webdynpro  ABAP ?

    Hi Friends,
    I am not able to upload the XML file into ABAP,can you please help me in solving this issue with the help of source code.
    Regards
    Dinesh

    Hi Dinesh,
    Try go through this program which I had developed earlier. It takes as input an XML file and then breaks it down into name-value pairs of an intrnal table. You need to pass an XML file as input to this program. (I had hard coded the path for my XML file in it. You need to replace it with 1 of your own or you can just delete it and use the browse button to selet the file on your PC)
    Regards,
    Uday
    REPORT  ZUDAY_XML no standard page heading.
    " Internal table to store the XML file in binary mode
    data: begin of it_xml occurs 1,
            c(255) type x,
          end of it_xml,
    " Name-value pairs table rturned by FM SMUM_XML_PARSE
          it_SMUM_XMLTB type SMUM_XMLTB occurs 0 with header line,
    " Table returned by FM SMUM_XML_PARSE for error handling
          it_bapiret2 type bapiret2 occurs 0 with header line.
    " XSTRING variable to be used by FM SCMS_BINARY_TO_XSTRING to hold the XML file in XSTRING format
    data: I_xstring type xstring, 
    " String variable to hold XML file path to pass to GUI_UPLOAD
          I_file_path type string,
    " Variable to store the size of the uploaded binary XML file
          I_LENGTH TYPE I VALUE 0.
    parameters: P_path type IBIPPARMS-PATH default 'C:\Documents and Settings\c5104398\Desktop\flights.xml'.
    " Get the XML file path from the user
    at selection-screen on value-request for P_path.
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          FILE_NAME = P_PATH.

  • Simple Transformation ST, upload xml file to internal table

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

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

Maybe you are looking for

  • Movie Playback Buttons

    Hi. I am very unexperienced with this, so please bear with me...I'm trying to create a button that can skip my flash intro anytime I press it? I chose my button. It is in a "button" layer and it is called "btn_forward". Can someone please give me a c

  • Ahhhh. I can't get a certain song onto my iPod...

    Yeah, it says that "it cannot be played on this iPod..." But what the heck?! I bought it! And it also won't play in my iTunes library. NO I don't share a computer or whatever. Or library. It's the song No No No by Def Leppard. Dang =[ iPod Nano...?  

  • Latest upgrade disables my internet connection

    I upgraded and now I can't access the internet from my home.  It tells me that it is checking my internet connection and then it "...disconnects WiFi because the connection is too slow".  Really???  This needs to be fixed, what can I do??  We use a V

  • Will an iphone 5 case fit a 5s ?

    I am wanting to buy an iphone 5s case. There are so few to choose from I wondered if a case for the iphone 5 would fit the 5s. Anyone help?  Thanks

  • Strange intermittent gulping sound

    For some weeks now I hear intermittently a strange sound coming from my speakers. It lasts about a second, and because of this and also because it comes at random moments, I cannot make a recording of it so I will try to describe it. It starts as a t