8️⃣
Implementing Deep Entity In
OData Services
Deep Entity is nothing but a Deep Structure ( i.e. a Structure within a structure
).
let’s take a Requirement.
Requirement :-
Suppose, My user wants to get the data from Sales Header, Sales Item and
Sales Shipment with only one URI.
Then, In that Situation we will have to use the concept of Deep Entity.
Implementing Deep Entity In OData Services 1
Steps needed for the implementation :-
Step 1 :- We will have to create a association and a navigation path from Sales
Header to Sales Item and Sales Header to Sales Shipment.
Step 2 :- We will have to create a deep structure in MPC_EXT Class.
Firstly, we will create three entity types for Sales Header, Sales Item and
Sales Ship Entity
Implementing Deep Entity In OData Services 2
Then, we will create a type structure in MPC_EXT class which will include
SID, OTYPE, internal table of item and internal table for shipment.
Step 3 :- Then we will implement the GET_EXPANDED_ENTITYSET method.
Step 4 :- At last we will be required to get trigger the method using URI to get
the data.
Custom Tables Used :-
Implementing Deep Entity In OData Services 3
Implementing Deep Entity In OData Services 4
Implementation :-
Step 1 :- Go to SEGW transaction code and create a OData project.
Step 2 :- Right click on Data model → import → DDIC structure to create a
Entity type and Entity set for header, item and shipment.
Implementing Deep Entity In OData Services 5
Step 3 :- Then we need to create the association property from header to item
and from header to shipment.
Implementing Deep Entity In OData Services 6
Step 4 :- Next, we will create a deep entity in MPC_EXT class.
Note :- You are required to give the navigation name as the internal table
for item and shipment.
Step 5 :- Now we will implement the method Get Expanded Entity Set.
We have a parameter IV_ENTITY_SET_NAME, It returns the name of the
entity set.
Implementing Deep Entity In OData Services 7
Implementing Deep Entity In OData Services 8
Testing the Get Expanded Entity
Implementation :-
Implementing Deep Entity In OData Services 9
Implementing Deep Entity In OData Services 10