Skip to Content

[OData] Inheriting entities from other service

Mar 29, 2017 at 10:14 AM


avatar image
Former Member

Hi everyone,

I have a question regarding the inheritance of entities of OData services.

Is something like that even possible in SAP Gateway?


Odata Service #1 has a customer entity.
Odata Service #2 needs the same entity with the same data provider code.

It would be cool the do the following:

Create a "entity reference" in OData Service #2 that references the customer entity in OData Service #1.

This way we have one code base for reading the customer entity.

The only way to realise that, that I know of, is to copy the entity from the first service and use the same class to read the data.

Even better would be the possibility to use navigation paths in the first service, like "/customer/toOrders" without declaring everything in the second service.

Thanks, Hendrik

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Christian Wolter Mar 29, 2017 at 10:48 AM


in SEGW you can refer a service. Rightlick on Data Model --> Include. Then you can choose a service to include.

You can also do this by code in MPC_EXT-Class (SEGW does the same):

                            iv_service_external_name    = 'Y_SERVICE_NAME'
                            iv_service_version          = '0001'
                            iv_model_tech_name          = 'Y_SERVICE_MODEL'
                            iv_model_version            = '0001' ).

I don't know whether it is possible to create an association to these included entities. I dont see them in SEGW, there is only a model reference visible. Maybe this could be achieved with coding in the MPC_EXT-Class.

You could adopt the associations you created with SEGW. You find them in the MPC-Class in the method DEFINE_ASSOCIATIONS.

Best regards

Christian Wolter

10 |10000 characters needed characters left characters exceeded