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

Similar Messages

  • How to remove new line character from query output?

    Hi,
    How to remove new line character from query output?
    have tried select replace(column_name, CHR(10), ' ') from table_name.
    Edited by: GreenHorn on Sep 11, 2008 12:53 AM

    Please consider, that windows uses a sequence of chr13||chr(10) Unix uses only one character chr(10).
    The new line character(s) may be OS-dependent.
    You could consider both with:
    replace(replace(column_name, CHR(13)||CHR(10), ' '),CHR(10),' ')
    Hartmut
    Edited by: hartmutm on 11.09.2008 01:32

  • 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 == "")

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

  • Removing new line character in jdk 1.2

    I am currently using replaceAll("\n", "") to remove new line characters in an string. But this works only for 1.4 version, I know need to have this work on 1.2 and 1.3.
    Is there an alternate method that I can use?

    If the string come from a file that's in the native text format for that platform, then replaceAll(System.getProperty("line.separator", "") will work.
    This won't work, however, if you, say, create a text file on windows and the read it on Unix without translating the EOL characters.
    If you can't be certain that the file is in the format that matches the current platform, three options pop to mind:
    * Run over the String, char by char, copying all chars to a new String except \r and \n.
    * Use two replaceAll calls--one with \r and one with \n.
    * Dump the String into a StringReader, then wrap the StringReader in a BufferedReader. Call readLine() on the BufferedReader in a loop, concatenating the results in a StringBuffer as you go.

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

    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

  • FileUtilsService Write String New Line Character

    Hi All,
    SITUATION:
    Writing a custom log file using the Write String service operation.
    Everytime an event occurs, i want to insert a new line, with date time stamp, details etc.
    PROBLEM:
    In the "value" property of the "write string" service operation... im inputting my relevant data but dont know how to indicate a new line
    WHAT I TRIED:
    I've tried every form of new line character i know: \n, \r, <BR>, \u0000a, \u0000d, ACSII, CRLF, etc, etc... none of them works.
    WHAT I FEAR:
    the exact same situation as http://forums.adobe.com/message/2780658#2780658 ... with a fairly definite answer
    I'm hoping i dont have to go this LONG ugly scary route.
    WAY FORWARD:
    Your thoughts, answers, suggestions....
    Thanking you all in advance.

    if going the "executeScript" way....
    this code worked for me:
    ===========================
    import java.lang.String;
    String vLogEntry = patExecContext.getProcessDataStringValue("/process_data/@logEntry");
    String vLogEntry = vLogEntry + " \r\n";
    patExecContext.setProcessDataStringValue("/process_data/@logEntry", vLogEntry);
    =================

  • New-line character in stacked message pop-up

    I have run into a brick wall with this situation--
    Our clients are running Client/Server Forms 6i, and Web Forms 6i using Patch 10. They are about to upgrade web forms to the latest version 9.0.4.1.0 (10g).
    We have a few PLL routines that use the stacked message method:    Message('text here'); Message('  ',no_acknowledge);to display important error messages to the user. It is especially useful to display the multiple ORA- errors when an unexpected server error occurs.
    Throughout all versions of Client/Server forms, and even in our old version of Web forms, I can use chr(10) or another character to start each error message on a new line.
    Somewhere after Patch 10, Oracle has removed that capability. Instead, pop-up stacked messages word-wrap into a multi-line message, and display the new-line character as a box indicating an unprintable character. Our nicely formatted messages are a mess!
    I have been told I should use an alert, which supports chr(10) as the new line. However, this is a PLL routine, and I would have to create an alert in hundreds of forms just to accommodate this short-sightedness. The changes and subsequent testing and release issues make this an unworkable solution.
    I am clueless as to why this feature would be removed. Oracle support is treating it as an enhancement request. Any ideas?

    Steve,
    If you really have hundreeds of forms ... create one more - to display your messages. Make it modal and nice looking. Call it through the library. Design it to work both as [OK] message and as an users responce [Yes]/[No]/[Cancel].
    And honestly - I don't think message(); message() is the best way to display messages. Whoever designed the application should've think about alerts with standartized naming convention, so they can be handled easily through the PLL.
    Venko

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

  • Need help in how to print new line character in unix using java

    Hi All,
    I use the printstream class to print some line in a text using java.
    here is the code:
       FileOutputStream out; // declare a file output object
            PrintStream p; // declare a print stream object
                    p.print("\t");
                    p.print(date);
                    p.print("\t\t");
                    p.print(RecCount);
                    p.println("\n");when i use this and output of this character in windows is
    date RecCount
    22-07-2007 23456
    when i use the same code in unix it shows the following output:
    date RecCount[]22-07-2007
    it wont accept the new line character could any one give me an idea to solve this problem.

    PrintStream has a println() method. Use that. Or System.getProperty("line.separator").
    Because a newline char doesn't necessarily specify a line break. It's system-dependent.

  • 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

  • Force Windows New Line Character

    Hi,
    I've a problem with new line character. I am in Windows platform but
    when I write a file with a BufferedWitter with println I obtain the
    character "\n" x0D like separator (Unix Separator). My System property
    line.separator is "\r\n".
    Can someone tell me how can I obtain files with the correct \r\n
    Windows new line character?.
    Thanks in advance.

    Resolved
    The problem was another process that automatically was replacing "\r\n" form "\n" and I don�t know it.
    All works fine.
    Thanks a lot.

Maybe you are looking for

  • Intel based iMac won't recogize external HD anymore

    I have a Seagate external fire wire HD that is no longer recognized by my iMac. It froze while trying to format it and I finally had to unplug it. Now it will not show up on my desktop or in Disk Utility. It does show up in system profiler as an unkn

  • For update clause

    Hi all in cursor with select for update clause we can reference column list. like select....... from.... for update [of column_reference] I want to know that what is the use of specifying column nane in for update clause? because its main purpose is

  • Purchase Requisition Committment and Availability Control

    Hi, We are using availability control based on usage 1 i.e. during the budget allocation/release, the availability control gets activated. Now i have poject structure where a user have already created PR i.e. committment of 10000 USD and whereas i go

  • Finance and Controlling report in combination with Cost center, GL account, Internal Order

    Hi Members, Finance and Controlling report in combination with Cost center, GL account, Internal Order. Please provide any slandered report in all 3 dimension. Thanks Dileep Kumar

  • How to use the bex broadcasting to send emails

    Hi Gurus, i made a web report, in this report , i have to send an email to some directions based in what characteristic get the value = 1, example:        KF x=    1        send email to   pp@.... y=    1        send email to   gg@.... The web report