点击(此处)折叠或打开
- form data_upload.
- data: ls_excel type zalsmex_tabline,
- lt_excel type table of zalsmex_tabline.
- data: lv_idx like sy-tabix.
- field-symbols: <lv_value> type any.
- if p_path is initial.
- message s000(z1) with '请输入上传文件名!' display like 'E'.
- leave list-processing.
- endif.
- call function 'ZALSM_EXCEL_TO_INTERNAL_TABLE2'
- exporting
- filename = p_path
- i_begin_col = 1
- i_begin_row = 2
- i_end_col = 10
- i_end_row = 65536
- tables
- intern = lt_excel
- exceptions
- inconsistent_parameters = 1
- upload_ole = 2
- others = 3.
- if sy-subrc <> 0.
- message id sy-msgid type sy-msgty number sy-msgno
- with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
- endif.
- sort lt_excel by row col.
- loop at lt_excel into ls_excel.
- lv_idx = ls_excel-col.
- assign component lv_idx of structure gs_itab to <lv_value>.
- <lv_value> = ls_excel-value.
- at end of row.
- append gs_itab to gt_itab.
- clear gs_itab.
- endat.
- endloop.
- endform.