首页 > Web开发 > 详细

使用SAP WebIDE开发SAP Fiori Worklist应用消费OData服务

时间:2020-02-16 09:32:08      阅读:72      评论:0      收藏:0      [点我收藏+]

新建一个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模式的方式调用:

技术分享图片

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
技术分享图片

使用SAP WebIDE开发SAP Fiori Worklist应用消费OData服务

原文:https://www.cnblogs.com/sap-jerry/p/12315721.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!