How to update XML file from the program

i am new in abap , and i have the following issue,so plz anyone who knows how to do it
Background :
An XML file is used as the datasource for a Flex Application. From time to time this requires updating with new staff details.
i have already saved the xml file in the c drive with the name C:\AdvAC\AC1\bin-debug\assets\staff
Requirement :  Write a Dialog transaction with the following text input fields.
Reference Indicator.     (Char10)
Staff No          (NUMC, Length 5)
Name               (Char50)
Room               (Numc, length 3)
Phone               (Numc Length 7)
Mail               (char30)
in screen 100
The transaction should also have an u201CUpdate Fileu201D button, which when pressed :
1) Loads the file C:\AdvAC\AC1\bin-debug\assets \ into an ITAB.
2) Inserts the data into the ITAB using the following XML format.
<staff>
<ref_ind> Reference Indicator.</ref_ind>
<staff_no> Staff No </staff_no>
<name> Name </name>
<room> Room </room>
<phone> Phone </phone>
<mail> Mail </mail>
</staff>
all should be inside  <allstaff> </allstaff> tagsu2026.
Writes the ITAB back to the file.
thanx all

this is what i have done but i dont know how to do the rest. i will apprecite any help from u.
Edited by: man700s on Feb 16, 2010 6:58 AM
REPORT  Z_XML_FILE_UPDATE.
TYPES: BEGIN OF ts_staff,
         REF_IND(10)  TYPE c,
         Staff_No(5)  TYPE c,
         Name(50)     TYPE c,
         Room(3)      Type n,
         Phone(7)     Type n,
         Mail(30)     Type c,
       END OF ts_staff.
DATA: t_staff TYPE TABLE OF ts_staff WITH HEADER LINE.
DATA: w_staff Type ts_staff.
DATA T_STRING TYPE TABLE OF STRING.
DATA W_STRING TYPE STRING.
call SCREEN 100.
PERFORM upload_xml_file.
PERFORM update_xml_tab.
*PERFORM download_xml_file.
MODULE USER_COMMAND_0100 INPUT.
W_STRING = '<allstaff>'.
  APPEND w_string to t_string.
  loop at t_staff into w_staff.
  w_string ='<staff>'.
  APPEND w_string to t_string.
  if T_staff-Ref_Ind = 'X'.
  CONCATENATE '<Ref_Ind>' w_staff-Ref_Ind '</Ref_Ind>' into w_string.
  APPEND w_string to t_string.
  ENDIF.
  if T_staff-staff_no = 'X'.
  CONCATENATE '<staff_no>' w_staff-staff_no '</staff_no>' into w_string.
  APPEND w_string to t_string.
  ENDIF.
  if T_staff-name = 'X'.
  CONCATENATE '<name>' w_staff-name '</name>' into w_string.
  APPEND w_string to t_string.
  ENDIF.
if T_staff-room = 'X'.
  CONCATENATE '<room>' w_staff-room '</room>' into w_string.
  APPEND w_string to t_string.
  ENDIF.
  if T_staff-phone = 'X'.
  CONCATENATE '<phone>' w_staff-phone '</phone>' into w_string.
  APPEND w_string to t_string.
  ENDIF.
  if T_staff-mail = 'X'.
  CONCATENATE '<mail>' w_staff-mail '</mail>' into w_string.
  APPEND w_string to t_string.
  ENDIF.
  w_string = '</staff>'.
  append w_string to t_string.
ENDLOOP.
  W_STRING = '</allstaff>'.
  APPEND w_string to t_string.
ENDMODULE.               
Edited by: man700s on Feb 16, 2010 7:01 AM

