SAP在公网上提供了免费的开发测试用OData服务 - ZGWSAMPLE_SRV 等。
比如
https://sapes1.sapdevcenter.com/SAP/OPU/ODATA/IWFND/RMTSAMPLEFLIGHT/
http://sapes1.sapdevcenter.com:8080/SAP/OPU/ODATA/IWFND/RMTSAMPLEFLIGHT/
http://sapes1.sapdevcenter.com:8080/sap/opu/odata/sap/ZGWSAMPLE_SRV/
如何申请测试帐号:
以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