Name |
SalesOrderSalesOrderItems |
Principal Entity* |
SalesOrder |
Principal Entity Cardinality* |
1 |
Dependent Entity* |
SalesOrderItem |
Dependent Entity Cardinality* |
M |
2) Choose the Create pushbutton:
3) Enter the following values and choose Enter:
Principal
Key* |
SoId |
Dependent
Property* |
SoId |
Now we create an association set for the association
1. Double-click Association Sets:
3. Enter the values and choose Enter:
Name |
SalesOrderSalesOrderItems |
Association* |
SalesOrderSalesOrderItems |
And finally we create a navigation property based on the
referential constraint
1. Expand Data Model > Entity Types > SalesOrder and
double-click Navigation Properties:
3. Enter the following values and choose Enter:
Name |
SalesOrderItems |
Relationship Name* |
SalesOrderSalesOrderItems |
Now we need to re-generate the runtime objects and we’re
then ready to test the service
1. Choose the Generate pushbutton:
2. Verify that the runtime objects have been generated
successfully:
3. Start the Gateway Client (Transaction /IWFND/GW_CLIENT)
in a separate window to run the service. Provide the following URI to get the
metadata for the service:
/sap/opu/odata/sap/ZGW100_XX_SO_SRV/$metadata
The Sales Order collection now includes a navigation
property.
4. When you now select a sales order entry using
/sap/opu/odata/sap/ZGW100_XX_SO_SRV/SalesOrderCollection(‘0500000001’),
for example, you can simply add the navigation link /SalesOrderItems to
navigate to the line items without having to set a filter yourself:
5. And finally you can use $expand to read all sales order
items for a given sales order in a single http call.
Simply provide the following URI:
/sap/opu/odata/sap/ZGW100_XX_SO_SRV/SalesOrderCollection(‘0500000001’)/?$expand=SalesOrderItems
The $expand statement is handled by the framework (no
additional implementation is required). Since the framework does not know that
both entities can be obtained using a single RFC call, it executes two calls to
the underlying BAPI. This can be improved by manually implementing (re-defining)
the GET_EXPANDED_ENTITY method.
So we are done. The Service is up and running.
ConversionConversion EmoticonEmoticon