Skip to Content
avatar image
Former Member

Problem with CALL METHOD cl_gui_frontend_services=>gui_upload

Hello

I am a beginner in abap and I have a generic type declaration problem when I want to CALL METHOD cl_gui_frontend_services=>gui_uploadn

Could some one please help me out and with this? Thank you for your input.

Nadin.

FORM ada_pc_file_in_itab_stellen
             TABLES     ft_itab                 TYPE STANDARD TABLE
              USING  value(fw_filename) TYPE c     
                     value(fw_filetype)        TYPE c      
                     value(fw_popup)           TYPE c     
                     value(fw_ausgabe_art) TYPE c  
           CHANGING  fw_subrc               LIKE sy-subrc        
                                    fw_lines           LIKE w_lines.        

  DATA: lw_filename TYPE string.
  DATA: lw_filetype  TYPE char10.
  DATA: lt_itab         LIKE any table. 

  lw_filename  = fw_filename.
  lw_filetype   = fw_filetype.
  lt_itab          = ft_itab.
    
CALL METHOD cl_gui_frontend_services=>gui_upload      
          EXPORTING
            filename                     = lw_filename
            filetype                       = lw_filetype

          CHANGING
            data_tab                     = ft_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
          not_supported_by_gui    = 17
          error_no_gui                   = 18
          OTHERS                          = 19.
ENDFORM.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Aug 17, 2007 at 01:46 PM

    I think that you should simply pass the FT_ITAB to the method call. No reason to put it in a local variable before passing.

    
      call method cl_gui_frontend_services=>gui_upload
                exporting
                  filename                     = lw_filename
                  filetype                       = lw_filetype
                changing
                  data_tab                     = ft_itab         "<--- CHange this
    
    

    Regards,

    RIch Heilman

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 17, 2007 at 02:04 PM

    Hi,

    Check this

    report  z0002.
    data: ft_itab  type filetable..
    data: lw_filename type string.
    data: lw_filetype  type char10.
    
    call method cl_gui_frontend_services=>gui_upload
      exporting
        filename                = lw_filename
        filetype                = lw_filetype
      changing
        data_tab                = ft_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
        not_supported_by_gui    = 17
        error_no_gui            = 18
        others                  = 19.
    

    aRs

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hello Nadin

      I think I simply replaced the GUI_UPLOAD function module this way:

      *&---------------------------------------------------------------------*
      *& Report  ZUS_SDN_UC_SSM_GUI_UPLOAD
      *&
      *&---------------------------------------------------------------------*
      *&
      *&
      *&---------------------------------------------------------------------*
      
      REPORT  zus_sdn_uc_ssm_gui_upload.
      
      
      
      DATA:
        gt_knb1        TYPE STANDARD TABLE OF knb1.
      
      
      
      START-OF-SELECTION.
      
      
        PERFORM gui_upload TABLES gt_knb1.
      
      
      
      END-OF-SELECTION.
      *&---------------------------------------------------------------------*
      *&      Form  GUI_UPLOAD
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      *      -->P_GT_KNB1  text
      *----------------------------------------------------------------------*
      FORM gui_upload
                  TABLES   ft_itab.
        "            TABLES   ft_itab  TYPE TABLE.          " syntax ok
        "            TABLES   ft_itab  TYPE STANDARD TABLE. " snytax ok
      * define local data
      
      ...
        CALL METHOD cl_gui_frontend_services=>gui_upload
          EXPORTING
            filename                = 'C:tempfile.txt'
      *      FILETYPE                = 'ASC'
      *      HAS_FIELD_SEPARATOR     = SPACE
      *      HEADER_LENGTH           = 0
      *      READ_BY_LINE            = 'X'
      *      DAT_MODE                = SPACE
      *      CODEPAGE                = SPACE
      *      IGNORE_CERR             = ABAP_TRUE
      *      REPLACEMENT             = '#'
      *    IMPORTING
      *      FILELENGTH              =
      *      HEADER                  =
          CHANGING
            data_tab                = ft_itab[]  " brackets !!! 
          EXCEPTIONS
            OTHERS                  = 99.
        IF sy-subrc <> 0.
      *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ...
      ENDFORM.                    " GUI_UPLOAD

      Regards

      Uwe

  • avatar image
    Former Member
    Aug 17, 2007 at 02:33 PM

    You may need to specify the table to exclude any header line:

              CHANGING
                data_tab                     = ft_itab[]   "<<<< table body only
    
    

    Andrew

    Add comment
    10|10000 characters needed characters exceeded

    • I think Andrew has it, you can use the [] to specify only the body of the internal table, but it would be a good programming practice to start getting used to defining your internal tables without header lines, because they can not be used within the OO context.

      Regards,

      RIch Heilman