怎么使用SAP WebIDE开发应用消费OData服务

2023-04-24,,

这篇文章主要介绍“怎么使用SAP WebIDE开发应用消费OData服务”,在日常操作中,相信很多人在怎么使用SAP WebIDE开发应用消费OData服务问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”怎么使用SAP WebIDE开发应用消费OData服务”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

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

到此,关于“怎么使用SAP WebIDE开发应用消费OData服务”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注本站网站,小编会继续努力为大家带来更多实用的文章!

《怎么使用SAP WebIDE开发应用消费OData服务.doc》

下载本文的Word格式文档,以方便收藏与打印。