How to delete string or line from unix file(dataset) of application server

Hi  All,
After transfer workarea information or all records into dataset(unix file). When I see the file in application server automatically the last line is shown a blank line. I am not passing any blank line.
I have tried for single record than also the file generates the last line(2nd line) also a blank line.
When I m reading the dataset, it is not reading the last blank line but why it is showing the last blank line?
How to delete string or line from unix file(dataset) of application server?
Please give your comments to resolve this.
Thanks
Tirumula Rao Chinni

Hi Rio,
I faced similar kind of issue working with files on UNIX platform.
The line is a line feed to remove it use
DATA : lv_carr_linefd TYPE abap_cr_lf VALUE cl_abap_char_utilities=>cr_lf. 
  DATA : lv_carr_return TYPE char1,                                   
         lv_line_feed   TYPE char1.                                          
  lv_line_feed   = lv_carr_linefd(1).
  lv_carr_return = lv_carr_linefd+1(1).
Note: IMP: The character in ' ' is not space but is a special
character set by pressing ALT and +255 simultaneosly
  REPLACE ALL OCCURRENCES OF lv_line_feed IN l_string WITH ' '.
  REPLACE ALL OCCURRENCES OF lv_carr_return IN l_string WITH ' '.

Similar Messages

  • How to delete a perticular node from xml file using java code

    Hii All,
    Now i am trying to delete a perticular node from xml file.Like...
    XML file:
    <Licence>
    <SERVER>
    <was id="1">1</was>
    <was id="2">2</was>
    </SERVER>
    </LICENCE>
    I am working in messaging service using JABBER framework with whiteboard facility.
    Here Some commands i have created to add,modify,delete nodes from xml file.They Are
    1.If u want to add a new node then.
    create Licence.SERVER <ss id="3">ddd</ss> lic.xml
    (here u want to add a new node called "ss" under Licence.SERVER.
    And lic.xml is tyhe xml file name where it was saved.
    2.If u want to delete a node(Suppose <was id="1">),then the command should be
    delete Licence.SERVER.was:id='"1" lic.xml
    A problem arises that here it find two was attributes.And it delete the last was attribute,not the requested node.
    PLEASE HELP ME IN SOLVING THIS CODE..
    ------------------------------------

    Looks like you clicked on "Post" before you pasted in the code you were talking about.

  • Regarding reading data from a file in the application server.

    Hello Everyone,
    My question is:
    The file in the application server consists of data with header, detail and trail out of which the detail contains the main information. The detail again contains the data in the form of a continuous string and again some spaces corresponding to a single record. I need to split the data in the internal table in such a way so that the first few characters get into field-1 of the target internal table. Again I need to consider the spaces for accessing the data for filling up in field-2. How do I decide on the 'Split' statement and specially when the whole string has to be taken care of as contatining data in a single string format without space and again some data after some spaces corresponding to a single record.
    Your help is very much needed. Thanks to all the experts in advance.

    Hi
      This is the sample code I was used for the similar requirement.
    DATA: single_line TYPE string .
    v_file_listings = pa_filn1.
    IF v_file_listings IS INITIAL .
    MESSAGE e039 WITH v_file_listings.
    ENDIF.
    *-- read file, split lines into fields and put data into table
    OPEN DATASET v_file_listings FOR INPUT IN TEXT MODE ENCODING NON-UNICODE. "Opening the files
    IF sy-subrc EQ 0.
    DO.
    READ DATASET v_file_listings INTO single_line. "Reading the content of file into line
    IF sy-subrc = 0.
    IF sy-index > 1. "skip header-line
    SPLIT "Split the content of line into work area
    single_line
    AT k_split
    INTO
    wa_listings-kschl " Condition type
    wa_listings-tabname16 " Condition table name
    wa_listings-vkorg " Sales organisation
    wa_listings-kunnr " sold-to party numberor ship-to party number
    wa_listings-matnr " Material Number
    wa_listings-kodatab " Valid-from date
    wa_listings-kodatb1. " Valid-to date
    APPEND wa_listings TO itab_listings. "Appending Work Area to internal table
    ENDIF.
    ELSE.
    EXIT.
    ENDIF.
    v_count1 = sy-tabix.
    ENDDO.
    Regards,
    Sreeram

  • How To delete the Chosen line from the Table Control

    Hi Friends,
      i am new to Module Pool Programming , i developed a Table Control in input mode and i am getting data also into that table control. my requirement is that i want to delete the current chosen line from that table control. please help me out.

    HI
    GOOD
    GO THROUGH THIS REPORT
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA: cols LIKE LINE OF flights-cols,
    lines TYPE i.
    DATA: ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm.
    DATA: itab TYPE TABLE OF demo_conn.
          TABLES demo_conn.
    SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
    LOOP AT flights-cols INTO cols WHERE index GT 2.
      cols-screen-input = '0'.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
    CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
    DESCRIBE TABLE itab LINES lines.
    flights-lines = lines.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE read_table_control INPUT.
      MODIFY itab FROM demo_conn INDEX flights-current_line.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'TOGGLE'.
          LOOP AT flights-cols INTO cols WHERE index GT 2.
            IF  cols-screen-input = '0'.
              cols-screen-input = '1'.
            ELSEIF  cols-screen-input = '1'.
              cols-screen-input = '0'.
          ENDIF.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
        WHEN 'SORT_UP'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
            cols-selected = ' '.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'SORT_DOWN'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
            cols-selected = ' '.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'DELETE'.
          READ TABLE flights-cols INTO cols
                                  WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              DELETE itab.
    ENDLOOP.
          ENDIF.
    ENDCASE.
    ENDMODULE.
    CHANGE THE CODE AS PER THIS LIGIC.
    THANKS
    MRUTYUN

  • How to delete an unused line from a family plan.

    Hi, I'm just wondering which number I would need to call to delete a line from my plan. I had a family plan with a total of four lines on it. I am the account holder, and two of the lines were removed onto their own plan today. That leaves me and my brother as the only two lines on the family plan. I want to cancel his line (his contract is already up and he apparently lost his phone months ago and doesn't care to replace it) and start a plan by myself. I have tried calling the basic toll free number and I am switched back and forth among everyone I talk to, and the online chat is ALWAYS busy. I was just wondering if there was a way to do this from My Verizon or if there was a number I could call that would direct me to a department specifically dealing with these issues. Thanks in advance.

    Cancelling a line has to be done in person or on the phone with customer service.  If you call the 800-922-0204 number, choose option 4 and then say "Agent" when prompted.  You should be connected to a live person in a couple of minutes.
    Or you can visit a Verizon store.... they will, of course, try to talk you out of it, but just be firm.  You will likely have to change your plan from a shared to an individual plan, since you will be the only line left.

  • How can I remove a line from a file?

    how ca i remove one or more than one line from a text file?

    Open the file for input.
    Open another file for output.
    Read each input line.
    If you want to delete it, go get the next line
    Otherwise, write the line to output, and go get the
    next line.
    Close both files.

  • How to Increase the memory size of a File in the Application Server

    Hello Abaper's
    I have generated a XML file for the data of  internal table (with 10 Records). When i download , i can see the XML file for the Entire 10 Records.
    But , while transferring the XML file to Applicationserver , it's  transferring only upto max 4 Records.I     assume that the memory is insufficient to  allocate 10  Records. Can we Increase the Memory size of the File on Application server. OR,  is there any error in My Source Code.
    Code i used to Transfer the XML File to Application server.
    OPEN DATASET FNAME FOR OUTPUT IN BINARY MODE.
    IF sy-subrc EQ 0.
       LOOP AT it_xmltab INTO wa_xmltab.
           TRANSFER wa_xmltab TO FNAME.
       ENDLOOP.
    ELSE.
      MESSAGE e004(zmsg5) WITH 'File FNAME not opened'.
    ENDIF.
    CLOSE DATASET FNAME.
    Regards
    Jv

    Hi,
    DATA : filename TYPE rlgrap-filename.
    DATA : doc_name TYPE char30.
    DATA : bin_size TYPE i.
    SELECT matnr matkl meins
           FROM mara INTO TABLE it_mara
           UP TO 10 ROWS.
    CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
      EXPORTING
        i_filename           = filename
        i_xml_doc_name       = doc_name
      IMPORTING
        pe_bin_filesize      = bin_size
      TABLES
        i_tab_sap_data       = it_mara         "  contains  10 Records
      CHANGING
        i_tab_converted_data = it_xmltab.
    placing XML File in Appl. Server
    DATA : FNAME(60) VALUE 'xyz_File'.
    DATA : num TYPE i.
    DATA : xmldata(256) TYPE x.
      For Writing The data in Application Server
    OPEN DATASET FNAME FOR OUTPUT IN BINARY MODE. " ENCODING DEFAULT.
    IF sy-subrc EQ 0.
      LOOP AT it_xmltab INTO wa_xmltab.
        TRANSFER wa_xmltab TO FNAME.
      ENDLOOP.
    ELSE.
      MESSAGE e004(zmsg5) WITH 'File FNAME not opened'.
    ENDIF.
    CLOSE DATASET FNAME.
      For Reading The data in Application Server
    OPEN DATASET FNAME FOR INPUT IN BINARY MODE. " ENCODING DEFAULT.
    DO.
      IF sy-subrc EQ 0.
        READ DATASET fname INTO xmldata.
        WRITE :/ xmldata.
        Clear xmldata.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
    CLOSE DATASET FNAME.
    at runtime i can see   
    it_mara  --> contain 10 records
    it_xmltab --> contain 7 lines (Each line size is 255 char). This table have XML format data,  (unknow format , with all numeric 
                        digits)
    it_xmltab is trasferred to application server , but the xml format is generated upto 4 records, and for the remaining records
    the XML format is not generated.
    the XML data in application server file is
    <?xml version="1.0"?><TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">0-BUY1</MATNR><MATKL Datatype="C" Length="18">012</MATKL><MEINS Datatype="C" Length="6">PC
    </MEINS>
    </TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">0-BUY2</MATNR><MATKL Datatype="C" Length="18">012</MATKL><MEINS Datatype="C" Length="6">
    PC </MEINS>
    </TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">000000000000000001</MATNR><MEINS Datatype="C" Length="6">EA</MEINS>
    </TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">000000000000000002</MATNR
    Regards
    JV

  • How to delete a schedule line from a PO

    Hi experts,
    Could you please help me out. Supplier confirmed twice through web which results in over commitment, now one of the schedule line need to be deleted for an item. How to do this..Please help.
    Regards
    Vinoth

    Hi Vinoth,
    Go to SPRO>Supply Network Collaboration>Basic Settings>Validation>SAP Standard Settings-->Display Settings for Standard Validation Profiles
    Click on Position button and enter Validation Profile=POC3,Validation check=PO_ITMOVERDELIVERY.
    Now check the following
    status =active ,
    Message type=E,
    save mode=DO not Save message ,
    Continuation=Continue Check.
    If it is not there goto SPRO>Supply Network Collaboration>Basic Settings>Validation>Own Settings-->Maintain Settings in Validation Profiles
    Validation Profile=POC3,
    Validation check=PO_ITMOVERDELIVERY.
    status =active ,
    Message type=E,
    save mode=DO not Save message ,
    Continuation=Continue Check.
    and save the setting.
    Thanks,
    Nikhil

  • Need help with java File IO ( Removing the first line from a file )

    Hi guys ,
    I am currently doing a project in which I need to extract out the values from the second line of a file to the end. The question is how do I ignore the first line ??
    I thought of two possible answers myself. One is to use randomaccessfile to read and rewrite. But the file may be HUGE so storing the whole file in memory is not a very good idea.
    Second is to jump to second line before doing while ((str = in.readLine()) != EOL) ... or just delete the first line from the file. Can anyone suggest a better solution or show me some sample codes ? Thanks.
    regards
    billyam

    Just skip the first line (bufferedReader.readLine()), add a comment, and then handle the rest of your file

  • Code for reading particular  fields from the file placed in application

    hi,
    code for reading particular  fields from the file placed in application server in to the internal table.

    Hi,
    Use the GUI_UPLOAD FM to upload the File into ur Internal Table.
    DATA : FILE_TABLE TYPE FILE_TABLE OCCURS 0,
             fwa TYPE FILE_TABLE,
             FILENAME TYPE STRING,
             RC TYPE I.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
      EXPORTING
        WINDOW_TITLE            = 'Open File'
       DEFAULT_EXTENSION       =
       DEFAULT_FILENAME        =
       FILE_FILTER             =
       INITIAL_DIRECTORY       =
       MULTISELECTION          =
       WITH_ENCODING           =
      CHANGING
        FILE_TABLE              = FILE_TABLE
        RC                      = RC
       USER_ACTION             =
       FILE_ENCODING           =
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        NOT_SUPPORTED_BY_GUI    = 4
        others                  = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE FILE_TABLE INDEX 1 into fwa.
    FILENAME = fwa-FILENAME.
        CALL FUNCTION 'GUI_UPLOAD'
             EXPORTING
                  filename                = filename
                  FILETYPE                = 'DAT'
           IMPORTING
                FILELENGTH              =
             TABLES
                  data_tab                = itab
             EXCEPTIONS
                  file_open_error         = 1
                  file_read_error         = 2
                  no_batch                = 3
                  gui_refuse_filetransfer = 4
                  invalid_type            = 5
                  OTHERS                  = 6 .
        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,
    Balakumar.G
    Reward Points if helpful.

  • How to delete the specified line in file?

    How to delete the specified line in file? In case of deleting a specified line in a file, how to do?
    Line 1
    Line 2
    Line 3
    Line 4
    Line 5
    The case is a file including the above content. Now I wanna to delete the "Line 3" and how to realize the action in Java?

    An alternative solution can be :
    import java.io.LineNumberReader;
    import java.io.IOException;
    import java.io.File;
    import java.io.FileReader;
    import java.io.BufferedWriter;
    import java.io.FileWriter;
    import java.io.PrintWriter;
    public class LineDeleter {
    public static void main(String args[]){
    try {
    //suppose you want to delete line 3
         int lineToBeDeleted = 3;
         File f = new File("line.txt");
         long fileSize = f.length();
    //Wrap the FileReader with a LineNumberReader. It will help you
    //identify the lines.
    LineNumberReader lnr = new LineNumberReader( new FileReader(f));
    //Wrap the FileWriter object with BufferedWriter object. Create it with the buffersize
    //equal to the file size.
         BufferedWriter bw = new BufferedWriter(new FileWriter(new File("line1.txt")),(int)fileSize);
    //Wrap BufferedWriter object with PrintWriter so that it allows you
    //to print line by line
    PrintWriter pw = new PrintWriter(bw);
         String s=null;
         while ( (s=lnr.readLine())!=null ){
              System.out.println(s);
              int lineNumber = lnr.getLineNumber();
    //match the line number
              if(! (lineNumber==lineToBeDeleted)){
                   pw.println(s);
              pw.flush();
              lnr.close();
              pw.close();
         catch(Exception e){System.out.println(e);}
    If you want you can rename the line1.txt to the original file name.
    I hope this helps.Good luck!!!!!!

  • How can i remove a line from an ordinary text file?

    It is easy to remove a line from a file by rewriting the file. how can i remove a line without rewriting ? Also, do not use whitespaces to overwrite the line. I expect a perfect line deletion code .....

    gimbal2 wrote:
    hsc71 wrote:
    It's the way you communicate. Try to be carefull with the words you use in your post. It's easy to insult people just by choosing the wrong words. Bold text and capitals is equal to shouting.
    shock. You said "wrong words". I am seriously offended by that!
    Seriously, would you care that I am offended? I really hope not... Say what you want, people will find reasons to take offense one way or the other.Hehe, maybe you're right, but the OP still has no answer.............and in the end that's what he/she is looking for.

  • How can I input read a line from a file and output it into the screen?

    How can I input read a line from a file and output it into the screen?
    If I have a file contains html code and I only want the URL, for example, www24.brinkster.com how can I read that into the buffer and write the output into the screen that using Java?
    Any help will be appreciate!
    ======START FILE default.html ========
    <html>
    <body>
    <br><br>
    <center>
    <font size=4 face=arial color=#336699>
    <b>Welcome to a DerekTran's Website!</b><br>
    Underconstructions.... <br>
    </font> </center>
    <font size=3 face=arial color=black> <br>
    Hello,<br>
    <br>
    I've been using the PWS to run the website on NT workstation 4.0. It was working
    fine. <br>
    The URL should be as below: <br>
    http://127.0.0.1/index.htm or http://localhost/index.htm
    <p>And suddently, it stops working, it can't find the connection. I tried to figure
    out what's going on, but still <font color="#FF0000">NO CLUES</font>. Does anyone
    know what's going on? Please see the link for more.... I believe that I setup
    everything correctly and the bugs still flying in the server.... <br>
    Thank you for your help.</P>
    </font>
    <p><font size=3 face=arial color=black>PeerWebServer.doc
    <br>
    <p><font size=3 face=arial color=black>CannotFindServer.doc
    <br>
    <p><font size=3 face=arial color=black>HOSTS file is not found
    <br>
    <p><font size=3 face=arial color=black>LMHOSTS file
    <br>
    <p><font size=3 face=arial color=black>How to Setup PWS on NT
    <BR>
    <p><font size=3 face=arial color=black>Issdmin doc</BR>
    Please be patient while the document is download....</font>
    <font size=3 face=arial color=black><br>If you have any ideas please drop me a
    few words at [email protected] </font><br>
    <br>
    <br>
    </p>
    <p><!--#include file="Hits.asp"--> </p>
    </body>
    </html>
    ========= END OF FILE ===============

    Hi!
    This is a possible solution to your problem.
    import java.io.*;
    class AddressExtractor {
         public static void main(String args[]) throws IOException{
              //retrieve the commandline parameters
              String fileName = "default.html";
              if (args.length != 0)      fileName =args[0];
               else {
                   System.out.println("Usage : java AddressExtractor <htmlfile>");
                   System.exit(0);
              BufferedReader in = new BufferedReader(new FileReader(new File(fileName)));
              StreamTokenizer st = new StreamTokenizer(in);
              st.lowerCaseMode(true);
              st.wordChars('/','/'); //include '/' chars as part of token
              st.wordChars(':',':'); //include ':' chars as part of token
              st.quoteChar('\"'); //set the " quote char
              int i;
              while (st.ttype != StreamTokenizer.TT_EOF) {
                   i = st.nextToken();
                   if (st.ttype == StreamTokenizer.TT_WORD) {          
                        if (st.sval.equals("href")) {               
                             i = st.nextToken(); //the next token (assumed) is the  '=' sign
                             i = st.nextToken(); //then after it is the href value.               
                             getURL(st.sval); //retrieve address
              in.close();
         static void getURL(String s) {     
              //Check string if it has http:// and truncate if it does
              if (s.indexOf("http://") >  -1) {
                   s = s.substring(s.indexOf("http://") + 7, s.length());
              //check if not mailto: do not print otherwise
              if (s.indexOf("mailto:") != -1) return;
              //printout anything after http:// and the next '/'
              //if no '/' then print all
                   if (s.indexOf('/') > -1) {
                        System.out.println(s.substring(0, s.indexOf('/')));
                   } else System.out.println(s);
    }Hope this helps. I used static methods instead of encapsulating everyting into a class.

  • How to delete a whole line in cmd prompt in Linux

    Hi all,
    How to delete a whole line in cmd prompt in Linux using short key?
    ex: [oracle@host1 ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/
    Thanks

    yes ctrl+ak or ctrl+eu both are better. if you look from that perspective, go end and delete will be the same job too. (ctrl+eu) (but for me in such a command line, for example cding in to the directories ,the cursor will be at the end of the line %99 of the time :) )
    about ctrl-t,
    Drag the character before the cursor forward over the character at the cursor, moving the cursor forward as well. If the insertion point is at the end of the line, then this transposes the last two characters of the line.
    for ex:
    misspelled command date -> daet -> ctrl+t -> date
    or
    misspelled command $APPPL_TO -> place the cursor on third P press ctrl+t repeateadly till the P will come to the end -> APPL_TOP

  • Delete a line from a file using Oracle .

    Hi Gents,
    Is there any option from oracle to delete the last line in a file using utl_file ?
    apart from sed or other UNIX commands>
    Regards
    Fento.

    hi,
    why don't you use SQL loader..?
    post in this export,Import,External table forum..
    Export/Import/SQL Loader & External Tables
    regards,
    Deepak

Maybe you are looking for