New-line Character for a file opened in BINARY mode for O/P

Can anybody please tell me how to put a new-line charcter for each record in a file opened in Binary mode for O/p. I cant use text mode  for other reasons in my scenario.
DATA: l_outdata TYPE xstring.
OPEN DATASET file FOR OUTPUT IN BINARY MODE.
Application logic to populate l_outdata
TRANSFER l_outdata TO file.
Any help, or attempt towards it will be duely rewarded,
Thanks in advance,
Sujit.

hi sujit,
1. how to put a new-line charcter for each record
but how will you decide, at which POSITION,
to put the new line character, if u have opened the file in binary  mode.
2. However, if u know the exact positions(s),
  u can use  CL_ABAP_CHAR_UTILITIES=>CR_LF
  to insert the new line character,
regards,
amit m.

Similar Messages

  • Want to know how to check for new line character in text file

    Hi All,
    I`m trying to read data from text file. However I`m not sure whether the data is in 1st line or nth line. Now I`m trying to read the text from the readline. But if text is "" and not NULL then my code fails. So I want to know how to check for new line character and go to next line to find the data. Please help.
    Thanks
    static int readandwriteFile(Logger logger,String filepath){
              BufferedWriter out = null;
              BufferedReader in = null;
              File fr = null;
              int get_count = 0;
              try     {
              if(new File(filepath).exists())
              fr= new File(filepath);
                        System.out.println("FileName: "+fr);
                   if(fr != null){
    in = new BufferedReader(new FileReader(fr));
                             String text = in.readLine();
                             if(text != null){
                             get_count = Integer.parseInt(text);
                             in.close();
                             else{
                                  get_count = 0;
         else{                    
    out = new BufferedWriter(new FileWriter(filepath));
         out.write("0");
                out.close();
                   }          //Reading of the row count file ended.
              catch(Exception e) {
                   e.printStackTrace();
              finally {
                   try{               if (in != null) {
                             in.close();
              if (out != null) {
                             out.close();
              catch(Exception e) {
                        e.printStackTrace();
              return get_count;
         }

    You are calling the readline() only once which means you are reading only the first line from the file...
    Use a loop (Do-While preferably)
    do{
    //your code
    }while(text == "")

  • Removing New Line Character in Input file

    Hi Experts,
    I Have a question about "New Line Character". I searched in SDN before posting this thread, But I didn't get answer.
    Question:
    Let me say my Client requirement first. After loading the data(Millions of Records) into SAP through LSMW, they asked write a program for validation of those loaded records based on I/P file. I wrote a program and It is success full.
    But, the problem is when file is in Application server in 'BIN' format, a new line character(#) is created. While comparing the last record of each line, it doesn't match. How to remove this new line character(#) in I/P file for each line of record? Please see the below records for example
    PROVINCIA DE BUENOS AIRE|   |1870|AR| #
    PROVINCIA DE BUENOS AIRE|   |1876|AR| #
    BOX 7407 PRINCETON|   |085437407|US|NJ#
    5756 2 A   CAPITAL FEDERAL|   |1431|AR|00#
    Note: This New line character is not matching the string "#".
    Please help me guys, so many objects are related with this concept. I appreciate quick response. Please.
    Thanks
    Sai

    Hi Arun, Ravi,
    I wrote the code like this, here 'fil_curre' is currency key.
    IF <l_wa_file_data>-fil_curre CS cl_abap_char_utilities=>newline.
              REPLACE ALL OCCURRENCES OF REGEX cl_abap_char_utilities=>newline
                                            IN <l_wa_file_data>-fil_curre WITH ''.
            ENDIF.
    While executing the code, the cursor here, simply jumps to next step.
    Any enhancements to this code or any new ideas?
    Thanks
    Sai

  • How to write new line character to a file from textarea

    Hi ,
    I want to save the contents of textarea in a file.The textarea may contain new line characters,
    I am getting the contents from the textarea using getText() method but after writing the contents to the file
    it stores the entire text in a single line.But I want the text as it apperars in the textarea.
    Please provide me a good solution.
    -mani

    maybe this code samples are useful to your problem
    File datatext = new File(fileName);
    try {BufferedWriter writer =new BufferedWriter(new OutputStreamWriter(new FileOutputStream(datatext)));
    writer.write(.......);
    writer.newLine();
    writer.close();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • New line charecter in a file

    Hi all,
    Can anybody please tell me how to put a new-line charcter in a txt file opened in Binary mode for O/p. I cant use text mode or multitple transfers for other reasons in my scenario. I tried using hex field of value 0A and 10, didnt work out. Any help, or attempt towards it will be duely rewarded,
    Thanks in advance,
    Arun N.

    Try concatenating <b>cl_abap_char_utilities=>cr_lf</b> at the end of your line.
    Data: data_string type string.
    data_string = '123456789'.
    concatenate data_string cl_abap_char_utilities=>cr_lf
         into data_string.
    Regards,
    Rich Heilman

  • New line character in File adapter

    I am having a receiver file adapter which generates files with multiple lines.
    My problem is when the target file is opened in notepad there is no line break and the lines comes as continous string with small rectangle as separator.This fails the target upload program.
    When I remove those small squares in notepad and hit enter and then upload it gets uploaded successfully.
    Is there any way to have line break so that new line will be generated each time (the documenation says the by-default it adds new line character then why in notepad it opens like a continous string?)
    Thanks in advance.
    Regards
    Rajeev

    Hello
    I know by default File Adapter value is line break. But if I open that generated file in notepad, the record does'nt appear on the new line. Instead at the end of each line there is special character added at the end of each record. When I hit enter and deletes that special character and then try to load that file it gets loaded successfully.
    So my problem is how to generate the file will give record on the new line. I tried to give 'nl' as endSeparator.
    How to give hexadecimal values? I tried giving '0xHH' but that gives error in File Adapter
    "Error: Conversion initialization failed: Exception: java.lang.NumberFormatException: For input string: "HH"
    Thanks in advance.
    Regards
    Rajeev

  • Problem is occurring in docx format; it is not printing "New Line" character in extracted txt using IFilter (offfiltx.dll) while with doc file IFilter (OffFilt.dll) is working fine.

    Problem: Problem
    is occurring in docx format; it is not printing “New Line” character in extracted txt using IFilter (offfiltx.dll) while with doc file IFilter (OffFilt.dll) is working fine.
    Environment: -
    Operating
    System:
    Windows XP SP2/7
    Language:
    C#
    MS
    Office Version: - MS Office 2007/2010/2013
    Problem
    Description: -
    We
    havedocx
    file with new line character, and we are processing this file in IFilter for extracting text, and it is giving output with concatenation of lines.
    Docx
    file format (Sample.docx)
    Test this music
    Word processing
    Testing docx file
    Output:
    - Test this music Word processing Testing docx file
    Requirement:
    - We
    have requirement to get following text in particular format with New Line from docx because client is using docx format only.
    Test this music
    Word processing
    Testing docx file
    Attempt:
    We have tried a lot after changing IFilter configuration,
    but it is not giving required output. Then we saved same file in doc format (Sample.doc), which is giving required output.
    Because it is application specific problem, kindly
    assist to resolve issue on priority. We are sharing IFilter paths for extracting text for doc and docx.
    Doc Filter Location: - %systemroot%\system32\OffFilt.dll
    Docx Filter Location: - <Drive>:\PROGRA~1\COMMON~1\MICROS~1\Filters\offfiltx.dll
    Code Snippet for setting property of filter
    internal static IFilter LoadAndInitIFilter(string fileName, string extension)
                IFilter filter
    = LoadIFilter(extension);
                if (filter
    == null)
                    return null;
                IPersistFile persistFile
    = (filter as IPersistFile);
                if (persistFile
    != null)
    persistFile.Load(fileName, 0);
                    IFILTER_FLAGS flags;
                    IFILTER_INIT iflags
    =
                                IFILTER_INIT.CANON_HYPHENS
    |
                                IFILTER_INIT.CANON_PARAGRAPHS
    |
                                IFILTER_INIT.CANON_SPACES
    |
                                IFILTER_INIT.APPLY_INDEX_ATTRIBUTES
    |
                                IFILTER_INIT.HARD_LINE_BREAKS
    |
                                IFILTER_INIT.FILTER_OWNED_VALUE_OK;
                    if (filter.Init(iflags,
    0, IntPtr.Zero, out flags)
    ==IFilterReturnCode.S_OK)
                        return filter;
                Marshal.ReleaseComObject(filter);
                return null;
    Kindly
    assist to resolve this issue and also let us know if any input is required.
    For any help, we would be really
    thankful.

    Kindly
    assist to resolve this issue and also let us know if any input is required.
    For any help, we
    would be really thankful.

  • New Line Character in OSB for sending email in proper format

    Hi
    We have a client requirement, where in we send an error email when ever an exception occurs in the OSB flow. We are using OSB 11g and we need to format the body within or before the publish activity using a replace activity something in the below manner (replace . in variable body (replace node contents))
    fn:concat("Following Exception Occurred <NEW LINE>","ErrorCode: ",fn:data($fault/ctx.errorCode) etc etc)
    Please tell us if there is a new line character available within OSB to format the email message. Please help its urgent. Thanks

    Thanks a lot for the reply, but still in the email body, i see everything in one line (no enter0). I tried " ","",\n and CHR(13). All dont seem to work.
    Also can you provide an example for &#13: (Ampersandhash13colon)
    Please help.
    Regards
    Amit Sachdev
    Edited by: user638094 on Mar 8, 2011 12:01 AM

  • Problem with new-line-character and java.io.LineNumberReader under AIX

    Hi folks,
    I got the following problem: I wrote a little parser that reads in a plain-text, tabulator-separated, line-formatted logfile (and later on safes the data to a 2-dimensional Vector). This logfile was originally generated by an AIX ksh script, however, I copied it on my Windows machine to work with it (for I'm using a Java editor that runs under Win Systems).
    For any reason, Windows, and what is worse Java too, seems not to recognize correctly the new-line character (in the API it is written that this should be a newline '\n' or a carriage-return '\r' or one followed by the other) that marks the end of a line in the logfile.
    Also, when I'm opening the logfile with the "Notepad"-editor, this special character does not seem to be recognized, every line is inserted right after the other.
    On the other side, when I open the logfile with the built-in editor in the CMD-Shell ("Dos-shell"), the newline chars seem to be recognized correctly.
    But when start my parser on the AIX-machine the newline does not seem to be recognized correctly again.
    I tried to read in the logfile with MS-Excel and safe it as a plain-text, tabulator-separated, line-formatted logfile again, with such files my parser works fine both on the AIX as it does on Windows.
    Any ideas? Anybody got over the same problem already?
    Greetz FK

    Under windows, text files' lines are usually delimited by \r\n,
    under Unix/Linux/AIX etc. \n
    and under Mac \r.
    I recommend to use the following editors, which are capable to handle files with Unix and Windows-styled line-delimiters or convert between these types:
    Programmer's File Editor (PFE; available on Windows)
    The Nirvana Editor (http://www.nedit.org/; available on Unix, MAcOS, Windows)
    (BTW good old vim can handle that too. Transferring text files to windows in order to edit them, even using Excel for this purpose means your being a UNIX newbie, (I mean no offense by writing this) so vim is probably beyond your reach for the moment.)
    Java normally assumes the platform's line delimiters where it is running, so if you transferred the file from Unix to Windows might be distrurbing.

  • CLIENT_TEXT_IO : cannot insert new line into a text file

    Facts:
    Developer 10g
    AS 10g
    Web utility
    Problem:
    i am traying to
    Open a text file. using CLIENT_TEXT_IO.FOPEN
    insert a record in to a text file using CLIENT_TEXT_IO.PUTF
    insert a new line using chr(10) or CLIENT_TEXT_IO.NEW_LINE
    or CLIENT_TEXT_IO.put_line
    insert the next record
    Close the file.
    all work except insert a new line
    Why !!!
    it was Working fine in 6i, but now in 10g and Webutil is not working
    plz help

    Hi you can put a new line in a text file using System.getProperty("line.separator"). This implementation will work for every OS.
    import java.io.*;
    class Demo{
    public static void main(String args[]) throws Exception {
    FileWriter fr = new FileWriter("FileDemo.txt");
         fr.write("AAAAAAAAAA");
    fr.write(System.getProperty("line.separator"));
    fr.write("AAAAAAAAAAA");
    fr.close();
    }

  • New line character and carriage return in XML, please help, thanks

    In XML, "&#10;" is only the new line character. I have tried that. If you put that in your XML, for example:
    <tag>line1&#10;line2&#10;line3</tag>
    You will get the output as follow:
    line1
    ____line2
    ________line3
    (where ___ represents space)
    The output that I want is actually like:
    line1
    line2
    line3
    So I would like to ask how I can do this.
    Thanks,
    Jackie

    while parsing your XML file you can directly suppress these newline and similar things in characters() method of SAX parser.
    you can opt to do nothing when you encounter them else if it is normal character then use it to print it.

  • ADF: how to insert new line character in column of VO?

    Hi Everyone,
    Im using Jdev 11G.
    i have a VO with 5 columns displayed on the ADF page.(VO has total 8 columns)
    1 column is the combination of 3 columns. i concatenated the 3 columns and added new line character after each column chr(13).
    VO query is working very fine in Toad. the columnn displays each concatenated column value after a new line character but the same query is not working in ADF.
    The column which is concatenating 3 columns and has to display with new line character is not displaying new line character its just concatenating the 3 values and displaying it on the page.
    wat can be the solution for this in ADF?
    Thank you.

    Setting escape="false" will allow putting html <BR> in the column and it will display ok however if your table allows export to excel the <BR> gets exported and displays as text in your exported file. Also & will export as &amp; To prevent that, use your original text without the escape=false setting and insert LF or CR (10 or 13 character), then add inline style of white-space: pre-line; to column or to style class in your skin. That will cause all line feeds to wrap but will export to excel without mixing html in the export.
    http://www.w3schools.com/cssref/pr_text_white-space.asp
    Edited by: Don Kleppinger on Jan 14, 2013 4:06 PM

  • NEW LINE CHARACTER

    i am trying to load text into the BASIC TEXT of the material. The input file has matnr and the text. The file we loaded is fine. But in the text editor the # for new line character appears and this is causing problem while writing the text in a sapscript.
    so i am trying to remove the # for the new line character while we load the file. i am using
    data: c_tab like CL_ABAP_CHAR_UTILITIES=>CR_LF. to split the file and it is not being recognized. The input file is a tab delimited text file from excel. and it has " at the begining and ending.
    thanks in advance

    that is problem with Xls , If u have text with any Delimitors then u will get this kind of Stuff.
    prabhu,peram then i will get in text file as "prabhu,peram".
    Regards
    Prabhu

  • Handling new line character in XML

    Hi,
    Question : How can we specify new line character in xml ?
    Explaination for use :
    I have a xml structure like :
    <?xml version="1.0" encoding="UTF-8"?>
    <MT_ISO8583_XML_request>
    <TRANSDETAILS>.
    <TRANSACTIONAMOUNT>0000000000000000</TRANSACTIONAMOUNT>
    <SYSAUDITNUMBER>225998394671</SYSAUDITNUMBER>
    </TRANSDETAILS>
    </MT_ISO8583_XML_request>
    I am using Java mapping to convert xml to some satndard flat file format. It works fine for single message.
    To handle multiple message i am using Multimapping split. Multimapping needs xml tags in traget structure also to split the message.
    To achieve it without BPM, I want to take the whole content of my target file to one tag. When i do this i lost all the new line characters aslo. How can i preserve my new line character using XML ?
    Regards
    Kulwinder

    Are you sure, that the nl characters are deleted?
    They are usually not shown in the XML display.
    You can also use an adapter module instead of a Java mapping. So you can do a split in mapping, but the conversion to the flat file in the adapter module. If you have already a Java mapping for this purpose, you can easily create an adapter module based on that Java code.
    Regards
    Stefan

  • Insert and retrieve new line character in DB2

    Hi,
    I have a requirement in my project where I need to generate flat files to be sent to the bank for validation and for each record type in the flat file, I want to have a line separator inserted in the file. Now, the line seperator is configurable as a system option as per customers needs which is stored in the database (we are using DB2). Even though, I inserted '\n' (New line character) in the system option as a line separator, while retrieving from database through JDBC and appending to the flat file, it is not recognizing it as a new line character and simply appends '\n\ in the flat file.
    Please suggest any solution for this.

    >
    Why with notepad I don't see 1 record per line? how to solve this problem?
    Hi,
    this is the problem, seems so clear.
    To use wordpad as standard editor is not an answer, neither for me, nor for other people who receives mail.
    No solution is a better answer.
    Best Regards
    Fabio Boni
    Edited by: Fabio Boni on Sep 6, 2010 10:46 AM
    Edited by: Fabio Boni on Sep 6, 2010 10:47 AM

Maybe you are looking for

  • Adobe Bridge full screen previews look horrible??? Any ideas???

    OSX finder previews and ViewNX look tac sharp????? I have scoured through other forums and have found this is a known issue but none of the tips are working. Full screen previews still look horrible!!!

  • E26 253 Error while check in only while running FM

    Dear Experts, I am trying to run Function module BAPI_DOCUMENT_CHECKIN2, which is returning with the error message E 26 253 Error while check in  and storing: D:\ XXX (Path) \XXX (file name). I have entered the following required input. DOCUMENT DATA

  • Pogo won't play games java won;t work with firefox

    I was playing pogo and it came up to update Java. Did it and now can't play most of the games like canasta. Says java won't work with firefox.....it did before. try for 4 days not and no luck

  • Mailbox contributor and custom permissions

    Hi, We upgraded to Exchange 2013 last month and have recently encountered an issue setting permission on calendars. In 2010 our guidance counselors gave contributor permissions to students. Students could see there free and busy time and could add an

  • Help: Error in LSMW migrating assets

    When I use LSMW - convert data, the system end up a ABAP dump. What does it mean? Runtime Errors         UC_OBJECTS_NOT_CONVERTIBLE Date and Time          2008.05.23 10:28:56 Short text      Data objects in Unicode programs cannot be converted. 发生了什么