天天看點

SAP call method

  FORM get_data USING    p_file.

* Before getting the path create global object

  CALL METHOD cl_gui_frontend_services=>gui_upload

    EXPORTING

    filename                = p_file

    filetype                = 'DAT'

*    has_field_separator     = SPACE

*    header_length           = 0

*    read_by_line            = 'X'

*    dat_mode                = SPACE

*    codepage                = SPACE

*    ignore_cerr             = ABAP_TRUE

    replacement             = ''

*    virus_scan_profile      =

*  IMPORTING

*    filelength              =

*    header                  =

    CHANGING

      data_tab                = gt_data

    EXCEPTIONS

      file_open_error         = 1

      file_read_error         = 2

      gui_refuse_filetransfer = 4

      invalid_type            = 5

      no_authority            = 6

      unknown_error           = 7

      access_denied           = 13

      not_supported_by_gui    = 17

      error_no_gui            = 18

      OTHERS                  = 19 .

  IF sy-subrc <> 0.

    PERFORM flush.

    MESSAGE ID sy-msgid TYPE 'W' NUMBER sy-msgno

               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

*     MESSAGE e053.

  ENDIF.

ENDFORM.  

繼續閱讀