GUI_UPLOAD Throws dp_out_of_memory

Hi togehter,
while i'm trying to upload an huge txt file with the method cl_gui_frontend_services=>gui_upload
i'm getting an errorcode back with 14: dp_out_of_memory.
Curiosly sometimes it works. Can somebody please explain this?
Thansk and regards
Philip

Ask ur basis team to increase TIMEOUT period as well as Dynamic Memory parameter.

Similar Messages

  • "Cannot interpret data in file" error while using GUI_UPLOAD for .xls file

    Hi,
         I have made a program using FM GUI_UPLOAD to upload an .xls file to an internal table. But upon executing ,it gives error "Cannot Interpret data in file". I have seen in other posts people talking about GUI_UPLOAD FM to upload data from excel directly into internal table. Kindly help.
    Here is my code. I had tried using different combination for HAS_FIELD_SEPARATOR but still its not working.
    In my emp1.xls file , the data in each column is present in the same order as in the internal table. Although the first column in my internal table is NUMC. I dont know if that is causing the problem.
    REPORT  ZUPLOAD_1.
    data: itab TYPE TABLE OF zempl_master WITH HEADER LINE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'C:\empl1.xls'
        FILETYPE                      = 'ASC'
        HAS_FIELD_SEPARATOR           = 'X'
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    *   NO_AUTH_CHECK                 = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   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-emp_no,itab-name.
    endloop.

    hi amber22 you need to use the below fm to upload an xls file
    FORM EXCEL_UPLOAD .
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          FILENAME    = FILENAM
          I_BEGIN_COL = 1
          I_BEGIN_ROW = 1
          I_END_COL   = 6
          I_END_ROW   = 100
        TABLES
          INTERN      = xl_itab.
    * EXCEPTIONS
    * INCONSISTENT_PARAMETERS = 1
    * UPLOAD_OLE = 2
    * OTHERS = 3 .
      IF SY-SUBRC = 0.
    MESSAGE 'DATA UPLOADED SUCCESSFULLY' TYPE 'I'.
      ENDIF.
    ENDFORM.                    " EXCEL_UPLOAD

  • Error while using the function module GUI_UPLOAD

    Hi,
    My requirement is to upload the data from .txt file into internal table.
    I have given my code like this
    PARAMETERS: p_fname LIKE rlgrap-filename.
    data: begin of gt_string occurs 0,
           record type char255,
          end of gt_string.
    AT SELECTION-SCREEN ON VALUE-REQUEST for p_fname.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
       EXPORTING
        PROGRAM_NAME        = SYST-REPID
        DYNPRO_NUMBER       = SYST-DYNNR
        FIELD_NAME          = ' '
         STATIC              = 'X'
        MASK                = ' '
        CHANGING
          file_name           = p_fname
       EXCEPTIONS
         MASK_TOO_LONG       = 1
         OTHERS              = 2
      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 'GUI_UPLOAD'
        EXPORTING
          filename                      = p_fname
         FILETYPE                      = 'ASC'
         HAS_FIELD_SEPARATOR           = 'X'
         HEADER_LENGTH                 = 0
        READ_BY_LINE                  = 'X'
        DAT_MODE                      = ' '
        CODEPAGE                      = ' '
        IGNORE_CERR                   = ABAP_TRUE
        REPLACEMENT                   = '#'
        CHECK_BOM                     = ' '
        NO_AUTH_CHECK                 = ' '
      IMPORTING
        FILELENGTH                    =
        HEADER                        =
        tables
          data_tab                      = gt_string
       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.
    Here I am getting dump error as 'Type conflict when calling a function module.
    The function module interface allows you to specify only fields
    of a particular type under "FILENAME". The field "P_FNAME" specified here has a different field type'.
    What would be the reason for this error?
    Can anyone help me?
    Regards,
    Hema

    see this sample program for F4 help
    *& Report  ZSD_EXCEL_INT_APP
    REPORT  ZSD_EXCEL_INT_APP.
    parameter: file_nm type localfile.
    types : begin of it_tab1,
            f1(20),
            f2(40),
            f3(20),
           end of it_tab1.
    data : it_tab type table of ALSMEX_TABLINE with header line,
           file type rlgrap-filename.
    data : it_tab2 type it_tab1 occurs 1,
           wa_tab2 type it_tab1,
           w_message(100)  TYPE c.
    at selection-screen on value-request for file_nm.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      PROGRAM_NAME        = SYST-REPID
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
       STATIC              = 'X'
      MASK                = ' '
      CHANGING
       file_name           = file_nm
    EXCEPTIONS
       MASK_TOO_LONG       = 1
       OTHERS              = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    start-of-selection.
    refresh it_tab2[].clear wa_tab2.
    file = file_nm.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = file
        i_begin_col                   = '1'
        i_begin_row                   =  '1'
        i_end_col                     = '10'
        i_end_row                     = '35'
      tables
        intern                        = it_tab
    EXCEPTIONS
       INCONSISTENT_PARAMETERS       = 1
       UPLOAD_OLE                    = 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.
    loop at it_tab.
      case it_tab-col.
       when '002'.
        wa_tab2-f1 = it_tab-value.
       when '004'.
        wa_tab2-f2 = it_tab-value.
      when '008'.
        wa_tab2-f3 = it_tab-value.
    endcase.
    at end of row.
      append wa_tab2 to it_tab2.
    clear wa_tab2.
      endat.
    endloop.
    data : p_file TYPE  rlgrap-filename value 'TEST3.txt'.
    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    *--- Display error messages if any.
      IF sy-subrc NE 0.
        MESSAGE e001(zsd_mes).
        EXIT.
      ELSE.
    *---Data is downloaded to the application server file path
        LOOP AT it_tab2 INTO wa_tab2.
          TRANSFER wa_tab2 TO p_file.
        ENDLOOP.
      ENDIF.
    *--Close the Application server file (Mandatory).
      CLOSE DATASET p_file.
    loop at it_tab2 into wa_tab2.
      write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
    endloop.

  • Problem with GUI_UPLOAD using excel sheet

    Hi,
      I am trying to upload excel sheet thru GUI_UPLOAD ... this excel sheet has a header line and 3 line of data. Even if I remove the header line then also the internal while debugging is showing 28 lines of entries with "#" "squares" in some columns ... while in others where data should be there shows all Zeros....
    The excel sheet has the following info
    Rate Type Valid From Date     From Currency     To Currency      Indirect Quote     Direct Quote
    M       29.09.2006             SGD             USD             1.6932     
    M       29.09.2006             USD             SGD                          1.6932
    M       29.09.2006             SGD             MYR                          2.19653
    KURST GDATU    FCURR TCURR INUKURS     DUKURS
    ###&#2161; |########|#####|### #|   0.00000 |0.00000 |
    ##29 |00000000|     |     |   0.00000 |0.00000 |
    o#d# |00000000|     |     |   0.00000 |0.00000 |
    The code that I am writing is as follows:-
    *& INTERNAL TABLES
    DATA : BEGIN OF T_INPUT occurs 0,
             KURST   LIKE TCURV-KURST,  " Exchange rate type
             GDATU   LIKE SY-DATUM,     " Date from which rate is effective
             FCURR   LIKE TCURC-WAERS,  " From currency
             TCURR   LIKE TCURC-WAERS,  " To currency
             INUKURS LIKE TCURR-UKURS,  " Indirect Quote
             DUKURS  LIKE TCURR-UKURS,  " Direct Quote
           END OF T_INPUT.
                S T A R T - O F - S E L E C T I O N                      *
    START-OF-SELECTION.
    Perform to upload the excel file.
      PERFORM UPLOAD_EXCEL_FILE.
    FORM UPLOAD_EXCEL_FILE .
      DATA: L_FILENM TYPE STRING.
      L_FILENM = P_FILENM.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                      = L_FILENM
          FILETYPE                      = 'ASC'
          HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
        TABLES
          DATA_TAB                      = T_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 .
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

    Hi SB,
    pls change the data type declared for 'valid from date'
    from
    DATA : BEGIN OF T_INPUT occurs 0,
    KURST LIKE TCURV-KURST, " Exchange rate type
    <b>GDATU LIKE SY-DATUM,</b> " Date from which rate is effective
    FCURR LIKE TCURC-WAERS, " From currency
    TCURR LIKE TCURC-WAERS, " To currency
    INUKURS LIKE TCURR-UKURS, " Indirect Quote
    DUKURS LIKE TCURR-UKURS, " Direct Quote
    END OF T_INPUT.
    to
    DATA : BEGIN OF T_INPUT occurs 0,
    KURST LIKE TCURV-KURST, " Exchange rate type
    GDATU(10) type c, " Date from which rate is effective
    FCURR LIKE TCURC-WAERS, " From currency
    TCURR LIKE TCURC-WAERS, " To currency
    INUKURS LIKE TCURR-UKURS, " Indirect Quote
    DUKURS LIKE TCURR-UKURS, " Direct Quote
    END OF T_INPUT.
    Cheers,
    Vikram
    Please reward for helpful replies!!

  • Runtime error while using GUI_UPLOAD

    Hi All,
    I have a text file which contains few records delimited by tab.
    I am trying to upload the contents of the file into an internal table using the FM GUI_UPLOAD
    But, I am getting run time error 'Type conflict when calling a function module'.
    The code that I had written is shown below.
    Please let me know where I went wrong.
    REPORT  Z84364BDC                               .
    TYPES : BEGIN OF ITAB_TP,
            MATNR TYPE MARA-MATNR,
            EAN11 TYPE MARA-EAN11,
            END OF ITAB_TP.
    DATA : FILE_ITAB TYPE STANDARD TABLE OF ITAB_TP.
    DATA : ITAB_WA TYPE ITAB_TP.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T01.
    PARAMETERS : P_FILE TYPE RLGRAP-FILENAME DEFAULT 'D:\Example.txt'.
    SELECTION-SCREEN END OF BLOCK B1.
    ***FILLING THE INTERNAL TABLE****
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = P_FILE
        FILETYPE                      = 'ASC'
        has_field_separator           = ','
        tables
        data_tab                      = FILE_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.

    The file is delimited by Comma field as mentioned above.
    Below is the code that I had written. But, I face the same problem
    REPORT  Z84364BDC                               .
    TYPES : BEGIN OF ITAB_TP,
            MATNR TYPE MARA-MATNR,
            EAN11 TYPE MARA-EAN11,
            END OF ITAB_TP.
    DATA : FILE_ITAB TYPE STANDARD TABLE OF ITAB_TP.
    DATA : ITAB_WA TYPE ITAB_TP.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T01.
    PARAMETERS : P_PATH TYPE RLGRAP-FILENAME DEFAULT 'D:\Example.txt'.
    SELECTION-SCREEN END OF BLOCK B1.
    DATA : P_FILE TYPE STRING.
    P_FILE = P_PATH.
    ****FILLING THE INTERNAL TABLE*****
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = P_FILE
        FILETYPE                      = 'ASC'
        has_field_separator           = 'X'
        tables
        data_tab                      = FILE_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.
    ***Displaying the Material*****
    LOOP AT FILE_ITAB INTO ITAB_WA.
    WRITE:/ ITAB_WA-MATNR.
    ENDLOOP.

  • Error in gui_upload

    hi guru,
    iam doing some bdc program.. but ity will going to dump on gui_upload.. so plz help me.
    An exception occurred that is explained in detail
    The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
    not caught in.
    procedure "F_UPLOAD_FILE" "(FORM)", nor was it propagated by a RAISING clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    The call to the function module "GUI_UPLOAD" is incorrect:
    The function module interface allows you to specify only
    fields of a particular type under "FILENAME".
    The field "P_P_FILE" specified here is a different
    field type
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-h01.                         
    PARAMETERS: p_file LIKE rlgra-filename                                                                               
    SELECTION-SCREEN : END OF BLOCK b1.                                                                                .----
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.                                                                               
    PERFORM f_get_file USING p_file.                                                                               
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'       
    *EXPORTING-                                                                               
    CHANGING                                                                               
    FILE_NAME           = p_p_file                                                                               
    endform.               
    form f_upload_file  using    p_p_file.                                                                               
    CALL FUNCTION 'GUI_UPLOAD'                                                                               
    EXPORTING                                                                               
    FILENAME                      = p_p_file                                                                               
    FILETYPE                      = 'DAT'                                                                               
    endform.

    Hi,
    Refer the program given below. it is working fine for me.
    make the paramerter as:
    pa_dfile TYPE rcgfiletr-ftfront.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_dfile.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          static        = 'X'
          mask          = '(Text file|*.TXT'
        CHANGING
          file_name     = pa_dfile
        EXCEPTIONS
          mask_too_long = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE ID 'PG' TYPE 'E' NUMBER '016'
              WITH 'Error in F4 help'(005).
        "The provided file is not an excel sheet.
        RETURN.
      ENDIF.
    DATA: lv_filetype(10) TYPE c,
            lv_gui_sep TYPE c,
            lv_file_name TYPE string.
      lv_filetype = 'ASC'.
      lv_gui_sep = 'X'.
      lv_file_name = pa_dfile.
    FM call to upload file
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = lv_file_name
          filetype                = lv_filetype
          has_field_separator     = lv_gui_sep 
        TABLES
          data_tab                = gi_table
        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.
    Hope it helps.
    Regards
    Rajesh Kumar
    Edited by: Rajesh Kumar on Jul 24, 2009 7:11 AM

  • Issue with field separator in GUI_UPLOAD

    Hello Gurus
    I am facing issue with gui_upload. I have a text file in which the fields are eparated by single Pipe  i.e |. Now when I try to read the data from file in internal table even with using field separator it does not insert data in proper fields.
    DATA: BEGIN OF IT_TAB OCCURS 0,
          OBJECT_ID type string,
          VERSION_SERIES_ID TYPE string,
          VERSION_NUMBER TYPE string,
          REVISION TYPE string,
          DOC_NUMBER TYPE string,
          DOCTITLE TYPE string,
          FILESIZE TYPE string,
          MIME_TYPE TYPE string,
          PLANTUNIT TYPE string,
          END OF IT_TAB.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = w_mpath
        FILETYPE                      = 'ASC'
        HAS_FIELD_SEPARATOR           = '|'
      HEADER_LENGTH                 = 0
       READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = it_tab[]
    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.
    I want the data to get appended in internal table based on | separator.
    Please help.
    Regards,
    Rajesh.

    Hi,
    I believe the field separator parameter will work for Excel files..You have to get the internal table in a string format..and then use split statement..
    check this example..
    DATA: BEGIN OF it_tab OCCURS 0,
           object_id TYPE string,
           version_series_id TYPE string,
           version_number TYPE string,
           revision TYPE string,
           doc_number TYPE string,
           doctitle TYPE string,
           filesize TYPE string,
           mime_type TYPE string,
           plantunit TYPE string,
         END OF it_tab.
    DATA: t_tab   TYPE TABLE OF string,
          v_string TYPE string.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                = 'C:\TEST.TXT'
    *    has_field_separator     = '|'          "Actually not required.
      TABLES
        data_tab                = t_tab
      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.
    ENDIF.
    LOOP AT t_tab INTO v_string.
      SPLIT v_string AT ','
            INTO
            it_tab-object_id
            it_tab-version_series_id
            it_tab-version_number
            it_tab-revision
            it_tab-doc_number
            it_tab-doctitle
            it_tab-filesize
            it_tab-mime_type
            it_tab-plantunit.
      APPEND it_tab.
      CLEAR: it_tab.
    ENDLOOP.
    Thanks
    Naren
    Edited by: Narendran Muthukumaran on Oct 15, 2008 4:58 PM

  • GUI_Upload & GUI_Download for excel files

    Hi experts,
    I want to upload excel file into sap. i am trying with GUI_Upload function module. when i see the data it is filled with # and other special char. When i save the excel file as .txt file and then read the txt file. Now i am getting correct data. Is it possible to read Excel data using GUI_UPLOAD directly without changing .xls to .txt.
    Also, how to change data in  second or  third tab of excel file using GUI_Download.
    -RK

    Hi
    Actually ur file selection s wrong.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          PROGRAM_NAME  = SYST-REPID
          DYNPRO_NUMBER = SYST-DYNNR
          FIELD_NAME    = 'P_FNAME'
          STATIC        = 'X'
         MASK          = '*.txt'
        CHANGING
          FILE_NAME     = P_FNAME
        EXCEPTIONS
          MASK_TOO_LONG = 1
          OTHERS        = 2.
    Upload:
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                = LV_FNAME
          FILETYPE                = 'ASC'
          HAS_FIELD_SEPARATOR     = 'X'
        TABLES
          DATA_TAB                = IT_UEXBANK01
        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.

  • Field Separator in GUI_UPLOAD

    Hi,
         I need to upload a tab delimited excel file . I am using FM GUI_DOWNLOAD.What are Filetype and Field Separator.
    Regards,
    Divyanshu

    Hi Divyanshu,
    It may be better to use the class method to future proof your development (which incidentally calls GUI_UPLOAD anyway). Consider the following code:
      data: i_file type standard table of t_file.
      call method cl_gui_frontend_services=>gui_upload
        exporting
          filename                = w_file
          has_field_separator     = 'X'      "Tab-delimited ASCII upload.
        changing
          data_tab                = i_file
        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
          not_supported_by_gui    = 17
          error_no_gui            = 18
          others                  = 19.
      if sy-subrc <> 0.
    *   Error handling
      endif.
    Hope this helps.
    JB

  • GUI_UPLOAD+HAS_FIELD_SEPARATOR

    Hi everybody .
    In my program, I use the fm GUI_UPLOAD to upload the flat file which separator is the pipe(|).
    Exemple of line :  AAA|BBB|CCC|DDD
    HAS_FIELD_SEPARATOR='|' not working, so how can i use this fm and define SEPARATOR  as pipe .
    thank  in advance

    Hi ,
       I believe the field separator parameter will work for Excel files..You have to get the internal table in a string format..and then use split statement..
         Use the below code it work for me..
    DATA: BEGIN OF it_tab OCCURS 0,
           object_id TYPE string,
           version_series_id TYPE string,
           version_number TYPE string,
           revision TYPE string,
           doc_number TYPE string,
           doctitle TYPE string,
           filesize TYPE string,
           mime_type TYPE string,
           plantunit TYPE string,
         END OF it_tab.
    DATA: t_tab   TYPE TABLE OF string,
          v_string TYPE string.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                = 'C:\TEST.TXT'
       has_field_separator     = '|'          "Actually not required.*
      TABLES
        data_tab                = t_tab
      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.
    ENDIF.
    LOOP AT t_tab INTO v_string.
      SPLIT v_string AT '|'
            INTO
            it_tab-object_id
            it_tab-version_series_id
            it_tab-version_number
            it_tab-revision
            it_tab-doc_number
            it_tab-doctitle
            it_tab-filesize
            it_tab-mime_type
            it_tab-plantunit.
      APPEND it_tab.
      CLEAR: it_tab.
    ENDLOOP.
    Regards,
    DHina..
    Edited by: Dhina DMD on May 13, 2011 1:41 PM
    Edited by: Dhina DMD on May 13, 2011 1:47 PM

  • DIFFERENCE BETWEEN OPEN_DATASET AND GUI_UPLOAD

    WHY WE USE OPEN_DATASET TO FETCH DATA FROM APPLICATION SERVER WHERE AS WE USE ONLY GUI_UPLOAD TO FETCH FROM PRESENTATION SERVER?

    Hi,
    Open dataset is used to transfer the contents to Application server file or to read the contents from Application server
    GUI_UPLOAD is used to transfer the contents from Presentation system file to internal table
    GUI_DOWNLOAD is used to transfer the contents from internal table to Presentation system file
    Application server file read/write:
    http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm
    presentation system file read/write:
    Sample ABAP Program to download table using new function GUI_DOWNLOAD
    *& Report ZDOWNLOAD *
    *& This program uses the new function GUI_DOWNLOAD *
    *& Output will be TAB delimited and include MANDT *
    *& It can be opened directly by Microsoft Excel *
    *& To use this program for any Database Table replace ZTEST with *
    *& new table name. *
    *& AUTHOR: Sheila Titchener - abap at iconet-ltd.co.uk *
    *& Date: February 2004 *
    REPORT zdownload MESSAGE-ID bd.
    DATA: w_tab TYPE ztest.
    DATA: i_tab TYPE STANDARD TABLE OF ztest.
    DATA: v_subrc(2),
    v_recswritten(6).
    PARAMETERS: p_file(80)
    DEFAULT 'D:
    ICONET
    SAP
    ZTEST.DAT'.
    DATA: filename TYPE string.
    filename = p_file.
    SELECT * FROM ztest INTO TABLE I_TAB.
    If text fields appear right justified or columns not lined up in output set
    TRUNC_TRAILING_BLANKS to X
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE =
    filename = filename
    FILETYPE = 'ASC'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = 'X'
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = 'X '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = I_TAB
    EXCEPTIONS
    FILE_WRITE_ERROR = 1
    NO_BATCH = 2
    GUI_REFUSE_FILETRANSFER = 3
    INVALID_TYPE = 4
    NO_AUTHORITY = 5
    UNKNOWN_ERROR = 6
    HEADER_NOT_ALLOWED = 7
    SEPARATOR_NOT_ALLOWED = 8
    FILESIZE_NOT_ALLOWED = 9
    HEADER_TOO_LONG = 10
    DP_ERROR_CREATE = 11
    DP_ERROR_SEND = 12
    DP_ERROR_WRITE = 13
    UNKNOWN_DP_ERROR = 14
    ACCESS_DENIED = 15
    DP_OUT_OF_MEMORY = 16
    DISK_FULL = 17
    DP_TIMEOUT = 18
    FILE_NOT_FOUND = 19
    DATAPROVIDER_EXCEPTION = 20
    CONTROL_FLUSH_ERROR = 21
    OTHERS = 22
    SYST FIELDS ARE NOT SET BY THIS FUNCTION SO DISPLAY THE ERROR CODE *
    IF sy-subrc <> 0.
    v_subrc = sy-subrc.
    MESSAGE e899 WITH 'File Open Error' v_subrc.
    ENDIF.
    DESCRIBE TABLE i_tab LINES v_recswritten.
    MESSAGE i899 WITH v_recswritten 'Records Written from ZTEST'.
    Sample ABAP Program to Upload table using new function GUI_UPLOAD
    *& Report ZUPLOAD *
    *& This program uses the new function GUI_UPLOAD *
    *& Input must be TAB delimited with a blank column at the start *
    *& to allow for MANDT. *
    *& To use this program for any Database Table replace ZTEST with *
    *& new table name. *
    *& AUTHOR: Sheila Titchener - abap at iconet-ltd.co.uk *
    *& Date: February 2004 *
    REPORT zupload MESSAGE-ID bd.
    DATA: w_tab TYPE ZTEST.
    DATA: i_tab TYPE STANDARD TABLE OF ZTEST.
    DATA: v_subrc(2),
    v_recswritten(6).
    PARAMETERS: p_file(80)
    DEFAULT 'C:\Temp\ZTEST.TXT'.
    DATA: filename TYPE string,
    w_ans(1) TYPE c.
    filename = p_file.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
    EXPORTING
    titlebar = 'Upload Confirmation'
    DIAGNOSE_OBJECT = ' '
    text_question = p_file
    text_button_1 = 'Yes'(001)
    ICON_BUTTON_1 = ' '
    text_button_2 = 'No'(002)
    ICON_BUTTON_2 = ' '
    default_button = '2'
    DISPLAY_CANCEL_BUTTON = 'X'
    USERDEFINED_F1_HELP = ' '
    START_COLUMN = 25
    START_ROW = 6
    POPUP_TYPE =
    IV_QUICKINFO_BUTTON_1 = ' '
    IV_QUICKINFO_BUTTON_2 = ' '
    IMPORTING
    answer = w_ans
    TABLES
    PARAMETER =
    EXCEPTIONS
    TEXT_NOT_FOUND = 1
    OTHERS = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CHECK w_ans = 1.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = filename
    FILETYPE = 'ASC
    has_field_separator = 'X'
    HEADER_LENGTH = 0
    READ_BY_LINE = 'X'
    IMPORTING
    FILELENGTH =
    HEADER =
    TABLES
    data_tab = i_tab
    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.
    SYST FIELDS ARE NOT SET BY THIS FUNCTION SO DISPLAY THE ERROR CODE *
    IF sy-subrc <> 0.
    v_subrc = sy-subrc.
    MESSAGE e899 WITH 'File Open Error' v_subrc.
    ENDIF.
    INSERT ZTEST FROM TABLE i_tab.
    COMMIT WORK AND WAIT.
    MESSAGE i899 WITH sy-dbcnt 'Records Written to ZTEST'.
    Thanks,
    Naveen Kumar.

  • What is difference between WS_UPLOAD and GUI_UPLOAD

    Dear gurus,
    Because my office implement SAP for a long time ago so some programs contain WS_UPLOAD function and I find that is obsolete so I want to know what is different or benefit if I modify program to use GUI_UPLOAD function instead of WS_UPLOAD function
    If you have related document please give me the link.
    Thank you,

    Hi,
    WS_Download Function module is used in 4.6 c version  and it is obsolete.From 6 version u need to use
    GUI_Download.
    WS_DOWNLOAD is obsolete function module for storing SAP data in a file in the file system of the presentation server.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
      FILENAME                      = ' '
      FILETYPE                      = 'ASC'
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
    TABLES
    DATA_TAB                      = lt_datatab
      FIELDNAMES                    =
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_WRITE_ERROR              = 2
      INVALID_FILESIZE              = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      NO_AUTHORITY                  = 10
      OTHERS                        = 11
    Now you ave to use method or function module GUI_DOWNLOAD
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
    EXPORTING
       BIN_FILESIZE              =
    FILENAME                  = lv_filename
       FILETYPE                  = 'ASC'
       APPEND                    = SPACE
       WRITE_FIELD_SEPARATOR     = SPACE
       HEADER                    = '00u2032
       TRUNC_TRAILING_BLANKS     = SPACE
       WRITE_LF                  = 'X'
       COL_SELECT                = SPACE
       COL_SELECT_MASK           = SPACE
       DAT_MODE                  = SPACE
       CONFIRM_OVERWRITE         = SPACE
       NO_AUTH_CHECK             = SPACE
       CODEPAGE                  = SPACE
       IGNORE_CERR               = ABAP_TRUE
       REPLACEMENT               = '#'
       WRITE_BOM                 = SPACE
       TRUNC_TRAILING_BLANKS_EOL = 'X'
       WK1_N_FORMAT              = SPACE
       WK1_N_SIZE                = SPACE
       WK1_T_FORMAT              = SPACE
       WK1_T_SIZE                = SPACE
    IMPORTING
       FILELENGTH                =
    CHANGING
    DATA_TAB                  = lt_datatab
    EXCEPTIONS
       FILE_WRITE_ERROR          = 1
       NO_BATCH                  = 2
       GUI_REFUSE_FILETRANSFER   = 3
       INVALID_TYPE              = 4
       NO_AUTHORITY              = 5
       UNKNOWN_ERROR             = 6
       HEADER_NOT_ALLOWED        = 7
       SEPARATOR_NOT_ALLOWED     = 8
       FILESIZE_NOT_ALLOWED      = 9
       HEADER_TOO_LONG           = 10
       DP_ERROR_CREATE           = 11
       DP_ERROR_SEND             = 12
       DP_ERROR_WRITE            = 13
       UNKNOWN_DP_ERROR          = 14
       ACCESS_DENIED             = 15
       DP_OUT_OF_MEMORY          = 16
       DISK_FULL                 = 17
       DP_TIMEOUT                = 18
       FILE_NOT_FOUND            = 19
       DATAPROVIDER_EXCEPTION    = 20
       CONTROL_FLUSH_ERROR       = 21
       NOT_SUPPORTED_BY_GUI      = 22
       ERROR_NO_GUI              = 23
       others                    = 24
    Thanks,
    Anitha

  • Ws_upload and GUI_upload ....

    Hi Everyone,
    I got a query, I have tried  using ws_upload and gui_upload both in the program...... the codes are below, If I try using .xls it gives only garbage in the internal table.  .txt format is working fine. Can anyone help by haveing a look at the code piece where am I going wrong. i trid these piece of codes in both ECC6.0 and 4.6.
    **************CODES BELOW*******************
    FORM UPLOAD_PS_PRICE .
    DATA:L_CURR LIKE  EKPO-NETPR.
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = p_local
          filetype                = 'DAT'
         has_field_separator     = 'X'
        TABLES
          data_tab                = t_ps_price
        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.
      ENDIF.
    CALL FUNCTION 'WS_UPLOAD'
            EXPORTING
                 FILENAME                = P_LOCAL
                 FILETYPE                = 'DAT'
            TABLES
                 DATA_TAB                = T_PS_PRICE
            EXCEPTIONS
                 CONVERSION_ERROR        = 1
                 FILE_OPEN_ERROR         = 2
                 FILE_READ_ERROR         = 3
                 INVALID_TYPE            = 4
                 NO_BATCH                = 5
                 UNKNOWN_ERROR           = 6
                 INVALID_TABLE_WIDTH     = 7
                 GUI_REFUSE_FILETRANSFER = 8
                 CUSTOMER_ERROR          = 9
                 OTHERS                  = 10.
       IF SY-SUBRC <> 0.
         MESSAGE S002 WITH TEXT-007.
       ENDIF.

    hi
    good
    did you debug the code and try to find out where is the exact error is, because it is quite difficult to give you the correct reply with this bit of code.
    thanks
    mrutyun^

  • GUI_UPLOAD not working for text file upload with '|' as a saperater

    Dear all,
    I have used 'GUI_UPLOAD' to upload data from text file having below format,
    1000|HBK1|HKTI
    1000|HBK2|HKTI
    1000|HBK3|HKTI
    My code is as below
    *& Report  ZTEST_NEW1
    REPORT  ZTEST_NEW1.
    TYPE-POOLS: truxs,
                kcde.
    TYPES :     BEGIN     OF             ty_data2          ,
                zbukr     TYPE           payr-zbukr       ,
                hbkid     TYPE           payr-hbkid       ,
                hktid     TYPE           payr-hktid       ,
               END       OF             ty_data2         .
    DATA :            it_file   TYPE           filetable        .
    DATA :      wa_file   LIKE LINE OF   it_file          .
    DATA :      w_rc      TYPE           i                ,
                lv_file   TYPE           string           .
    DATA : it_data2 TYPE TABLE OF ty_data2,
           wa_data2 LIKE LINE OF it_data2.
    SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-020.
    PARAMETER : pr_file   TYPE           rlgrap-filename         .
    SELECTION-SCREEN END OF BLOCK bk1                            .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pr_file.
      PERFORM get_file.
    START-OF-SELECTION.
      PERFORM get_data.
    FORM get_file .
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
    *  EXPORTING
    *    WINDOW_TITLE            =
    *    DEFAULT_EXTENSION       =
    *    DEFAULT_FILENAME        =
    *    FILE_FILTER             =
    *    INITIAL_DIRECTORY       =
    *    MULTISELECTION          =
    *    WITH_ENCODING           =
        CHANGING
          file_table              = it_file
          rc                      = w_rc
    *    USER_ACTION             =
    *    FILE_ENCODING           =
       EXCEPTIONS
         file_open_dialog_failed = 1
         cntl_error              = 2
         error_no_gui            = 3
         not_supported_by_gui    = 4
         OTHERS                  = 5
      IF sy-subrc EQ 0.
        CLEAR : wa_file.
        LOOP AT it_file INTO wa_file.
          pr_file = wa_file-filename.
          CLEAR : wa_file.
        ENDLOOP.
      ELSE.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " get_file
    FORM get_data .
    IF pr_file IS INITIAL.
        MESSAGE 'Enter file name'(002) TYPE 'E'.
      ENDIF.
      IF pr_file CP '*.xls'
        or pr_file CP '*.xlsx' . " Added
      ELSEIF pr_file CP '*.txt'.
    CONSTANTS : c_del TYPE c LENGTH 1 VALUE '|'.
        lv_file = pr_file.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = lv_file
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = c_del
    *   HEADER_LENGTH                 = 1
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
      TABLES
        DATA_TAB                      = it_data2
    * 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.
    endif.
    ENDFORM.                    " get_data
    In my output I am only getting company codes and not getting other two columns, can any body guide me where I am doing wrong?
    I have checked many other same kind of threads and I have done the same as suggested to do but still I am facing issue.
    Thanks in advance.
    Regards,
    Umang

    Hi Umang,
    There is a simple solution to this problem. Make the following changes to your code(marked in red color):
    REPORT  ZTEST_NEW1.
    TYPE-POOLS: truxs,
                kcde.
    TYPES :     BEGIN     OF             ty_data2          ,
                zbukr     TYPE           payr-zbukr       ,
                hbkid     TYPE           payr-hbkid       ,
                hktid     TYPE           payr-hktid       ,
               END       OF             ty_data2         .
    types: begin of ty_data
                 str type char200,
               end of ty_data.
    DATA: it_data type table of ty_data,
               wa_data type ty_data.
    DATA :            it_file   TYPE           filetable        .
    DATA :      wa_file   LIKE LINE OF   it_file          .
    DATA :      w_rc      TYPE           i                ,
                lv_file   TYPE           string           .
    DATA : it_data2 TYPE TABLE OF ty_data2,
           wa_data2 LIKE LINE OF it_data2.
    rest of the code **
    FORM get_data .
    IF pr_file IS INITIAL.
        MESSAGE 'Enter file name'(002) TYPE 'E'.
      ENDIF.
      IF pr_file CP '*.xls'
        or pr_file CP '*.xlsx' . " Added
      ELSEIF pr_file CP '*.txt'.
    CONSTANTS : c_del TYPE c LENGTH 1 VALUE '|'.
        lv_file = pr_file.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = lv_file
       FILETYPE                      = 'ASC'
    *HAS_FIELD_SEPARATOR           = c_del                    "comment this line
    HEADER_LENGTH                 = 1
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = it_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
    IF SY-SUBRC  0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endif.
    Loop at it_data into wa_data.
    split wa_data-str at '|' into wa_data2-zbukr wa_data2-hbkid wa_data2-hktid.
    append wa_data2 to it_data2.
    clear wa_data2.
    Endloop.
    ENDFORM.                    " get_data
    IT_DATA2 will contain the final uploaded data. Hope this helps

  • FILE_OPEN_ERROR  gui_upload

    Hi there , I´m  facing some troubles with the following code :
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                       = c:/example.txt
        FILETYPE                       = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = reg_maestro
      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        .
    I´ve created a empty  example.txt file  and  put this in c:/ , but I got the error FILE_OPEN_ERROR , we recently upgrade to ecc 6.0 but I don´t if something is missing in the process about this kind of fuction.

    HI,
      Just try it simply as below.
    the possible reasons could be.
    1) file with that name is not existing in that path
    2) path name is wrong (u gave it as c:/ give it as c:\)
    3) file may be open..
    how ever just try with giving the file path and the output table and see how it works
    *-- Read the File From PC
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME = V_FILENAME
        TABLES
          DATA_TAB = I_FILE
        EXCEPTIONS
          OTHERS   = 17.
    Thanks
    mahesh

Maybe you are looking for

  • Which tech i should look into if i want to...

    hi all, i am looking for guide on using Java tech to 1. "talk" to GSM modems 2. end-to-end encryption i.e. decrypt files from media using dynamic decryption technologies and encrypt with another type on-the-fly without human intervention. please en l

  • JDBC Driver: MS Access

    I need to connect locally to a mdb file on a Windows OS and manipulate its data. I have tried the sun.jdbc.odbc.JdbcOdbcDriver but it does not support primary keys manipulation. I have read numerous topics about JDBC drivers for MS Access, some of th

  • My Mac OS is version 10.5.8 can I update to the lastest OS?

    I want to upgrade the OS but not sure if I can go straight to the latest OS or if I need to install another one first?

  • Nokia ovi suite 3.0.0.290 bluetooth

    i have a big problem " i have a windows 7 64 bit when i install my ovi suite i found  (use bluetooth instead) disable what can i do to connect my phone via bluetooth Attachments: Doc2.doc ‏131 KB

  • Automatically commit

    Hi Guys! I have a master details form in Oracle Form 10g. In my master block I have a list item. Depending on the value I choose in that list I make changes in the details block and I call a procedure that do lots of insert in some database tables. T