GUI_UPLOAD can't upload data in a tab-delimited text file

Hi.
I was trying to upload data in a tab-delimited textfile.
I could do it for a ASC textfile (by setting FILETYPE = 'ASC'), but I couldn't do it for a tab-delimited textfile (by setting FILETYPE = 'DAT').
Any help is appreciated.

hi kian,
If u r using DAT file then HAS_FIELD_SEPERATOR should contain X.
<b>check the following code:</b>
parameters: p_file  like rlgrap-filename. " File Name.
call function 'GUI_UPLOAD'
    exporting
      filename              =  p_file      " NAME of the file
<b>  filetype                = 'DAT'
      has_field_separator     = 'X '</b>  "  <b>X  indicates Fields are separated by tabs.</b>
    tables
      data_tab                = t_file   " Internal table that contains the file data
    exceptions
      file_open_error         = 1
      file_read_error         = 2
      no_batch                = 3
      gui_refuse_filetransfer = 4
      invalid_type            = 5
      no_authority            = 6
      unknown_error           = 7
      bad_data_format         = 8
      header_not_allowed      = 9
      separator_not_allowed   = 10
      header_too_long         = 11
      unknown_dp_error        = 12
      access_denied           = 13
      dp_out_of_memory        = 14
      disk_full               = 15
      dp_timeout              = 16
      others                  = 17.
<b>IF the file type is DAT then following rules applies.</b>
The components of the internal table are filled from the file. If the
table contains several columns, the entries in the file must be
separated by tabs. No conversion exits are carried out.
The following applies for the different data types:
  -   I or N or P or F
   The numbers must be formatted according to the decimal representation
   defined in the user settings.
    -   D
   The date must be defined according to the date format defined in the
   user settings.
    -   T
   The time must have the format hh:mm:ss.
Reward me if useful...
Harimanjesh AN

