建立一個Destination,類型為HTTP,再添加三個額外的Properties,其中WebIDEUsage設定為odata_gen:
其中WebIDEUsage屬性的值,除了odata_gen之外,還有odata_abap,ui5_execute_abap等選擇。
關于這些值的差別,參考SAP幫助文檔:
Values for the WebIDEUsage property determine how the SAP Web IDE interprets the destination definition & presents it to you for connection and consumption. The value odata_gen signifies that the destination represents generic OData services (as opposed to OData services that are hosted on an SAP Gateway system, for example) and that the full, specific OData service URL specification is to be provided in the SAP Web IDE New Project wizard, specifically via the Service URL data connection source, as shown in this example scenario:https://help.sap.com/viewer/825270ffffe74d9f988a0f0066ad59f0/CF/en-US/5c3debce758a470e8342161457fd6f70.html
WebIDE裡建立一個UI5應用,基于模闆SAP Fiori Worklist Application建立。
維護項目明細:
選擇這個Fiori應用基于的OData服務,從Service Url的下拉菜單裡,選中之前建立的Destination:
這裡我們需要手動補全OData服務的url:
/V2/Northwind/Northwind.svc
點選Test按鈕,獲得這個OData服務裡包含的data collection:
點選Diagram按鈕可以看到這個OData服務所有的entity和其之間的互相關系:
標明OData服務後,點選下一步,應用類型選擇為Standalone App:
Object Collection選擇Products:
依次維護剩下的屬性,點選Finish:
打開生成的項目檔案,用Layout Editor打開Worklist.view.xml:
找到顯示産品價格機關的空間,将值寫死成USD:
在manifest.json裡維護useBatch為false,這樣可以讓該Fiori應用采用非batch模式消費OData服務。
直接運作,看到該應用能夠正常工作了:
并且在Chrome開發者工具network标簽頁裡,看到該OData服務确實是以非batch模式的方式調用:
本文來自雲栖社群合作夥伴“汪子熙”,了解相關資訊可以關注微信公衆号"汪子熙"。