下面是我今天研究的后台OData数据的model以及如何在IE里面consume:
SPRO里面:
![](https://img.haomeiwen.com/i2085791/d60c5e658f0ab9a5.png)
这个model provider class定义了LWM_CUSTOMER_BRIEFING这个model的所有structure,以及structure之间的相互关系。
现在没有一个图形化界面的tool来做modelling,我们只能在CL_LWM_CB_ADAPTER_MDP的DEFINE里面定义model的structure。具体做法是预先定义好后台要使用的entity的data type,
Customer briefing 所有使用到的DDIC object全部放在这个package里面:LWM_CRM_CUSTOMER_BRIEFING
在DEFINE里面,通过ABAP 代码创建一个个entity,给它们绑上DDIC object,同时建立相互关系,如association.
![](https://img.haomeiwen.com/i2085791/769a148c7b148c4e.png)
![](https://img.haomeiwen.com/i2085791/3c1e41a6c8388f72.png)
通过http://ldcigm2.herr.corp:50018/sap/opu/sdata/sap/customer_briefing?sap-client=001 我们可以拿到customer briefing的service document。
Service document里面只定义了哪些entity暴露了哪些操作,真正metadata的full definition xml用这个URL down:
http://ldcigm2.jerry.corp:50018/sap/opu/sdata/sap/customer_briefing/format=xml
service document也能通过SICF进去之后,从sap node出发,点test拿到。
![](https://img.haomeiwen.com/i2085791/4074c751d7c2e5ce.png)
比如这部分就说明CustomerCollection这个节点能够执行“search”的action:
![](https://img.haomeiwen.com/i2085791/6cd26c6b5024ce40.png)
返回所有的Customer信息,Customer node的property就是在figure1里面看到的那些。
![](https://img.haomeiwen.com/i2085791/428a9ff7ce566967.png)
Search 所有name property中包含“UT_Customer” 的Customer
http://ldcigm2.jerry.corp:50018/sap/opu/sdata/sap/CUSTOMER_BRIEFING/CustomerCollection?sap-client=001&$format=xml&search=UT_Customer
返回Partner ID = 133的customer的detail 信息
http://ldcigm2.jerry.corp:50018/sap/opu/sdata/sap/CUSTOMER_BRIEFING/CustomerCollection(133)?sap-client=001&$format=xml
所有这些操作都在service provider class CL_LWM_CB_ADAPTER_RDP里面实现,
如果我们直接在IE里面通过http://ldcigm2.jerry.corp:50018/sap/opu/sdata/sap/CUSTOMER_BRIEFING/CustomerCollection(133)?sap-client=001&$format=xml
的URL consume OData service:
Gateway 系统上首先会根据OData service expose出来的external name找到internal使用的service ID:
![](https://img.haomeiwen.com/i2085791/f0a279d257939dfd.png)
然后根据service ID找到对应的CRM 系统的destination:
![](https://img.haomeiwen.com/i2085791/8cb1785773b5a446.png)
通过RFC直接call CRM系统上的一个remote function module:
![](https://img.haomeiwen.com/i2085791/4b0078574f7114fc.png)
![](https://img.haomeiwen.com/i2085791/5ad6d766475272db.png)
在CRM的这个FM上设个断点,发现断点已经被触发了。
![](https://img.haomeiwen.com/i2085791/4aa957494c79de21.png)
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
![](https://img.haomeiwen.com/i2085791/fc7ecd97deb67090.png)
网友评论