REPORT zdemo08.
DATA:gs_bin TYPE tbl1024,
gt_bin LIKE TABLE OF gs_bin.
DATA:gv_filename TYPE string,
gv_filelength TYPE i.
PERFORM get_filename USING gv_filename.
CHECK gv_filename IS NOT INITIAL.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gv_filename
filetype = 'BIN'
IMPORTING
filelength = gv_filelength
TABLES
data_tab = gt_bin
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.
DATA:gv_dokar TYPE draw-dokar,
gv_doknr TYPE draw-doknr,
gv_dokvr TYPE draw-dokvr,
gv_doktl TYPE draw-doktl,
gs_msg TYPE messages,
lt_content TYPE TABLE OF drao,
ls_content TYPE drao,
gs_files TYPE cvapi_doc_file,
gt_files LIKE TABLE OF gs_files.
gv_dokar = 'Z01'.
gv_doknr = '10000007268'.
gv_dokvr = '00'.
gv_doktl = '000'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = gv_doknr
IMPORTING
output = gv_doknr.
gs_files-updateflag = 'I'." 复选框
gs_files-appnr = '6'." 应用程序编号
gs_files-dappl = 'XLS'." 应用程序
gs_files-langu = sy-langu." 语言代码
*gs_files-dttrg = 'ZDMS_OTAS'." 数据载体名称
*gs_files-storage_cat = 'ZDMS_OTAS'." 原始文件的库存类别
gs_files-filename = '测试测试1'.
gs_files-checked_in = 'X'.
APPEND gs_files TO gt_files.
ls_content-appnr = '6'.
ls_content-orln = gv_filelength.
LOOP AT gt_bin INTO gs_bin.
ls_content-orblk = gs_bin-line.
ls_content-zaehl = ls_content-zaehl + 1.
APPEND ls_content TO lt_content.
ENDLOOP.
CALL FUNCTION 'CVAPI_DOC_CHECKIN'
EXPORTING
pf_dokar = gv_dokar
pf_doknr = gv_doknr
pf_dokvr = gv_dokvr
pf_doktl = gv_doktl
pf_content_provide = 'TBL'
IMPORTING
psx_message = gs_msg
TABLES
pt_content = lt_content
pt_files_x = gt_files.
WRITE 1.
COMMIT WORK AND WAIT.
*&---------------------------------------------------------------------*
*& Form get_filename
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PV_PATH text
*----------------------------------------------------------------------*
FORM get_filename USING pv_path TYPE string..
DATA : lv_file_filter TYPE string.
DATA : ls_filetable TYPE file_table,
lt_filetable TYPE filetable.
DATA : lv_rc TYPE i.
DATA : lv_user_action TYPE i.
lv_file_filter = '(*.xlsx;*.xls)|*.xlsx;*.xls|'.
cl_gui_frontend_services=>file_open_dialog(
EXPORTING window_title = 'Select file'
file_filter = lv_file_filter
CHANGING file_table = lt_filetable
rc = lv_rc
user_action = lv_user_action ).
CHECK lv_user_action EQ 0.
CHECK lt_filetable[] IS NOT INITIAL.
READ TABLE lt_filetable INTO ls_filetable INDEX 1.
pv_path = ls_filetable-filename.
ENDFORM. " GET_FILENAME
阅读(1092) | 评论(0) | 转发(0) |