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

Similar Messages

  • Regarding error in GUI_UPLOAD FM

    Dear all,
    i  got an error mesaage in GUI_UPLAD FM when i m uploading a file in to it .
    error message " Recursive occurrence of virus scan profile /SCET/GUI_UPLOAD in the sequence /SCET/GUI_UPLOAD"
    please give me any solution how to slove it.
    thanks in advance
    abhilash

    Solved by self
    see this link for ans.
    https://cw.sdn.sap.com/cw/docs/DOC-113596?decorator=print

  • Getting CONTROL_FLUSH_ERROR error with GUI_UPLOAD

    Hi Friends
    In my Report I am using the FM: GUI_UPLOAD and while running the report in foreground, I am getting the proper results. But while running the same in Background I am getting the error: CONTROL_FLUSH_ERROR .
    As my understanding ,to resolve this we have to upgrade the sap gui.
    Can anyone suggest me the exact reason for this error and the solution as well.
    Points are assured for useful answers.
    @SAP GURUS: I am eagerly waiting for your help and suggestions on this.
    Regards,
    Sree

    Hi,
    As far as i know, there is no note for this. this is the functionality of GUI_UPLOAD>
    GUI_* and WS_* function modules are not designed to work in that way, as they need to access your personal computer  file.
    To choose the correct download method to used, you can check the value of SY-BATCH in your code, check if background or foreground mode and then execute.
    Hope this helps. Pls reward points if useful.
    Shruthi

  • SLIN error for GUI_upload

    Hi
    I'm working with Unicode project, I have replaced ws_upload with gui_upload. I found one error in EPC(extended program check) the file is not compatible.
    Can anyone help me?
    Thanks
    Sapien

    PARAMETERS: p_syfild TYPE rlgrap-filename.
    DATA: lv_file TYPE string.
    lv_file = p_syfilh.
      CALL FUNCTION 'GUI_UPLOAD'
       EXPORTING
          filename                      = lv_file
       filetype                      = 'ASC'
         HAS_FIELD_SEPARATOR           = ' '
         HEADER_LENGTH                 = 0
         READ_BY_LINE                  = 'X'
         DAT_MODE                      = ' '
         CODEPAGE                      = ' '
         IGNORE_CERR                   = ABAP_TRUE
         REPLACEMENT                   = '#'
         CHECK_BOM                     = ' '
        IMPORTING
         FILELENGTH                    =
         HEADER                        =
        TABLES
          data_tab                      = it_legacy
       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 e000 WITH 'Unable to upload the file'(007).    "Error Message
       endif.

  • Regarding unicode error in gui_upload

    in 4.6c cancel and filename is passed in importing in  download .after unicode checks how to pass cancel in gui_upload and how ever filename is present in exporting parameters in gui_downlaod there is no cancel parameter in gui_download. plz any one have any idea on where  to pass cancel parameters in gui_download
    CALL FUNCTION 'DOWNLOAD'
        IMPORTING
               ACT_FILENAME        = V_pcfile
                    CANCEL              = CANCEL_FLAG

    hi ram, maybe u can check the subrc when u press cancel,i think the value is 9,from there u can proceed to your logic

  • Validation for BDC program

    hi,
    In BDC programe I have to check (or) validate the file path at selection screen events .
    if the selected file is wrong error message should be triggered. how i can do this.
    with regards,
    Srinath

    Hello Reddy,
    In the following example,
    purchase order fields are taken in through a text-file, if the fields do not match the fields of internal table, then just throw an error in GUI_UPLOAD saying , 'FILE CANNOT BE UPLOADED' or say 'UPLOADING FAILED'.
    * STRUCTURE FOR PURCHASE ORDER TABLE                                  *
    TYPES:
      BEGIN OF type_s_mat,
        eeind TYPE rm06b-eeind,            " Delivery Date
        txz01 TYPE eban-txz01,             " Short Text
        menge TYPE eban-menge,             " Quantity
        meins TYPE eban-meins,             " Units
        preis TYPE eban-preis,             " Price
      END OF type_s_mat.                   " BEGIN OF TYPE_S_MAT
    * FIELD STRING FOR PURCHASE ORDER TABLE                               *
    DATA:
      fs_mat TYPE type_s_mat.
    * INTERNAL TABLE FOR PURCHASE ORDER TABLE                             *
    DATA:
         t_mat LIKE
      STANDARD TABLE
            OF fs_mat.
    * INTERNAL TABLE FOR BATCH DATA TRANSFER                              *
    DATA:
         t_bdc TYPE
      STANDARD TABLE
            OF bdcdata
          WITH HEADER LINE.
    * INTERNAL TABLE FOR MESSAGES                                         *
    DATA:
    t_messages TYPE
      STANDARD TABLE
            OF bdcmsgcoll
          WITH HEADER LINE.
    * Work Variables                                                      *
    DATA:
      w_filename TYPE rlgrap-filename,     " Selected File-Name
      w_msg(72) TYPE c,                    " Messages
      w_filename1 TYPE string.             " Full-Path
    *      INITIALIZATION                                                 *
    INITIALIZATION.
      PARAMETERS p_file(128).              " Name of File to be opened
    *      AT SELECTION-SCREEN ON VALUE-REQUEST                           *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM open_mat_file.
      p_file = w_filename.
    *      START-OF-SELECTION                                             *
    START-OF-SELECTION.
      IF p_file IS INITIAL.
        MESSAGE 'No File Selected' TYPE 'S' DISPLAY LIKE 'E'.
      ELSE.
        PERFORM open_file.
      ENDIF.                               " IF P_FILE IS INITIAL
    *&      Form  open_mat_file
    * This Subroutine opens Material File of the Presentation Server.
    * This Subroutine has got no Interface Parameters.
    FORM open_mat_file .
      CALL FUNCTION 'F4_FILENAME'
    * EXPORTING
    *   PROGRAM_NAME        = SYST-CPROG
    *   DYNPRO_NUMBER       = SYST-DYNNR
    *   FIELD_NAME          = ' '
       IMPORTING
         file_name          = w_filename.
    ENDFORM.                               " FORM OPEN_MAT_FILE
    *&      Form  open_file
    * This Subroutine facilitates file upload on Presentation Server.
    * This Subroutine has got no Interface Parameters.
    FORM open_file .
      w_filename1 = w_filename.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
         filename                      =  w_filename1
         filetype                      = 'ASC'
    *     has_field_separator           = ' '
    *    HEADER_LENGTH                 = 0
    *    READ_BY_LINE                  = 'X'
    *    DAT_MODE                      = ' '
    *    CODEPAGE                      = ' '
    *    IGNORE_CERR                   = ABAP_TRUE
    *    REPLACEMENT                   = '#'
    *  IMPORTING
    *    FILELENGTH                    =
    *    HEADER                        =
        TABLES
          data_tab                     = t_mat
       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 'Uploading Failed'  TYPE 'S' DISPLAY LIKE 'E'.
      ELSE.
        PERFORM populating_bdc.
      ENDIF.                               " IF SY-SUBRC NE 0
    ENDFORM.                               " FORM OPEN_FILE
    *&      Form  populating_bdc
    * This Subroutine Populates data in Transaction ME51
    * This Subroutine has got no Interface Parameters.
    FORM populating_bdc .
      LOOP AT t_mat INTO fs_mat.
        PERFORM screens USING 'SAPMM06B' '0100'.
        PERFORM fields USING 'EBAN-BSART' 'NB'.
        PERFORM fields USING 'EBAN-KNTTP' 'X'.
        PERFORM fields USING 'RM06B-LPEIN' 'T'.
        PERFORM fields USING 'RM06B-EEIND' fs_mat-eeind.
        PERFORM fields USING 'EBAN-WERKS' '1000'.
        PERFORM fields USING 'EBAN-EKGRP' '100'.
        PERFORM fields USING 'EBAN-MATKL' '006'.
        PERFORM fields USING 'BDC_OKCODE' '/00'.
        PERFORM screens USING 'SAPMM06B' '0106'.
        PERFORM fields USING 'EBAN-TXZ01' fs_mat-txz01.
        PERFORM fields USING 'EBAN-MENGE' fs_mat-menge.
        PERFORM fields USING 'EBAN-MEINS' fs_mat-meins.
        PERFORM fields USING 'BDC_OKCODE' '/00'.
        PERFORM screens USING 'SAPMM06B' '0102'.
        PERFORM fields USING 'EBAN-PREIS' fs_mat-preis.
        PERFORM fields USING 'BDC_OKCODE' '/00'.
        PERFORM screens USING 'SAPMM06B' '0505'.
        PERFORM fields USING 'COBL-KOSTL' '1000'.
        PERFORM fields USING 'BDC_OKCODE' '/00'.
        PERFORM screens USING 'SAPMM06B' '0106'.
        PERFORM fields USING 'BDC_OKCODE' 'BU'.
        CALL TRANSACTION 'ME51' USING t_bdc MODE 'A' MESSAGES INTO
        t_messages.
        IF sy-subrc EQ 0.
          LOOP AT t_messages.
            CALL FUNCTION 'FORMAT_MESSAGE'
              EXPORTING
                id        = t_messages-msgid
                lang      = sy-langu
                no        = t_messages-msgnr
                v1        = t_messages-msgv1
                v2        = t_messages-msgv2
                v3        = t_messages-msgv3
                v4        = t_messages-msgv4
              IMPORTING
                msg       = w_msg
              EXCEPTIONS
                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.
            ELSE.
              WRITE:/ w_msg.
            ENDIF.                         " IF SY-SUBRC <> 0
          ENDLOOP.                         " LOOP AT T_MAT INTO FS_MAT
        ENDIF.                             " IF SY-SUBRC EQ 0
      ENDLOOP.                             " LOOP T_MAT INTO FS_MAT
    ENDFORM.                               " FORM POPULATING_BDC
    *&      Form  screens
    * This Subroutine populates program name and screen numbers.
    *      -->VALUE(P_PROG)   PROGRAM NAME
    *      -->VALUE(P_SCRNO)  SCREEN NUMBER
    FORM screens USING value(p_prog) value(p_scrno).
      t_bdc-program = p_prog.
      t_bdc-dynpro = p_scrno.
      t_bdc-dynbegin = 'X'.
      APPEND t_bdc.
    ENDFORM.                               " FORM SCREENS
    *&      Form  fields
    * This Subroutine populates Field Value and Field name
    *      -->VALUE(P_FNAM)  Field Name
    *      -->VALUE(P_FVAL)  Field Value
    FORM fields USING value(p_fnam) value(p_fval).
      t_bdc-fnam = p_fnam.
      t_bdc-fval = p_fval.
      APPEND t_bdc.
    ENDFORM.                               " FORM FIELDS
    Hope the above given example, helps you.
    Thanks: Zahackson

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

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

  • GUI_UPLOAD error

    Hi,
    I am getting a dump error while using the FM GUI_UPLOAD, i am using the FM KD_GET_FILENAME_ON_F4 to get the file name and the Parameter is defined as parameters: p_pcfile type rlgrap-filename. The error is  CALL_FUNCTION_CONFLICT_TYPE
    CX_SY_DYN_CALL_ILLEGAL_TYPE
    Is there any other way to over come this issue.
    Thanks
    Kumar

    hi check this simple example.....
    send the file to a string before giving it to the gui_upload.
    REPORT  ZVENKATTEST0.
    data: begin of itab occurs 0,
          a type c,
          c type c,
          b type i,
          end of itab.
    itab-a = 'a' .
    itab-c = ':'.
    itab-b = 1 .
    append itab .
    itab-a = 'b' .
    itab-c = ':'.
    itab-b = 2 .
    append itab .
    itab-a = 'c' .
    itab-c = ':'.
    itab-b = 3 .
    append itab .
    data: file type string .
    file = 'C:\Documents and Settings\venkatapp\Desktop\testing1.txt'.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                        = file
       FILETYPE                        = 'ASC'
       WRITE_FIELD_SEPARATOR           = ':'
      TABLES
        DATA_TAB                        = itab.

  • Error in background on GUI_UPLOAD.

    Hi,
    If i run a report in background which contains the function module : GUI_UPLOAD it is getting the error message as 'Error uploading C:\Documents and Settings\...' .
    do the gui_upload wont execute in background?.
    Please suggest.
    Usefull anwers will be rewarded.
    Neslin.

    Hi
      The GUI Upload and GUI download FMs are used only when the program is executed in the foreground only.
       If we have to use the GUI download in the background u have to first create a program such that the file from the presentation server is trannsferred to the application server through the help of the dataset statements.
      Then on onwards your program would be executed in the background succesfully.
    Regards
    Rajesh.

  • FM GUI_UPLOAD gives PC036 "Error when opening the download file".

    Dear all
    I'm having a problem with a particular PC.
    A program which calls FM GUI_UPLOAD gives the error PC036 "Error when opening the download file".
    The file we are trying to upload is a text file, with tab delimiter.
    If the same user executes the same program from another PCs, it works fine.
    If another user executes the program in the "problematic" PC, it gives the error.
    So, the problem is PC-related.
    I checked SAP GUI Codepage, and was the same as other PCs.
    I cheched regional configuration, and was also the same as other PCs.
    The operating  system is Windows XP, and the SAP GUI version is 7.10,  File version 7100.2.7.3077, Build 967944 , Patch level 7.
    SAP version is ECC6.
    I searched across forums, SAP note, and the web, but I couldn't find anything.
    I would be grateful if someone could give me ideas.
    Thanks in advance
    Jordi

    Hello. The user accounts are have same privilegies (like both are "Power users")? Also the file system are the same in both PC NTFS or FAT32 (today i'm find FAT32 in enterprise ) If NTFS may be some Domain politics are not allow to save file correctly, or space are not enough....Try check this first...Regards.

  • FTP using GUI_UPLOAD file.Its showing error like 'FILE NOT AVAIABLE''.

    Hi Friends,
    I am calling a file by FTP using GUI_UPLOAD file.
    Its showing error like 'FILE NOT AVAIABLE''
    Below is my sample code.
    I_FILE = 'FTP://10.121.6.61/IPSM/FILE1.TXT'.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = I_FILE
        FILETYPE                      = 'ASC'
      TABLES
        DATA_TAB                      = IT_TABLE.
    Pls suggest.

    Hi ,
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = '
    172.19.125.2\flat\G1\meeting.txt'
      FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = '#'
    TABLES
        DATA_TAB                      = itab
    Try this .
    With Regards ,
    M.Sreeram .
    Edited by: sreeram manoharan on Feb 11, 2010 12:47 PM

  • FM "GUI_UPLOAD" : Error Message

    Dear All,
    I'm doing one Customer Invoice upload program.
    In the selection screen, I have one parameter to get File path from the users.
    It executes first time without any error.
    I dont change any parameter in the selection screen. I execute this program again. But it shows an information message stating "WRONG PARAMETER: FILE_NAME" and after OK, it shows an error message stating "File is not available". This error is coming from the FM "GUI_UPLOAD".
    I set breakpoint after GUI_UPLOAD. SY-SUBRC = 1. It means "file_open_error = 1".
    Can anyone tell the reason and solution for this problem?
    Points will be rewarded.
    Thanks & Regards,
    Neeraj

    yes u need to assign file name type string ......see the sample code ...........here i have used class 'frontend services' to fetch the file......
    DATA: FILENAME  TYPE STRING,                           "Default File Name
          FILETABLE TYPE FILETABLE,                        "Table Holding Selected Files
          V_RC      TYPE I,                                "Return Code, Number of Files or -1 If Error Occurred
          V_FILE TYPE STRING.                              "
    FILENAME = 'C:\Documents and Settings\ramyav\Desktop\raam.txt'..
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
      EXPORTING
       WINDOW_TITLE            =
       DEFAULT_EXTENSION       =
        DEFAULT_FILENAME        = FILENAME
       FILE_FILTER             =
       WITH_ENCODING           =
       INITIAL_DIRECTORY       =
       MULTISELECTION          =
      CHANGING
        FILE_TABLE              =  FILETABLE
        RC                      =  V_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 <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF SY-SUBRC = 0.
      READ TABLE FILETABLE INDEX 1 INTO V_FILE.
    ENDIF.
    IF V_RC = 1.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                      = V_FILE
         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            = VIRUS_SCAN_PROFILE
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    = FILELENGTH
      HEADER                        = HEADER
        TABLES
          DATA_TAB                      = IT_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.
    ENDIF.
    reward points if helpful

  • GUI_UPLOAD error when reading PDF

    Hi,
    I am using GUI_UPLOAD to read a PDF and store it against a material number. When I go into MM03 to view all the attachments it shows that it is there but when I try to open it an error appears stating 'There was an error opening this document. The file is damaged and could not be repaired.' I have done the same process with other types of documents and it works fine. The problem is only for PDF. Any assistance in this would be truly appreciated.
    Kind regards,
    Neera

    Hi
    Refer this link. You will find the <b>procedure to upload PDF files</b> in <b> page  7</b>.
    <a href=" https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8046aa90-0201-0010-5e99-962948c83331">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8046aa90-0201-0010-5e99-962948c83331</a>
    Regards
    Raj

Maybe you are looking for