Similar Messages

  • How to edit the existing data in the XML file from java programming.

    Hi all
    i am able to create XML file with the sample data as below from java programming.
    i need sample code on how to edit the existing data in the XML file?
    for example
    <?xml version="1.0"?>
       <mydata>
               <data1>
                         <key1>467</key1>
                        <name1>Paul</name1>
                        <id1>123</id1>
              </data1>
              <data2>
                         <key2>467</key2>
                        <name2>Paul</name2>
                        <id2>123</id2>
              </data2>
        </mydata>
    i am able to insert the data in the XML.
    now i need sample code on how to modify the data in the above XML file from the java programming for only key2,name2,id2 tags only. the remaining tags data in the XML file i want to keep same data except for key2,name2,id2 which are i want to modify from java code
    Regards
    Sunil
    [points will be always rewardable]

    hi
    u need a parser or validate the xml file for to read the xml file from java coding u need for this
    xml4j.jar u can download this file  from here
    http://www.alphaworks.ibm.com/tech/xml4j
    or we can use the SAX(simple API for XML)
    some sample applications for this
    http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html
    http://www.developertutorials.com/tutorials/java/read-xml-file-in-java-050611/page1.html
    http://www.xml-training-guide.com/e-xml44.html
    let me know u need any other info
    bvr

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • Help on how to read the content of an XML file from the payload

    I have a receiver channel / mail adapter, that sends e-mails with a XML attachment.
    I’m trying to write a Bean, that should make it possible to rename the attached XML file dynamically.
    In the Bean I want to read the content of the attached XML file, it could be the “order number”.
    The filename should then be “Order number”.XML.
    <u><i>Can anyone help me with how to read the content of the XML file from the payload.</i></u>
    <i><b>Frank</b></i>

    hi,
    check this: http://jakarta.apache.org/poi/

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • HOw to update XML file residing in DAM by component JSP in run-time?

    i have made a component which reads xml file residing in DAM.
    Content Author can fill some values in dialog of this component, as soon as author provide the values,i have to update these values in XML file and component reloadsby reading the updated xml file.
    i am trying to achieve this by making object of XML file and giving it's path., but i ma unable to access the XML file.
    Can anyone help me out to how to update XML file by component JSP in run-time?

    Now the changed data must be exported back into the XML file, meaning that the content of certain elements must be updated. How can this be done with XSLT?
    XSLT approach:  check these online tutorial
    http://www.xml.com/pub/a/2000/08/02/xslt/index.html
    http://www.xml.com/pub/a/2000/06/07/transforming/index.html
    ABAP approach:
    for example you have the xml (original) in a string called say xml_out .
    data: l_xml  type ref to cl_xml_document ,
            node type ref to if_ixml_node  .
    create object l_xml.
    call method l_xml->parse_string
      exporting
        stream = xml_out.
    node = l_xml->find_node(
        name   = 'IDENTITY'
       ROOT   = ROOT
    l_xml->set_attribute(
        name    = 'Name'
        value   = 'Charles'
        node    = node
    (the above example reads the element IDENTITY and sets attribute name/value to the same)
    like wise you can add new elements starting from IDENTITY using various methods available in class CL_XML_DOCUMENT
    so how do I access the XML file in order to update it?
    you have already read this XML into a ABAP variable right?
    Sorry couldnt understand your whole process, why do you need to read local XML file?
    Raja

  • How to refresh XML file  from my client machine

    Hai All
    I have temp.XML and temp.XSL template in our server machine.
    when i give a print from client machine first time it gives the record,and next time it did not get refresh.Always it shows the previous records in the browser.But when i go into the server machine and click on temp.xml,it shows the current record(correct records)
    How to refresh XML file  from my client machine?
    Regards
    Dhina

    You never delete a Time Machine backup by dragging it to the Trash. You are supposed to use the TM application to manage the backups. What you will need to do now is to simply erase the drive using Disk Utility.

  • How to read .xml file from embedded .swf(flash output) in captivate

    I have been trying to read .xml file from the .swf (Flash output) that is embedded within the captivate file but no luck yet . Please if anyone got any clue on how get this thing done using Action script 3.0 then let me know. I am using Adobe Captivate 5.5 at present and Flash CS 5.5.
    I am well aware about how to read .xml file through action script 3.0 in flash but when insert the same flash in captivate and publish nothing comes in captivate output. I would higly appreciate if anyone could help me out with that.
    Here is is graphical demonstration of my query :
    Message was edited by: captainmkv

    Hi Captainmkv,
    Does the information in this post cover what you're trying to do: http://forums.adobe.com/message/5081928#5081928
    Tristan,

  • How to download a file from the net and save it into .txt format in a datab

    Can some one show me a tutorial on how to download a file from the net and save it into .txt format in a database?
    Thank you,

    http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html

  • How to download a file from the internet using terminal

    how to download a file from the internet using terminal
    does any one know how to download afile from the internet using the Terminal application?

    Use curl. Something like this:
    curl -O http://www.example.com/filename.zip
    For more info, type +man curl+.

  • How to Generate XML File from Java Code.

    I want to generate the xml file from the java code.
    Could you plz suggest any webSite address with example?

    Here is the code
    import java.io.File;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    public class CreateXML {
         private DocumentBuilderFactory factory = null;
         private DocumentBuilder builder = null;
         private Document document = null;
         public CreateXML() {
              try {
                   factory = DocumentBuilderFactory.newInstance();
                   builder = factory.newDocumentBuilder();
                   document = builder.newDocument();
              } catch (FactoryConfigurationError e) {
                   e.printStackTrace();
              } catch (ParserConfigurationException e) {
                   e.printStackTrace();
         /** Creates the document for xml. */
         public Document createDocument(){
              try{               
                   Element root = document.createElement("Root");
                   Element child = document.createElement("child");
                   root.appendChild(child);
                   document.appendChild(root);
              }catch(RuntimeException e){
                   e.printStackTrace();
              return document;
         /** Saves the document as xml. */
         public void saveDocument(Document document){
              try{
                   TransformerFactory transFactory = TransformerFactory.newInstance();
                   Transformer transformer = transFactory.newTransformer();
                   DOMSource source = new DOMSource(document);
                   StreamResult stream = new StreamResult(new File("sample.xml"));
                   transformer.transform(source, stream);
                   System.out.println("XML Created !!");
              }catch(TransformerConfigurationException e){
                   e.printStackTrace();
              } catch (TransformerException e) {
                   e.printStackTrace();
         public static void main(String args[]){
              CreateXML createXML = new CreateXML();
              Document document = createXML.createDocument();
              createXML.saveDocument(document);
    }

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

  • How to share personal files from the  iMac to MacBook Pro

    How do I share files from the iMac so I don't have to keep on sending it to the MacBook Pro. Under the iMac's system preferences, I clicked on sharing and enabled personal file sharing. When I connect to the iMac's server using the MacBook Pro, I try to log in but it says my log in info is unknown. So I try loging in as a guest but when I click on the drop box, it says that I don't have the privilegde to view it. Is there another easier way of file sharing between the computers I have at home?

    When you log into the server computer you need to use the username and password of an account that exists on the server computer.

  • How do you get an xml file from the PO Output for Communication report?

    Can anyone tell me how you've created an xml output fil for this program? When I run it, the View XML button doesn't light up, and the output file is empty.
    I can see the XML when I click the View Log button, but can't figure out how to save it so that the XMLP Desktop tool can load it properly.
    If you can tell me how to create this file, I'd be very appreciative.

    Hi,
    I can't see the xml in my log file. Maybe you have a different logging level. One issue I have had before is that the xml declaration had a strange character encoding. It should say something like: <?xml version="1.0" ?>. If it mentions anything about encoding you can remove it.
    One of our developers wrote a custom process to write the xml to a table when the document was generated as we couldn't find any other way of doing it.
    You can use the sample xml available from the data definition but this is missing fields.
    Probably not much help...
    Paul

  • How to create a xml file from the jsp page?

    I'm a beginner of the develop xml,my question like this,
    there has a jsp page,some parameters in it,I wanna get the parameters and create a xml file,so,what parser method should I use?
    And how to create a new xml file,when the file haven't exist at first?
    pls give some code,thanks.

    a ggod link for u http://www.theserverside.com/resources/article.jsp?l=JSP-XML2

Maybe you are looking for

  • Translated description is not coming in BW reporting

    Hello, I have a BI report in which the description of each column is coming correctly when I have logged in english. When I logged in German Language the description is not coming correctly. It is coming like selektion 1, Selektion 2. KIndly suggest

  • Disable Backspace when in input text fields

    Im trying to find a way to disable the keyboard backspace button from going back a page in the site but allowing it to function as a character delete when needed for typing in an input text field of a form. Strangely this problem only occurs for abou

  • Checking if Date/Time is Available (and then some more)

    Okay, so I am stepping out of my as3 skill set here quite a ways and need some bookoo assistance (Flash 5.5). I am working on trying to come up with a way (an AIR desktop application, or web application) for the teachers on my campus to be able to as

  • Strange red shadows in backit portrait in ACR - but ok in ViewNX

    I've recently been processng NEFs from a D300 using ACR without any problems. Until... The following photo has some very wierd red shadows when imported using ACR5.5. But when viewed using the Nikon ViewNX 1.4.0 they look perfectly ok. I've also trie

  • Apple Tv connectivity

    The modem used for airport express is 12m distance away (other end of house) signal strength of modem wi fi can pick up 5 or more neighbours as well. streaming iTunes music to sterio no trouble ever. Baught iTV unit hoping to pick up same result (pur