[英]ABAP: How to write every row of a table into an excel file
我想遍歷一個表並將表中的每一行數據寫入一個 excel 文檔。
LOOP AT IT_Table INTO ST_Table.
IF IT_Table[] IS NOT INITIAL.
DELETE FROM ZLN.
MOVE-CORRESPONDING IT_Table[] TO IT_ZLN[].
MODIFY ZLN FROM TABLE IT_ZLN.
"Code here to write to excel
ENDIF.
ENDLOOP.
FM GUI_DOWNLOAD - 第一個標題,然后附加行。
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = "C:\myexcel.xls"
TABLES
data_tab = lt_hdr.
LOOP AT it_table INTO st_table.
... "here your code
APPEND st_table to it_output.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = "C:\myexcel.xls"
append = 'X' "this will append line to your file
TABLES
data_tab = it_output. "table with one record wich you should collect
CLEAR it_output.
ENDLOOP.
SAP_CONVERT_TO_XLS_FORMAT 可以閱讀有關此 FM 的信息
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.