SAP在公网上提供了免费的开发测试用OData服务 - ZGWSAMPLE_SRV 等。
比如
https://sapes1.sapdevcenter.com/SAP/OPU/ODATA/IWFND/RMTSAMPLEFLIGHT/
http://sapes1.sapdevcenter.com:8080/SAP/OPU/ODATA/IWFND/RMTSAMPLEFLIGHT/
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/
http://sapes1.sapdevcenter.com:8080/sap/opu/odata/sap/ZGWSAMPLE_SRV/
如何申请测试帐号:
- 立即免费申请SAP Netweaver Gateway测试服务,浏览器访问SAP SCN网站
- 如果没有SCN帐号,先申请一下。
- 点击 follow this link to the sign up form 填写表格申请,系统自动立刻回复给你电子邮件,内有帐号口令。
- 登录 https://sapes1.sapdevcenter.com/webgui 修改缺省口令
- SCN网站 上有Flight Example服务的测试链接,比如 https://sapes1.sapdevcenter.com/SAP/OPU/ODATA/IWFND/RMTSAMPLEFLIGHT/
以ZGWSAMPLE_SRV为例,OData访问方法
Service Root, Service Document,可以查看Collection, Entity的名字列表
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/
Metadata信息,可以看到Entity的定义
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/$metadata
导航
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/BusinessPartnerCollection
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/BusinessPartnerCollection('0100000000')
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/BusinessPartnerCollection('0100000000')/SalesOrders
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/SalesOrderCollection('0500000000')/LineItems
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/SalesOrderLineItemCollection(SoItemPos='0000000010',SoId='0500000000')/Product
Get all business partners whose company name starts with the letter S.
check xml item CompanyName
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/BusinessPartnerCollection?$filter=startswith(CompanyName,'S')
select字段
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/BusinessPartnerCollection?$select=BusinessPartnerID,CompanyName
复杂查询
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/BusinessPartnerCollection?$filter=startswith(CompanyName,'SAP')&$select=BusinessPartnerID,CompanyName
排序
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/BusinessPartnerCollection?$orderby=CompanyName
分页
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/BusinessPartnerCollection?$top=2&$inlinecount=allpages&$select=BusinessPartnerID,CompanyName
https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/BusinessPartnerCollection?$top=2&$inlinecount=allpages&$select=BusinessPartnerID,CompanyName&$skip=1
返回格式,加个参数
$format=atom
$format=json
$format=xml
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow