DATA: file_path TYPE string.
DATA: len TYPE i.
file_path = l_file.
TRANSLATE file_path TO UPPER CASE.
len = STRLEN( file_path ) - 3.
CLEAR tabi.
IF file_path+len(3) = 'XLS'.
break slopes.
DATA t_excel TYPE alsmex_tabline OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = l_file
i_begin_col = 1
i_begin_row = 1
i_end_col = 2
i_end_row = 50
TABLES
intern = t_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
LOOP AT t_excel.
CASE t_excel-col.
WHEN 1.
s_tabi-matnr = t_excel-value.
WHEN 2.
s_tabi-erfmg = t_excel-value.
ENDCASE.
AT END OF row.
APPEND s_tabi to tabi.
CLEAR s_tabi.
ENDAT.
ENDLOOP.
ELSE.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = file_path
filetype = 'ASC'
has_field_separator = 'X'
CHANGING
data_tab = tabi.
ENDIF.
Subscrever:
Enviar feedback (Atom)
Sem comentários:
Enviar um comentário