Skip to Content
avatar image
Former Member

[OData] Inheriting entities from other service

Hi everyone,

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

Is something like that even possible in SAP Gateway?

Example:

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 29, 2017 at 10:48 AM

    Hi,

    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):

    model->include_model_by_name(
                                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

    Add comment
    10|10000 characters needed characters exceeded