Fiori-ODATA-Demo1

  1. READ(Get Entity)
需求 URI
读EntitySet(多条) /sap/opu/odata/sap/ZGJZ_PO_DEMO_SRV/POHeaderSet
读Entity(单条) /sap/opu/odata/sap/ZGJZ_PO_DEMO_SRV/POHeaderSet(‘4500000545’)
/sap/opu/odata/sap/ZGJZ_PO_DEMO_SRV/POItemSet(Ebeln=’4500000364’,Ebelp=’00010’)
加格式 /sap/opu/odata/sap/ZGJZ_PO_DEMO_SRV/POHeaderSet(‘4500000545’)?$format=json
/sap/opu/odata/sap/ZGJZ_PO_DEMO_SRV/POHeaderSet(‘4500000545’)?$format=xml
读个别字段(多个) /sap/opu/odata/sap/ZGJZ_PO_DEMO_SRV/POHeaderSet?$select=Ebeln,Bukrs
读个别字段(单个) /sap/opu/odata/sap/ZGJZ_PO_DEMO_SRV/POHeaderSet(‘4500000545’)/Lifnr
读个别字段并且加格式 /sap/opu/odata/sap/ZGJZ_PO_DEMO_SRV/POHeaderSet?$select=Ernam,Bukrs,Ebeln&$format=json
记录数 /sap/opu/odata/sap/ZGJZ_PO_DEMO_SRV/POHeaderSet/$count

上面表格中的URI是不需要在后端进行额外的开发就可以使用的(当然要实现Entity和EntitySet)。可以看出,可以通过’?’来增加查询选项,多个查询选项间用’&’连接。 我们再来看一个这个URI的组成:

URI:

Jim Guo wechat
ex. subscribe to my blog by scanning my public wechat account