天天看點

How to resolve ASSERTION_FAILED error when you register the odata service expose

Description

When you try to register an Odata service exposed by a CDS view in tcode /IWFND/MAINT_SERVICE, you meet with runtime error ASSERTION_FAILED as displayed in picture below.

How to resolve ASSERTION_FAILED error when you register the odata service expose

Keywords

ASSERTION_FAILED, @OData.publish

Root cause

If you debug in the backend, you can find the exception is raised in line 9.

How to resolve ASSERTION_FAILED error when you register the odata service expose

The field causing this exception, “STAT”, does not come from the consumption view itself but from the foreign view zorder_sys_status.

When we comment out line 22~24, the service registration could successfully be done.

Solution

在目前view上重新建立一個新的consumption view.

How to resolve ASSERTION_FAILED error when you register the odata service expose

這樣做的目的是確定最後用于生成odata service的consumption view A, 其字段全部來自 view B.

比較correction之前的實作: consumption view A,其字段部分來自view B, 部分來自view C, 這種scenario并不被SADL 架構支援。

original view:

How to resolve ASSERTION_FAILED error when you register the odata service expose

new created consumption view:

How to resolve ASSERTION_FAILED error when you register the odata service expose

After correction it works with the following url:

https://jerry:44354/sap/opu/odata/sap/Z_C_SERVICE_ORDER_VIEW_CDS/Z_C_Service_Order_View(order_guid=guid’00163EA7-2000-1ED2-85EF-EFADF195A1B2’)

How to resolve ASSERTION_FAILED error when you register the odata service expose

繼續閱讀