Gateway Project for Multi Level Association

The below post shows to design a gateway project with multi level association like from parent->child->grandchild. Later testing this with expanded entity set.

The three DDIC structure to model our entity.

Create a gateway project and create entity types and sets by importing 3 above created structures.

The ety_code entity type.

The ety_conn entity type.

The ety_date entity type. One thing to be observed here is the abap data type for date and the EDM data type for date are different. On oData side its DateTime.

Below artifacts are generated and the service is registered. Now look for the DPC ext class.

Lets redefine these 6 methods related to GET_ENTITY & GET_ENTITY set of out 3 entities.

codeSet Entity-

codeSet Entity Set-

connSet Entity-

connSet Entity Set-

dateSet Entity-

dateSet Entity Set-

Test the service in the gateway client- for the codeSet entity-

Test the service in the gateway client- for the connSet entity-

Test the service in the gateway client- for the dateSet entity- [ here the fldate is a datetiem format]

What we have now is that for the 3 entity types there are two associations are created.

One from Code to Conn and another from Conn to Date with cardinality.

The entity set field relation.

The entity set field relation.

For each association the navigation is created. So we have two navigation.

One from Code to Conn. [ Header to Child]

Two from Conn to Date [ Child to Grand Child]

And no navigation from ety_date.

Lets test the expand – with one navihation.

Result-

Test the Expand with two navigation-

Result- We have

Flight Code

-> Flight Connection

->Flight Date

With $expand the GET_EXPANDED_ENTITY & GET_EXPANDED_ENTITYSET method gets called and gives back the result . But we can redefine these two methods and add logic to fill the deep structure result to overcome the performance issue.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s