Problem in outputting a string into a file

Hi guys,
I tried to output a string to a file. The string is 'Size : 30u201D X 13 ½u201D X17 ¾u201D(H)'.
However, with this code :
l_file = '/erp/reports/testgk.txt'.
l_str = 'Size : 30u201D X 13 ½u201D X17 ¾u201D(H)'.
OPEN DATASET l_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
TRANSFER l_str TO l_file.
It returned me a weird string: 'Size : 30M-bM-@M-] X 13 M-BM-=M-bM-@M-] X17 M-BM->M-bM-@M-](H)'
Would you please let me know how to solve this problem?
Thanks, gk

Hello gk,
I tried this code & works fine for me though:
DATA: v_data TYPE string VALUE ' 30u201D X 13 ½u201D X17 ¾u201D(H)',
      v_file TYPE string VALUE
              '\glbwi720InterfaceID2100I_MB_207INsdn.txt'.
OPEN DATASET v_file FOR OUTPUT
IN TEXT MODE
ENCODING DEFAULT.
IF sy-subrc = 0.
  TRANSFER v_data TO v_file.
  CLOSE DATASET v_file.
ENDIF.
Looks like the "usual" ENCODING problem
BR,
Suhas

Similar Messages

  • Problem in converting table data into CSV file

    Hi All,
    In my Process i need to convert my error table data into csv file,my data is converted as csv file by using OdisqlUnload function,but the column headers are not converted,i use another procedure for converting column headers but iam getting below error ...
    com.sunopsis.sql.SnpsMissingParametersException: Missing parameter string.find, string.find
    SQL: import string import java.sql as sql import java.lang as lang import re sourceConnection = odiRef.getJDBCConnection("SRC") output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+') myStmt = sourceConnection.createStatement() my_query = "select * FROM E$_LOCAL_F0911Z1" my_query=my_query.upper() if string.find(my_query, '*') > 0: myRs = myStmt.executeQuery(my_query) md=myRs.getMetaData() collect=[] i=1 while (i <= md.getColumnCount()): collect.append(md.getColumnName(i)) i += 1 header=','.join(map(string.strip, collect)) elif string.find(my_query,'||') > 0: header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',') else: header = my_query[7:string.find(my_query, 'FROM')] print header old=output_write.read() output_write.seek(0) output_write.write (header+'\n'+old) sourceConnection.close() output_write.close()
    And i used below code for converting.......
    import string
    import java.sql as sql
    import java.lang as lang
    import re
    sourceConnection = odiRef.getJDBCConnection("SRC")
    output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+')
    myStmt = sourceConnection.createStatement()
    my_query = "select FROM E$_COMPANY"*
    *my_query=my_query.upper()*
    *if string.find(my_query, '*') > 0:*
    *myRs = myStmt.executeQuery(my_query)*
    *md=myRs.getMetaData()*
    *collect=[]*
    *i=1*
    *while (i <= md.getColumnCount()):*
    *collect.append(md.getColumnName(i))*
    *i += 1*
    *header=','.join(map(string.strip, collect))*
    *elif string.find(my_query,'||') > 0:*
    *header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',')*
    *else:*
    *header = my_query[7:string.find(my_query, 'FROM')]*
    *print header*
    *old=output_write.read()*
    *output_write.seek(0)*
    *output_write.write (header+'\n'+old)*
    *sourceConnection.close()*
    *output_write.close()*
    Any one can you help regarding this
    Edited by: 30021986 on Oct 1, 2012 6:04 PM

    This may not be an option for you but in pinch you may want to consider outputing your data to an MS Spreadsheet, then saving it as a CSV. It's somewhat of a cumbersome process, but it will get you by for now.
    You will need to change your content type to application/vnd.ms-excel.
    <% response.setContentType("application/vnd.ms-excel"); %>

  • How to write a string into a file in java

    Say i hv a string named str.......plz give the total code of creating a file and writing the string into it

    This is the function where i am trying to write a file....i hv highlighted the regions where file writing codes are used........kindly suggest where is my mistake as this code is running but not writing anything.........only the file is getting created but nothing is getting written...aslo i havnt put fw.close() here where in the code should I put it
    static void func1(String str) throws IOException
    int i=0,j=0,k=1,m=0;
    int size1=0,file_size=0;
    String str1;
    int arr[]= new int[no_of_lines+1];
    FileWriter fw;
    *try{*
    fw=new FileWriter("output.txt");
    catch(IOException exc)
    System.out.println("Cannot open file");
    return;
    arr[0]=0;
    while(true)
    a=svcRand.nextInt(10);
    k++;
    i=0;
    j++;
    try{
    FileReader fr= new FileReader(str);
    BufferedReader br= new BufferedReader(fr);
    while((str1=br.readLine()) !=null)
    i++;
    if(i==a)
    file_size=func2(str1,size1);
    str1=str1+"\r\n";
    fw.write(str1);
    catch(FileNotFoundException exc)
    System.out.println("File not found");
    return;
    catch(ArrayIndexOutOfBoundsException exc)
    System.out.println("Usage: Showfile file");
    return;

  • How can i save the output  of  report into  a file,.

    Hi friends,
                 i was create a executable program .. it was executing fine.. imagine.. my program is just fetching the data from  LFA1  table based on some conditions.. every thing is fine.. and i'm getting the output also..
    but i want to save this output in a separate file.. that means.. what can i do.. my program is executing background... so, i want to save this out put in a file... so, can any one plz provide me the coding steps...
    for example here i'm giving the  my program code.. so, now where can i add the new coding.. and what can  i add ...
    data:begin of  table itab occurs 0,
            lifnr  type  lifnr,
            name1 type  name1,
            end of itab.
    select lifnr  name1  from lfa1  into table  itab .
    loop at itab.
    write:/  itab-lifnr , itab-name1,
    endloop.
    i dont know coding.. I'm learning ABAP... so, can you plz provide the exact coding..for storing these data into separate file from spool..
    help ful answers will be rewarded
    Thanks
    Babu

    Hi  Santhosh,  and  Atish,
         Thanks  for ur responces... i was mention already in my question itself.. that my program is executing  in background.. so,  every day at  6 am it will execute.. but i want to see the result...
    for that what can i do..
    regards
    Babu

  • REG: WRITE XML STRING INTO XML FILE

    Hi All, I have a XML FILE on PC. I get a xml string from my server.
    My Task: I want to append the xml string coming from the server into the existing xml file at a particular Node. Given below is my code :
    String xmlString = baos.toString();
                      DocumentBuilder db4XMLString = docBuilderFactory.newDocumentBuilder();
                      InputSource inStream = new InputSource();
                      inStream.setCharacterStream(new StringReader(xmlString));
                      Document doc4XMLString = db4XMLString.parse(inStream);
                      Node root4XMLString = doc4XMLString.getElementsByTagName("epg").item(0);
                      doc.appendChild(doc.importNode(root4XMLString, true));
                      File file = new File(Constant.XMLFILEPATH);
                      Result result = new StreamResult(file.toURI().getPath());
                      Source source = new DOMSource(doc);
                      Transformer xformer = TransformerFactory.newInstance().newTransformer();
                      xformer.transform(source, result);But, wen i run my application I get following exception:
    The markup in the document following the root element must be well-formed.
    org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    Is that my XML string is not well formed. Is it so then please let me how to convert my xml string into well formed XML data.
    Please help me out.
    Thanking You.

    There are many reasons why xmlString could be not well formed. There is no magic recipe for making it well formed: just look at it and see why it is not parseable.
    Note that this line:
    String xmlString = baos.toString();can be problematic if you have non ASCII-7 characters in your XML document. baos could then contain a byte representation of these characters in one particular encoding, but, since you use the .toString() method that relies on the default encoding of your system, you can end up with a mismatch and garbage in your XML.

  • Problem in Coverting XML String into Document

    Hi,
    I am getting some problem while parsing a String XML in to Document object.
    CODE :
    public static Document converDocument(String xml){
    DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = null;
    try {
    builder = factory.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
    e.printStackTrace();
    Document document = null;
    try {
    document = builder.parse(new InputSource(new StringReader(xml)));
    System.out.println("Document is after parsing ====>>>"+document);
    } catch (SAXException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    } catch (IOException e1) {
    e1.printStackTrace();
    return document;
    The xml which I am passing is :
    <?xml version="1.0" encoding="UTF-8"?>
    <note>
    <to>Tove</to>
    <from>Jani</from>
    <heading>Reminder</heading>
    <body>abc</body>
    </note>
    It is giving the document as null;
    Can anybody please help?
    Regards,
    sheeetal.

    >
    Vikas Sridharan wrote:

    >       CALL TRANSFORMATION ('ID')
    >       SOURCE XML = lv_output_str "<============ ERRONEOUS = HERE
    >       RESULT ref = <fst_dyn_table> .
    >
    Remove the "=" sign, this code will work :
          CALL TRANSFORMATION ('ID')
          SOURCE XML lv_output_str
          RESULT ref = <fst_dyn_table> .

  • Insert XML String into XML file at a certain position

    Hello,
    I have this xml string:
    <jdbc-driver-params>
    <url>jdbc:oracle:thin:@localhost:1521:mydb</url>
    <driver-name>oracle.jdbc.OracleDriver</driver-name>
    <properties>
    <property>
    <name>user</name>
    <value>myuser</value>
    </property>
    </properties>
    <password-encrypted>myuser</password-encrypted>
    </jdbc-driver-params>and i need to insert it into an xml file at a certain position (as child for a node)
    The xml file looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90"
        xmlns:sec="http://www.bea.com/ns/weblogic/90/security"
        xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/920 http://www.bea.com/ns/weblogic/920.xsd">
        <name>myDB</name>
        <jdbc-data-source-params>
            <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>
        </jdbc-data-source-params>
    </jdbc-data-source>And this is how I would like to get it in the end:
    <?xml version='1.0' encoding='UTF-8'?>
    <jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90" xmlns:sec="http://www.bea.com/ns/weblogic/90/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls" xsi:schemaLocation="http://www.bea.com/ns/weblogic/920 http://www.bea.com/ns/weblogic/920.xsd">
      <name>mydb</name>
      <jdbc-driver-params>
        <url>jdbc:oracle:thin:@localhost:1521:myDB</url>
        <driver-name>oracle.jdbc.OracleDriver</driver-name>
        <properties>
          <property>
            <name>user</name>
            <value>myuser</value>
          </property>
        </properties>
        <password-encrypted>myuser</password-encrypted>
      </jdbc-driver-params>
      <jdbc-connection-pool-params>
        <test-table-name>SQL SELECT 1 FROM DUAL</test-table-name>
      </jdbc-connection-pool-params>
      <jdbc-data-source-params>
        <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>
      </jdbc-data-source-params>
    </jdbc-data-source>So, I obtain the node for the given xml string, the jdbc-data-source node from the xml file and i attempt the appendChild. The problem is that nothing really gets inserted into the xml file.
    Someone, any idea?
    My code:
    try
                   DOMParser parser = new DOMParser();
                   parser.parse(xmlFileName);
                   Document doc = parser.getDocument(); // the document we will insert node into
                   Node root = doc.getElementsByTagName("jdbc-data-source").item(0);
                   //get XML string node
                   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder db = factory.newDocumentBuilder();
                   InputSource inStream = new InputSource();
                   inStream.setCharacterStream(new StringReader(xmlString));
                   Document doc4XMLString = db.parse(inStream);
                   Node rootXMLString = doc4XMLString.getElementsByTagName("jdbc-driver-params").item(0);
                   root.appendChild(doc.importNode(rootXMLString, true));
                   return true;
              catch (Exception e)
                   e.printStackTrace();
              }Thanks,
    johnny
    Edited by: smeag0l on Aug 6, 2008 5:08 PM
    Edited by: smeag0l on Aug 6, 2008 5:43 PM

    Well, you helped me again :-) Thank you very much!
    Here is how the code should look:
                            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder db4XMLFile = factory.newDocumentBuilder();
                   Document doc4XMLFile = db4XMLFile.parse(xmlFileName);
                   Node root4XMLFile = doc4XMLFile.getElementsByTagName(rootNodeName).item(0);
                   DocumentBuilder db4XMLString = factory.newDocumentBuilder();
                   InputSource inStream = new InputSource();
                   inStream.setCharacterStream(new StringReader(xmlString));
                   Document doc4XMLString = db4XMLString.parse(inStream);
                   Node root4XMLString = doc4XMLString.getElementsByTagName(xmlStringNodeName).item(0);
                   root4XMLFile.appendChild(doc4XMLFile.importNode(root4XMLString, true));
                   File file = new File(xmlFileName);
                            Result result = new StreamResult(file.toURI().getPath());
                   Source source = new DOMSource(doc4XMLFile);
                   Transformer xformer = TransformerFactory.newInstance().newTransformer();
                      xformer.transform(source, result);

  • Grainy Output When Outputting h.264 into QuickTime File in Premiere Elements 12

    I have a video project that I need to output into a QuickTime file. I would like to use the h.254 codec in the file, because that would make it the most versatile for all of the places I will be using the video. However, when I use Share > Computer > QuickTime > Advanced... and use these settings:
    Codec: H.264
    Quality: 100%
    Frame Size: 1080x1920
    Frame Rate: 29.9 fps
    Field Order: None (Progressive)
    No bitrate limit
    Audio Codec: AAC
    Sample Rate: 48000 khz
    Bit depth: 16-bit
    I wind up with a terribly grainy and muted-color video. I have used these same settings in Share > Computer > AVCHD and end up with a great video. Is there anything I can do to output the nice quality into .mov?

    I have a video project that I need to output into a QuickTime file. I would like to use the h.254 codec in the file, because that would make it the most versatile for all of the places I will be using the video. However, when I use Share > Computer > QuickTime > Advanced... and use these settings:
    Codec: H.264
    Quality: 100%
    Frame Size: 1080x1920
    Frame Rate: 29.9 fps
    Field Order: None (Progressive)
    No bitrate limit
    Audio Codec: AAC
    Sample Rate: 48000 khz
    Bit depth: 16-bit
    I wind up with a terribly grainy and muted-color video. I have used these same settings in Share > Computer > AVCHD and end up with a great video. Is there anything I can do to output the nice quality into .mov?

  • Output folder contents into text file

    Hello, everyone.
    I am new to automator, and I'd like to learn how to use it. Recently, someone asked me if there was a way that they could select a folder and somehow dump the filenames of all items in that folder (non-recursively) to a text file. It seems to me that this is the sort of thing that Automator would be able to do. Can anyone give me some tips on how I might go about doing this?
    I also figured this might be possible with a custom bash command. I am more experienced with bash and Unix command line, so if there is a better option there, please let me know. I just figured I would check here first.
    Thanks!

    That does work, but the only problem is that the folder who's contents are being exported will be different every time. (I see now that I didn't specify that in my first post). Ideally, he would either be given an option to select a folder to read, or he would just be able to drag and drop the folder onto an application (or into terminal) and have it perform this task.

  • How to convert a string into xml file

    Hi,
    i have a string . the string contain fully formated xml data. i mean my string like below
    <?xml version="1.0"?>
    <PARTS>
       <TITLE>Computer Parts</TITLE>
       <PART>
          <ITEM>Motherboard</ITEM>
          <MANUFACTURER>ASUS</MANUFACTURER>
          <MODEL>P3B-F</MODEL>
          <COST> 123.00</COST>
       </PART>
       <PART>
    ......................i want to convert it into an xml file
    can u help me?
    thank u

    Thank you Paul Clapham,
    and sorry ..
    i have some other doubt.. regarding xml
    i want to post an XML file from one server(Server_1) to other server.(Server_2)
    To generate an xml file i used DOM in Server_1.
    using xml.transform , StringWriter i converted it into String.
    I post the string to another server and there i will parse it.
    for that i write the code like below in servlet in server_1
    <form name=fn action=http://localhost:8080/server_2/parseXMl.do method=post>
    <input type=hidden name=xmlFile value="+Xmlstring+">
    <input type=submit >is this process is correct?
    Some of the turorial told that use web-services/XML-RPC
    but i new to both..
    I want to complete it using my knowledge only/
    Is it possible to do it?
    Or any other alternative?
    can help me?

  • Convert xml string into xml file?

    Hi,
    I got a method that returns an JDom Element object.
    Then I use the JDOM Element toString method() to change it into xml string.
    Now, I need to convert it into actual xml file.
    How to I do it?
    Thanks.

    Hi,
    If you got an xml string, just write it to an ordinary file. Look at FileWriter.
    /Kaj

  • How to write a plain string into a file using File Adapter

    Hi All,
    I am new to ESB technology. I have created one ESB application to invoke a java web service(Which will return string as result) and to write retrieved result in to a file. To achieve it i have created the file adapter using user defined schema. It was working fine. But, I got the modifications in my requirement to store the returned result(String value) in to a text file without any user defined schema. So i used native format for FileAdapter and mapped the returnedResponse(String value) to opaque:opaqueElement. But i am facing relationship error.
    anybody can help me to solve this issue?.. is there any method to convert a string value to opaqueElement..
    Thanks in advance..

    Hi All,
    I am new to ESB technology. I have created one ESB application to invoke a java web service(Which will return string as result) and to write retrieved result in to a file. To achieve it i have created the file adapter using user defined schema. It was working fine. But, I got the modifications in my requirement to store the returned result(String value) in to a text file without any user defined schema. So i used native format for FileAdapter and mapped the returnedResponse(String value) to opaque:opaqueElement. But i am facing relationship error.
    anybody can help me to solve this issue?.. is there any method to convert a string value to opaqueElement..
    Thanks in advance..

  • Name of the programme, which writes PO Output IDOC into a file

    Hello Guru's,
    Will anyone know the name of the Program which writes the Purchase Order Output Medium IDOC into a file ( xl file, text file etc,.) in SAP.

    Hello
    I cannot tell you the program name (but this should be easy to find out using debugging) yet just send the PO output to the required port ( WE21 ):
    - generate XML file -> send to XML port
    - generate flat file   -> send to FILE port
    Regards
      Uwe

  • Convert report output into excel file

    hiii,
    Can we convert output of report into excel file format?
    Plz tell me the.
    Thanks in advance

    Hello,
    http://download-uk.oracle.com/docs/cd/B14099_17/bi.1012/b13895/orbr_paptoexcel.htm
    29 Building a Report for Spreadsheet Output
    Regards

  • Split SQR output into multiple files And Rename each file.

    Greetings!
    We ran into scenario where we need to split an SQR output (PDF) split into multiple files (each page , each file). More over the out put has to be renamed with EMPLID.
    It is for printing Advices, where we run DDP003 to print all of them, Our requirement needs to have one PDF file for each employee to placed into a shared drive OR to be emailed.
    I was thinking of running the same process in a loop individually, but this is resource intensive. Is there any way we can batch run this SQR process and split into each page (each paychek comes to one page),
    AND
    I need them renamed by SQR as it creates them, Each file would be names as EMPLID.
    This is all in alternative to run process individually by employee , via self service. to not to over laod Process scheduler server.
    Can anyone help me how can we get these thigns done in SQR?
    Thanks in advance.

    You can use the SQR command new-report for each employee which closes the current report output file and opens a new one with the specified file name (e.g. EMPLID).

Maybe you are looking for

  • Local file not found in browser

    Hi! I struggle building my first web site. The core is a photo album, created in jAlbum. To this album, I want to link from a Welcome page created in Rapid Weaver. To try this linking out locally, I put the album in my Sites folder, enable Web Sharin

  • Acrobat 9 dll files takes time to unload after closing the reader

    I have a Java Desktop application, in which Acrobat 9 is used to display the reports generated. Acrobat 9 does not start a child process under acrobat.exe but loads dll files in the process and they take time to unload, due to which my javaw.exe is n

  • Trouble updating to ios 4.3

    Hi i can't download the update because it is interrupted while processing file at the end of the download (error 3253)!What am i supposed to do?

  • Crystal Report XI R2 - RDC supported on Windows 64-bit

    Hello! We are using Crystal Report XI R2 runtime RDC component on Windows 32-bit platform. Is the RDC supported on Windows 64-bit platform? Best regards, A.

  • Fixing Color/Contrast in iCloud Calendar

    Here's a method I created to help those who would like to increase the text contrast in iCloud Calendar.