SAP EP實現檔案下載功能
YsdCompView:
//點選下載按鈕時實現的方法,呼叫WindowsController的方法showPrintDMSWin建立Windows,把相關資訊封裝到selectList上 public void onActionDownload(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent ) { //@@begin onActionDownload(ServerEvent) IPrivateYsdCompView.IQueryResultListNode node = wdContext.nodeQueryResultList(); List selectList = newWindowsController的方法 showPrintDMSWin:
public void showPrintDMSWin( java.util.List selectList )
{
//@@begin showPrintDMSWin()
IWDWindow window = wdContext.currentPrintDMSViewElement().getWinref();
IWDWindowInfo windowInfo=null;
if (window == null) {
/*Getter for element with given name in 1:n aggregation Windows. */
windowInfo = wdComponentAPI.getComponentInfo().findInWindows("PrintDMSWin");
window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
window.setTitle("檢視簽收單");
window.setWindowSize(50,50);
window.setWindowPosition(WDWindowPos.CENTER);
wdContext.currentPrintDMSViewElement().setWinref(window);
}
window.show();
//清空查詢結果
wdContext.nodeFiles().invalidate();
//設定傳入引數
wdContext.currentPrintDMSViewElement().setSelectList(selectList);
wdThis.wdGetYsdCompController().queryDMS(selectList, wdContext.nodeFiles());
//@@end
}
Component Controller:用於遠端呼叫RFC的oper1,輸入引數通過selectList傳遞。
//@@begin javadoc:queryDMS() /** 查詢DMS獲取憑證檔案的二進位制資料. */ //@@end public void queryDMS( java.util.List selectlist, com.sap.tc.webdynpro.progmodel.api.IWDNode node ) { //@@begin queryDMS() Zewm_Rfc_Dms_Download2_Input input = new Zewm_Rfc_Dms_Download2_Input(); for (int i = 0; i < selectlist.size(); i++) { IPrivateYsdCompView.IQueryResultListElement element = (IPrivateYsdCompView.IQueryResultListElement)selectlist.get(0); input.setIp_Oper("1"); input.setIp_Documentnumber("000000000000000"+element.getSignid()); } Zewm_Rfc_Dms_Download2_Output output = wdThis.wdGetRfcControllerController().excute_ZTM_RFC_DMS_DOWNLOAD2(input); if (output != null && wdThis.wdGetRfcControllerController().handleBapiret(output.getEp_Return())) { List reports = output.getTb_Report(); int size = reports.size(); if (size > 0) { for (int i = 0; i < size; i++) { Zdms_File_Info2 obj = (Zdms_File_Info2)reports.get(i); IWDNodeElement newEle = node.createElement(); WDCopyService.copyCorresponding(obj, newEle); node.addElement(newEle); } } } //@@end }YsdCompView://點選檢視檔案則將呼叫了printDMSView的方法:onActionseeFile
public void onActionseeFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent ) { //@@begin onActionseeFile(ServerEvent) List itemList = new ArrayList(); IWDNodeElement ele = wdContext.nodeFiles().getCurrentElement(); if (null == ele) { wdComponentAPI.getMessageManager().reportWarning("沒有檔案"); } else { wdComponentAPI.getMessageManager().reportSuccess("start download!"); itemList.add(ele); if (ele.getAttributeAsText("Storagecategory").equals("")) { wdComponentAPI.getMessageManager().reportWarning("沒有檔案"); }else{ InputStream inputStream = wdThis.wdGetYsdCompController().getDMS(itemList); //呼叫getDMS方法實際上是遠端呼叫了RFC操作2,把操作1得到的資訊變成操作流,從而實現下載 if(inputStream == null){ wdComponentAPI.getMessageManager().reportWarning("沒有檔案"); }else{ String fileName = wdContext.currentFilesElement().getFilename(); String fileType = wdContext.currentFilesElement().getFiletype(); wdThis.wdGetCOMP_EXCELInterface().showDMSFileWin(inputStream,fileName,fileType);//執行下載 } } } //@@end }Component Controller:
//@@begin javadoc:getDMS() /** 根據憑證檔案的二進位制檔案獲取DMS的IO流. */ //@@end public java.io.InputStream getDMS( java.util.List selectlist ) { //@@begin getDMS() InputStream inputStream = null; Zewm_Rfc_Dms_Download2_Input input = new Zewm_Rfc_Dms_Download2_Input(); for (int i = 0; i < selectlist.size(); i++) { IPrivatePrintDMSView.IFilesElement element = (IPrivatePrintDMSView.IFilesElement)selectlist.get(i); input.setIp_Oper("2"); input.setIp_Storagecategory(element.getStoragecategory()); input.setIp_File_Id(element.getFile_Id()); } Zewm_Rfc_Dms_Download2_Output output = wdThis.wdGetRfcControllerController().excute_ZTM_RFC_DMS_DOWNLOAD2(input); if (output != null && wdThis.wdGetRfcControllerController().handleBapiret(output.getEp_Return())) { byte[] bytes = output.getEp_Content(); try { inputStream = new ByteArrayInputStream(bytes); } catch(Exception e){ e.printStackTrace(); } wdComponentAPI.getMessageManager().reportSuccess(inputStream.toString()); return inputStream; }else { return null; } //@@end }COMP_EXCEL:
//@@begin javadoc:showExportExcelWin() /** 下載指定模版 */ //@@end public void showExportExcelWin( com.sap.tc.webdynpro.services.sal.datatransport.api.IWDResource excelInput, java.lang.String filename ) { //@@begin showExportExcelWin() wdContext.currentContextElement().setExportexcelresource(excelInput); wdContext.currentContextElement().setExportexcelfilename(filename); IWDWindowInfo exportExcelWinInfo = wdComponentAPI.getComponentInfo().findInWindows("ExportExcelWin"); IWDWindow exportExcelWin = wdComponentAPI.getWindowManager().createModalWindow(exportExcelWinInfo); exportExcelWin.setTitle("下載"); exportExcelWin.setWindowSize(150, 80); exportExcelWin.setWindowPosition(WDWindowPos.CENTER); wdContext.currentContextElement().setExportexcelwinref(exportExcelWin); exportExcelWin.show(); //@@end }相關推薦
SAP EP實現檔案下載功能
YsdCompView://點選下載按鈕時實現的方法,呼叫WindowsController的方法showPrintDMSWin建立Windows,把相關資訊封裝到selectList上 public void onActionDownload(com.sap.tc.webdynpro.progmode
Spring 實現檔案下載功能
方式1: public void download(HttpServletResponse response,@RequestParam(value="params") String params) throws IOException, DocumentException{ response
Spring Boot實現檔案下載功能
我們只需要建立一個控制器(Controler)檔案,即Controller目錄下的File_Download.java,其完整目錄如下: @Controller public class File_Download { //實現Spring Boot 的檔案下載功能,對映網址為/download
SpringMVC實現檔案下載功能(檔案匯出功能)
1.頁面程式碼 <a class="layui-btn" href="${pageContext.request.contextPath}/bAndWListManage/downloadWhiteListTmp.do" onclick="downloadTempla
Android Webview實現檔案下載功能
在做美圖欣賞Android應用的時候,其中有涉及到Android應用下載的功能,這個應用本身其實也比較簡單,就是通過WebView控制呼叫相應的WEB頁面進行展示。剛開始以為和普通的檔案下載實現,只需要一個連結,然後點選就可以實現下載了,可是放到手機上試的時候,點選下載
Spring Boot入門(11)實現檔案下載功能
在這篇部落格中,我們將展示如何在Spring Boot中實現檔案的下載功能。 還是遵循筆者寫部落格的一貫風格,簡單又不失詳細,實用又能讓你學會。 本次建立的Spring Boot專案的主要功能為檔案下載,而且這也是唯一功能,當然,作為例子,要儘可
Java後臺實現檔案下載功能
專案中使用的框架是SpringMVC+MyBatis 在專案中需要做一個功能。就是一個報表。然後根據報表生成一個csv格式的檔案。然後進行壓縮。並提供下載功能。 該“Excel下載” 功能的業務邏輯是當點選該按鈕。則需要把報表頁面上顯示的資料進行生成一個
java web Servlet--實現檔案下載功能
先上一段原始碼,這一段檔案下載,是在 Servlet 上面實現的。package util; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import j
django 實現檔案下載功能
一、概述 在實際的專案中很多時候需要用到下載功能,如導excel、pdf或者檔案下載,當然你可以使用web服務自己搭建可以用於下載的資源伺服器,如nginx,這裡我們主要介紹django中的檔案下載。 前端實現方式 a標籤+響應頭資訊 <a href="/download/1/">下
java實現檔案下載功能,自動彈出儲存視窗
public void download() { String filePath = this.queueService.getCsvFilePathById(id); try { File file = new Fi
WebView實現檔案下載功能
WebView控制呼叫相應的WEB頁面進行展示。當碰到頁面有下載連結的時候,點選上去是一點反應都沒有的。原來是因為WebView預設沒有開啟檔案下載的功能,如果要實現檔案下載的功能,需要設定WebView的DownloadListener,通過實現自己的DownloadLi
如何實現檔案下載功能
1 如何實現檔案下載實現檔案下載有兩種方式(1)使用超連結標籤,即<a href=""></a>標籤就可以(2)使用伺服器端編碼的形式2 以上兩種方式的區別(1)使用超連結標籤確實可以實現檔案下載,但是存在問題,我在這裡說一下,道友們也可以自己嘗試,當
Android開發中使用FileDownloader來實現檔案下載功能(總結一)
今天研究了一下Android開發中檔案下載功能,記錄一下。這篇部落格主要介紹第三方下載外掛:FileDownloader的單任務的使用方法,至於多工的後面會做補充記錄,再寫一篇博文。效果圖如下:(虛擬機器連不上網)1、首先是引用方法:implementation 'com.l
java—servlet實現檔案下載功能
最近在學javaweb技術,利用所學知識做了一個簡單的專案,在伺服器上實現給使用者下載檔案的功能。自動列出資料夾下的檔案提供下載,支援中文檔名。 結果圖 其中使用了tomcat來部署伺服器,程式碼中應用了少許EL表示式和JSTL標籤,使用了jsp和servl
spring4mvc 實現檔案下載功能reponse.getOutputStream()重複呼叫問題解決
本來是準備做一個類似網路硬碟的功能,判斷目標是檔案的時候,點選就啟動下載。 誰想遇到了不少麻煩,最直接的麻煩就是遇到了response.getOutputStream()重複使用的異常。。雖然對功能沒有影響,但是這個報錯的異常始終看著不舒服,百度上搜索了一大圈,總是說什麼g
java後臺實現excel檔案下載功能
java中對於excel檔案的操作,有讀取,寫入,上傳等功能,在對excel檔案進行操作時,為了讓使用者更加直觀的製作excel資料,必然會有下載模板excel檔案功能, 這裡以學生基本資訊模板excel檔案為例,實現對指定路徑下的excel檔案進行下載的後臺程式碼。
PHP檔案下載功能 在ThinkPHP中實現步驟
下載功能 1.如果是其他檔案,直接在a標籤的href屬性中填寫路徑,可以下載。 2.如果是一個圖片檔案,那麼直接在a標籤的href屬性中,填寫路徑是不能進行下載。 那麼需要進行一下操作步驟: &nb
java實現word、pdf檔案下載功能
在SpringMVC的開發過程中,有時需要實現文件的下載功能。文件的下載功能涉及到了java IO流操作的基礎知識,下面本文詳細介紹java如何實現後臺文件下載功能。 首先根據文件在專案中的儲存路徑建立File物件,並獲取文件的名稱和字尾。判斷瀏覽器型別,防止
基於HTTP的多執行緒檔案下載功能實現
思想 檔案資訊獲取的獲取方式與單執行緒的方式一樣 與單執行緒相比不同的是將遠端檔案分塊併發獲取,然後再併發寫入到本地暫存檔案中 遠端檔案分塊的實現依據是:connection.setRequestProperty(“Range”,”bytes=”+start
用loadrunner實現excel檔案下載功能的錄製及校驗
按照普通方式錄製指令碼,指令碼成功錄製後,需要做以下操作 1。定義變數: long file; long pr; int flen; 2。手工關聯: web_reg_save_param("pr","LB=","RB=","SEARCH=BODY",LAST); 第一個引數