Similar Messages

  • How do you save data into a tab delimited text file?

    It sounds simple if we just save the data, but here I have to enter few text entries and write values beside them. For example, if we have results like..
    Voltage 5 V
    Current 2 mA
    Power 1 mW
    What VI do you use to save the entries like this in the file. I don't want to use Report Generation VIs as it adds overhead...
    Any suggestions would be well appreciated.
    Thanks.

    Hi Act,
    They say a picture is worth a 1000 words.
    I prepared a small vi to give you an idea how it is done. There are probably much better examples available if you look around. But here goes...
    It is actually simple. The attached example is not the best approach, but as I said, it is to get you going..
    The vi allows you to create a file with the extention of your choice. You can substitute the write to file vi with a write to speadsheet. The appropriate approach is to first open the file, decide if you wish to create, append or overwrite the file, write to the file and close the file.
    All the necessary vi's are located inside the Functions Palette under File IO.
    JLV
    Attachments:
    Write_to_file_example.vi ‏32 KB

  • Tab delimited text file

    Hi,
        Can someone provide me a sample code on how to read data from a tab delimited text file into an internal table?.
    Thanks,
    Sandeep

    For example if u have 15 columns, define a internal table like this.
    TYPES: BEGIN OF ty_input_file,
           column1 TYPE char30,
           column2 TYPE char50,
           column3 TYPE char50,
           column4 TYPE char50,
           column5 TYPE char50,
           column6 TYPE char50,
           column7 TYPE char50,
           column8 TYPE char50,
           column9 TYPE char50,
           column10 TYPE char50,
    END OF ty_input_file.
    DATA: i_input TYPE STANDARD TABLE OF ty_input_file.
    Or if u know the data type of the value which is coming in the file u can define that in the internal table.
    Then the use the below FM to upload the value to internal table.
    lcl_filename will contain the file path in the file lies in the presentation server.
        CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            filename                = lcl_filename
            filetype                = 'ASC'
            has_field_separator     = 'X'
          TABLES
            data_tab                = i_input
          EXCEPTIONS
            file_open_error         = 1
            file_read_error         = 2
            no_batch                = 3
            gui_refuse_filetransfer = 4
            invalid_type            = 5
            no_authority            = 6
            unknown_error           = 7
            bad_data_format         = 8
            header_not_allowed      = 9
            separator_not_allowed   = 10
            header_too_long         = 11
            unknown_dp_error        = 12
            access_denied           = 13
            dp_out_of_memory        = 14
            disk_full               = 15
            dp_timeout              = 16
            OTHERS                  = 17.
    Also check a sample Program:
    REPORT  z_upload_muncpcode.
    PARAMETERS : p_fname   LIKE rlgrap-filename.
    TYPES: BEGIN OF ty_munc,
            land1     TYPE tzone-land1,
            zone1     TYPE tzone-zone1,
            vtext TYPE tzont-vtext,
           END OF ty_munc.
    DATA: i_munc   TYPE STANDARD TABLE OF ty_munc,
          i_tzone  TYPE STANDARD TABLE OF tzone,
          i_tzont  TYPE STANDARD TABLE OF tzont,
          wa_munc  TYPE ty_munc,
          wa_tzone TYPE tzone,
          wa_tzont TYPE tzont.
    CONSTANTS: c_path     TYPE char20 VALUE 'C:\',
               c_mask     TYPE char9  VALUE ',*.*,*.*.',
               c_mode     TYPE char1  VALUE 'O',
               c_filetype TYPE char10 VALUE 'ASC',
               c_x        TYPE char01 VALUE 'X'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
    *-- Browse Presentation Server
      PERFORM f4_presentation_file.
    START-OF-SELECTION..
    *-- Read presentation server file
      PERFORM f1003_pre_file.
      LOOP AT i_munc INTO wa_munc.
        wa_tzone-mandt = wa_tzont-mandt = sy-mandt.
        wa_tzone-land1 = wa_tzont-land1 = wa_munc-land1.
        wa_tzone-zone1 = wa_tzont-zone1 = wa_munc-zone1.
        wa_tzont-spras = sy-langu.
        wa_tzont-vtext = wa_munc-vtext.
        APPEND wa_tzont TO i_tzont.
        APPEND wa_tzone TO i_tzone.
        CLEAR: wa_munc, wa_tzont, wa_tzone.
      ENDLOOP.
    END-OF-SELECTION.
    Modify Table TZONT
      PERFORM enqueue_table USING text-001.
      MODIFY tzont FROM TABLE i_tzont.
      PERFORM dequeue_table USING text-001.
    Modify Table TZONE
      PERFORM enqueue_table USING text-002.
      MODIFY tzone FROM TABLE i_tzone.
      PERFORM dequeue_table USING text-002.
      WRITE: 'Tables TZONE & TZONT are updated'.
    *&                  Form  f4_presentation_file
    *&                F4 Help for presentation server
    FORM f4_presentation_file .
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_path         = c_path
          mask             = c_mask
          mode             = c_mode
          title            = text-001
        IMPORTING
          filename         = p_fname
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 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.
    ENDFORM.                    " f4_presentation_file
    *&                      Form  f1003_pre_file
    *&                         Upload File
    FORM f1003_pre_file .
      DATA: lcl_filename TYPE string.
      lcl_filename = p_fname.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = lcl_filename
          filetype                = c_filetype
          has_field_separator     = c_x
        TABLES
          data_tab                = i_munc
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        EXIT.
      ENDIF.
    ENDFORM.                    " f1003_pre_file
    *&                         Form  enqueue_table
    *&                           Enqueue Table
    FORM enqueue_table USING p_tabname.
      CALL FUNCTION 'ENQUEUE_E_TABLE'
        EXPORTING
          tabname        = p_tabname
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " enqueue_table
    *&                        Form  dequeue_table
    *&                           Dequeue Table
    FORM dequeue_table USING p_tabname.
      CALL FUNCTION 'DEQUEUE_E_TABLE'
        EXPORTING
          tabname = p_tabname.
    ENDFORM.                    " dequeue_table
    Regards,
    Prakash.
    Message was edited by: Prakash Ramu

  • Program to upload data from a tab-delimited file ...

    I have to upload data from a tab-delimited file with following fields into database table(ZCBU) with same fields:
    CBU (parent)
    KUNNR (child)
    ERDAT (effective from)
    MANDT (client)
    SFID (salesforce ID)
    AEDAT (effective to)
    AENAM (assigned by).
    This file can be of type PC(txt) or UNIX.
    plz tell me how to do this in both type of files

    Hi,
    DATA: bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
    DATA: xfile TYPE string.
    DATA: BEGIN OF itab OCCURS 0,
            empno TYPE zmemp-empno,
            name  TYPE zmemp-first_name,
            last  TYPE zmemp-last_name,
            comp  TYPE zmemp-comp,
            place TYPE zmemp-place,
            END OF itab.
    PARAMETER : p_file TYPE rlgrap-filename OBLIGATORY.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Form to get the file path of legacy data stored on presentation server
      PERFORM get_file_path.
    START-OF-SELECTION.
      MOVE p_file TO xfile.
    to get the data from excel sheet data into an internal table
      PERFORM get_data.
      LOOP AT itab .
        REFRESH bdcdata.
        PERFORM bdc_dynpro      USING 'ZM_EMPLOYEE' '9001'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'S9001_EMPNO'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=CREA'.
        PERFORM bdc_field       USING 'S9001_EMPNO'
                                      itab-empno.
        PERFORM bdc_dynpro      USING 'ZM_EMPLOYEE' '9002'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'S9002_PLACE'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=SAVE'.
        PERFORM bdc_field       USING 'S9002_EMPNO'
                                      itab-empno.
        PERFORM bdc_field       USING 'S9002_FIRST_NAME'
                                      itab-name.
        PERFORM bdc_field       USING 'S9002_LAST_NAME'
                                      itab-last.
        PERFORM bdc_field       USING 'S9002_COMP'
                                      itab-comp.
        PERFORM bdc_field       USING 'S9002_PLACE'
                                      itab-place.
        PERFORM bdc_dynpro      USING 'ZM_EMPLOYEE' '9001'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'S9001_EMPNO'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=BACK'.
        CALL TRANSACTION 'ZMEMP'
        USING bdcdata
        UPDATE 'A'
        MODE   'N'.
      ENDLOOP.
           Start new screen                                              *
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.                    "BDC_DYNPRO
           Insert field                                                  *
    FORM bdc_field USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.                    "BDC_FIELD
    *&      Form  get_file_path
    FORM get_file_path .
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        CHANGING
          file_name = p_file.
    ENDFORM.                    " get_file_path
    *&      Form  get_data
    FORM get_data .
      DATA : lines1 TYPE i.
      MOVE p_file TO xfile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename            = xfile
          filetype            = 'ASC'
          has_field_separator = 'X'
        TABLES
          data_tab            = itab.
      DESCRIBE TABLE itab LINES lines1.
      WRITE : / lines1 , 'REcords uploaded' .
    ENDFORM.                    " get_data
    Regards,
    Nihar Swain,

  • Small doubt  reg upload from tab delimited text file

    Hi  all,
    i am uploading a tab delimited text file to a ztable.
    I moving the text file in to internal table
    data : begin of i_tab occurs 0,
           text(1024) type c,
           end of i_tab.
    then i have passed to FM GUI_UPLOAD.
    and then splitting
    loop at i_tab.
    split i_tab at con_tab
                              into i_xyz-matnr
                                   i_xyz-werks.
        append i_xyz.
    endloop..
    is this the right approach . iam getting the results but iam just curious to know.
    Do i need to internal like the one i created
    data : begin of i_tab occurs 0,
           text(1024) type c,
           end of i_tab.
    or do i need to create one with field that i have in text file.
    data : begin of i_tab occurs 0,
       matnr like mara-matnr,
      werks like marc-werks
    end of i_tab.
    WHICH ONE OF THE TWO IS RIGHT.
    THANKS IN ADVANCE

    There will be NO difference,i guess in the 2 methods.
    you can use which you like.
    Check the below program,i also given quantity fields F2,F3.
    its working fine
    REPORT  ZSRIM_TEMP13.
    data : begin of itab occurs 0,
             f1(20) type c,
             f2     type i,
             f3(10)     type p DECIMALS 2,
           end of itab.
           CALL FUNCTION 'GUI_UPLOAD'
             EXPORTING
               FILENAME                      = 'c:a.txt'
              FILETYPE                      = 'ASC'
              <b>HAS_FIELD_SEPARATOR           = 'X'</b>
    *          HEADER_LENGTH                 = 0
    *          READ_BY_LINE                  = 'X'
    *          DAT_MODE                      = ' '
    *          CODEPAGE                      = ' '
    *          IGNORE_CERR                   = ABAP_TRUE
    *          REPLACEMENT                   = '#'
    *          CHECK_BOM                     = ' '
    *          VIRUS_SCAN_PROFILE            = VIRUS_SCAN_PROFILE
    *          NO_AUTH_CHECK                 = ' '
    *        IMPORTING
    *          FILELENGTH                    = FILELENGTH
    *          HEADER                        = HEADER
             TABLES
               DATA_TAB                      = ITAB
            EXCEPTIONS
              FILE_OPEN_ERROR               = 1
              FILE_READ_ERROR               = 2
              NO_BATCH                      = 3
              GUI_REFUSE_FILETRANSFER       = 4
              INVALID_TYPE                  = 5
              NO_AUTHORITY                  = 6
              UNKNOWN_ERROR                 = 7
              BAD_DATA_FORMAT               = 8
              HEADER_NOT_ALLOWED            = 9
              SEPARATOR_NOT_ALLOWED         = 10
              HEADER_TOO_LONG               = 11
              UNKNOWN_DP_ERROR              = 12
              ACCESS_DENIED                 = 13
              DP_OUT_OF_MEMORY              = 14
              DISK_FULL                     = 15
              DP_TIMEOUT                    = 16
              OTHERS                        = 17
           IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           ENDIF.
           LOOP AT ITAB.
             WRITE :/ ITAB-F1, ITAB-F2,ITAB-F3.
           ENDLOOP.
    my input file i created with TAB seperated text file,
    here is the input file
    LINE1     1000     123.25
    LINE2     2000     234.25
    LINE3     3000     345.25
    LINE1     1000     123.25
    LINE2     2000     234.25
    LINE3     3000     345.25
    Regards
    Srikanth
    Message was edited by: Srikanth Kidambi

  • Pgm to upload a tab delimited text file

    Hi ,
    can anyone send me a program to upload a tab delimited text file into a ztable.
    My email id is : [email protected]
    Thanks
    Kajol

    Check the below code:
    *& Report  Z_UPLOAD_MUNCPCODE                                          *
    REPORT  z_upload_muncpcode.
    PARAMETERS : p_fname   LIKE rlgrap-filename.
    TYPES: BEGIN OF ty_munc,
            land1     TYPE tzone-land1,
            zone1     TYPE tzone-zone1,
            vtext TYPE tzont-vtext,
           END OF ty_munc.
    DATA: i_munc   TYPE STANDARD TABLE OF ty_munc,
          i_tzone  TYPE STANDARD TABLE OF tzone,
          i_tzont  TYPE STANDARD TABLE OF tzont,
          wa_munc  TYPE ty_munc,
          wa_tzone TYPE tzone,
          wa_tzont TYPE tzont.
    CONSTANTS: c_path     TYPE char20 VALUE 'C:\',
               c_mask     TYPE char9  VALUE ',*.*,*.*.',
               c_mode     TYPE char1  VALUE 'O',
               c_filetype TYPE char10 VALUE 'ASC',
               c_x        TYPE char01 VALUE 'X'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
    *-- Browse Presentation Server
      PERFORM f4_presentation_file.
    START-OF-SELECTION..
    *-- Read presentation server file
      PERFORM f1003_pre_file.
      LOOP AT i_munc INTO wa_munc.
        wa_tzone-mandt = wa_tzont-mandt = sy-mandt.
        wa_tzone-land1 = wa_tzont-land1 = wa_munc-land1.
        wa_tzone-zone1 = wa_tzont-zone1 = wa_munc-zone1.
        wa_tzont-spras = sy-langu.
        wa_tzont-vtext = wa_munc-vtext.
        APPEND wa_tzont TO i_tzont.
        APPEND wa_tzone TO i_tzone.
        CLEAR: wa_munc, wa_tzont, wa_tzone.
      ENDLOOP.
    END-OF-SELECTION.
    Modify Table TZONT
      PERFORM enqueue_table USING text-001.
      MODIFY tzont FROM TABLE i_tzont.
      PERFORM dequeue_table USING text-001.
    Modify Table TZONE
      PERFORM enqueue_table USING text-002.
      MODIFY tzone FROM TABLE i_tzone.
      PERFORM dequeue_table USING text-002.
      WRITE: 'Tables TZONE & TZONT are updated'.
    *&                  Form  f4_presentation_file
    *&                F4 Help for presentation server
    FORM f4_presentation_file .
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_path         = c_path
          mask             = c_mask
          mode             = c_mode
          title            = text-001
        IMPORTING
          filename         = p_fname
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 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.
    ENDFORM.                    " f4_presentation_file
    *&                      Form  f1003_pre_file
    *&                         Upload File
    FORM f1003_pre_file .
      DATA: lcl_filename TYPE string.
      lcl_filename = p_fname.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = lcl_filename
          filetype                = c_filetype
          has_field_separator     = c_x
        TABLES
          data_tab                = i_munc
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        EXIT.
      ENDIF.
    ENDFORM.                    " f1003_pre_file
    *&                         Form  enqueue_table
    *&                           Enqueue Table
    FORM enqueue_table USING p_tabname.
      CALL FUNCTION 'ENQUEUE_E_TABLE'
        EXPORTING
          tabname        = p_tabname
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " enqueue_table
    *&                        Form  dequeue_table
    *&                           Dequeue Table
    FORM dequeue_table USING p_tabname.
      CALL FUNCTION 'DEQUEUE_E_TABLE'
        EXPORTING
          tabname = p_tabname.
    ENDFORM.                    " dequeue_table
    Regards,
    Prakash.

  • FM to upload TAB DELIMITED TEXT file into Internal table.

    Hello Friends,
    The FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' is used to upload EXCEL file into a Internal table.
    Is there any FM which performs the simillar operation on TAB DELIMITED TEXT FILE.
    Thanks in advance!
    Ashish

    Hi,
    To upload text file with tab delimated you can use FM
    GUI_OPLOAD.
    In this function you have put X in the field HAS_FIELD_SEPARATOR.
    Regards,
    Sujit

  • Efficent method to sort data from tab delimited text file

    I am currently writing a program to sort through data that was acquired and display it on a graph and some other indicators.  The file is a tab delimited text file with possibly 100,000s of data points.  the current method that I have tried using was that if I wanted all of the data from Oct, I would parse out the month from the timestamp, compare that to the desired month, and add it to the array if it is the same.  Other possible options of sorting are yearly and daily, possibly even hourly.
    The method does work, however it does take some time (up to a minute on a P4 3.6 GHz with 2 gb ram), and most of the other computers are not nearly as fast or with as much memory.  Is there a more efficent method to sorting the data??
    I attached my sorting vi as well as a sample data file.
    thanks for the advice.  It is saved in LV8.0.1
    Kenny
    Kenny
    Attachments:
    data sort.zip ‏84 KB
    oven1.txt ‏21 KB

    First of all, "sorting" has usually a different meaning (Sorting and numeric array ascending or descending, a string array aphabetically, etc.). Your data already seems sorted by date and time, you just want to pick a subset having certain characteristics.
    The main problem that is slowing you down is your constant growing of large arrays. This causes constant memory reallocations.
    Since your data is already sorted by date and time, all you need is to place your data in a sutable data structure, find the start and end point of your selection, then use "array subset" for example.
    Your code also seems to have a lot of unecessary complexity. See for example your "test for sort data" (see image below).
    the four cases only differ by filename --> only the file name belongs into the case and the file operation outside the inner case. Even better, just use autoindexing.
    that shift register does not do anything, because it always contains the same data. Using "index array" with index wired to [i] is equivalent to an autoindexing tunnel.
    You have a case structure to select which files to read, skipped files give you an empty array. Do you really need to do all these operations on an empty array. Why not place all code inside the TRUE case??
    Below is an image of one possible code alternative that addresses some of these points.
    Message Edited by altenbach on 10-26-2006 09:32 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    testForSortData.png ‏33 KB

  • Saving the data into the tab limited text file

    Dear Friends ,
    please help me at the earliest possible , i want to store the data into an text file which is tab limited ,previously i was able to the same into the excel sheet using the jakarta HSSF POI , an open source library to store the data into the EXCEL sheet , now friends please tell me whether is there any other open source to store the data into the tab limited text file what i mean by tablimited is the data is to be saved as
    Name        Email-id        phone          streeet          city
    sri            @some.com     9434           jahdui          hye
    asdf         @.com           3455           sdgsdf         retlike this so please suggest me
    thank you in advance,
    bye
    sriharsha

    Consult the docs for BufferedWriter and from there.
    regards
    Christian
    import java.io.*;
    public class Test
         public static void main(String[] args)
              BufferedWriter writer;
              String[][] s = { {"Name","Email-id","phone","streeet","city"},
                        {"sri","@some.com","9434","jahdui","hye"},
                        {"asdf","@.com","3455","sdgsdf","ret"}};
              try {
                   writer = new BufferedWriter(new FileWriter("out.txt"));
                   for (int j=0; j< s.length; j++) {
                        for (int i = 0; i < s[j].length; ++i) {
                             writer.write(s[j]+"\t");
                        writer.newLine();
                   writer.close();
              } catch (IOException e) {
                   e.printStackTrace();

  • Application Server Download - Tab Delimited Text File

    Hi,
    I am trying to create a tab delimited text file in application server. Is there any option should i use with the Open Dataset / Transfer statements? My requirement is to download the file (Text - Tab Delimited) into Excel for further analysis. Can you please suggest me a suitable solution for this?
    Thanks,
    Kannan.

    Hi,
    You can use transactions CG3Y and CG3Z. Its very simple.
    Refer sample code:
    constants: c_split TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
    c_path TYPE VALUE char100 '/local/data/interface/A28/DM/OUT'.
    *& Form f1001_browse_appl_file
    Pick up the file path for the file in the application server
    FORM f1001_browse_appl_file .
    DATA: lcl_directory TYPE char128.
    lcl_directory = p_direct.
    CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
    EXPORTING
    directory = lcl_directory
    filemask = c_mask
    IMPORTING
    serverfile = p_f2
    EXCEPTIONS
    canceled_by_user = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE s000 WITH text-039.
    EXIT.
    ENDIF.
    ENDFORM. " f1001_browse_appl_file
    *& Form f1004_app_file
    upload the file from the application server
    FORM f1004_app_file .
    REFRESH: i_input.
    OPEN DATASET p_f2 IN TEXT MODE ENCODING DEFAULT FOR INPUT.
    IF sy-subrc EQ 0.
    DO.
    READ DATASET p_f2 INTO wa_input_rec.
    IF sy-subrc 0.
    MESSAGE s000 WITH text-030.
    EXIT.
    ENDIF.
    o
    + Split The CSV record into Work Area
    PERFORM f0025_record_split.
    o
    + Populate internal table.
    APPEND wa_input TO i_input.
    CLEAR wa_input.
    ENDDO.
    ENDIF.
    ENDFORM. " f1004_app_file
    *& Form f0025_record_split
    Move the assembly layer file into the work area
    FORM f0025_record_split .
    CLEAR wa_input.
    SPLIT wa_input_rec AT c_split INTO
    wa_input-legacykey
    wa_input-profile_role
    wa_input-read_date.
    ENDFORM. " f0025_record_split
    DO your manipulation with the data records here.
    Popualte data into final internal table and write it back to application server at the desired path.
    *& Form f0020_write_application
    Write error log to application Server
    FORM f0020_write_application .
    IF p_f1 IS NOT INITIAL.
    CONCATENATE p_direct p_obj sy-datum text-037 INTO p_f2.
    ELSEIF p_f2 IS NOT INITIAL.
    REPLACE text-036 IN p_f2 WITH text-037.
    ENDIF.
    OPEN DATASET p_f2 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc 0.
    EXIT.
    ENDIF.
    LOOP AT i_error INTO wa_error.
    TRANSFER wa_error TO p_f2.
    IF sy-subrc 0.
    EXIT.
    ENDIF.
    CLEAR wa_error.
    ENDLOOP.
    CLOSE DATASET p_f2.
    ENDFORM. " f0020_write_application
    HTH,
    Regards,
    Dhruv Shah

  • EXcel to tab delimited text file

    I am saving an excel file into a tab delimited text file so that i can use it for uploading data.
    The excel file contains a text field in which there is a comma ',' .
    for all the fields which has a comma in the excel file
    the text  file is adding double qoutes " in the beginning and end of the filed.
    for example
    contents of filed in excel file is :  GASKET, FLAT OEM 1380X1530X3 SIL ARAMIDE
    and in the text file it is coming as "GASKET, FLAT OEM 1380X1530X3 SIL ARAMIDE"
    i dont want the " in the beginning and end
    can anybody help.
    points will be rewarded.
    I am just saving the excel file as tab delimited text file and i am getting the quotes added in the begining and end.
    Thanks.

    Thats to preserer the comma in between otherwise when you upload the same the data will split at comma.
    Regards,
    Amit
    Reward all helpful replies.

  • OPEN DATASET output to Tab delimited text file???

    Can anyone suggest the best way for downloading a TAB DELIMITED text file to the application server using open dataset.
    I'm currently downloading the file, but I find that it puts "#"'s in place of empty numeric fields.
    any help appreciated,
    Lee

    Hi Lee,
      System identifies Tab delimited as #.
      But its not a problem.
      If you wang to download the data into intenal table,
    you need to do declare delimiter.
      Refer code:
    CONSTANTS:  c_split TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
               c_hash         TYPE c          VALUE '#'.
    data:wa_input_rec  TYPE char2000.
      OPEN DATASET p_appl IN TEXT MODE ENCODING DEFAULT FOR INPUT.
        IF sy-subrc = 0.
          DO.
            READ DATASET p_appl INTO wa_input_rec.
            IF sy-subrc <> 0.
              EXIT.
            ELSE.
    *-- Split the Tab # into corresponding Columns fields.
              PERFORM f0056_split_records.
              APPEND wa_input_file TO i_input_file.
              CLEAR: wa_input_rec, wa_input_file.
            ENDIF.
          ENDDO.
    FORM f0056_split_records .
      CLEAR wa_input_file.
      SPLIT wa_input_rec AT c_split INTO
    wa_input_file-column0
    wa_input_file-column1
    wa_input_file-column2
    wa_input_file-column3
    wa_input_file-column4   IN CHARACTER MODE.
    ENDFORM.                    " f0056_split_records
    Reward points if this helps.
    Manish
    Message was edited by: Manish Kumar
    Message was edited by: Manish Kumar

  • How to get tab delimited text file when Stored Procedure executes ?

    Hello Everyone,
    I have a stored procedure which returns 1 result set as an output.
    I want the output as a Tab Delimited Text file.
    I know that I can use SSIS and get the same output but I am not allowed to use SSIS in this case.
    Is there any other ways ?
    I will be really appreciate If someone can answer with, How many different ways I can get Tab delimited text file ?
    Thanks in advance
    Henary

    you can do that by using SQLCMD
    http://blog.sqlauthority.com/2013/03/05/sql-server-exporting-query-results-to-csv-using-sqlcmd/
    you can also use BCP 
    EXEC master..xp_cmdshell 'bcp "select * from tempdb.dbo.orders" queryout "c:\output.txt" -c -T'
    EXEC master..xp_cmdshell 'bcp "exec usertest.dbo.proctest" queryout "c:\output.txt" -c -T'
    --Prashanth

  • Tab Delimited Text File to be Emailed (External Email ID) from SAP

    Hi,
    I have a requirement to email a tab delimited text file as an attachment to external email id from SAP. The text file is of line with type string and the length of each line is about 1024 char size. Can you please suggest me a suitable solution to this requirement? It looks like the FM: SO_NEW_DOCUMENT_ATT_SEND_API1 can handle a text file of 255 char length. I am not sure how to attach a text file of records with length more than 1025 char size.
    Appreciate your help in advance.
    Thanks,
    Kannan

    Hi,
    I have a requirement to email a tab delimited text file as an attachment to external email id from SAP. The text file is of line with type string and the length of each line is about 1024 char size. Can you please suggest me a suitable solution to this requirement? It looks like the FM: SO_NEW_DOCUMENT_ATT_SEND_API1 can handle a text file of 255 char length. I am not sure how to attach a text file of records with length more than 1025 char size.
    Appreciate your help in advance.
    Thanks,
    Kannan

  • How to create a tab-delimited text file?

    Hi,
    I need to create a tab-delimited text file at presentation server getting content from an internal table. My file should also have a header - also tab-delimited. Data for a header is stored in some work area.
    Any ideas how to add tab-delimiter into a text file? Or should I go for a HEX file and use
    CONSTANTS: c_tab TYPE x VALUE '09'.
    and separate my data with this constant instead?
    Any thoughts whould be appreciated.
    TIA
    Ivaylo Mutafchiev

    Hi Ivaylo,
    Refer sample code:
        IF i_final_head[] IS NOT INITIAL.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              filename                = lcl_filename
              filetype                = 'ASC'
              write_field_separator   = 'X'
            TABLES
              data_tab                = i_final_head
            EXCEPTIONS
              file_open_error         = 1
              file_read_error         = 2
              no_batch                = 3
              gui_refuse_filetransfer = 4
              invalid_type            = 5
              no_authority            = 6
              unknown_error           = 7
              bad_data_format         = 8
              header_not_allowed      = 9
              separator_not_allowed   = 10
              header_too_long         = 11
              unknown_dp_error        = 12
              access_denied           = 13
              dp_out_of_memory        = 14
              disk_full               = 15
              dp_timeout              = 16
              OTHERS                  = 17.
          IF sy-subrc <> 0.
            MESSAGE s000 WITH text-031.
            EXIT.
          ENDIF.
        ENDIF.
    Reward points if this helps.
    Manish
    Message was edited by: Manish Kumar

Maybe you are looking for