Split tab delimited file

Hiall,
I filled an internal table with the data from a tab delimited file (trought the FM FTP_TOR3).
All my date is in the internal table, but I want to split it now. I tried with the '#' (as ALT + 3), but he doesn 't split the line.
I'm on 4.6, so I cannot use the horizontal_tab as splitter

While I was searching on this forum on unicode-characters (had a feeling it was something like this), I found  a post with practicly the same problem (but with a somewhat bizarre title ), there they told me to use this :
data : c_tab type x value '09'.
as splitter. Apparently, it has something to do with Unix unicode, and the windows # differs from the Unix #.
Problem solved, thanks for the help
(awarded you 10 points for the help )
kr
Björn

Similar Messages

  • Split tab delimited file coming from application server.

    Hi,
    i have received a tab delimited file from the application server.it contains # instead of tab at the application server.
    i want to know how to split it.
    i tried decalring constant as:
    c_tab type x value'09'.
    but it gives an error saying only c,n,d and t types are allowed.
    please gelp.
    Thanks,
    Anand.

    Hi,
    Do like this
    *--Local Variables
      DATA : l_file TYPE string,
             l_line TYPE string.
    *--Clear
      CLEAR : l_file.
      l_file = p_ipfile.
    *--Read the data from application server file.
      OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc NE 0.
    *--Error in opening file
        MESSAGE i368(00) WITH text-005.
      ENDIF.
    *--Get all the records from the specified location.
      DO.
        READ DATASET l_file INTO l_line.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          SPLIT l_line AT cl_abap_char_utilities=>horizontal_tab
                          INTO st_ipfile-vbeln
                               st_ipfile-posnr
                               st_ipfile-edatu
                               st_ipfile-wmeng.
          APPEND st_ipfile TO it_ipfile.
        ENDIF.
      ENDDO.
    *--Close dataset
      CLOSE DATASET l_file.
    Regards,
    Prashant

  • Splitting tab delimited file?

    how to split a tab delimited file?

    Hi,
    Do like this
    *--Local Variables
      DATA : l_file       TYPE string,
             l_line(1000) TYPE c.
    *--Clear
      CLEAR : l_file.
      l_file = p_aifile.
    *--Read the data from application server file.
      OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc NE c_ok.
        MESSAGE i368(00) WITH text-014.
      ENDIF.
    *--Get all the records from the specified location.
      DO.
        READ DATASET l_file INTO l_line.
        IF sy-subrc NE c_ok.
          EXIT.
        ELSE.
          SPLIT l_line AT cl_abap_char_utilities=>horizontal_tab
                          INTO st_ipfile-anlkl
                               st_ipfile-txt50
                               st_ipfile-txa50
                               st_ipfile-anlhtx
                               st_ipfile-sernr
                               st_ipfile-invnr
                               st_ipfile-aktiv
                               st_ipfile-invzu
                               st_ipfile-kostl
                               st_ipfile-raumn
                               st_ipfile-ord41
                               st_ipfile-gdlgrp
                               st_ipfile-herst
                               st_ipfile-typbz
                               st_ipfile-afabe
                               st_ipfile-afasl
                               st_ipfile-ndjar
                               st_ipfile-ndper
                               st_ipfile-tafabe
                               st_ipfile-tafasl
                               st_ipfile-tndjar
                               st_ipfile-tndper
                               st_ipfile-anbtr01
                               st_ipfile-anbtr02
                               st_ipfile-anbtr03
                               st_ipfile-anbtr04.
          APPEND st_ipfile TO it_ipfile.
        ENDIF.
      ENDDO.
    *--Close dataset
      CLOSE DATASET l_file.
    Regards,
    Prashant
    Edited by: Prashant Patil on Mar 5, 2008 4:11 PM

  • Upload tab-delimited file from the application server to an internal table

    Hello SAPients.
    I'm using OPEN DATASET..., READ DATASET..., CLOSE DATASET to upload a file from the application server (SunOS). I'm working with SAP 4.6C. I'm trying to upload a tab-delimited file to an internal table but when I try load it the fields are not correctly separated, in fact, they are all misplaced and the table shows '#' where supposedly there was a tab.
    I tried to SPLIT the line using as separator a variable with reference to CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB but for some reason that class doesn't exist in my system.
    Do you know what I'm doing wrong? or Do you know a better method to upload a tab-delimited file into an internal table?
    Thank you in advance for your help.

    Try:
    REPORT ztest MESSAGE-ID 00.
    PARAMETER: p_file LIKE rlgrap-filename   OBLIGATORY.
    DATA: BEGIN OF data_tab OCCURS 0,
          data(4096),
          END   OF data_tab.
    DATA: BEGIN OF vendor_file_x OCCURS 0.
    * LFA1 Data
    DATA: mandt  LIKE bgr00-mandt,
          lifnr  LIKE blf00-lifnr,
          anred  LIKE blfa1-anred,
          bahns  LIKE blfa1-bahns,
          bbbnr  LIKE blfa1-bbbnr,
          bbsnr  LIKE blfa1-bbsnr,
          begru  LIKE blfa1-begru,
          brsch  LIKE blfa1-brsch,
          bubkz  LIKE blfa1-bubkz,
          datlt  LIKE blfa1-datlt,
          dtams  LIKE blfa1-dtams,
          dtaws  LIKE blfa1-dtaws,
          erdat  LIKE  lfa1-erdat,
          ernam  LIKE  lfa1-ernam,
          esrnr  LIKE blfa1-esrnr,
          konzs  LIKE blfa1-konzs,
          ktokk  LIKE  lfa1-ktokk,
          kunnr  LIKE blfa1-kunnr,
          land1  LIKE blfa1-land1,
          lnrza  LIKE blfa1-lnrza,
          loevm  LIKE blfa1-loevm,
          name1  LIKE blfa1-name1,
          name2  LIKE blfa1-name2,
          name3  LIKE blfa1-name3,
          name4  LIKE blfa1-name4,
          ort01  LIKE blfa1-ort01,
          ort02  LIKE blfa1-ort02,
          pfach  LIKE blfa1-pfach,
          pstl2  LIKE blfa1-pstl2,
          pstlz  LIKE blfa1-pstlz,
          regio  LIKE blfa1-regio,
          sortl  LIKE blfa1-sortl,
          sperr  LIKE blfa1-sperr,
          sperm  LIKE blfa1-sperm,
          spras  LIKE blfa1-spras,
          stcd1  LIKE blfa1-stcd1,
          stcd2  LIKE blfa1-stcd2,
          stkza  LIKE blfa1-stkza,
          stkzu  LIKE blfa1-stkzu,
          stras  LIKE blfa1-stras,
          telbx  LIKE blfa1-telbx,
          telf1  LIKE blfa1-telf1,
          telf2  LIKE blfa1-telf2,
          telfx  LIKE blfa1-telfx,
          teltx  LIKE blfa1-teltx,
          telx1  LIKE blfa1-telx1,
          xcpdk  LIKE  lfa1-xcpdk,
          xzemp  LIKE blfa1-xzemp,
          vbund  LIKE blfa1-vbund,
          fiskn  LIKE blfa1-fiskn,
          stceg  LIKE blfa1-stceg,
          stkzn  LIKE blfa1-stkzn,
          sperq  LIKE blfa1-sperq,
          adrnr  LIKE  lfa1-adrnr,
          mcod1  LIKE  lfa1-mcod1,
          mcod2  LIKE  lfa1-mcod2,
          mcod3  LIKE  lfa1-mcod3,
          gbort  LIKE blfa1-gbort,
          gbdat  LIKE blfa1-gbdat,
          sexkz  LIKE blfa1-sexkz,
          kraus  LIKE blfa1-kraus,
          revdb  LIKE blfa1-revdb,
          qssys  LIKE blfa1-qssys,
          ktock  LIKE blfa1-ktock,
          pfort  LIKE blfa1-pfort,
          werks  LIKE blfa1-werks,
          ltsna  LIKE blfa1-ltsna,
          werkr  LIKE blfa1-werkr,
          plkal  LIKE  lfa1-plkal,
          duefl  LIKE  lfa1-duefl,
          txjcd  LIKE blfa1-txjcd,
          sperz  LIKE  lfa1-sperz,
          scacd  LIKE blfa1-scacd,
          sfrgr  LIKE blfa1-sfrgr,
          lzone  LIKE blfa1-lzone,
          xlfza  LIKE  lfa1-xlfza,
          dlgrp  LIKE blfa1-dlgrp,
          fityp  LIKE blfa1-fityp,
          stcdt  LIKE blfa1-stcdt,
          regss  LIKE blfa1-regss,
          actss  LIKE blfa1-actss,
          stcd3  LIKE blfa1-stcd3,
          stcd4  LIKE blfa1-stcd4,
          ipisp  LIKE blfa1-ipisp,
          taxbs  LIKE blfa1-taxbs,
          profs  LIKE blfa1-profs,
          stgdl  LIKE blfa1-stgdl,
          emnfr  LIKE blfa1-emnfr,
          lfurl  LIKE blfa1-lfurl,
          j_1kfrepre  LIKE blfa1-j_1kfrepre,
          j_1kftbus   LIKE blfa1-j_1kftbus,
          j_1kftind   LIKE blfa1-j_1kftind,
          confs  LIKE  lfa1-confs,
          updat  LIKE  lfa1-updat,
          uptim  LIKE  lfa1-uptim,
          nodel  LIKE blfa1-nodel.
    DATA: END   OF vendor_file_x.
    FIELD-SYMBOLS:  <field>,
                    <field_1>.
    DATA: delim          TYPE x        VALUE '09'.
    DATA: fld_chk(4096),
          last_char,
          quote_1     TYPE i,
          quote_2     TYPE i,
          fld_lth     TYPE i,
          columns     TYPE i,
          field_end   TYPE i,
          outp_rec    TYPE i,
          extras(3)   TYPE c        VALUE '.,"',
          mixed_no(14) TYPE c        VALUE '1234567890-.,"'.
    OPEN DATASET p_file FOR INPUT.
    DO.
      READ DATASET p_file INTO data_tab-data.
      IF sy-subrc = 0.
        APPEND data_tab.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
    * count columns in output structure
    DO.
      ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      columns = sy-index.
    ENDDO.
    * Assign elements of input file to internal table
    CLEAR vendor_file_x.
    IF columns > 0.
      LOOP AT data_tab.
        DO columns TIMES.
          ASSIGN space TO <field>.
          ASSIGN space TO <field_1>.
          ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
          SEARCH data_tab-data FOR delim.
          IF sy-fdpos > 0.
            field_end = sy-fdpos + 1.
            ASSIGN data_tab-data(sy-fdpos) TO <field_1>.
    * Check that numeric fields don't contain any embedded " or ,
            IF <field_1> CO mixed_no AND
               <field_1> CA extras.
              TRANSLATE <field_1> USING '" , '.
              CONDENSE <field_1> NO-GAPS.
            ENDIF.
    * If first and last characters are '"', remove both.
            fld_chk = <field_1>.
            IF NOT fld_chk IS INITIAL.
              fld_lth = strlen( fld_chk ) - 1.
              MOVE fld_chk+fld_lth(1) TO last_char.
              IF fld_chk(1) = '"' AND
                 last_char = '"'.
                MOVE space TO fld_chk+fld_lth(1).
                SHIFT fld_chk.
                MOVE fld_chk TO <field_1>.
              ENDIF.       " for if fld_chk(1)=" & last_char="
            ENDIF.         " for if not fld_chk is initial
    * Replace "" with "
            DO.
              IF fld_chk CS '""'.
                quote_1 = sy-fdpos.
                quote_2 = sy-fdpos + 1.
                MOVE fld_chk+quote_2 TO fld_chk+quote_1.
              ELSE.
                MOVE fld_chk TO <field_1>.
                EXIT.
              ENDIF.
            ENDDO.
            <field> = <field_1>.
          ELSE.
            field_end = 1.
          ENDIF.
          SHIFT data_tab-data LEFT BY field_end PLACES.
        ENDDO.
        APPEND vendor_file_x.
        CLEAR vendor_file_x.
      ENDLOOP.
    ENDIF.
    CLEAR   data_tab.
    REFRESH data_tab.
    FREE    data_tab.
    Rob

  • Read Tab delimited File from Application server

    Hi Experts,
    I am facing problem while reading file from Application server.
    File in Application server is stored as follows, The below file is a tab delimited file.
    ##K#U#N#N#R###T#I#T#L#E###N#A#M#E#1###N#A#M#E#2###N#A#M#E#3###N#A#M#E#4###S#O#R#T#1###S#O#R#T#2###N#A#M#E#_#C#O###S#T#R#_#S#U#P#P#L#1###S#T#R#_#S#U#P#P#L#2###S#T#R#E#E#T###H#O#U#S#E#_#N#U#M#1
    i have downloaded this file from Application server using Transaction CG3Y. the Downloaded file is a tab delimited file and i could not see "#' in the file,
    The code is as Below.
    c_split  TYPE abap_char1 VALUE cl_abap_char_utilities=>horizontal_tab.
    here i am using IGNORING CONVERSION ERRORS in order to avoid Conversion Error Short Dump.
    OPEN DATASET wa_filename-file FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
          IF sy-subrc = 0.
            WRITE : /,'...Processing file - ', wa_filename-file.   
           DO.
          Read the contents of file
              READ DATASET wa_filename-file INTO wa_file-data.
              IF sy-subrc = 0.
                SPLIT wa_file-data AT c_split INTO wa_adrc_2-kunnr
                                                   wa_adrc_2-title
                                                   wa_adrc_2-name1
                                                   wa_adrc_2-name2
                                                   wa_adrc_2-name3
                                                   wa_adrc_2-name4
                                                   wa_adrc_2-name_co
                                                   wa_adrc_2-city1
                                                   wa_adrc_2-city2
                                                   wa_adrc_2-regiogroup
                                                   wa_adrc_2-post_code1
                                                   wa_adrc_2-post_code2
                                                   wa_adrc_2-po_box
                                                   wa_adrc_2-po_box_loc
                                                   wa_adrc_2-transpzone
                                                   wa_adrc_2-street
                                                   wa_adrc_2-house_num1
                                                   wa_adrc_2-house_num2
                                                   wa_adrc_2-str_suppl1
                                                   wa_adrc_2-str_suppl2
                                                   wa_adrc_2-country
                                                   wa_adrc_2-langu
                                                   wa_adrc_2-region
                                                   wa_adrc_2-sort1
                                                   wa_adrc_2-sort2
                                                   wa_adrc_2-deflt_comm
                                                   wa_adrc_2-tel_number
                                                   wa_adrc_2-tel_extens
                                                   wa_adrc_2-fax_number
                                                   wa_adrc_2-fax_extens
                                                   wa_adrc_2-taxjurcode.
    WA_FILE-DATA is having below values
    ##K#U#N#N#R###T#I#T#L#E###N#A#M#E#1###N#A#M#E#2###N#A#M#E#3###N#A#M#E#4###S#O#R#T#1###S#O#R#T#2###N#A#M#E#_#C#O###S#T#R#_#S#U#P#P#L#1###S#T#R#_#S#U#P#P#L#2###S#T#R#E#E#T###H#O#U#S#E#_#N#U#M#1
    And this is split by tab delimited and moved to other variables as shown above.
    Please guide me how to read the contents without "#' from the file.
    I have tried all possible ways and unable to get solution.
    Thanks,
    Shrikanth

    Hi ,
    In ECC 6 if all the unicode patches are applied then UTF 16 will defintly work..
    More over i would suggest you to ist replace # with some other  * or , and then try to see in debugging if any further  # appears..
    and no # appears then try to split now.
    if even now the # appears after replace statement then try to find out what exactly is it... wheather it is a horizantal tab etc....
    and then again try to replace it and then split..
    Please follow the process untill all the # are replaced...
    This should work for you..
    Let me know if you further face any issue...
    Regards
    Satish Boguda

  • Opening a tab delimited file and replacing a space

    Hi,
    I am trying to open a tab delimited file with 4 columns and corresponding values under it. If no value under the column, 0 should be replaced. I used the StringTokenizer and the split methods, but this doesnt seem to work. Any ideas?
    E.g
    Title1 Title2 Title3
    4 7
    5 2
    SHould be like this:
    Title1 Title2 Title3
    4 0 7
    0 5 2
    Thanks..

    The answer, however, is no. Java is a strongly typed
    language; there is no predefined manner in which a
    String object can be casted to an Integer object
    because a String is not an Integer.
    However, if you'd like to create an Integer based on
    the contents of a String, you can pass the String to
    the Integer.parseInt(String) method. That method
    will do one of two things: return the Integer object
    representing the integer contained within the String
    (if the String represents an Integer) or throw a
    NumberFormatException (if the String is not an
    Integer).Hi,
    Thanks tvynr for your reply. Ok first things, sorry, I had written that post in a hurry. Yes i dont usually put capital letters for my fields. Also i did mean using the add method. Not the get..
    And yes I have tried various different type castings. Just to see if one of them would work. And yes i did try Integer.parseInt() by passing in the string to get back its contents as an integer. *And yes the String content is an integer.
    Heres a snippet of my code -
                  List ArrScore1 = new ArrayList(); //List to store Score in one Array
                  List ArrScore2 = new ArrayList(); //List to store same Scores in another Array. FOr comparisions
                  List SCORES = new ArrayList();
                  int dist1,dist2 = 0;
                  float distance,percent;
                    while ((record = br.readLine())!= null)     //To read from a file line by line from first line
                      recCount++;
                      String rec = record;
                      String [] ScoreScop = rec.split("\t");
                      ArrScore1.add(ScoreScop[4])); 
                      ArrScore2.add(ScoreScop[4]);
                    } //End of While loop
                 System.out.println("Total Records: " + recCount);
                 for (int i=0; i<ArrScore1.size(); i++)
                    for (int j = i + 1; j < ArrScore2.size(); j++)
                       dist1  = Integer.parseInt(ArrScore2.get(j));  //Error I get here is is Cannot resolve symbol. What does this mean exactly?
    dist2 = Integer.parseInt(ArrScore1.get(i)); //Same error
    distance = dist1/dist2;
    percent = distance * 100;
    SCORES.add(percent); //Again same error
    } //End of j loop
    } // End of i loop
    I have included all the necessary packages as well. Including :
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.util.List;
    import java.util.ArrayList;Any idea what I am doing wrong here?

  • Text Tab delimited file-Strcuture-validation

    Hi Folks,
    1.Is there a way to check whether the file is text tab delimited or not,programatically ?
    2.can we check whether the data in the text tab delimited file is in line with the structure of the internal table into which it is going to be uploaded ?
    Thanks,
    K.Kiran.

    hi try this
    DO.
    READ DATASET p_ufile INTO in_file.
    IF sy-subrc <> 0.
    EXIT.
    ENDIF.
    APPEND in_file.
    CLEAR in_file.
    ENDDO.
    CLOSE DATASET p_ufile.
    LOOP AT in_file.
    SPLIT in_file AT c_tab INTO
    wa_citm_b-type
    wa_citm_b-vbeln
    wa_citm_b-posnr
    wa_citm_b-uepos.
    wa_citm_b-matnr
    lv_menge
    wa_citm_b-arktx
    wa_citm_b-vbegdat
    wa_citm_b-venddat
    wa_citm_b-prctr
    wa_citm_b-zterm
    wa_citm_b-faksp
    wa_citm_b-taxm1
    wa_citm_b-vlaufz
    wa_citm_b-vlauez
    wa_citm_b-vlaufk
    wa_citm_b-vkuegru
    wa_citm_b-bstkd
    wa_citm_b-bstdk
    wa_citm_b-posex
    wa_citm_b-bstkd_e
    wa_citm_b-bstdk_e
    wa_citm_b-period.
    IF NOT wa_citm_b-posnr CA sy-abcde.
    APPEND wa_citm_b TO lt_citm_b.
    ENDIF.
    ENDLOOP.

  • Tab delimited file on app server. How to do that?

    Hello,
    When i transfer a tab delimited file from pre. server(windows) to app. server(windows) using CG3Z , the tab delimitation  is not working.
    for eg : the file with below layout
    01.04.2007     31.03.2008     1     120     
    01.05.2007     31.07.2008     2     140     
    is getting changed like
    01.04.2007#31.03.2008#1#120     
    01.05.2007#31.07.2008#2#140     
    All i need is a tab delimited file in app server also . Wats that i need to do for this ? Also how can i write a tab delimited file on app server through my program using open dataset.
    Thanks for ur time.
    Jeeva.

    Hi..
    Check this code: you will find the solution:
    Using the Static Attribute <b>CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB</b>
    Example:
    This is the Simple way you can download the ITAB with Tab delimiter:
    DATA : V_REC(200).
    OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    LOOP AT ITAB INTO WA.
      Concatenate WA-FIELD1 WA-FIELD2
             INTO V_REC
             SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
      TRANSFER V_REC TO P_FILE.
    ENDLOOP.
    CLOSE DATASET P_FILE.
    Note: if there are any Numeric fields ( Type I, P, F) In your ITAB then before CONCATENATE you have to Move them to Char fields ..
    Reward if Helpful.
    Example:
    DATA: V_RECORD(200).
    OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF SY-SUBRC <> 0.
      EXIT.
    ENDIF.
    DO.
    READ DATASET P_FILE INTO V_RECORD.
      IF SY-SUBRC NE 0.
        EXIT.
      ENDIF.
    SPLIT V_Record at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
                                INTO WA-FIELD1 WA-FIELD2.
    APPEND WA TO ITAB.
    ENDDO.
    <b>reward if Helpful.</b>

  • Tab delimited file, to populate JTable

    Hey all
    As Java is fairly new for me I have come into several problems.
    First of all i have a program making a tab delimited file, for example like this:
    Mig     12345    You
    Gig      12345    DouNow i want to read the file and populate each line in the JTable.
    But my problem is the transfer from file to object.. This is my code so far:
    String[] kolonneNavne = {"Kursusnavn",
                                    "Kursusnummer",
                                    "Point",
                                    "Skemaplacering",
                                    "Liniefag",
                        "Kursus taget"};
              Object[][] kdata ={{null,null,null,null,null,null}};
              try {
                   BufferedReader buff = new BufferedReader(new FileReader("kurser.ini"));
                   String linie = buff.readLine();
                   StringTokenizer t = new StringTokenizer(linie, "\t", false);
                   String kursus[] = {null,null,null,null,null};
                   int antalKurser = 0;
                   while (linie != null){
                        kursus[0] = t.nextToken();
                        kursus[1] = t.nextToken();
                        kursus[2] = t.nextToken();
                        kursus[3] = t.nextToken();
                        kursus[4] = t.nextToken();
                        kdata[0][antalKurser] = kursus[0];
                        kdata[1][antalKurser] = kursus[1];
                        kdata[2][antalKurser] = kursus[2];
                        kdata[3][antalKurser] = kursus[3];
                        kdata[4][antalKurser] = kursus[4];
                        kdata[5][antalKurser] = new Boolean(false);
                        linie = buff.readLine();
                        antalKurser++;
              catch (ArrayIndexOutOfBoundsException e){                         
              catch (IOException e){
                   e.printStackTrace();
              }This should read every line in the file, and add the contents to kdata but it doesn't.
    I've tried several things, reading the "How to Use tables" by java, and also looking at the Class "Scanner", but havn't got that working either.
    I think that the error is in the assigning kursus[j] and kdata[][], but how do i do it? How kan i add contents to an array already having information:
    Object[][] kdata;?
    Is there a smarter way?
    Afterwards i do the essential:
    final JTable table = new JTable(kdata, kolonneNavne);

    Thanks for the debugging thing, i actually didn't know what it did..
    Well if i change the assigning from the file with split, it should look like this:
    try {
                   // For at l�se en linie af gangen
                   BufferedReader buff = new BufferedReader(new FileReader("kurser.ini"));
                   String linie = buff.readLine();
                   //Scanner sc = new Scanner(linie);
                   StringTokenizer t = new StringTokenizer(linie, "\t", false);
                   String kursus[] = {null,null,null,null,null};
                   int antalKurser = 0;
                   while (linie != null){
                        kdata[antalKurser] = linie.split("\t",5); // Or should this be kdata[0][antalKurser] ???
                        kdata[5][antalKurser] = new Boolean(false);
                        linie = buff.readLine();
                        antalKurser++;
              catch (IOException e){
                   e.printStackTrace();
              }But i still get errors when running the code...
    Do i assign the data correct? It seems to me that that is the problem... I have tried searching for "object assign data java" but, all that comes up is "Object oriented programming with java"... Which i s understandeble beacause of java being Object oriented...
    Hmm.. Hope you could help me with assigning the data!
    It comes with this error:
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 5 
            at KursusTabel.<init>(KursusTabel.java:51)
            at KursusTabel.createAndShowGUI(KursusTabel.java:103)
            at KursusTabel.access$100(KursusTabel.java:15)
            at KursusTabel$2.run(KursusTabel.java:117)
            at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)Is it the first error that processes every other error? Thanks!

  • Detecting line-breaks within a column of an uploaded tab-delimited file.

    Suppose you upload a tab-delimited file from your laptop and split each row of the file into some structure that you append to an itab.
    Is there a way inside ABAP to detect that a field of the uploaded file has a CR or CRLF in it?  And if so, where it is ?
    Thanks in advance ...

    You can use any of the following for those char.
    DATA:   head_crnl(1)   TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              top_crnl(1)    TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              end_crnl(1)    TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              blank_crnl(1)  TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              final_crnl(1)  TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              first_pgbr(1)  TYPE c VALUE cl_abap_char_utilities=>form_feed.
    Declare the above variables and check if they occur in the file. Hope this helps.

  • Trouble importing contacts from a tab-delimited file into Contacts on 10.9.5

    I am having Trouble importing contacts from a tab-delimited file into Contacts on MacBook Pro, OS 10.9.5, Intel 2.4 GHz Core 2 Duo., 400GB drive, 4GB memory DDR3
    So far I have:
    - Followed closely the help screen in Contacts app
    - Modified my source document meticulously - first in MS Word, then copied and tweaked in Apple's "Text Edit" app
    - The problem arises when I go to access the document for import.  Specifically, the target document, and all others in that file, are "greyed out" and thus can't be "opened" to facilitate the import process
    - Tried changing the extension of the document name to ".txt", ".rtf", and ".rtd". No change or improvement.
    - Searched Apple.com/help and found nothing relevant
    Can anyone offer some advice or tell me what I may be overlooking in this process?
    Any help will be greatly appreciated!
    Thanks,
    <Email Edited By Host>

    Hi Rammohan,
    Thanks for the effort!
    But I don't need to use GUI upload because my functionality does not require to fetch data from presentation server.
    Moreover, the split command advised by you contains separate fields...f1, f2, f3... and I cannot use it because I have 164 fields.  I will have to split into 164 fields and assign the values back to 164 fields in the work area/header line.
    Moreover I have about 10 such work areas.  so the effort would be ten times the above effort! I want to avoid this! Please help!
    I would be very grateful if you could provide an alternative solution.
    Thanks once again,
    Best Regards,
    Vinod.V

  • Large line to internal tables from  tab delimited file

    Dear All
    I am trying to upload the large file of tab delimited data into a SAP internal table. I am basically stuck with the fact that there are multiple lines and multiple columns in tab delimited file. There are around 300 columns which are tab delimited and separated
    For e.g  (* indicates tab)
    1material*****************1**9888**********5**********34*********3*********346************************-->upto 5000 columns
    1material*****************1**99338************4***********************************6************7************-->upto 5000 columns
    1material*****************1**22888********************5*********7*********************6*****7**************-->upto 5000 columns
    1material*****************1**44844************************5***5*********************************************-->upto 5000 columns
    1material***********34****1**54*******33********33*****33**************************************************-->upto 5000 columns
    1material*****************1**99888*****************************************************************************-->upto 5000 columns
    below upto 500 rows or more
    I want to read this file into a columner internal table.
    I am trying several ways . I have file on APP server. However Line breaks after 1024 characters or comes on another line.
    Currently I am not able to load it in single line of internal table. The structure of file is dynamic .. not static
    Amol

    Hi Amolsonaikar,
    you may try like this:
    TYPES:
      begin of line,
        t_field type table of string,
      end of line,
      t_line type table of line.
    DATA:
      lt_line  type t_line,
      lv_line type string,
      lt_field type table of string.
    open dataset 'XYZ' for input in text mode encoding default.
    while sy-subrc = 0.
      read dataset into lv_line.
      split lv_line at '|' into lt_field.
      append lt_field to lt_line.
    endwhile.
    Regards,
    Clemens

  • Functions to upload UNIX tab-delimited file

    plz tell me  lists of  Functions to upload UNIX tab-delimited file in the database table

    HI,
    data : itab like standard table of ZCBU.
    ld_file = p_infile.
    OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
    ELSE.
      DO.
        CLEAR: wa_string, wa_uploadtxt.
        READ DATASET ld_file INTO wa_string.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
                                          wa_uploadtxt-name2
                                          wa_uploadtxt-age.
          MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
          APPEND wa_upload TO it_record.
        ENDIF.
      ENDDO.
      CLOSE DATASET ld_file.
    ENDIF.
    loop at it_record.
    itab-field1 = it_reocrd-field1.
    itab-field2 = it_record-field2.
    append itab.
    endloop.
    *-- Now update the table
    modify ZCBU from table itab.

  • To import addresses, need format of tab delimited file

    I am trying to import addresses from my G3 PB Mozilla App. I exported addresses on G3 to both ldif and tab-delimited files and then attached to an email message which I sent to myself. I received email on Mac mini, but the 2 files showed up inline, not as attachments. I copied the ldif portion to a text file; ditto for tab-delimited. I tried importing into Address Book, but got message that format was not valid.
    Can't I just edit the tab-delimited file in TextEdit, save as RTF, and get Address Book to recognize the data?
    Thanks,
    Owen

    Hi, Did you get solution for this? Please let me know as I'm looking for the same solution. The Bank requirement is to generate a Tab delimited file but the RFFOGB_T with Format GB_BACS issues the output as below...
    Required by Bank:
    692532 73855963 RRS P R BACKLEY         169.91 GSLV
    294518 99855581 CETS PRITECTIIN         799.72 GSLV
    The output I get from SAP/DMEE:
    ........1........2........3........4........5........6....
    VOL1000004                           ....953312
                  1 <CR/LF>
    HDR1A953312S  195331200000400010001       10040 100420000000
                    <CR/LF>
    HDR2F0200000100                                   00
                    <CR/LF>
    UHL1 10041999999    000000001 DAILY  000
                    <CR/LF>
    6010392865540009960062063474662    00000115000ABC UK Ltd.       0
    1465                                <CR/LF>
    6006206347466201760062063474662    00000115000SAPBACS0000003306 C
    ONTRA            ABC UK LTD.        <CR/LF>
    EOF1A953312S  195331200000400010001       10040 100420000000
                    <CR/LF>
    EOF2F0200000100                                   00
                    <CR/LF>
    UTL10000000115000000000011500000000010000001
                    <CR/LF>
    END
                    <CR/LF>
    <END>
    Rgds,
    Stan

  • GUI_Download problem in tab delimited file

    Hi,
    I am trying to download tab delimited file using F.M GUI_DOWNLOAD.We have
    4.6C version.I have declared internal table with 5 columns.The file created using F.M is very strange.Column 1 and 2 and 3 and 4 are seaprated by tab but column 2
    and 3  and column 4 and 5 are not seaprated by tab but have fixed length.
    I am not getting where I am doing mistake.Any help is appericiated.
    Below is the structure of internal table.
    DATA:BEGIN OF IT_FINAL OCCURS 0,
           Company(3) type c,
           County(30) type c,
           FId(35) type c,
           Wellno(15) type c,
           Welldesc(35) type c,
         END OF IT_FINAL.
    Data populated in table it_final.
    it_final-Company = '300'.
    it_final-County = 'Greenwood'.
    it_final-fid = 'testts'.
    it_final-wellno = '10000000'.
    it_final-welldesc = 'tebsbvd'.
    append it_final.
    F.M GUI_DOWNLOAD
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
        BIN_FILESIZE                  =
          filename                      = l_path
        FILETYPE                      = 'ASC'
        APPEND                        = ' '
          write_field_separator         = 'X'
        HEADER                        = '00'
        TRUNC_TRAILING_BLANKS         = ' '
        WRITE_LF                      = 'X'
        COL_SELECT                    = ' '
        COL_SELECT_MASK               = ' '
        DAT_MODE                      = ' '
      IMPORTING
        FILELENGTH                    =
        TABLES
          data_tab                      = it_final
         EXCEPTIONS
         file_write_error              = 1
         no_batch                      = 2
         gui_refuse_filetransfer       = 3
         invalid_type                  = 4
         no_authority                  = 5
         unknown_error                 = 6
         header_not_allowed            = 7
         separator_not_allowed         = 8
         filesize_not_allowed          = 9
         header_too_long               = 10
         dp_error_create               = 11
         dp_error_send                 = 12
         dp_error_write                = 13
         unknown_dp_error              = 14
         access_denied                 = 15
         dp_out_of_memory              = 16
         disk_full                     = 17
         dp_timeout                    = 18
         file_not_found                = 19
         dataprovider_exception        = 20
         control_flush_error           = 21
         OTHERS                        = 22
    Thanks,
    Rekha.

    Hi,
    i think it is because tou need to uncomment:
         FILETYPE                      = 'ASC'
    try it.
    Best regards.

Maybe you are looking for

  • Extreme base station 802.11g Mystery

    Been trying to wrap my head around this for the past week. Girlfriend unplugged our perfectly working Airport express from wall outlet by mistake. She plugs it back in but no connection is detected by our two ibook G4s (both running leopard). After t

  • How do I write onto a PDF form?

    I have a PDF file that I want to enter text in.  When I click on it, an auto pop up box comes up and says I need to sign up for PDF, which I did.  I then converted the form to a word document, but it still will not let me write on the form.  How do I

  • Issue w/iPhone 4S Typing

    My iPhone 4S recently began duplicating alpha and/or numeric(s) when typing. When I try erasing a single alpha or numeric it runs on to delete the entire word/sentence. On occasion it displays a selection of variations for the letter I've typed. The

  • How to split document to fit press format ?

    Is there an easy way to split a big size document to fit in a offset press (example: 28" x 40")? For example, if I have a document 11"x 60" that we need to print with a offset press 28"x 40". Actually, I split the document manually, I divide it in tw

  • Confusion trying to include potrait and landscape in same document

    Hello, I believe I have followed the instructions in the Star Office 8 Writer, but I cannot seem to get portrait and landscape pages in the same document. I want the first half of the document portrait and the second half landscape. I can get portrai