下載內表到本地.CSV檔案中
form down_load tables gt_down." TYPE gt_data.
data: filename type string value '',
path type string value '',
fullpath type string value ''.
call method cl_gui_frontend_services=>file_save_dialog
exporting
default_extension = 'CSV'
file_filter = '*.CSV'
initial_directory = 'D:'
changing
filename = filename
path = path
fullpath = fullpath
exceptions
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4.
loop at gt_down into wa_down.
if not wa_down-runit is initial.
call function 'CONVERSION_EXIT_CUNIT_OUTPUT'
exporting
input = wa_down-runit
language = sy-langu
importing
* LONG_TEXT =
output = wa_down-runit
* SHORT_TEXT =
exceptions
unit_not_found = 1
others = 2.
endif.
condense wa_down-lcamount.
condense wa_down-tcamount.
condense wa_down-quantity.
modify gt_down from wa_down.
clear wa_down.
endloop.
* CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
* EXPORTING
* I_FIELD_SEPERATOR = ';'
* I_APPL_KEEP = 'X'
* TABLES
* I_TAB_SAP_DATA = gt_down[]
* CHANGING
* I_TAB_CONVERTED_DATA = gt_down1[]
* EXCEPTIONS
* CONVERSION_FAILED = 1
* OTHERS = 2
* .
* IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
data lv_num(6) type c.
data lv_temp(32).
clear: wa_down , wa_down1,lv_temp,lv_num.
clear gt_down1.
refresh gt_down1.
loop at gt_down into wa_down.
clear wa_down1.
write wa_down-period to wa_down1(6).
write ';' to wa_down1+6(1).
write wa_down-rbukrs to wa_down1+7(3).
write ';' to wa_down1+10(1).
write wa_down-segment to wa_down1+11(2).
write ';' to wa_down1+13(1).
write wa_down-blank1 to wa_down1+14(12).
write ';' to wa_down1+26(1).
write wa_down-blank2 to wa_down1+27(12).
write ';' to wa_down1+39(1).
write wa_down-racct to wa_down1+40(12).
write ';' to wa_down1+52(1).
write wa_down-txt50 to wa_down1+53(30).
write ';' to wa_down1+83(1).
write wa_down-bilkt to wa_down1+84(12).
write ';' to wa_down1+96(1).
write wa_down-txt50_ga to wa_down1+97(30).
write ';' to wa_down1+127(1).
write wa_down-rcntr to wa_down1+128(12).
write ';' to wa_down1+140(1).
write wa_down-prctr_text to wa_down1+141(30).
write ';' to wa_down1+171(1).
write wa_down-rfarea to wa_down1+172(12).
write ';' to wa_down1+184(1).
write wa_down-fkbtx to wa_down1+185(30).
write ';' to wa_down1+215(1).
write wa_down-country to wa_down1+216(10).
write ';' to wa_down1+226(1).
write wa_down-product to wa_down1+227(15).
write ';' to wa_down1+242(1).
write wa_down-lcamount to wa_down1+243(20) right-justified.
write ';' to wa_down1+263(1).
write wa_down-quantity to wa_down1+264(20) right-justified.
write ';' to wa_down1+284(1).
write wa_down-runit to wa_down1+285(3).
write ';' to wa_down1+288(1).
write wa_down-rassc to wa_down1+289(33).
write ';' to wa_down1+322(1).
write wa_down-blank3 to wa_down1+323(12).
write ';' to wa_down1+335(1).
write wa_down-tcamount to wa_down1+336(20) right-justified.
write ';' to wa_down1+356(1).
write wa_down-rtcur to wa_down1+357(3).
append wa_down1 to gt_down1.
endloop.
call function 'GUI_DOWNLOAD'
exporting
filename = fullpath
tables
data_tab = gt_down1[]
endform. "down_load[@more@]
data: filename type string value '',
path type string value '',
fullpath type string value ''.
call method cl_gui_frontend_services=>file_save_dialog
exporting
default_extension = 'CSV'
file_filter = '*.CSV'
initial_directory = 'D:'
changing
filename = filename
path = path
fullpath = fullpath
exceptions
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4.
loop at gt_down into wa_down.
if not wa_down-runit is initial.
call function 'CONVERSION_EXIT_CUNIT_OUTPUT'
exporting
input = wa_down-runit
language = sy-langu
importing
* LONG_TEXT =
output = wa_down-runit
* SHORT_TEXT =
exceptions
unit_not_found = 1
others = 2.
endif.
condense wa_down-lcamount.
condense wa_down-tcamount.
condense wa_down-quantity.
modify gt_down from wa_down.
clear wa_down.
endloop.
* CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
* EXPORTING
* I_FIELD_SEPERATOR = ';'
* I_APPL_KEEP = 'X'
* TABLES
* I_TAB_SAP_DATA = gt_down[]
* CHANGING
* I_TAB_CONVERTED_DATA = gt_down1[]
* EXCEPTIONS
* CONVERSION_FAILED = 1
* OTHERS = 2
* .
* IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
data lv_num(6) type c.
data lv_temp(32).
clear: wa_down , wa_down1,lv_temp,lv_num.
clear gt_down1.
refresh gt_down1.
loop at gt_down into wa_down.
clear wa_down1.
write wa_down-period to wa_down1(6).
write ';' to wa_down1+6(1).
write wa_down-rbukrs to wa_down1+7(3).
write ';' to wa_down1+10(1).
write wa_down-segment to wa_down1+11(2).
write ';' to wa_down1+13(1).
write wa_down-blank1 to wa_down1+14(12).
write ';' to wa_down1+26(1).
write wa_down-blank2 to wa_down1+27(12).
write ';' to wa_down1+39(1).
write wa_down-racct to wa_down1+40(12).
write ';' to wa_down1+52(1).
write wa_down-txt50 to wa_down1+53(30).
write ';' to wa_down1+83(1).
write wa_down-bilkt to wa_down1+84(12).
write ';' to wa_down1+96(1).
write wa_down-txt50_ga to wa_down1+97(30).
write ';' to wa_down1+127(1).
write wa_down-rcntr to wa_down1+128(12).
write ';' to wa_down1+140(1).
write wa_down-prctr_text to wa_down1+141(30).
write ';' to wa_down1+171(1).
write wa_down-rfarea to wa_down1+172(12).
write ';' to wa_down1+184(1).
write wa_down-fkbtx to wa_down1+185(30).
write ';' to wa_down1+215(1).
write wa_down-country to wa_down1+216(10).
write ';' to wa_down1+226(1).
write wa_down-product to wa_down1+227(15).
write ';' to wa_down1+242(1).
write wa_down-lcamount to wa_down1+243(20) right-justified.
write ';' to wa_down1+263(1).
write wa_down-quantity to wa_down1+264(20) right-justified.
write ';' to wa_down1+284(1).
write wa_down-runit to wa_down1+285(3).
write ';' to wa_down1+288(1).
write wa_down-rassc to wa_down1+289(33).
write ';' to wa_down1+322(1).
write wa_down-blank3 to wa_down1+323(12).
write ';' to wa_down1+335(1).
write wa_down-tcamount to wa_down1+336(20) right-justified.
write ';' to wa_down1+356(1).
write wa_down-rtcur to wa_down1+357(3).
append wa_down1 to gt_down1.
endloop.
call function 'GUI_DOWNLOAD'
exporting
filename = fullpath
tables
data_tab = gt_down1[]
endform. "down_load[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11011430/viewspace-1017647/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 上傳本地.CSV檔案到內表中
- django下載csv檔案筆記Django筆記
- Android 下載Zip檔案,並解壓到本地Android
- 根據網路連線(檔案連結)下載檔案到本地
- 從github下載專案到本地Github
- jmeter儲存下載的檔案到本地JMeter
- 將csv檔案匯入到neo4j中
- js實現使用檔案流下載csv檔案JS
- 從ASM磁碟中複製檔案到本地檔案系統ASM
- 儲存檔案到本地
- Servlet實現匯出下載csv檔案Servlet
- WKWebView載入本地檔案WebView
- 驅動載入到proc檔案下
- JS實現將文字或JSON內容下載到檔案中JSON
- 使用Vue+go實現前後端檔案的上傳下載,csv檔案上傳下載可直接照搬VueGo後端
- 網頁端直接生成csv檔案供使用者下載網頁
- 把csv檔案的資料匯入到oracle資料庫中Oracle資料庫
- 將libc database下載到本地Database
- PHP下載遠端檔案及獲取檔案內容PHP
- 使用ABAP批量下載Markdown原始檔裡的圖片到本地
- 將 SAP ABAP 內表內容本地匯出成 Excel 檔案試讀版Excel
- 實現簡單的csv檔案上傳和bootstrap表格的下載boot
- 從CSV檔案中讀取jpg圖片的URL地址並多執行緒批量下載執行緒
- aix掛載光碟機並把內容複製到本地硬碟中AI硬碟
- Android下載網路pdf檔案儲存至本地Android
- 將本地檔案傳輸到GitHubGithub
- 將寶塔PHP專案下載到本地部署之nginx配置PHPNginx
- Python通過paramiko從遠處伺服器下載檔案資源到本地Python伺服器
- 本地HTML中圖片下載HTML
- csv是什麼格式檔案 csv檔案是什麼意思
- 將內表下載到網頁,並開啟網頁:網頁
- Modern CSV for mac CSV檔案編輯器Mac
- pandas操作csv檔案
- CSV檔案儲存
- 檔案下載
- Linux中利用csvquote處理csv檔案Linux
- 對於CSV檔案中{,}和{"}的處理
- java方法客戶端下載伺服器上的檔案到本地Java客戶端伺服器