下載內表資料到excel
FORM excel_data .
DATA:
l_filename TYPE string,
l_path TYPE string,
l_fullpath TYPE string,
l_title TYPE string.
l_title = '開票資訊下載'.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = l_title
default_extension = 'xls'
default_file_name = l_title
file_filter = '(電子表格EXCEL)'
CHANGING
filename = l_filename
path = l_path
fullpath = l_fullpath
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
STOP.
ENDIF.
DATA x_filename LIKE rlgrap-filename.
WRITE l_fullpath TO x_filename.
DATA: BEGIN OF itab_field OCCURS 0,
fname(40) TYPE c ,
END OF itab_field.
DATA: BEGIN OF lt_tab OCCURS 0,
kpsqh(12),
zcxdd(5),
tzkpfs(10),
datum(8),
uname(12),
kzwij(13),
zkpyq(100),
kunag(10),
name1(10),
extension1(40),
extension2(40),
remark(50),
zshr(12),
zshrq(8),
zswfph(30),
zkpbz(40),
zkpr(12),
zkpsj(8),
zkdgs(10),
zkddh(20),
zjjrq(8),
END OF lt_tab.
itab_field-fname = '開票申請號'.
APPEND itab_field.
itab_field-fname = '促銷分開'.
APPEND itab_field.
itab_field-fname = '開票方式'.
APPEND itab_field.
itab_field-fname = '申請日期'.
APPEND itab_field.
itab_field-fname = '申請人'.
APPEND itab_field.
itab_field-fname = '金額'.
APPEND itab_field.
itab_field-fname = '開票特殊要求'.
APPEND itab_field.
itab_field-fname = '客戶'.
APPEND itab_field.
itab_field-fname = '客戶描述'.
APPEND itab_field.
itab_field-fname = '稅務發票收件人'.
APPEND itab_field.
itab_field-fname = '稅務發票收件電話'.
APPEND itab_field.
itab_field-fname = '稅務發票收件地址'.
APPEND itab_field.
itab_field-fname = '稽核人'.
APPEND itab_field.
itab_field-fname = '稽核日期'.
APPEND itab_field.
itab_field-fname = '稅務發票號'.
APPEND itab_field.
itab_field-fname = '開票備註'.
APPEND itab_field.
itab_field-fname = '開票人'.
APPEND itab_field.
itab_field-fname = '開票時間 '.
APPEND itab_field.
itab_field-fname = '快遞公司'.
APPEND itab_field.
itab_field-fname = '快遞單號'.
APPEND itab_field.
itab_field-fname = '寄件日期'.
APPEND itab_field.
LOOP AT it_tab.
MOVE-CORRESPONDING it_tab TO lt_tab.
APPEND lt_tab.
CLEAR lt_tab.
ENDLOOP.
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = x_filename
data_sheet_name = '開票資訊'
create_pivot = 0
TABLES
data_tab = lt_tab
fieldnames = itab_field
EXCEPTIONS
file_not_exist = 1
filename_expected = 2
communication_error = 3
ole_object_method_error = 4
ole_object_property_error = 5
invalid_filename = 6
invalid_pivot_fields = 7
download_problem = 8
OTHERS = 9.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90072/viewspace-1035452/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 上傳資料到內表
- Java 匯入資料到Excel並提供檔案下載介面JavaExcel
- excel導資料到PostgresqlExcelSQL
- PHP匯出大量資料到excel表格PHPExcel
- 從EXCEL匯入資料到SQL SERVERExcelSQLServer
- [pb]從excel匯入資料到datawindowExcel
- 寫資料到本地EXCEL的模板中去Excel
- 使用Spark載入資料到SQL Server列儲存表SparkSQLServer
- Vue匯出資料到Excel電子表格VueExcel
- Python批量匯入Excel資料到MySQLPythonExcelMySql
- 【Mysql】匯出資料到excel檔案中MySqlExcel
- 從OSS裝載資料到PostgreSQLSQL
- C#快速匯出百萬級資料到Excel方法C#Excel
- 利用Excel匯入資料到SAP C4CExcel
- SQL通過bcp匯出資料到excel檔案SQLExcel
- 用Perl從oracle匯出百萬級資料到excelOracleExcel
- Java 下載 Excel模板JavaExcel
- post方法下載excelExcel
- 下載內表到本地.CSV檔案中
- asp.net中利用NPOI匯出資料到excel中ASP.NETExcel
- SQLServer插入資料到有自增列的表SQLServer
- 使用外部表關聯MySQL資料到OracleMySqlOracle
- django下載excel,使用django-excel外掛DjangoExcel
- 使用Excel匯入資料到SAP Cloud for Customer系統ExcelCloud
- Flink同步Kafka資料到ClickHouse分散式表Kafka分散式
- 【帶資訊的Excel模板下載】Excel
- 用smartupload下載excel,excel全為亂碼!Excel
- Excel資料透視表怎麼做 Excel資料透視表技巧Excel
- Excel 表匯入資料Excel
- 將內表下載到網頁,並開啟網頁:網頁
- 匯入表的部分資料到測試環境
- 使用Direct-Path INSERT插入資料到表中
- ASP.NET 匯出gridview中的資料到Excel表中,並對指定單元格換行操作ASP.NETViewExcel
- 前端方式實現excel下載前端Excel
- csv和excel讀取和下載Excel
- Excel下載的檔名問題Excel
- ajax請求下載excel檔案Excel
- ABAP 動態備份自建表資料到新表(自建表有資料的情況下要改欄位長度或者其他)