使用SAP WebIDE开发SAP Fiori Worklist应用消费OData服务
新建一個Destination,類型為HTTP,再添加三個額外的Properties,其中WebIDEUsage設(shè)置為odata_gen:
其中WebIDEUsage屬性的值,除了odata_gen之外,還有odata_abap,ui5_execute_abap等選擇。
關(guān)于這些值的區(qū)別,參考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應(yīng)用,基于模板SAP Fiori Worklist Application創(chuàng)建。
維護項目明細:
選擇這個Fiori應(yīng)用基于的OData服務(wù),從Service Url的下拉菜單里,選中之前創(chuàng)建的Destination:
這里我們需要手動補全OData服務(wù)的url:
/V2/Northwind/Northwind.svc
點擊Test按鈕,獲得這個OData服務(wù)里包含的data collection:
點擊Diagram按鈕可以看到這個OData服務(wù)所有的entity和其之間的相互關(guān)系:
選定OData服務(wù)后,點擊下一步,應(yīng)用類型選擇為Standalone App:
Object Collection選擇Products:
依次維護剩下的屬性,點擊Finish:
打開生成的項目文件,用Layout Editor打開Worklist.view.xml:
找到顯示產(chǎn)品價格單位的空間,將值硬編碼成USD:
在manifest.json里維護useBatch為false,這樣可以讓該Fiori應(yīng)用采用非batch模式消費OData服務(wù)。
直接運行,看到該應(yīng)用能夠正常工作了:
并且在Chrome開發(fā)者工具network標簽頁里,看到該OData服務(wù)確實是以非batch模式的方式調(diào)用:
要獲取更多Jerry的原創(chuàng)文章,請關(guān)注公眾號"汪子熙":
總結(jié)
以上是生活随笔為你收集整理的使用SAP WebIDE开发SAP Fiori Worklist应用消费OData服务的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 不会主动告知风险!ChatGPT生成代码
- 下一篇: odata协议里filter操作自带的函