关闭

Choose path to download file .

276人阅读 评论(0) 收藏 举报
分类:
"Definition of data for get download path
DATA : fullpath       TYPE                   string,
       filename       TYPE                   string,
       path           TYPE                   string,
       user_action    TYPE                   i,
       encoding       TYPE                   abap_encoding.
 
IF p_file IS INITIAL.
  CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
      window_title         = 'Gui_Download Demo'
      with_encoding        = 'X'
      initial_directory    = 'D:\SAP'
    CHANGING
      filename             = filename
      path                 = path
      fullpath             = fullpath
      user_action          = user_action
      file_encoding        = encoding
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      OTHERS               = 4.
 
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.
 
  IF user_action <> cl_gui_frontend_services=>action_ok.
    EXIT.
  ENDIF.
 
ELSE.
  fullpath = p_file.
 
ENDIF.
 
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename                = fullpath
    filetype                = 'DAT'
  TABLES
    data_tab                = it_top             " download internal table
  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.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:16326次
    • 积分:382
    • 等级:
    • 排名:千里之外
    • 原创:20篇
    • 转载:11篇
    • 译文:0篇
    • 评论:0条