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.

Similar Messages

  • 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

  • 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

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

  • 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

  • Receiver File Adapter - Tab delimited Text file

    I am using receiver file adapter to convert message created by ABAP PROXY to convert tab delimited text file format.
    XML message is in following format.
    - <DT_R3_ROLES_OUTBOUND_REC>
      <LIST_CATEGORY>SAP_HR</LIST_CATEGORY>
      <USRID>MRUDULAP</USRID>
      <EMAIL>[email protected]</EMAIL>
      <NAME>MRUDULA PATEL</NAME>
      </DT_R3_ROLES_OUTBOUND_REC>
    - <DT_R3_ROLES_OUTBOUND_REC>
      <LIST_CATEGORY>SAP_HR</LIST_CATEGORY>
      <USRID>HCHD</USRID>
      <EMAIL>[email protected]</EMAIL>
      <NAME>H CHD</NAME>
      </DT_R3_ROLES_OUTBOUND_REC>
    I have used file content conversion in the adapter configuration.
    Recordset structure = DT_LISTSERV_INBOUND_REC
    DT_LISTSERV_INBOUND_REC.addHeaderLine = 0
    DT_LISTSERV_INBOUND_REC.fieldSeparator = ','
    How to use Tab as the delimiter in the fieldSeparator field?
    Now the output in the file is as follows :
    [email protected]'MRUDULA PATEL
    [email protected]'H CHD
    What I need to do to make the file as the tab delimited file?
    Thanks in advance!
    Mrudula Patel

    Hi Mruddula,
    Use fieldSeparator: '0x09' for horizontal tab
    <b>DT_LISTSERV_INBOUND_REC.fieldSeparator: '0x09'</b>
    Naveen

  • 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

  • Reading Tab Delimited Text File

    HI
    I am having problem in reading Tab Delimited text file.
    If i place some spaces in name of text file. it dosn`t read the file.
    if there is a simple name without space, then it reads easily.
    but when having space in file name then it shows nothing.
    PLZ help me .......
    give me some code or links to solution
    thanks!

    Could you post up an example of the file? With a FedEx report file, I created an application to read each line and split the String into an array where ever a [tab] exists. Since the columns aren't evenly tabbed, I used a regular expression to replace any whitespace in a with a \t (tab). Now it takes that line and splits it into an array where the [tab] exists. Then I access that specific column in the String by line.
    08/28/2007                        FedEx Ground                             COLO2
    23:16:29                        LANE FULL REPORT                  reptClaneFulls
                                                                              Page 1
                          Next               Sorters
                          Load         Main            Auto Smalls
                 Chute    Point  Primary  Secondary  Primary  Secondary
                 0101     8001         0         11        0          0
                 0102     5333         0          9        0          0
                 0104     0142         0        441        0          0
                 0106     0328         0          5        0          0
                 0107     0452         0          2        0          0
                 0110     0333         0          2        0          0
                 0113     0447         0          7        0          0
                 0114     0447         0          1        0          0
                 0115     0303         0         11        0          0
                 0127     0132         0          2        0          0
                 0128     0132         0         11        0          0
                 0129     0132         0          9        0          0
                 0130     0405         0        102        0          0
                 0131     0371         0        270        0          0
                 0132     0371         0        168        0          0
                 0133     0122         0         13        0          0
                 0134     0456         0         36        0          0
                 0135     0146         0        152        0          0
                 0136     0146         0          2        0          0
                 0138     0371         0         24        0          0
                 0201     0552         0          9        0          0
                 0204     0445         0         69        0          0
                 0205     0445         0         51        0          0
                 0207     0641         0          1        0          0
                 0211     0551         0          1        0          0
                 0212     0454         0          7        0          0
                 0213     3441         0         39        0          0
                 0216     0841         0          1        0          0
                 0217     0631         0        211        0          0
                 0222     0441         0         12        0          0
                 0223                  0          5        0          0
                 0224     0441         0          9        0          0
                 0225     0441         0         42        0          0
                 0226     0441         0         11        0          0
                 0227     0441         0          5        0          0
                 0229     0619         0        753        0          0
                 0230     0619         0        188        0          0
                 0231     0602         0          2        0          0
                 0232     0604         0         91        0          0
                 0233     0604         0          3        0          0
                 0238     0601         0          1        0          0
                 0304     1435         0         12        0          0
                 0307     2430         0        477        0          0
                 0309     1430         0         98        0          0
                 0310     1430         0          1        0          0
                 0311     0971         0          1        0          0
                 0312     0449         0         19        0          0
                 0313     0449         0        128        0          0
                 0315     0923         0         31        0          0
                 0316     0981         0         11        0          0
                 0317     0972         0          9        0          0
    08/28/2007                        FedEx Ground                             COLO2
    23:16:29                        LANE FULL REPORT                  reptClaneFulls
                                                                              Page 2
                          Next               Sorters
                          Load         Main            Auto Smalls
                 Chute    Point  Primary  Secondary  Primary  Secondary
                 0318     0972         0          6        0          0
                 0319     2431         0          1        0          0
                 0323     0436         0          9        0          0
                 0324                  0          3        0          0
                 0326     3431         0         12        0          0
                 0328     0958         0         55        0          0
                 0332     0430         0         84        0          0
                 0333     0430         0         16        0          0
                 0334     4430         0         29        0          0
                 0337     0480         0          2        0          0
                 0343     0555         0         36        0          0
                 0405     1437         0         52        0          0
                 0406     1437         0         51        0          0
                 0407     3152         0         58        0          0
                 0408     3152         0          2        0          0
                 0410     0152         0          5        0          0
                 0411     0152         0          3        0          0
                 0415     0100         0         55        0          0
                 0417     0253         0         95        0          0
                 0420     0282         0          1        0          0
                 0421     0282         0         82        0          0
                 0422     0753         0         13        0          0
                 0425     0165         0          9        0          0
                 0426     0165         0          8        0          0
                 0427     0089         0         21        0          0
                 0428     0089         0         10        0          0
                 0434     0437         0          3        0          0
                 0436     0170         0          4        0          0
                 0441     0263         0          9        0          0
                 0442     0219         0          1        0          0
                 0443     0219         0         20        0          0
                 0444     3258         0          3        0          0
                 0447     0156         0         89        0          0
                 0448     0156         0         59        0          0
                 0449     0156         0          1        0          0
                 0450     0760         0         14        0          0
                 0451     3163         0         16        0          0
                 0453     0212         0         27        0          0
                 0454     7760         0          2        0          0
                 107A     0219         0          0        0         88
                 108A     0219         0          0        0         89
                 110A     7061         0          0        0        185
                 111A     7061         0          0        0        190
                 112A     0170         0          0        0          3
                 113A     0170         0          0        0          1
                 114A     0170         0          0        0          3
                 118A     0089         0          0        0        261
                 119A     0089         0          0        0        255
                 120A     0282         0          0        0          5
                 121A     0282         0          0        0          4
                 122A     0753         0          0        0          6
    08/28/2007                        FedEx Ground                             COLO2
    23:16:29                        LANE FULL REPORT                  reptClaneFulls
                                                                              Page 3
                          Next               Sorters
                          Load         Main            Auto Smalls
                 Chute    Point  Primary  Secondary  Primary  Secondary
                 124A     3156         0          0        0        258
                 125A     0258         0          0        0         74
                 126A     3258         0          0        0          3
                 127A     0263         0          0        0         34
                 128A     3263         0          0        0          7
                 129A     0152         0          0        0         39
                 130A     0152         0          0        0         44
                 131A     0152         0          0        0         33
                 132A     3152         0          0        0        176
                 133A     3152         0          0        0        181
                 134A     0253         0          0        0         34
                 135A     0253         0          0        0         34
                 136A     3253         0          0        0        103
                 137A     0156         0          0        0         85
                 138A     0156         0          0        0         87
                 139A     0437         0          0        0        271
                 140A     3437         0          0        0        111
                 141A     0165         0          0        0        204
                 142A     3165         0          0        0          5
                 143A     0163         0          0        0          9
                 144A     3163         0          0        0          5
                 147A     7760         0          0        0          9
                 201A     8001         0          0        0          1
                 202A     8001         0          0        0          2
                 205A     3435         0          0        0         62
                 206A     0402         0          0        0        218
                 208A     0405         0          0        0         15
                 212A     0411         0          0        0          5
                 213A     0411         0          0        0          5
                 214A     3441         0          0        0        224
                 215A     3441         0          0        0        225
                 216A     0410         0          0        0          9
                 217A     0449         0          0        0         49
                 218A     0449         0          0        0         51
                 219A     3452         0          0        0         12
                 220A     0452         0          0        0          4
                 221A     0452         0          0        0          6
                 222A     3431         0          0        0         33
                 223A     3431         0          0        0         38
                 224A     2430         0          0        0         14
                 225A     2430         0          0        0         14
                 226A     4430         0          0        0         15
                 227A     4430         0          0        0         15
                 228A     0430         0          0        0          4
                 229A     0430         0          0        0          4
                 230A     1430         0          0        0         11
                 231A     1430         0          0        0         23
                 232A     0456         0          0        0         96
                 233A     7433         0          0        0          9
                 234A     0333         0          0        0          3
                 235A     7641         0          0        0         10
    08/28/2007                        FedEx Ground                             COLO2
    23:16:29                        LANE FULL REPORT                  reptClaneFulls
                                                                              Page 4
                          Next               Sorters
                          Load         Main            Auto Smalls
                 Chute    Point  Primary  Secondary  Primary  Secondary
                 236A     0802         0          0        0          5
                 240A     0631         0          0        0        111
                 241A     0551         0          0        0          3
                 245A     0958         0          0        0         71
                 246A     0554         0          0        0         72
                 247A     0923         0          0        0         48
                 248A     0371         0          0        0         31
                 249A     0972         0          0        0         49
                 250A     0381         0          0        0          3
                 251A     0619         0          0        0         27
                 253A     0604         0          0        0         48
                 254A     0132         0          0        0         57
                 255A     0132         0          0        0         53
                 257A     0942         0          0        0         16
                 307A     0951         0          0        0        138
                 308A     0464         0          0        0         22
                 309A     0641         0          0        0         45
                 310A     0641         0          0        0         47
                 311A     0122         0          0        0         16
                 312A     0971         0          0        0         76
                 313A     0602         0          0        0         37
                 314A     0841         0          0        0          9
                 315A     0841         0          0        0          8
                 317A     0958         0          0        0          2
                 318A     0532         0          0        0         35
                 320A     0604         0          0        0         16
                 322A     0981         0          0        0         90
                 323A     0371         0          0        0         42
                 324A     0972         0          0        0         13
                 325A     0372         0          0        0         35
                 326A     0928         0          0        0         14
                 327A     0619         0          0        0         78
                 328A     0328         0          0        0         17
                 330A     0303         0          0        0         27
                 331A     0923         0          0        0          1
                 332A     0336         0          0        0          3
                 333A     7850         0          0        0          7
                 335A     0146         0          0        0          8
                 337A     0454         0          0        0         20
                 338A     3445         0          0        0         86
                 339A     0445         0          0        0        371
                 340A     1441         0          0        0         42
                 341A     2442         0          0        0        111
                 342A     0441         0          0        0         59
                 343A     1442         0          0        0         23
                 344A     0442         0          0        0         28
                 345A     7441         0          0        0         66
                 346A     4441         0          0        0         73
                 347A     2441         0          0        0         72
                 348A     3462         0          0        0         12
                 349A     0462         0          0        0         62
    08/28/2007                        FedEx Ground                             COLO2
    23:16:29                        LANE FULL REPORT                  reptClaneFulls
                                                                              Page 5
                          Next               Sorters
                          Load         Main            Auto Smalls
                 Chute    Point  Primary  Secondary  Primary  Secondary
                 350A     0447         0          0        0         36
                 351A     0447         0          0        0         43
                 352A     3468         0          0        0          2
                 353A     0468         0          0        0         13
                 354A     0142         0          0        0         26
                 356A     0436         0          0        0          7
                 357A     0436         0          0        0          5
                 359A     0480         0          0        0         20
                 RLBL                  0         47        0          0
                 SSBL                  0        127        0          0
                 SSGN                  0         32        0          0
                 SSRD                  0        323        0          0
                 ======================================================
                 TOTAL:                0       5071        0       6630

  • 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

  • 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

  • Download into tab delimited  text file

    Hi all
    I am uploading  data from a text file with tab delimited.
    For some reason if the record doesnot satisfy the criteria i cannot upload the record .
    In the program i am moving those records into another internal table and deleting from the actual that i ausing to update the ztable.
    I need to download those fault records into another text file with tab delimited space with the same format so that they can correct those records and upload again.
    Thanks
    Preeti

    Preeti,
    Look at the code below. It should do everything that U want to do. However it uploads data from excel and downloads data into a text file.
    Hope this helps,
    Shreekant.
    Program Name  : ZRSD0177_XREF_EXCEL_UPLOAD                           *
    REPORT  zrsd0177_xref_excel_upload NO STANDARD PAGE HEADING    .
    TABLES : zzsd0010,
             knvv.
    DATA : g_repid LIKE sy-repid,
           $v_start_col         TYPE i VALUE '1',
           $v_start_row         TYPE i VALUE '2',
           $v_end_col           TYPE i VALUE '256',
           $v_end_row           TYPE i VALUE '65536',
           gd_currentrow TYPE i.
    *Data Declaration for the table ZZSD0010
    DATA : BEGIN OF it_zzsd0010 OCCURS 0.
            INCLUDE STRUCTURE zzsd0010.
    DATA : END OF it_zzsd0010.
    *DATA : it1_zzsd0010 LIKE it_zzsd0010 OCCURS 0 WITH HEADER
          LINE.
    *Data Declaration for EXCEL TABLES
    DATA :BEGIN OF it_tab_driver OCCURS 0,
               mandt                LIKE zzsd0010-mandt,
               sorg                 LIKE zzsd0010-vkorg,
               sdis                 LIKE zzsd0010-vtweg,
               sdiv                 LIKE zzsd0010-spart,
               gelco_princ_customer LIKE zzsd0010-princ_customer,
               sell_div             LIKE zzsd0010-kdgrp,
               payer                LIKE zzsd0010-payer,
               qad_cust(10)         TYPE c,
               name(30)             TYPE c,
               broker(3)            TYPE c,
          END OF it_tab_driver.
    DATA : it_tab_driver1 LIKE it_tab_driver OCCURS 0 WITH HEADER LINE.
    DATA :BEGIN OF it_tab_lookup OCCURS 0,
               rpc_ship_to(10) TYPE c,
               rpc_sold_to(10) TYPE c,
               rpc_bill_to(10) TYPE c,
               type(10)        TYPE c,
               qad_ship_to(10) TYPE c,
               qad_sold_to(10) TYPE c,
               qad_bill_to(10) TYPE c,
               sell_div1       LIKE zzsd0010-kdgrp,
               broker(3)       TYPE c,
          END OF it_tab_lookup.
    DATA : BEGIN OF it_knvv OCCURS 0,
            kunnr LIKE knvv-kunnr,
            vkorg LIKE knvv-vkorg,                              "V004
            vtweg LIKE knvv-vtweg,                              "V004
            spart LIKE knvv-spart,                              "V004
            kdgrp LIKE knvv-kdgrp,
           END OF it_knvv.
    DATA: it_outfile(200)   OCCURS 0 WITH HEADER LINE.
    DATA: it_outfile1(200)  OCCURS 0 WITH HEADER LINE.          "V004
    DATA: it_outfile2(200)  OCCURS 0 WITH HEADER LINE.          "V004
    DATA: it_outfile3(200)  OCCURS 0 WITH HEADER LINE.          "V004
    DATA: it_outfile4(200)  OCCURS 0 WITH HEADER LINE.          "V004
    DATA: it_driver LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    DATA: it_lookup LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    *--- Selection Screen
    SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text.
    PARAMETERS : p_file  LIKE rlgrap-filename DEFAULT
    'C:\zzsd0010\driver.xls'.
    PARAMETERS : p1_file LIKE rlgrap-filename DEFAULT
    'C:\zzsd0010\lookup.xls'.
    PARAMETERS : p2_file LIKE rlgrap-filename DEFAULT
    'C:\zzsd0010\error.txt'.
    PARAMETERS : p3_file LIKE rlgrap-filename DEFAULT
    'C:\zzsd0010\warning_Sales_Div.txt'.
    PARAMETERS : p4_file LIKE rlgrap-filename DEFAULT           "V004
    'C:\zzsd0010\warning_Sales_Org.txt'.                        "V004
    PARAMETERS : p5_file LIKE rlgrap-filename DEFAULT           "V004
    'C:\zzsd0010\warning_Dist_channel.txt'.                     "V004
    PARAMETERS : p6_file LIKE rlgrap-filename DEFAULT           "V004
    'C:\zzsd0010\warning_Division.txt'.                         "V004
    PARAMETERS : p7_file LIKE rlgrap-filename DEFAULT           "V004
    'C:\zzsd0010\cust_not_found.txt'.
    SELECTION-SCREEN : END OF BLOCK blk.
    INITIALIZATION.
      g_repid = sy-repid.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name = g_repid
        IMPORTING
          file_name    = p_file.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p1_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name = g_repid
        IMPORTING
          file_name    = p1_file.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p2_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name = g_repid
        IMPORTING
          file_name    = p2_file.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p3_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name = g_repid
        IMPORTING
          file_name    = p3_file.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p4_file.           "V004
      CALL FUNCTION 'F4_FILENAME'                               "V004
        EXPORTING                                               "V004
          program_name = g_repid                                "V004
        IMPORTING                                               "V004
          file_name    = p4_file.                               "V004
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p5_file.           "V004
      CALL FUNCTION 'F4_FILENAME'                               "V004
        EXPORTING                                               "V004
          program_name = g_repid                                "V004
        IMPORTING                                               "V004
          file_name    = p5_file.                               "V004
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p6_file.           "V004
      CALL FUNCTION 'F4_FILENAME'                               "V004
        EXPORTING                                               "V004
          program_name = g_repid                                "V004
        IMPORTING                                               "V004
          file_name    = p6_file.                               "V004
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p7_file.           "V004
      CALL FUNCTION 'F4_FILENAME'                               "V004
        EXPORTING                                               "V004
          program_name = g_repid                                "V004
        IMPORTING                                               "V004
          file_name    = p7_file.                               "V004
    START-OF-SELECTION.
    Get the data from XLS to Internal Table
      PERFORM f1000_upload_driver_data.
      PERFORM f2000_upload_lookup_data.
    *UPDATE DATA BASE
      SORT it_tab_driver BY gelco_princ_customer qad_cust.
      SORT it_tab_lookup BY qad_sold_to.
      CLEAR : it_tab_lookup,
              it_tab_driver.
      LOOP AT it_tab_driver.
        CLEAR : it_tab_lookup.
        IF
           it_tab_driver-gelco_princ_customer = it_tab_driver-qad_cust.
    Hit the sold-to column first, and if does not find a hit then try
    the bill-to column.
          READ TABLE it_tab_lookup
          WITH KEY qad_sold_to = it_tab_driver-gelco_princ_customer.
          IF sy-subrc = 0.
            it_zzsd0010-mandt          = it_tab_driver-mandt.
            it_zzsd0010-vkorg          = it_tab_driver-sorg.
            it_zzsd0010-vtweg          = it_tab_driver-sdis.
            it_zzsd0010-spart          = it_tab_driver-sdiv.
            it_zzsd0010-princ_customer = it_tab_lookup-rpc_sold_to.
            it_zzsd0010-kunnr          = it_tab_lookup-rpc_sold_to.
            it_zzsd0010-payer          = ' '.
            it_zzsd0010-kdgrp          = it_tab_driver-sell_div.
            it_zzsd0010-ernam          = sy-uname.
            it_zzsd0010-erdat          = sy-datum.
            it_zzsd0010-erzet          = sy-uzeit.
            it_zzsd0010-aenam          = sy-uname.
            it_zzsd0010-aedat          = sy-datum.
            it_zzsd0010-aezat          = sy-uzeit.
            PERFORM f6000_add_zeros_to_cust.                    "V004
            APPEND it_zzsd0010.
            INSERT INTO zzsd0010 VALUES it_zzsd0010.
            PERFORM f5000_warning_file.                         "V004
            CLEAR  it_zzsd0010.
          ELSEIF sy-subrc <> 0.
            READ TABLE it_tab_lookup
            WITH KEY qad_bill_to = it_tab_driver-gelco_princ_customer.
            IF sy-subrc = 0.
              it_zzsd0010-mandt          = it_tab_driver-mandt.
              it_zzsd0010-vkorg          = it_tab_driver-sorg.
              it_zzsd0010-vtweg          = it_tab_driver-sdis.
              it_zzsd0010-spart          = it_tab_driver-sdiv.
              it_zzsd0010-princ_customer = it_tab_lookup-rpc_bill_to.
              it_zzsd0010-kunnr          = it_tab_lookup-rpc_bill_to.
              it_zzsd0010-payer          = 'X'.
              it_zzsd0010-kdgrp          = it_tab_driver-sell_div.
              it_zzsd0010-ernam          = sy-uname.
              it_zzsd0010-erdat          = sy-datum.
              it_zzsd0010-erzet          = sy-uzeit.
              it_zzsd0010-aenam          = sy-uname.
              it_zzsd0010-aedat          = sy-datum.
              it_zzsd0010-aezat          = sy-uzeit.
              PERFORM f6000_add_zeros_to_cust.                  "V004
              APPEND it_zzsd0010.
              INSERT INTO zzsd0010 VALUES it_zzsd0010.
              PERFORM f5000_warning_file.                       "V004
              CLEAR  it_zzsd0010.
            ELSE.
              it_tab_driver1 = it_tab_driver.
              APPEND it_tab_driver1.
            ENDIF.
          ENDIF.
        ELSEIF it_tab_driver-gelco_princ_customer <> it_tab_driver-qad_cust.
    Hit the sold-to column first, and if does not find a hit then try
    the bill-to column.
          READ TABLE it_tab_lookup
          WITH KEY qad_sold_to = it_tab_driver-qad_cust.
          IF sy-subrc = 0.
            it_zzsd0010-mandt          = it_tab_driver-mandt.
            it_zzsd0010-vkorg          = it_tab_driver-sorg.
            it_zzsd0010-vtweg          = it_tab_driver-sdis.
            it_zzsd0010-spart          = it_tab_driver-sdiv.
            it_zzsd0010-kunnr          = it_tab_lookup-rpc_sold_to.
            it_zzsd0010-payer          = ' '.
            it_zzsd0010-kdgrp          = it_tab_driver-sell_div.
            it_zzsd0010-ernam          = sy-uname.
            it_zzsd0010-erdat          = sy-datum.
            it_zzsd0010-erzet          = sy-uzeit.
            it_zzsd0010-aenam          = sy-uname.
            it_zzsd0010-aedat          = sy-datum.
            it_zzsd0010-aezat          = sy-uzeit.
            READ TABLE it_tab_lookup
            WITH KEY qad_sold_to = it_tab_driver-gelco_princ_customer.
            IF sy-subrc = 0.
              it_zzsd0010-princ_customer = it_tab_lookup-rpc_sold_to.
              PERFORM f6000_add_zeros_to_cust.                  "V004
              APPEND it_zzsd0010.
              INSERT INTO zzsd0010 VALUES it_zzsd0010.
              PERFORM f5000_warning_file.                       "V004
              CLEAR  it_zzsd0010.
            ELSEIF sy-subrc <> 0.
              READ TABLE it_tab_lookup
              WITH KEY qad_bill_to = it_tab_driver-gelco_princ_customer.
              IF sy-subrc = 0.
                it_zzsd0010-princ_customer = it_tab_lookup-rpc_bill_to.
                PERFORM f6000_add_zeros_to_cust.                 "V004
                APPEND it_zzsd0010.
                INSERT INTO zzsd0010 VALUES it_zzsd0010.
                PERFORM f5000_warning_file.                      "V004
                CLEAR  it_zzsd0010.
              ELSE.
                it_tab_driver1 = it_tab_driver.
                APPEND it_tab_driver1.
              ENDIF.
            ENDIF.
          ELSEIF sy-subrc <> 0.
            READ TABLE it_tab_lookup
            WITH KEY qad_bill_to = it_tab_driver-qad_cust.
            IF sy-subrc = 0.
              it_zzsd0010-mandt          = it_tab_driver-mandt.
              it_zzsd0010-vkorg          = it_tab_driver-sorg.
              it_zzsd0010-vtweg          = it_tab_driver-sdis.
              it_zzsd0010-spart          = it_tab_driver-sdiv.
              it_zzsd0010-kunnr          = it_tab_lookup-rpc_bill_to.
              it_zzsd0010-payer          = 'X'.
              it_zzsd0010-kdgrp          = it_tab_driver-sell_div.
              it_zzsd0010-ernam          = sy-uname.
              it_zzsd0010-erdat          = sy-datum.
              it_zzsd0010-erzet          = sy-uzeit.
              it_zzsd0010-aenam          = sy-uname.
              it_zzsd0010-aedat          = sy-datum.
              it_zzsd0010-aezat          = sy-uzeit.
              READ TABLE it_tab_lookup
              WITH KEY qad_sold_to = it_tab_driver-gelco_princ_customer.
              IF sy-subrc = 0.
                it_zzsd0010-princ_customer = it_tab_lookup-rpc_sold_to.
                PERFORM f6000_add_zeros_to_cust.                "V004
                APPEND it_zzsd0010.
                INSERT INTO zzsd0010 VALUES it_zzsd0010.
                PERFORM f5000_warning_file.                     "V004
                CLEAR  it_zzsd0010.
              ELSEIF sy-subrc <> 0.
                READ TABLE it_tab_lookup
                WITH KEY qad_bill_to = it_tab_driver-gelco_princ_customer.
                IF sy-subrc = 0.
                  it_zzsd0010-princ_customer = it_tab_lookup-rpc_bill_to.
                  PERFORM f6000_add_zeros_to_cust.              "V004
                  APPEND it_zzsd0010.
                  INSERT INTO zzsd0010 VALUES it_zzsd0010.
                  PERFORM f5000_warning_file.                   "V004
                  CLEAR  it_zzsd0010.
                ELSE.
                  it_tab_driver1 = it_tab_driver.
                  APPEND it_tab_driver1.
                ENDIF.
              ENDIF.
            ELSE.
              it_tab_driver1 = it_tab_driver.
              APPEND it_tab_driver1.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDLOOP.
      LOOP AT it_tab_driver.
        IF
         it_tab_driver-gelco_princ_customer <> it_tab_driver-qad_cust.
          READ TABLE it_tab_lookup
          WITH KEY qad_sold_to = it_tab_driver-gelco_princ_customer.
          IF sy-subrc = 0.
            it_zzsd0010-mandt          = it_tab_driver-mandt.
            it_zzsd0010-vkorg          = it_tab_driver-sorg.
            it_zzsd0010-vtweg          = it_tab_driver-sdis.
            it_zzsd0010-spart          = it_tab_driver-sdiv.
            it_zzsd0010-princ_customer = it_tab_lookup-rpc_sold_to.
            it_zzsd0010-kunnr          = it_tab_lookup-rpc_sold_to.
            it_zzsd0010-payer          = ' '.
            it_zzsd0010-kdgrp          = it_tab_driver-sell_div.
            it_zzsd0010-ernam          = sy-uname.
            it_zzsd0010-erdat          = sy-datum.
            it_zzsd0010-erzet          = sy-uzeit.
            it_zzsd0010-aenam          = sy-uname.
            it_zzsd0010-aedat          = sy-datum.
            it_zzsd0010-aezat          = sy-uzeit.
            PERFORM f6000_add_zeros_to_cust.                    "V004
            APPEND it_zzsd0010.
            INSERT INTO zzsd0010 VALUES it_zzsd0010.
            PERFORM f5000_warning_file.                         "V004
            CLEAR  it_zzsd0010.
          ELSE.
            it_tab_driver1 = it_tab_driver.
            APPEND it_tab_driver1.
          ENDIF.
        ENDIF.
      ENDLOOP.
      PERFORM f3000_data_base_not_updated.
      PERFORM f4000_check_sales_division.
    *&      Form  f1000_upload_driver_data
    FORM f1000_upload_driver_data.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p_file
          i_begin_col             = $v_start_col
          i_begin_row             = $v_start_row
          i_end_col               = $v_end_col
          i_end_row               = $v_end_row
        TABLES
          intern                  = it_driver
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/10 'File '.
      ENDIF.
      IF sy-subrc EQ 0.
        READ TABLE it_driver INDEX 1.
        gd_currentrow = it_driver-row.
        LOOP AT it_driver.
          IF it_driver-row NE gd_currentrow.
            APPEND it_tab_driver.
            CLEAR it_tab_driver.
            gd_currentrow = it_driver-row.
          ENDIF.
          CASE it_driver-col.
            WHEN '0001'.
              it_tab_driver-mandt = it_driver-value.
            WHEN '0002'.
              it_tab_driver-sorg = it_driver-value.
            WHEN '0003'.
              it_tab_driver-sdis = it_driver-value.
            WHEN '0004'.
              it_tab_driver-sdiv = it_driver-value.
            WHEN '0005'.
              it_tab_driver-gelco_princ_customer = it_driver-value.
            WHEN '0006'.
              it_tab_driver-sell_div = it_driver-value.
            WHEN '0007'.
              it_tab_driver-payer = it_driver-value.
            WHEN '0008'.
              it_tab_driver-qad_cust = it_driver-value.
            WHEN '0009'.
              it_tab_driver-name = it_driver-value.
            WHEN '0010'.
              it_tab_driver-broker = it_driver-value.
          ENDCASE.
        ENDLOOP.
      ENDIF.
      APPEND it_tab_driver.
    ENDFORM.                    " f1000_upload_driver_data
    *&      Form  f2000_upload_lookup_data
    FORM f2000_upload_lookup_data.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p1_file
          i_begin_col             = $v_start_col
          i_begin_row             = $v_start_row
          i_end_col               = $v_end_col
          i_end_row               = $v_end_row
        TABLES
          intern                  = it_lookup
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/10 'File '.
      ENDIF.
      IF sy-subrc EQ 0.
        READ TABLE it_lookup INDEX 1.
        gd_currentrow = it_lookup-row.
        LOOP AT it_lookup.
          IF it_lookup-row NE gd_currentrow.
            APPEND it_tab_lookup.
            CLEAR it_tab_lookup.
            gd_currentrow = it_lookup-row.
          ENDIF.
          CASE it_lookup-col.
            WHEN '0001'.
              it_tab_lookup-rpc_ship_to = it_lookup-value.
            WHEN '0002'.
              it_tab_lookup-rpc_sold_to = it_lookup-value.
            WHEN '0003'.
              it_tab_lookup-rpc_bill_to = it_lookup-value.
            WHEN '0004'.
              it_tab_lookup-type        = it_lookup-value.
            WHEN '0005'.
              it_tab_lookup-qad_ship_to = it_lookup-value.
            WHEN '0006'.
              it_tab_lookup-qad_sold_to = it_lookup-value.
            WHEN '0007'.
              it_tab_lookup-qad_bill_to = it_lookup-value.
            WHEN '0008'.
              it_tab_lookup-sell_div1    = it_lookup-value.
            WHEN '0009'.
              it_tab_lookup-broker      = it_lookup-value.
          ENDCASE.
        ENDLOOP.
      ENDIF.
      APPEND it_tab_lookup.
    ENDFORM.                    " f2000_upload_lookup_data
    *&      Form  f3000_data_base_not_updated
          text
    FORM f3000_data_base_not_updated .
      CALL FUNCTION 'DOWNLOAD'
       EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
         filename                      = p2_file
         filetype                      = 'ASC'
        TABLES
          data_tab                      = it_tab_driver1
      FIELDNAMES                    =
       EXCEPTIONS
         invalid_filesize              = 1
         invalid_table_width           = 2
         invalid_type                  = 3
         no_batch                      = 4
         unknown_error                 = 5
         gui_refuse_filetransfer       = 6
         customer_error                = 7
         OTHERS                        = 8
      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.                    " data_base_not_updated
    *&      Form  f4000_Check_Sales_Division
          text
    FORM f4000_check_sales_division .
      SORT it_outfile.
      SORT it_outfile1.
      SORT it_outfile2.
      SORT it_outfile3.
      CALL FUNCTION 'DOWNLOAD'
        EXPORTING
          filename                = p3_file
          filetype                = 'ASC'
        TABLES
          data_tab                = it_outfile
        EXCEPTIONS
          invalid_filesize        = 1
          invalid_table_width     = 2
          invalid_type            = 3
          no_batch                = 4
          unknown_error           = 5
          gui_refuse_filetransfer = 6
          customer_error          = 7
          OTHERS                  = 8.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'DOWNLOAD'                                  "V004
        EXPORTING                                               "V004
          filename                = p4_file                     "V004
          filetype                = 'ASC'                       "V004
        TABLES                                                  "V004
          data_tab                = it_outfile1                 "V004
        EXCEPTIONS                                              "V004
          invalid_filesize        = 1                           "V004
          invalid_table_width     = 2                           "V004
          invalid_type            = 3                           "V004
          no_batch                = 4                           "V004
          unknown_error           = 5                           "V004
          gui_refuse_filetransfer = 6                           "V004
          customer_error          = 7                           "V004
          OTHERS                  = 8.                          "V004
      IF sy-subrc <> 0.                                         "V004
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO           "V004
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.           "V004
      ENDIF.                                                    "V004
      CALL FUNCTION 'DOWNLOAD'                                  "V004
        EXPORTING                                               "V004
          filename                = p5_file                     "V004
          filetype                = 'ASC'                       "V004
        TABLES                                                  "V004
          data_tab                = it_outfile2                 "V004
        EXCEPTIONS                                              "V004
          invalid_filesize        = 1                           "V004
          invalid_table_width     = 2                           "V004
          invalid_type            = 3                           "V004
          no_batch                = 4                           "V004
          unknown_error           = 5                           "V004
          gui_refuse_filetransfer = 6                           "V004
          customer_error          = 7                           "V004
          OTHERS                  = 8.                          "V004
      IF sy-subrc <> 0.                                         "V004
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO           "V004
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.           "V004
      ENDIF.                                                    "V004
      CALL FUNCTION 'DOWNLOAD'                                  "V004
        EXPORTING                                               "V004
          filename                = p6_file                     "V004
          filetype                = 'ASC'                       "V004
        TABLES                                                  "V004
          data_tab                = it_outfile3                 "V004
        EXCEPTIONS                                              "V004
          invalid_filesize        = 1                           "V004
          invalid_table_width     = 2                           "V004
          invalid_type            = 3                           "V004
          no_batch                = 4                           "V004
          unknown_error           = 5                           "V004
          gui_refuse_filetransfer = 6                           "V004
          customer_error          = 7                           "V004
          OTHERS                  = 8.                          "V004
      IF sy-subrc <> 0.                                         "V004
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO           "V004
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.           "V004
      ENDIF.                                                    "V004
      CALL FUNCTION 'DOWNLOAD'                                  "V004
        EXPORTING                                               "V004
          filename                = p7_file                     "V004
          filetype                = 'ASC'                       "V004
        TABLES                                                  "V004
          data_tab                = it_outfile4                 "V004
        EXCEPTIONS                                              "V004
          invalid_filesize        = 1                           "V004
          invalid_table_width     = 2                           "V004
          invalid_type            = 3                           "V004
          no_batch                = 4                           "V004
          unknown_error           = 5                           "V004
          gui_refuse_filetransfer = 6                           "V004
          customer_error          = 7                           "V004
          OTHERS                  = 8.                          "V004
      IF sy-subrc <> 0.                                         "V004
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO           "V004
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.           "V004
      ENDIF.                                                    "V004
    ENDFORM.                    " f4000_Check_Sales_Division
    *&      Form  f5000_warning_file
          Sales area in KNVV table is compared with the sales area in
          ZZSD0010 table and a warning file is created if any mismatch   *
          occurs                                                         *
    FORM f5000_warning_file .                                   "V004
      IF it_zzsd0010-payer <> 'X'.                              "V003
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'             "V002
          EXPORTING                                             "V002
            input  = it_zzsd0010-kunnr                          "V002
          IMPORTING                                             "V002
            output = it_zzsd0010-kunnr.                         "V002
        SELECT kunnr                                            "V002
               vkorg                                            "V004
               vtweg                                            "V004
               spart                                            "V004
               kdgrp                                            "V002
          INTO TABLE it_knvv                                    "V002
          FROM knvv                                             "V002
         WHERE kunnr = it_zzsd0010-kunnr.                       "V002
        IF sy-subrc = 0.                                        "V002
          READ TABLE it_knvv WITH KEY kunnr = it_zzsd0010-kunnr.
          IF it_zzsd0010-kdgrp <> it_knvv-kdgrp.                "V002
            CONCATENATE it_zzsd0010-princ_customer              "V002
                        it_zzsd0010-kunnr                       "V002
                        it_zzsd0010-kdgrp                       "V002
                        it_knvv-kdgrp                           "V002
            INTO it_outfile SEPARATED BY space.                 "V002
            APPEND it_outfile.                                  "V002
          ENDIF.                                                "V002
          IF it_zzsd0010-vkorg <> it_knvv-vkorg.                "V004
            CONCATENATE it_zzsd0010-princ_customer              "V004
                        it_zzsd0010-kunnr                       "V004
                        it_zzsd0010-vkorg                       "V004
                        it_knvv-vkorg                           "V004
            INTO it_outfile1 SEPARATED BY space.                "V004
            APPEND it_outfile1.                                 "V005
          ENDIF.                                                "V004
          IF it_zzsd0010-vtweg <> it_knvv-vtweg.                "V004
            CONCATENATE it_zzsd0010-princ_customer              "V004
                        it_zzsd0010-kunnr                       "V004
                        it_zzsd0010-vtweg                       "V004
                        it_knvv-vtweg                           "V004
            INTO it_outfile2 SEPARATED BY space.                "V004
            APPEND it_outfile2.                                 "V005
          ENDIF.                                                "V004
          IF it_zzsd0010-spart <> it_knvv-spart.                "V004
            CONCATENATE it_zzsd0010-princ_customer              "V004
                        it_zzsd0010-kunnr                       "V004
                        it_zzsd0010-spart                       "V004
                        it_knvv-spart                           "V004
            INTO it_outfile3 SEPARATED BY space.                "V004
            APPEND it_outfile3.                                 "V005
          ENDIF.                                                "V004
          CLEAR it_outfile.                                     "V002
          CLEAR it_outfile1.                                    "V004
          CLEAR it_outfile2.                                    "V004
          CLEAR it_outfile3.                                    "V004
          CLEAR it_knvv.                                        "V002
          REFRESH it_knvv.                                      "V002
        ELSE.                                                   "V002
          CONCATENATE 'CUSTOMER'                                "V002
                       it_zzsd0010-kunnr                        "V002
                      'NOT FOUND IN KNVV TABLE'                 "V002
          INTO it_outfile4 SEPARATED BY space.                   "V002
          APPEND it_outfile4.                                    "V002
        ENDIF.                                                  "V002
      ENDIF.                                                    "V003
    ENDFORM.                    " f5000_warning_file            "V004
    *&      Form  f6000_add_zeros_to_cust
          text
    -->  p1        text
    <--  p2        text
    form f6000_add_zeros_to_cust .
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'             "V002
          EXPORTING                                             "V002
            input  = it_zzsd0010-kunnr                          "V002
          IMPORTING                                             "V002
            output = it_zzsd0010-kunnr.                         "V002
    endform.                    " f6000_add_zeros_to_cust

  • 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

Maybe you are looking for

  • PCI Bus unlocked on K9N4 SLI F

    Hello people, I'm new at this forum.  I'm from Argentina and I'm trying to find a solution to this issue. When I raise the fsb bus the pci bus go up too.  I have a sound blaster audigy on that bus and that's why I can't go further with my overclock :

  • Error in File Database connector Error Time Limit exceeded

    Hello Experts, I am getting following error while fatching data from SAP BW using MDX connection. I am using Crystal Reports 2011 and save it in SAP BO 4.1 SP2. I have OLD BO system also. It is running successfully over there with using same connecti

  • BEX Query to ABAP Transaction Code

    Hi, RRI from BEX Query to ABAP Transaction Code When I Right clivk and select GOTO on my Delivery order say 120012 It shd directly go into tht particular DO The transaction code is vl33n but when i give ABAP Transaction as reciever object it only goe

  • Title Background Transparency Doesn't Work

    Hello, I can't get the title background transparency to work. I'm running Premiere CS6 6.04. Clicking on the background button does nothing. Sometimes, I can randomly change the background settings to get it to become transparent, but that is not wor

  • SWF_XI_CUSTOMIZING error

    Hi all, In transaction SWF_XI_CUSTOMIZING, when I run the customizing step: Maintain Runtime Environment -> Schedule Background Job for Deadline Monitoring I have SP14. I get this error: Error within CL_SWF_ADM_JOB_FACTORY=>GET_INSTANCE Any ideas? Or