Ignore blank lines in text file using number format exception.

hi.. does anyone know how to ignore a blank line and move on to the next line? the text file contains:
2
bla bla bla
112.4
222.5
ble ble vle
115.5
123.2

The problem with trim() is that it only trims spaces (0x20). In a source code file, "blank" lines are as likely to contain TABs as spaces. I would recommend something like   if (line.length() == 0 || line.matches("\\s+")) If the inefficiency of matches() becomes a problem, you can use a pre-compiled Pattern object, or roll your own isItWhitespace() method.

Similar Messages

  • Skipping Blank Lines in text File

    I am working on an assignment in which i have to read from a text file and store the strings individually. The problem i have is that the text file has blank line between each set of strings. So i figured to use "fin.nextLine();" to skip that blank line and continue with storing the values. but i get
    "Exception in thread "main" java.util.NoSuchElementException: No line found
         at java.util.Scanner.nextLine(Unknown Source)
         at processmsg.ProcessMessages.choice1(ProcessMessages.java:68)
         at processmsg.ProcessMessages.main(ProcessMessages.java:25)"
    which is where the fin.nexLine() is at. How can i just skip that blank line?
    System.out.println("Please enter the file location");
              Scanner stdin = new Scanner(System.in);
              String fileName = stdin.nextLine();
              // read the information from the file
              try {
                   Scanner fin = new Scanner(new File(fileName));
                   String tSendName = fin.nextLine();
                   while(tSendName != null)
                        String tRecieveName = fin.nextLine();
                        String tPhoneNumber = fin.nextLine();
                        String tDate = fin.nextLine();
                        String tTime = fin.nextLine();
                        String tStatus = fin.nextLine();
                        String tMessage = fin.nextLine();
                        PhoneMessage phonemessage = new PhoneMessage(tSendName, tRecieveName,
                                  tPhoneNumber, tDate, tTime, tStatus, tMessage);
                        fin.nextLine();
                        tSendName = fin.nextLine();

    don't know if you want the whole code, the whole code is kind of large and spread out over 3 different classes. and yes the text file is standard
    sender
    reciever
    phone number
    date
    time
    status
    message
    sender
    reciever
    phone number
    date
    time
    status
    message
    sender
    reciever
    phone number
    date
    time
    status
    message
    private static void choice()
              // scan the file location from the user
              System.out.println("Please enter the file location");
              Scanner stdin = new Scanner(System.in);
              String fileName = stdin.nextLine();
              // read the information from the file
              try {
                   Scanner fin = new Scanner(new File(fileName));
                   String tSendName = fin.nextLine();
                   while(tSendName != null)
                        String tRecieveName = fin.next();
                        String tPhoneNumber = fin.next();
                        String tDate = fin.nextLine();
                        String tTime = fin.nextLine();
                        String tStatus = fin.nextLine();
                        String tMessage = fin.nextLine();
                        PhoneMessage phonemessage = new PhoneMessage(tSendName, tRecieveName,
                                  tPhoneNumber, tDate, tTime, tStatus, tMessage);
                        // skip blank line between entries
                        fin.nextLine();
                        // test date string for correct format
                        int month = Integer.parseInt(tDate.substring(0,2));
                        int day = Integer.parseInt(tDate.substring(3,5));
                        int year = Integer.parseInt(tDate.substring(6,10));
                        // test time string for correct format
                        int hour = Integer.parseInt(tTime.substring(0,2));
                        int minute = Integer.parseInt(tTime.substring(3,5));
                        int second = Integer.parseInt(tTime.substring(6,8));
                        tSendName = fin.nextLine();
                        msgList.add(phonemessage);
                   fin.close();
              } catch (FileNotFoundException e) {
                   System.out.println("The file " + fileName + " was not found!");
              } catch (java.lang.NumberFormatException e) {
                   System.out.println("The date and/or time is not of the correct format");
         }

  • Blank line in text file after download

    Hi  all,
    i am using the below code to get the 254 blank spaces at the end of the text file & it's comming correctly.
    generally i am downloading 2 lines in the original program  & i am getting one blank line in between these two lines.
    The main thing is that i am getting this blank line when i run this program in my office computer. But i am not getting this blank line when i run this same program in my home laptop. Please suggest why this blank line is appearing & any solution ?
    DATA: BEGIN OF OUTTAB OCCURS 100,
            PROD_CODE(3),
            LINE_DETL(2043),
          END OF OUTTAB.
    DATA:V_OUTPUT(2043).
    DATA: space_character type c.
    space_character  = CL_ABAP_CHAR_UTILITIES=>MINCHAR.
            DO 254 times.
               CONCATENATE V_OUTPUT space_character INTO V_OUTPUT.
               ENDDO.
               OUTTAB-LINE_DETL = V_OUTPUT.APPEND OUTTAB.
    call function 'GUI_DOWNLOAD'
       EXPORTING
          filename = OUTFILE1
          filetype = 'ASC'
          TABLES
          data_tab = OUTTAB

    I don't think this is issue of ABAP. Any way just to check download the file on laptop and open same file and office computer
    if file looks ok then it is OS or text editor issue.
    Thanks,
    AK.

  • How to replace a line ina text file using java?

    Hi ALL,
    Does anybody know how to replace a line in a text file uisng java.

    use this thing:
    http://doesthatevencompile.com/current-projects/code-sniplets/ASCIIFile.htm
    open the file,
    read its contents, replace the text you need in the contents, set the contents back into the file.
    it takes care of the IO for you.

  • Ignore last lines in a file using FCC

    Hello,
    can we ignore last two line in a file, when we are using FCC.
    in a file uploaded with some special char like $#@..... due to this mapping getting failed.
    i want to ignore last two lines in a file.
    Regards,
    Chinna

    Hi Chinna,
    you can also use replaceString funtion to remove all special character and then use result for date transformation like shown below.
    Hope it will be helpful for you.
    Regards
    Jitender

  • How to read some lines from a text file using java.

    hi,
    i m new to java and i want to read some lines from a text file based on some string occurrence in the file. This file to be read in steps.
    we only want to read the file upto the first Occurrence of "TEXT" string.
    How to do it ,,,
    Kinldy give the code
    Regards,
    Sagar
    this is the text file
    dfgjdjj
    sfjhjkd
    ghjkdg
    hjkdgh TEXT
    ikeyt
    ujt
    jk
    tyk TEXT
    rukl
    r

    Hendawy wrote:
    Since the word "TEXT" is formed of 4 letters, you would read the text file 4 bytes by four bytes. Wrong on two counts. First, the file may not be encoded 1 byte per character. It could be utf-16 in which case it would be two byte per character. Second, even if it were 1 byte per character, the string "Text" may not start on a 4 byte boundary.
    Consider a FileInputStream object "fis" that points to your text file. use fis.read(byte[] array, int offset, int len) to read every four bytes. Convert the "TEXT" String into a byte array "TEXT".getBytes(), and yous the Arrays class to compare the equality of the read bytes with your "TEXT".getBytes()Wrong since it relies on my second point and will fail when fis.read(byte[] array, int offset, int len) does not read 4 bytes (as is no guaranteed to). Check the Javadoc. Also, the file may not be encoded with the default character encoding.
    The problem is easily solved by reading a line at a time using a BufferedReader wrapping an InputStreamReader wrapping a FileInputStream and specifying the correct character encoding.
    Edited by: sabre150 on Apr 29, 2009 2:13 PM

  • Attaching text file using SO_NEW_DOCUMENT_ATT_SEND_API1

    hello guys, i'm a newbie here.
    I'm having trouble attaching an existing text file using function 'SO_NEW_DOCUMENT_ATT_SEND_API1'. It seems i can't find the right combination of parameters that are being passed to this function.
    first, i'm using WS_UPLOAD to upload the text file to an internal table then i'm creating all the neccessary internal tables that will be use by this function..
    By the way, i'm trying to send mail w/ attachments to external mail and SAPids. Below is my code.
    REPORT ZHR_TESTEMAIL .
    TABLES: USR02, PA0105, SOSU, SOUC, RLGRAP, IBIPPARMS, DYNPREAD, RSCSEL.
    DATA: FOLD_YR(2) TYPE C,
          FOLD_TYPE(3) TYPE C,
          G_HEADER LIKE SOOD2,
          G_FOLMAM LIKE SOFM2,
          METHOD1 LIKE SY-UCOMM,
          G_DOCUMENT LIKE SOOD4,
          G_USER LIKE SOUDNAMEI1,
          FOLD_NUMBER(12) TYPE C,
          G_NEW_PARENT LIKE SOODK,
          G_OWNER LIKE SOUD-USRNAM,
          G_REF_DOCUMENT LIKE SOOD4,
          G_USER_DATA LIKE SOUDATAI1,
          G_AUTHORITY LIKE SOFA-USRACC,
          G_OBJCNT LIKE SOLI OCCURS 0 WITH HEADER LINE,
          G_OBJHEAD LIKE SOLI OCCURS 0 WITH HEADER LINE,
          G_OBJPARA LIKE SELC OCCURS 0 WITH HEADER LINE,
          G_OBJPARB LIKE SOOP1 OCCURS 0 WITH HEADER LINE,
          G_RECIPIENTS LIKE SOOS1 OCCURS 0 WITH HEADER LINE,
          G_REFERENCES LIKE SOXRL OCCURS 0 WITH HEADER LINE,
          G_ATTACHMENTS LIKE SOOD5 OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF G_FILES OCCURS 10 ,
          TEXT(4096) TYPE C,
          END OF G_FILES.
    DATA: BEGIN OF IT_WS_FILE OCCURS 0,
          WS_FILE LIKE RLGRAP-FILENAME,
          END OF IT_WS_FILE.
    DATA: BEGIN OF IT_SAPID OCCURS 0,
          SAPID LIKE USR02-BNAME,
          END OF IT_SAPID.
    DATA: BEGIN OF IT_EMAIL OCCURS 0,
          EMAILADD LIKE PA0105-USRID_LONG,
          END OF IT_EMAIL.
    DATA: BEGIN OF IT_TSP01 OCCURS 0.
            INCLUDE STRUCTURE TSP01.
    DATA: END OF IT_TSP01.
    DATA: BEGIN OF TAB2 OCCURS 50,
          TEXT(200) TYPE C,
          END OF TAB2.
    DATA: V_DOCDATA TYPE SODOCCHGI1,
          V_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
          V_OBJHEAD LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJTXT  LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJBIN  LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJHEX  LIKE SOLIX      OCCURS 0 WITH HEADER LINE,
          IT_RECVRS TYPE SOMLRECI1  OCCURS 0 WITH HEADER LINE,
          IT_CONTNT TYPE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          IT_BODY   LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
          V_TLIN    TYPE I,
          V_LINE    TYPE I.
    DATA: BEGIN OF IT_TEXTLINE OCCURS 500,
          TEXTLINE(5000),
          END OF IT_TEXTLINE.
    DATA: FYL LIKE RLGRAP-FILENAME,
          GV_SUBNO LIKE SOSU-SUBNO,
          GV_EMAIL LIKE PA0105-USRID_LONG,
          GV_NEXTDAY LIKE SY-DATUM,
          YEAR(4) TYPE C,
          RECFLAG TYPE C.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM WITH FRAME TITLE TEXT-001.
    PARAMETERS: SUBJ(254) TYPE C OBLIGATORY,            "Subject
                DESC(254) TYPE C.                       "Message
    SELECT-OPTIONS: SAPID FOR USR02-BNAME NO INTERVALS. "Recipient's SAP ID
    SELECT-OPTIONS: EMAILADD FOR PA0105-USRID_LONG NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK PARAM.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM2 WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS: WS_FILE FOR DYNPREAD-FIELDNAME NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK PARAM2.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM3 WITH FRAME TITLE TEXT-003.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT1 RADIOBUTTON GROUP A USER-COMMAND BUT. "Local PC
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT2 RADIOBUTTON GROUP A.                  "Server
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT3 RADIOBUTTON GROUP A.                  "Spool
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT3.
    PARAMETERS: SPOOLNUM LIKE RSPOTYPE-RQNUMBER.            "Spool Number
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK PARAM3.
    SELECTION-SCREEN BEGIN OF BLOCK PROC WITH FRAME TITLE TEXT-004.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETER: BPROC AS CHECKBOX USER-COMMAND BCK. "Background Processing
    SELECTION-SCREEN COMMENT 5(50) FOR FIELD BPROC.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK PROC.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR WS_FILE-LOW.
      DATA: WS_FILE_TEMP TYPE IBIPPARMS-PATH.
      CLEAR: WS_FILE_TEMP.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                PROGRAM_NAME  = SY-REPID
                DYNPRO_NUMBER = SY-DYNNR
                FIELD_NAME    = 'WS_FILE'
           IMPORTING
                FILE_NAME     = WS_FILE_TEMP.
      WS_FILE-LOW = WS_FILE_TEMP.
    AT SELECTION-SCREEN.
      SELECT SAPNAM FROM SOUC
          INTO TABLE IT_SAPID
          WHERE SAPNAM IN SAPID
            AND DELETED = ''.
      GV_NEXTDAY = SY-DATUM + 1.
      LOOP AT EMAILADD.
        IT_EMAIL-EMAILADD = EMAILADD-LOW.
        APPEND IT_EMAIL.
        CLEAR: IT_EMAIL.
      ENDLOOP.
      IF NOT BPROC IS INITIAL.
        CLEAR: RBUT1, RBUT3.
        RBUT2 = 'X'.
      ELSE.
        CLEAR: RBUT2.
      ENDIF.
      IF NOT RBUT3 IS INITIAL.
        REFRESH: WS_FILE.
      ENDIF.
      IF SAPID IS INITIAL AND EMAILADD IS INITIAL.
        MESSAGE E000(ZZ) WITH TEXT-201.
      ELSEIF NOT SAPID IS INITIAL AND EMAILADD IS INITIAL.
        CLEAR IT_SAPID.
        READ TABLE IT_SAPID.
        SELECT SINGLE SUBNO FROM SOSU
          INTO GV_SUBNO
          WHERE USRNO IN ( SELECT USRNO FROM SOUC
                             WHERE SAPNAM = IT_SAPID-SAPID ).
        IF SY-SUBRC NE 0.
          MESSAGE E000(ZZ) WITH TEXT-202.
        ENDIF.
        CLEAR: IT_SAPID.
      ELSEIF NOT SAPID IS INITIAL AND NOT EMAILADD IS INITIAL.
        CLEAR: IT_SAPID, IT_EMAIL.
        READ TABLE IT_SAPID.
        READ TABLE IT_EMAIL.
        SELECT SINGLE SUBNO FROM SOSU
          INTO GV_SUBNO
          WHERE USRNO IN ( SELECT USRNO FROM SOUC
                             WHERE SAPNAM = IT_SAPID-SAPID ).
        IF SY-SUBRC NE 0.
          SUBMIT RSSOADM0 WITH USRNAM EQ IT_SAPID-SAPID
                          WITH NEW_SUBS EQ IT_EMAIL-EMAILADD
                          WITH SUB_ESC EQ 'U'
                          WITH EDAT EQ SY-DATUM
                          WITH BDAT EQ SY-DATUM
                         WITH BDAT EQ GV_NEXTDAY
                         WITH EDAT EQ '99991231'
                          WITH BTIM EQ SY-UZEIT
                          WITH ETIM EQ '240000'
                          WITH FORW_ALL EQ 'X'
                          WITH PSTHR2 EQ ''
                          AND RETURN.
        ENDIF.
        CLEAR: IT_SAPID.
      ELSEIF NOT EMAILADD IS INITIAL AND SAPID IS INITIAL.
        RECFLAG = 'X'.
      ENDIF.
    START-OF-SELECTION.
        PERFORM B_SENDMAIL.
    FORM B_SENDMAIL.
      YEAR = SY-DATUM+0(4).
      LOOP AT WS_FILE.
        CLEAR: FYL.
        FYL = WS_FILE-LOW.
        REFRESH: TAB2.
        CALL FUNCTION 'WS_UPLOAD'
             EXPORTING
                  FILENAME = FYL
                  FILETYPE = 'BIN'
             TABLES
                  DATA_TAB = TAB2.
        IT_TEXTLINE[] = TAB2[].
    DOCUMENT_DATA (SUBJECT OF MAIL)
        V_DOCDATA-OBJ_NAME   = DESC.
        V_DOCDATA-OBJ_DESCR  = SUBJ.
        V_DOCDATA-OBJ_LANGU  = SY-LANGU.
        V_DOCDATA-SENSITIVTY = 'C'.
        V_DOCDATA-OBJ_PRIO   = '1'.
    BODY OF MAIL
        IT_BODY-LINE = 'Collection Report'.
        APPEND IT_BODY.
    CONTENTS_TXT (Attachments)
        IT_CONTNT[] = IT_TEXTLINE[].
        DESCRIBE TABLE IT_CONTNT LINES V_LINE.
        READ TABLE IT_CONTNT INDEX V_LINE.
    PACKING_LIST
        V_OBJPACK-DOC_SIZE = ( V_LINE - 1 ) * 255 + STRLEN( IT_CONTNT ).
        V_OBJPACK-TRANSF_BIN = 'X'.
        V_OBJPACK-HEAD_START = 1.
        V_OBJPACK-HEAD_NUM   = 0.
        V_OBJPACK-BODY_START = 1.
        V_OBJPACK-BODY_NUM   = V_LINE.
        V_OBJPACK-DOC_TYPE   = 'TXT'.
        V_OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
        V_OBJPACK-OBJ_DESCR  = 'Attached Document'.
        APPEND V_OBJPACK.
        CLEAR  V_OBJPACK.
    RECEIVERS of mail
        IF RECFLAG IS INITIAL.
          LOOP AT IT_SAPID.
            IT_RECVRS-RECEIVER   = IT_SAPID-SAPID.
            IT_RECVRS-REC_TYPE   = 'B'.
            IT_RECVRS-COM_TYPE   = ''.
            IT_RECVRS-EXPRESS    = 'X'.
            IT_RECVRS-NO_FORWARD = ''.
            IT_RECVRS-NO_PRINT   = ''.
            APPEND IT_RECVRS.
            CLEAR IT_RECVRS.
          ENDLOOP.
        ELSE.
          LOOP AT EMAILADD.
            IT_RECVRS-RECEIVER   = EMAILADD-LOW.
            IT_RECVRS-REC_TYPE   = 'U'.
            IT_RECVRS-COM_TYPE   = 'INT'.
            IT_RECVRS-EXPRESS    = 'X'.
            APPEND IT_RECVRS.
            CLEAR IT_RECVRS.
          ENDLOOP.
        ENDIF.
    OBJECT_HEADER (Filename)
        CONCATENATE 'Collection Report' '_'
                     SY-DATUM+4(4) YEAR '.TXT'
                     INTO V_OBJHEAD-LINE.
       V_OBJHEAD-LINE = FYL+16(25).
        APPEND V_OBJHEAD.
        CLEAR V_OBJHEAD.
    Function Module For Sending Mail with Attachment
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                  DOCUMENT_DATA              = V_DOCDATA
             TABLES
                  PACKING_LIST               = V_OBJPACK
                  OBJECT_HEADER              = V_OBJHEAD
                  CONTENTS_HEX               = IT_CONTNT
                  CONTENTS_TXT               = IT_BODY
                  RECEIVERS                  = IT_RECVRS
             EXCEPTIONS
                  TOO_MANY_RECEIVERS         = 1
                  DOCUMENT_NOT_SENT          = 2
                  DOCUMENT_TYPE_NOT_EXIST    = 3
                  OPERATION_NO_AUTHORIZATION = 4
                  PARAMETER_ERROR            = 5
                  X_ERROR                    = 6
                  ENQUEUE_ERROR              = 7
                  OTHERS                     = 8.
        IF SY-SUBRC = 0.
          MESSAGE S000(ZZ) WITH TEXT-005.
        ELSE.
          MESSAGE S000(ZZ) WITH TEXT-006.
        ENDIF.
      ENDLOOP.
    end of my code *
    please help me guys... when i run this program,    DOCUMENT_NOT_SENT is what i always get.. 
    waiting for ur reply... thank you vey much and godbless.

    Hi,
    Try this sample code.
    FORM SEND_TO_EMAIL USING zFName.
      DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
      DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
      DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
      DATA: DOC_CHNG LIKE SODOCCHGI1.
      DATA: TAB_LINES LIKE SY-TABIX.
      DATA: ctmp(50) TYPE C.
    Creation of the document to be sent
      DOC_CHNG-OBJ_NAME = 'JOURNAL'.
      CONCATENATE 'SAP Payroll Journal file Period' pybegda INTO ctmp
                  SEPARATED BY SPACE.
      DOC_CHNG-OBJ_DESCR = cTmp.
      OBJTXT = 'SAP Payroll Journal'.
      APPEND OBJTXT.
      CONCATENATE 'For Period' pybegda INTO ctmp
                  SEPARATED BY SPACE.
      OBJTXT = ctmp.
      APPEND OBJTXT.
      CONCATENATE 'Attached File :' zFname INTO ctmp
                  SEPARATED BY SPACE.
      OBJTXT = ctmp.
      APPEND OBJTXT.
      OBJTXT = 'Please find the attachment.'.
      APPEND OBJTXT.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creation of the entry for the compressed document
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      APPEND OBJPACK.
    Creation of the document attachment
      <b>LOOP AT xMail.
        CONDENSE xMail-aline.
        OBJBIN = xMail-aline.
        APPEND OBJBIN.
        CLEAR OBJBIN.
      ENDLOOP.</b>
      DESCRIBE TABLE OBJBIN LINES TAB_LINES.
      OBJHEAD = zFname. APPEND OBJHEAD.
    Creation of the entry for the compressed attachment
      OBJPACK-TRANSF_BIN = 'X'.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 1.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      OBJPACK-OBJ_NAME = 'DATA'.
      OBJPACK-OBJ_DESCR = 'SAP Payroll File'.
      OBJPACK-DOC_SIZE = TAB_LINES * 255.
      APPEND OBJPACK.
    Completing the recipient list
      LOOP AT PENERIMA.
        CONDENSE PENERIMA-PNRM.
        RECLIST-RECEIVER = PENERIMA-PNRM.
        RECLIST-REC_TYPE = 'U'.
        APPEND RECLIST.
      ENDLOOP.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = DOC_CHNG
                PUT_IN_OUTBOX              = ' '
           TABLES
                PACKING_LIST               = OBJPACK
                OBJECT_HEADER              = OBJHEAD
                CONTENTS_BIN               = OBJBIN
                CONTENTS_TXT               = OBJTXT
                RECEIVERS                  = RECLIST
           EXCEPTIONS
                TOO_MANY_RECEIVERS         = 1
                DOCUMENT_NOT_SENT          = 2
                OPERATION_NO_AUTHORIZATION = 4
                OTHERS                     = 99.
      CASE SY-SUBRC.
        WHEN 0.
          WRITE: / 'Result of the send process:'.
          LOOP AT RECLIST.
            WRITE: / RECLIST-RECEIVER(48), ':'.
            IF RECLIST-RETRN_CODE = 0.
              WRITE / 'The document was sent'.
            ELSE.
              WRITE / 'The document could not be sent'.
            ENDIF.
          ENDLOOP.
        WHEN 1.
          WRITE: / 'Too many receiver'.
        WHEN 2.
          WRITE: / 'Document could not be sent to any recipient'.
        WHEN 4.
          WRITE: / 'No send authorization'.
        WHEN OTHERS.
          WRITE: / 'Error occurred while sending'.
      ENDCASE.
    ENDFORM.

  • Deleting a column in a text file using LabVIEW

    Hello all,
    I'm trying to delete the first column of my tab delimited text file using LabVIEW and then save it under the same file name.  Can someone show me a quick way to perform this operation.  Is this even possible with LabVIEW?  Any help would be much appreciated.
    My purpose is to automate this operation for hundreds of daily text files containing data that needs processing.  I'm currently using LabVIEW 8.2.
    Thanks!
    -noviceLabVIEWuser

    If the file is relatively small:
    Read the file using the Read from Spreadsheet File VI to get 2D array.
    Remove the column from the 2D array.
    Write out new 2D array to new file using Write to Spreadsheet File VI.
    If the file is relatively large then you will likely run into memory issues. In this case you will need to read the file in chunks. You can decide how many lines to read at a time. Use a for-loop that's set to run for the number of chunks to read (based on the total number of lines and the number of lines you want to read at a time). Hint: Quotient & Remainder function. In the loop use the Read Text File VI to read your set number of lines. Convert the lines to a 2D array delete your column, and write out that chunk of data to the new file. Rinse and repeat.

  • Why this error in writing string to text file using utl_file?

    HI Friends,
    Iam trying to write procedure to add one line of text in text file using UTIL package. But getting error.
    create or replace procedure Add_To_File() is
    OutFile utl_file.file_type;
    l_err_code NUMBER(10);
    l_err_msg VARCHAR2(2000);
    vNewLine VARCHAR2(4000);
    vdir varchar2(200):='UTIL_DIR';
    begin
    OutFile:=utl_file.fopen(vdir,'out.txt','w','32000');
    vNewLine:='Loading is successfull';
    utl_file.put_line(OutFile,vNewLine);
    EXCEPTION
    WHEN OTHERS THEN
    l_err_code := SQLCODE;
    l_err_msg := SUBSTR(SQLERRM,1,128);
    Dbms_output.put_line(l_err_code || l_err_msg);
    end;
    when i execute above procedure iam getting this error.
    LINE/COL ERROR
    1/23 PLS-00103: Encountered the symbol ")" when expecting one of the
    following:
    <an identifier> <a double-quoted delimited-identifier>
    current delete exists prior
    Please suggest me where iam wrong.
    Thanks,
    Venkat Vadlamudi

    868591 wrote:
    HI Friends,
    Iam trying to write procedure to add one line of text in text file using UTIL package. But getting error.
    create or replace procedure Add_To_File() is
    OutFile utl_file.file_type;
    l_err_code NUMBER(10);
    l_err_msg VARCHAR2(2000);
    vNewLine VARCHAR2(4000);
    vdir varchar2(200):='UTIL_DIR';
    begin
    OutFile:=utl_file.fopen(vdir,'out.txt','w','32000');
    vNewLine:='Loading is successfull';
    utl_file.put_line(OutFile,vNewLine);
    EXCEPTION
    WHEN OTHERS THEN
    l_err_code := SQLCODE;
    l_err_msg := SUBSTR(SQLERRM,1,128);
    Dbms_output.put_line(l_err_code || l_err_msg);
    end;
    when i execute above procedure iam getting this error.
    LINE/COL ERROR
    1/23 PLS-00103: Encountered the symbol ")" when expecting one of the
    following:
    <an identifier> <a double-quoted delimited-identifier>
    current delete exists prior
    Please suggest me where iam wrong.
    Thanks,
    Venkat Vadlamudibelow works for me
      1  CREATE OR replace PROCEDURE Add_to_file
      2  IS
      3    outfile       utl_file.file_type;
      4    l_err_code NUMBER(10);
      5    l_err_msg  VARCHAR2(2000);
      6    vnewline   VARCHAR2(4000);
      7    vdir       VARCHAR2(200) := 'UTIL_DIR';
      8  BEGIN
      9    outfile := utl_file.Fopen(vdir, 'out.txt', 'w', '32000');
    10    vnewline := 'Loading is successfull';
    11    utl_file.Put_line(outfile, vnewline);
    12  EXCEPTION
    13    WHEN OTHERS THEN
    14            l_err_code := SQLCODE;
    15            l_err_msg := Substr(sqlerrm, 1, 128);
    16            dbms_output.Put_line(l_err_code
    17                           || l_err_msg);
    18* END;
    SQL> /
    Procedure created.

  • Ignoring white lines in a file parsed with Scanner

    I've a little problem...
    How to ignore white lines in a file (for configuration informations) parsed with Scanner???
    My parser can ignore #(comments) and other thing, but not white lines...
    oooo
    fucking little problem!!!
    Thank for solutions...
    euronymous

    Wrong assumption. Scanner doesn't return lines, it returns tokens separated by delimiters which are whitespace by default, so by default it will already ignore blank lines.
    If you are using custom delimiters, make sure to include space, tab, and newline (\r \n and \f) as delimiters.

  • Spool SQl data into text file using dynamic sql

    Hi,
    I am spooling output data into text file using command
    select 'select t.mxname,bo.lxtype,t.mxrev'||chr(10)||'from mx_1234567'||chr(10)||
    'where <condition>';
    here mxname varchar(128),lxtype(128),mxrev(128) all are of varchar type.I want the output in format
    e.g Part|1211121313|A
    but due to column width the output,I am getting is with spaces.
    "Part then blank spaces |1211121313 then blank spaces |A"
    how can I remove these spaces between columns.I used set space 0 but not working.
    Thanks in advance.
    Your help will be appreciated.

    Hi Frank,
    I have seen your reply for SET LINE SIZE function. But, I could not be able to understand it.
    I am facing similar kind of issue in my present project.
    I am trying spool more than 50 columns from a table into flat file. Because of more column lengths in few columns, i am getting space. There are so many columns with the same issue. I want to remove that space.so that, data can fit perfectly in one line in .txt file without any wrap text.
    Below is my sample query.sql. Please let me know the syntax. My mail id : [email protected]
    --Created : Sep 22,2008, Created By : Srinivasa Bojja
    --Export all Fulfillments
    --Scheduled daily after 1:00am and should complete before 3:30am
    WHENEVER SQLERROR EXIT SQL.SQLCODE
    SET LINESIZE 800
    SET WRAP OFF
    SET PAGESIZE 800
    SET FEEDBACK OFF
    SET HEADING ON
    SET ECHO OFF
    SET CONCAT OFF
    SET COLSEP '|'
    SET UNDERLINE OFF
    SPOOL C:\Fulfillment.txt;
    SELECT SRV.COMM_METHOD_CD AS Method,
    SRV.SR_NUM AS "Fulfillment Row_Id",
    CON.LAST_NAME AS "Filled By"
    SRV.SR_TITLE AS Notes,
    SRVXM.ATTRIB_04 AS "Form Description"
    FROM SIEBEL.S_SRV_REQ SRV,
    SIEBEL.S_SRV_REQ_XM SRVXM,
    SIEBEL.S_USER USR,
    SIEBEL.S_CONTACT CON
    WHERE SRV.ROW_ID = SRVXM.PAR_ROW_ID AND
    SRV.OWNER_EMP_ID = USR.ROW_ID AND
    CON.ROW_ID= SRV.CST_CON_ID;
    SPOOL OFF;
    EXIT;

  • How copy just line in text file with cat? (SOLVED)

    Hi.
    How i make to copy just only line in text file with cat?
    For example:
    [:0.0]
    file=/home/Arch/./.wallpaper.png
    mode=0
    bgcolor=# 0 0 0
    I want copy just "/home/Arch/./.wallpaper.png" part.
    Actually i want create a shortcut for last wallpaper set from Nitroget, then i put this in SLim background.
    Recently i use hsetroot for wallpaper (~/.wallpaper.png) and i create a shortcut in /usr/share/slim/theme/MYTHEME whith ln -s ~/.wallpaper.png /usr/share/slim/theme/MYTHEME/background.png.
    I want make a same with Nitrogen.
    I now this looks like crazy, but...
    Sorry my English.
    Last edited by kramerxiita (2008-06-04 16:50:48)

    moljac024 wrote:
    kramerxiita wrote:
    moljac024 wrote:How can you make SliM change the background ? You link the theme background to another file ?
    Yes. In theme directory i put background.png shortcut for my wallpaper. So, when a change wallpaper, slim background change too.
    Example:
    ln -s mywallpaper.png /usr/share/slim/themes/default/background.png
    So, Slim background always is my wallpaper.
    So the wallpaper has to be a *.png ?
    No, jpg is possible. But when you create a symbolic link, remember put the extension too. If change png to jpg, change a symbolic link extension.
    But, remember if slim theme directory have background.png and background.jpg, Slim always choice .png. So, put only one this.

  • New Line in Text File

    Hi -
    Im using the FileWriter and BufferedWriter classes to output text into a .txt file.
    The text I am writing is taken from another text file using the FileReader and BufferedReader classes.
    The text is reading from the file, and will also output to the new text file, however it won't insert a new line, it only inserts an 'unprintable' character i.e. an empty square
    My code is below - its only starting out so its farily simple at the moment, just reading from one file and outputting to another.
    Is there a way i can get the actual new line/carriage return inserted instead of the empty square. (im running Windows XP)
    Thanks in advance
    import java.io.*;
    public class Pad {
    private String inputPath;
    private String outputPath;
    /** Creates a new instance of Pad */
    public Pad() {
    inputPath = "C:\\OUTBOUND.TXT";
    outputPath = "C:\\04'06.txt";
    * @param args the command line arguments
    public static void main(String[] args) {
    // TODO code application logic here
    System.out.println("PAD File");
    //Read PAD File
    Pad p = new Pad();
    p.readPADFile(p.inputPath, p.outputPath);
    public void readPADFile(String inputPath, String outputPath)
    inputPath = this.inputPath;
    outputPath = this.outputPath;
    //System.out.println(inputPath);
    int recordCount = 0;
    String record = null;
    try
    FileReader fr = new FileReader(inputPath);
    FileWriter fw = new FileWriter(outputPath);
    BufferedReader br = new BufferedReader(fr);
    BufferedWriter bw = new BufferedWriter(fw);
    record = new String();
    while((record = br.readLine())!=null)
    recordCount++;
    //System.out.println(recordCount + ": " + record);
    bw.write(record + "\n");
    bw.close();
    br.close();
    fw.close();
    fr.close();
    }catch(IOException e)
    System.out.println("IOException Error");
    e.printStackTrace();
    System.out.println(e.toString());
    }

    I assume by using the
    System.getProperty("line.separator") that this will
    work independent of platform.Yes. And using bw.println() instead of bw.print() will already do it for you. So all you need to change in your program are two letters.

  • How to read a tab seperated data from a text file using utl_file

    Hi,
    How to read a tab seperated data from a text file using utl_file...
    I know if we use UTL_FILE.get_line we can read the whole line...but i need to read the tab separated value separately.....
    Thanks in advance...
    Naveen

    Naveen Nishad wrote:
    How to read a tab seperated data from a text file using utl_file...
    I know if we use UTL_FILE.get_line we can read the whole line...but i need to read the tab separated value separately.....If it's a text file then UTL_FILE will only allow you to read it a line at a time. It is then up to you to split that string up (search for split string on this forum for methods) into it's individual components.
    If the text file contains a standard structure on each line, i.e. it is a fixed delimited structure, then you could use external tables to read the data instead.

  • I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel

    I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel.
    When it was explained to me it didn't sound to hard of a task, I have no LabVIEW experience and the tutortial sucks.

    StevenD: FYI, I did NOT give you the one star rating. I would never do that!
    StevenD wrote:
    Ow. Someone is grumpy today.
    Well, this is an assignment, so it is probably homework.
    Why else would anyone give HIM such an assigment, after all he has no LabVIEW experience and the tutorials are too hard for him?
    This would make no sense unless all of it was just covered in class!
    This is not a free homework service with instant gratification.
    OK! Let's do it step by step. I assume you already have a VI with the digital indicators.
    "...but have no idea where to begin".
    open notepad.
    decide on a format, possibly one line per indicator.
    type the document.
    close notepad.
    open LabVIEW.
    Open the existing VI with all the indicators.
    (are you still following?)
    look at the diagram.
    Who made the program?
    Does the code make sense so far?
    Is it a statemachine or just a bunch of crisscrossed wires?
    Where do you want to add the file read?
    How should the file be read (after pressing a read button, at the start of the program ,etc.)
    See how far you get!
    Message Edited by altenbach on 06-24-2008 11:23 AM
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for

  • URGENT: Problem with lexical reference in query statement!

    I am modifying the seeded Receipt Traveler report. The query I need to modify is the receipts query (Q_RECEIPTS). The entire query statement for this is a lexical reference - &P_SELECT_RECEIPTS. The actual query is being set in the After Parameter Fo

  • Oracle Standard Manager Hang

    Good Day every One , Am working on Oracle Application 12.1.3 And Database 1.2.0.3 And OS RedHat 6.1 I had this problem my standard manager have too many pending request and there is no one can see the output of the oracle requests because all of them

  • Siri not working with Nike plus

    I noticed today that siri would not working while i was using Nike Plus on my run.  Is this a known problem or is it just me?

  • Cumulative output based on flag...

    Hi, I have a table as Txn No Flag Amt 1 C 500 2 D 100 3 C 200 4 C 100 5 D 400 6 D 100 I am trying to write a query which will give me the total amount that is based on the Flag value i.e. D or C. If Flag is D subtract the current amount from previous

  • How do I transfer music off of my ipod 30gb into my library?

    How do I transfer music off of my ipod 30gb into my library?