Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7185447
  • 博文数量: 655
  • 博客积分: 10264
  • 博客等级: 上将
  • 技术积分: 8278
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-04 17:47
个人简介

ABAP顾问

文章分类

全部博文(655)

文章存档

2017年(2)

2014年(8)

2013年(3)

2012年(2)

2011年(18)

2010年(102)

2009年(137)

2008年(274)

2007年(134)

分类:

2007-12-07 22:12:09

*&---------------------------------------------------------------------*
*& Report  Z_BARRY_FILE_SELECT
*&
*&---------------------------------------------------------------------*
*& 文件、路径选取模板
*&
*&---------------------------------------------------------------------*
REPORT  z_barry_file_select.
TABLES rlgrap.
DATA: gd_path TYPE string.
DATA: it_tab TYPE filetable,
      gd_subrc TYPE i.
DATA: ld_filename TYPE string,
      ld_path TYPE string,
      ld_fullpath TYPE string,
      ld_result TYPE i,
      gd_file TYPE c.
SELECT-OPTIONS openfile FOR rlgrap-filename.
PARAMETERS: savefile TYPE  rlgrap-filename.
PARAMETERS: filepath LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filepath.
  CALL METHOD cl_gui_frontend_services=>directory_browse
    EXPORTING
      window_title    = 'File Directory'
      initial_folder  = 'C:'
    CHANGING
      selected_folder = gd_path.
  CALL METHOD cl_gui_cfw=>flush.
  CONCATENATE gd_path '' INTO filepath.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR openfile-low.
  REFRESH: it_tab.
  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title     = 'Select File'
      default_filename = '*.txt'
      multiselection   = 'X'
    CHANGING
      file_table       = it_tab
      rc               = gd_subrc.
  LOOP AT it_tab INTO openfile-low.
    openfile-sign = 'I'.
    openfile-option = 'EQ'.
    APPEND openfile.
  ENDLOOP.
  CALL METHOD cl_gui_cfw=>flush.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR savefile.
  CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
      default_extension = 'XLS'
      default_file_name = 'accountsdata'
      initial_directory = 'c:\temp\'
    CHANGING
      filename          = ld_filename
      path              = ld_path
      fullpath          = ld_fullpath
      user_action       = ld_result.
  savefile  = ld_fullpath.
阅读(3880) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~