下面是我今天研究的背景OData資料的model以及如何在IE裡面consume:
SPRO裡面:

這個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.
通過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/KaTeX parse error: Expected 'EOF', got '&' at position 24: …?sap-client=001&̲format=xml
service document也能通過SICF進去之後,從sap node出發,點test拿到。
比如這部分就說明CustomerCollection這個節點能夠執行“search”的action:
然後我們在IE裡面測試:
http://ldcigm2.jerry.corp:50018/sap/opu/sdata/sap/CUSTOMER_BRIEFING/CustomerCollection?sap-client=001&$format=xml&search
傳回所有的Customer資訊,Customer node的property就是在figure1裡面看到的那些。
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:
然後根據service ID找到對應的CRM 系統的destination:
通過RFC直接call CRM系統上的一個remote function module:
在CRM的這個FM上設個斷點,發現斷點已經被觸發了。