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.

Similar Messages

  • Problem while reading the file from FTP server

    Hi Friends,
    I have a problem while fetching files from FTP server.
    I used FTP_Connect, FTP_COMMAND function modules. I can able to put the files into FTP server.
    but I cant able to pick the files from FTP server.
    anyone have faced similar issues kindly let me know.
    Thanks
    Gowrishankar

    Hi,
    try this way..
    for reading the file using FTP you need to use different unix command ..
    Prabhuda

  • Problem while reading XML File from Memory

    I want to read the data from an XML File which is residing in memory.The XML File should be read not by the name or the location of the file but by a Response String.
    So Can anybody help me out how can get this.
    I tried it with BufferedInputStream but BufferedInputStream needs InputStream as a Parameter and i am not able to get what parameter should be passed into the BufferedInputStream as the syntax of this is
    BufferedInputStream(InputStream in)
    Its very Urgent !!!
    Thanks in Advance

    I have created the parsing method.
    The code is like this.
    if(response.toString().equals("CS_NEWS_RESPONSE"))
    *//InputStream in = new BufferedInputStream(InputStream());*
    *//InputStream in = new BufferedInputStream(response.toString());*
    *//BufferedInputStream b = new BufferedInputStream(in);*
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
    Document doc = docBuilder.parse(in);
              Element root = doc.getDocumentElement();
    The code will go like this....
    response.toString() is containing the response type which is the identification of that particular XML File. By using this my file is identified and after identification of this file, i should read the contents and parse them.
    Sentences in the bold are the ways. Is this the correct way ??
    Amit Will you be able to help me or is there anybody else who knows about this.
    Edited by: Monadear on Oct 5, 2007 9:37 AM

  • Read XML file from presentation server

    Hi All,
    I want read XML file from presentation server currently i am using GUI_UPLOAD fm . but it is reading some junk data.
    DATA : BEGIN OF upl OCCURS 0,
              f(255) TYPE c,
           END OF upl.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename = D:\XX.XML'
          filetype = 'BIN'
        TABLES
          data_tab = upl.
    is there any other alternative.
    Thanks
    Swarup,

    Hi Swarup,
    Use method IMPORT_FROM_FILE of class CL_XML_DOCUMENT.
    A sample code snippet :-
    PARAMETERS: p_filnam TYPE localfile OBLIGATORY
    DEFAULT 'C:\Documents and Settings\ssaha\Desktop\test.xml'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_filnam.
    DATA: l_v_fieldname TYPE dynfnam.
    l_v_fieldname = p_filnam.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    field_name = l_v_fieldname
    IMPORTING
    file_name = p_filnam.
    START-OF-SELECTION.
    TYPES:
    BEGIN OF ty_tab,
    name TYPE string,
    value TYPE string,
    END OF ty_tab.
    DATA:
    lcl_xml_doc TYPE REF TO cl_xml_document,
    v_subrc TYPE sysubrc,
    v_node TYPE REF TO if_ixml_node,
    v_child_node TYPE REF TO if_ixml_node,
    v_root TYPE REF TO if_ixml_node,
    v_iterator TYPE REF TO if_ixml_node_iterator,
    v_nodemap TYPE REF TO if_ixml_named_node_map,
    v_count TYPE i,
    v_index TYPE i,
    v_attr TYPE REF TO if_ixml_node,
    v_name TYPE string,
    v_prefix TYPE string,
    v_value TYPE string,
    v_char TYPE char2.
    DATA:
    itab TYPE STANDARD TABLE OF ty_tab,
    wa TYPE ty_tab.
    CREATE OBJECT lcl_xml_doc.
    CALL METHOD lcl_xml_doc->import_from_file
    EXPORTING
    filename = p_filnam
    RECEIVING
    retcode = v_subrc.
    CHECK v_subrc = 0.
    v_node = lcl_xml_doc->m_document.
    CHECK NOT v_node IS INITIAL.
    v_iterator = v_node->create_iterator( ).
    v_node = v_iterator->get_next( ).
    WHILE NOT v_node IS INITIAL.
    CASE v_node->get_type( ).
    WHEN if_ixml_node=>co_node_element.
    v_name = v_node->get_name( ).
    v_nodemap = v_node->get_attributes( ).
    IF NOT v_nodemap IS INITIAL
    * attributes
    v_count = v_nodemap->get_length( ).
    DO v_count TIMES.
    v_index = sy-index - 1.
    v_attr = v_nodemap->get_item( v_index ).
    v_name = v_attr->get_name( ).
    v_prefix = v_attr->get_namespace_prefix( ).
    v_value = v_attr->get_value( ).
    ENDDO.
    ENDIF.
    WHEN if_ixml_node=>co_node_text OR
    if_ixml_node=>co_node_cdata_section.
    * text node
    v_value = v_node->get_value( ).
    MOVE v_value TO v_char.
    IF v_char <> cl_abap_char_utilities=>cr_lf.
    wa-name = v_name.
    wa-value = v_value.
    APPEND wa TO itab.
    CLEAR wa.
    ENDIF.
    ENDCASE.
    * advance to next node
    v_node = v_iterator->get_next( ).
    ENDWHILE.
    LOOP AT itab INTO wa.
    ENDLOOP.
    Regards
    Abhii

  • Function module to read xml files from application server

    Hi experts,
            I need to read  xml files from application server to sap. Is the any siutable function moldule for that?

    Hi Cenosure,
    Donno about FM which will upload data directly to SAP, I think you have to do some mapping for it so that it will suit the SAP format. Again it depends on your requirement..
    Please elaborate more about your requirement.
    Please have a look on below FM
    TEXT_CONVERT_XML_TO_SAP
    Also search on SCN there are many threads on the same topic available.
    http://abapreports.blogspot.com/2008/09/upload-xml-file-from-application-server.html
    This is the link which will give you the Code
    http://www.geocities.com/rmtiwari/Resources/MySolutions/Dev/Codes/Report/Z_RMTIWARI_XML_TO_ABAP_46C.html
    Use this XML file to Upload the same, this Program will work for your XML file also,
    http://www.geocities.com/rmtiwari/Resources/MySolutions/Dev/Codes/Report/input_xml.xml
    See the below thread also
    Upload XML to internal table and vice versa in SAP 4.6C
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7
    ilesh Nandaniya

  • FM to read XML files from Application server in ECC5.0

    Hi All,
    We need to pick up an XML file from Application server/FTP server. The requirement is to parse the XML file and process it to create material master. SAP provides standard function modules to read XML files.
    Now we need to read the XML file contents of MM01 and upload into SAP Data Base through BAPI
    I need to know about the Function modules to read XML files from Application Server and also about the FM's that will update the Date base tables with the data obtained form XML files.
    Regards
    Prathima

    Parsing XML data:
    http://help.sap.com/saphelp_nw04/helpdata/en/86/8280ba12d511d5991b00508b6b8b11/frameset.htm
    or alternatively check out ABAP online help for "CALL TRANSFORMATION".
    For creating the material master look at BAPI_STANDARDMATERIAL_CREATE.
    Thomas

  • Reading XML file from application server and  put into internal table-4.6C

    Dear All,
    Is there any way of reading XML file from application server to SAP? I am using 4.6C. Function module SCMS_STRING_TO_XSTRING function module is not available. Please suggest.
    Thanks and regards,
    Atanu

    Hi Atanu!
    Simply use the XSLT transformation 'ID'.
    FIELD-SYMBOLS <ls_result> TYPE ANY.
    CREATE DATA lref_data TYPE (your_structure).
    ASSIGN lref_data->* TO <ls_result>.
    CALL TRANSFORMATION id
                        SOURCE XML xmlstr
                        RESULT result = <ls_result>.
    "xmlstr" contains your XML file. Just read it into it via standard I/O operations. "<ls_result>" will contain your DDIC formatted content.
    Best regards
    Torsten

  • Problem while dowloading the file from Application Server

    Dear Experts,
                 I am facing the Problem while downloading the file from Application server.
    We done the automatic function while saving the invoice, this will create an idoc, and this idoc is written in the Application Server.
    I am running the Transaction AL11 and select the record, and from menu --> List, i am downloading into TXT format.
    But for some segments, the length is long, and so the last 3 to 4 fields values are not appearing in the File. Even though i am unable to view the values in the file before downloading. But i can view in IDOC.
    Please help me to solve this issue.
    Thanks & Regards,
    Srini

    but our user will use the Txn. AL11 and they will download from there
    Educate the user On a serious note, tell him this is not how data from app server should be downloaded. You can ask him to talk to the basis team to provide him access to the app server folder where the file is being stored.
    I can set the Variant and put this in background, But always the file name will be change, Like we use Time stamp in the File name.
    You can't automate this process by scheduling in BG mode. This is because the in BG mode you can't dwld the file to presentation server.
    Hope i'm clear.
    BR,
    Suhas

  • 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.

  • Reading XML File from application server

    Hi experts,
    My aim is to read a XML file from application server and extract the relevant data from it and process further.
    When I am trying to read a XML file from application server it is reading success fully but the problem is that its not reading the last root structure of XML file why is so happening can any body help me?
    I am using the following code:
    TYPES: BEGIN OF xml_line,
    text(256) type x,
    END OF xml_line.
    DATA: e_file LIKE rlgrap-filename VALUE  'applcatin server path'
    OPEN DATASET e_file FOR INPUT IN BINARY MODE.
    IF sy-subrc EQ 0.
      DO.
        READ DATASET e_file INTO wa_item1-text.
        IF sy-subrc EQ 0.
          APPEND wa_item1 TO gt_item1 .
          CLEAR wa_item1.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
    ENDIF.
    CLOSE DATASET e_file.
    after this i am passing this internal table to "cl_ixml" class to extract the data
    but it returning the itab with required value except the last record.
    The stream reading the file it self is i thought in complete thats why it is not converting the all values.
    Please  help me...
    Thanks a ton in advance.

    Hi,
    1 Copy Report BCCIIXMLT1
    2 (you can change the way of filling internal table xml_table if necessary)
    3 you don't need the part between
    *-- render the DOM back into an output stream/internal table
    and
    *-- print the whole DOM tree as a list...
    Comment it out or simply delete it
    4 Rename form print_node to your liking e.g. process_node
    5 In your new form you need three extra variables:
    data: attribs type ref to IF_IXML_NAMED_NODE_MAP,
          attrib_node type ref to IF_IXML_NODE,
          attrib_value type string.
    6 After the lines:
    when if_ixml_node=>co_node_element.
      string = pNode->get_name( ).
    Insert:
    attribs = pNode->get_attributes( ).
    clear attrib_value.
    case string.
      when ''. "put your XML tag name here
        attrib_node = attribs->get_named_item(name = '' ). "put your XML attribute name here
        attrib_value = attrib_node->get_value( ).
    You can also refer link,
    /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
    thanks & regards
    shreemohan

  • Read XML file from different server on JSP

    Dear All,
    I am a newbie to JSP with XML, now i want to read the "test.xml" from JSP.
    I read successfully this "test.xml" file from my system and I got output, but I need to read the xml file from
    different server like "http://www.domain.com/test.xml". I couldn't read such a type of file from different server.
    Is it possible to read a xml file from different server?
    If anybody have idea please let me know.
    Thanks in Advance,
    Prasath.
    <%@ page import="java.sql.*,java.io.*,java.util.*,javax.xml.parsers.*,org.w3c.dom.*,org.xml.sax.*" %>
    <%
    try {
        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
        Document doc = docBuilder.parse (new File("http://www.domain.com/test.xml"));
        // normalize text representation
        doc.getDocumentElement ().normalize ();
        out.println ("Root element of the doc is " +
             doc.getDocumentElement().getNodeName()+"<br>");
        NodeList listOfPersons = doc.getElementsByTagName("person");
        int totalPersons = listOfPersons.getLength();
        out.println("Total no of people : " + totalPersons+"<br>");
        for(int s=0; s<listOfPersons.getLength() ; s++){
            Node firstPersonNode = listOfPersons.item(s);
            if(firstPersonNode.getNodeType() == Node.ELEMENT_NODE){
                Element firstPersonElement = (Element)firstPersonNode;
                NodeList firstNameList = firstPersonElement.getElementsByTagName("first");
                Element firstNameElement = (Element)firstNameList.item(0);
                NodeList textFNList = firstNameElement.getChildNodes();
                out.println("First Name : " +
                       ((Node)textFNList.item(0)).getNodeValue().trim()+"<br>");
                NodeList lastNameList = firstPersonElement.getElementsByTagName("last");
                Element lastNameElement = (Element)lastNameList.item(0);
                NodeList textLNList = lastNameElement.getChildNodes();
                out.println("Last Name : " +
                       ((Node)textLNList.item(0)).getNodeValue().trim()+"<br>");
                NodeList ageList = firstPersonElement.getElementsByTagName("age");
                Element ageElement = (Element)ageList.item(0);
                NodeList textAgeList = ageElement.getChildNodes();
                out.println("Age : " +
                       ((Node)textAgeList.item(0)).getNodeValue().trim()+"<br>");
            }//end of if clause
        }//end of for loop with s var
    }catch (SAXParseException err) {
    out.println ("** Parsing error" + ", line "
         + err.getLineNumber () + ", uri " + err.getSystemId ());
    out.println(" " + err.getMessage ());
    }catch (SAXException e) {
    Exception x = e.getException ();
    ((x == null) ? e : x).printStackTrace ();
    }catch (Throwable t) {
    t.printStackTrace ();
    %>

    You might try:
    Document doc = docBuilder.parse ("http://www.domain.com/test.xml");Alternatively use the java.net package to obtain an Input Stream to the xml document
    InputStream in = methodThatYouWriteYourselfCalledgetInputStreamForURI("http://www.domain.com/test.xml");
    Document doc = docBuilder.parse (in);cheers,
    evnafets

  • Not recognizing # while reading the file from application server

    Hi
    I am reading a file from application server. While reading into internal table with read statement the last field in each record is filling with hash symbol in the last digit. If I write any if condition with HASH symbol its not going inside the if condition, means its not recognizing as hash may be its internally treating as some other. I need to remove the hash from that field. How I can do that.
    Thanks,
    kishore

    I faced exact situation. Yes, internally its treated as some other special character. What i did was, becuase hash symbol was always coming at the end...i created a dummy field in my internal table so that it will not interfere with my actual data. When i see the data in my internal table, the hash always falls in the last field (dummy) which i will ignore. I could not get solution to remove this hash so i adopted this approach and it worked!!
    Hope it helps,
    SKJ

  • Error while reading excel file from application server into internal table.

    Hi experts,
    My requirement is to read an excel file from application server into internal table.
    Hence I have created an excel file fm_test_excel.xls in desktop and uploaded to app server using CG3Z tcode (as BIN file type).
    Now in my program I have used :
    OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
    DO.
    READ DATASET v_filename INTO wa_tab.
    The statement OPEN DATASET works fine but I get a dump (conversion code page error) at READ DATASET statement.
    Error details:
    A character set conversion is not possible.
    At the conversion of a text from codepage '4110' to codepage '4103':
    - a character was found that cannot be displayed in one of the two
    codepages;
    - or it was detected that this conversion is not supported
    The running ABAP program 'Y_READ_FILE' had to be terminated as the conversion
    would have produced incorrect data.
    The number of characters that could not be displayed (and therefore not
    be converted), is 445. If this number is 0, the second error case, as
    mentioned above, has occurred.
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
    caught and
    therefore caused a runtime error.
    The reason for the exception is:
    Characters are always displayed in only a certain codepage. Many
    codepages only define a limited set of characters. If a text from a
    codepage should be converted into another codepage, and if this text
    contains characters that are not defined in one of the two codepages, a
    conversion error occurs.
    Moreover, a conversion error can occur if one of the needed codepages
    '4110' or '4103' is not known to the system.
    If the conversion error occurred at read or write of  screen, the file
    name was '/usr/sap/read_files/fm_test_excel.xls'. (further information about
    the file: "X 549 16896rw-rw----201105170908082011051707480320110517074803")
    Also let me know whether this is the proper way of reading excel file from app server, if not please suggest an alternative .
    Regards,
    Karthik

    Hi,
    Try to use OPEN DATASET v_filename FOR INPUT IN BINARY mode encoding default. instead of OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
    As I think you are uploading the file in BIN format to Application server and trying to open text file.
    Regards,
    Umang Mehta

  • Read XML files from remote server

    Post Author: TomDegetel
    CA Forum: Data Integration
    This question may look simple to you but I don't see directly how to do this.The idea is to read data from an XML file which is sent to a UNIX directory on a server.When the JobServer is running on my local PC I can configure a flow that reads the file from the local harddisk but if the JobServer is running on another server I don't know how to reach this file.How can I connect from the jobserver to a remote server in order to read an xml file and read its contents into a query ? Thanks,  Tom

    Post Author: bhofmans
    CA Forum: Data Integration
    you have several options :
    1) Make sure the directory is accessible to your jobserver via shares. This can even be done between Windows and UNIX using SAMBA or related software.
    2) Use ftp to get the file from the remote location and ftp it to a local drive (DI had built-in options to do ftp)
    3) In 11.7 we added the possibility to specify an URL for the XML file in stead of a file name. So if you can make the XML file available via a web server on the UNIX machine, this would be another way to access the file.

  • Problem in reading xml file from server

    Hi,
    I am using tomcat 4.1 and jdk 1.4.
    All the class files and xml files are put into the one jar file.
    While running our application a jar file is called from jsp file. in that file we are embedded applet coding. here by i am sending my applet code with this...
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = "500" HEIGHT = "500" codebase="http://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Version=1,2,0,0">
    <PARAM NAME = CODE VALUE = "Screen.class" >
    <PARAM NAME = CODEBASE VALUE = "/Sample/web/" >
    <PARAM NAME = ARCHIVE VALUE = "csr.jar" >
    </NOEMBED></EMBED>
    </OBJECT>
    while running our application from another machine we are getting exception filenotfounfexception in the xml is in the generated jar file.
    Exception:
    org.xml.sax.SAXParseException: File "file:///C:/Documents and Settings/Administrator/Desktop/control_property.xml" not found.
    but that xml file is in the jar file and that jar file is present under sample application folder.
    what should i change in the applet code? is there any thing related to trusted applet ?
    Thanks

    You have the xml file in the jar so it is a resource?
    http://java.sun.com/docs/books/tutorial/uiswing/misc/icon.html#getresource
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)

Maybe you are looking for