Download Excel
SM30 provided standard function for export data to excel, Path: Menu->Table View->Export File->Contents;
or you can copy standard function for your own button in PAI as following.
module zuser_command input.
case function.
when 'ZDOWN'.
data(lo_excel_download2) = cl_svim_excel_download=>get_instance(
exporting
iv_vim_called_by = vim_called_by_cluster
iv_object_type = vim_object_type
iv_object_name = conv #( vim_view_name )
iv_text_table = abap_true ).
try.
call method lo_excel_download2->if_svim_excel_download~download_view_content
exporting
it_vim_total = total[]
it_vim_header = x_header[]
it_vim_namtab = x_namtab[].
catch cx_svim_download_error.
" Error in excel download
endtry.
when others.
endcase.
endmodule.
upload Excel
Attention: this upload is a direct replace of screen data, require manual save at last.
case function.
when 'ZUPLOAD'.
* convert data from excel to <ft_table>.
extract[] = <ft_table>.
total[] = <ft_table> .
maxlines = tctrl_(table_name)-lines = lines( extract[] ).
<status>-upd_flag = abap_true.
when others.
endcase.