Professional Documents
Culture Documents
Step by Step Odata Part 3
Step by Step Odata Part 3
Hi, Guest
Log On Join Us
Products
About SCN
Downloads
Industries
Partnership
Developer Center
Activity
Lines of Business
University Alliances
Innovation
Browse
Communications
Actions
Actions
volker.drees
Login
Register
Previous
Next
Posted by Volker Drees in volker.drees on Oct 26, 2012 11:45:07 AM
Share
Like
Filter Blog
By date:
--By tag:
gateway mobile
netweaver_gateway odata rfc
sap_netweaver_gateway
service_builder
Recent Posts
Name
SalesOrderSalesOrderItems
Principal Entity*
SalesOrder
Dependent Entity*
SalesOrderItem
Incoming Links
Step-by-Step Add a New Entity with Association
and Implement it
Displaying only last record(in entityset) multiple
times in Table (Using Association & Navigation)?
converted by Web2PDFConvert.com
SoId
Dependent Property*
SoId
SalesOrderSalesOrderItems
Association*
SalesOrderSalesOrderItems
converted by Web2PDFConvert.com
SalesOrderItems
Relationship Name*
SalesOrderSalesOrderItems
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
converted by Web2PDFConvert.com
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
converted by Web2PDFConvert.com
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.
I hope you enjoyed creating and consuming an OData Service that is based on RFC modules.
16896 Views
Products: sap_netweaver_gateway Topics: mobile Tags: gateway, odata, netweaver_gateway, service_builder
My Rating:
(16 ratings)
Share
Like
11 Comments
Wouter Peeters Oct 6, 2013 1:42 PM
Hi Volker,
Thx, these are a great tutorial series to get started with Gateway.
But I'm having some troubles adding a navigation torwards the Product Detail, from the Sales Order
Item entity. Do you have any pointers? Maybe this is a good idea for a part 4.
Regards,
wouter
Like (0)
Volker Drees Oct 8, 2013 10:32 AM (in response to Wouter Peeters)
Hi Wouter,
thanks for the feedback.
Navigating from a Line Item to the related Product is a little trickier. This is because the URI
that you use (e.g. ".../SalesOrderItemCollection( SoItemPos=..., SoID=...)/ToProduct" ) only
has the key information of the Line Item. In order to be able to navigate to the product entry
you first need to read the Line Item detail to fetch the related Product-Id, and from there fetch
the entire product.
Luckily this is taken care of by the Service Builder as well. You just need to make sure to
maintain the Association and the Referential Constraint between the Line Item and the
Product.
hth.
Regards, Volker
Like (1)
Wouter Peeters Oct 8, 2013 12:04 PM (in response to Volker Drees)
Hi Volker,
Thanks for the reply, for more information there's a topic on the matter:
http://scn.sap.com/thread/3434085
Regards,
Wouter
Like (0)
Vijay Dudla May 13, 2014 1:05 PM (in response to Volker Drees)
converted by Web2PDFConvert.com
Hi Volker,
I did the same steps but unable to use the navigation or expand option? what was
the issue.
Below is the metadata for my service.
<?xml version="1.0" encoding="utf-8" ?>
- <edmx:Edmx Version="1.0"
xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:sap="http://www.sap.com/Protocols/SAPData">
- <edmx:DataServices m:DataServiceVersion="2.0">
- <Schema Namespace="ZDEMO09_SRV" xml:lang="en"
xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
- <EntityType Name="Orderheader" sap:content-version="1">
- <Key>
<PropertyRef Name="Vbeln" />
</Key>
<Property Name="Vbeln" Type="Edm.String" Nullable="false" MaxLength="10"
sap:label="Sales Document" sap:sortable="false" sap:filterable="false" />
<Property Name="Erdat" Type="Edm.DateTime" Nullable="false"
sap:label="Created on" sap:creatable="false" sap:updatable="false"
sap:sortable="false" sap:filterable="false" />
<Property Name="Erzet" Type="Edm.Time" Nullable="false" sap:label="Time"
sap:creatable="false" sap:updatable="false" sap:sortable="false"
sap:filterable="false" />
<Property Name="Ernam" Type="Edm.String" Nullable="false" MaxLength="12"
sap:label="Created by" sap:creatable="false" sap:updatable="false"
sap:sortable="false" sap:filterable="false" />
<NavigationProperty Name="OrderItemSet"
Relationship="ZDEMO09_SRV.SalesOrder" FromRole="FromRole_SalesOrder"
ToRole="ToRole_SalesOrder" />
</EntityType>
- <EntityType Name="OrderItem" sap:content-version="1">
- <Key>
<PropertyRef Name="Posnr" />
<PropertyRef Name="Vbeln" />
</Key>
<Property Name="Pstyv" Type="Edm.String" Nullable="false" MaxLength="4"
sap:label="Item category" sap:creatable="false" sap:updatable="false"
sap:sortable="false" sap:filterable="false" />
<Property Name="Matkl" Type="Edm.String" Nullable="false" MaxLength="9"
sap:label="Material Group" sap:creatable="false" sap:updatable="false"
sap:sortable="false" sap:filterable="false" />
<Property Name="Matnr" Type="Edm.String" Nullable="false" MaxLength="18"
sap:label="Material" sap:creatable="false" sap:updatable="false"
sap:sortable="false" sap:filterable="false" />
<Property Name="Posnr" Type="Edm.String" Nullable="false" MaxLength="6"
sap:label="Item" sap:sortable="false" sap:filterable="false" />
<Property Name="Vbeln" Type="Edm.String" Nullable="false" MaxLength="10"
sap:label="Sales Document" sap:sortable="false" sap:filterable="false" />
</EntityType>
- <Association Name="SalesOrder" sap:content-version="1">
<End Type="ZDEMO09_SRV.Orderheader" Multiplicity="1"
Role="FromRole_SalesOrder" />
<End Type="ZDEMO09_SRV.OrderItem" Multiplicity="*"
Role="ToRole_SalesOrder" />
- <ReferentialConstraint>
- <Principal Role="FromRole_SalesOrder">
<PropertyRef Name="Vbeln" />
</Principal>
- <Dependent Role="ToRole_SalesOrder">
<PropertyRef Name="Vbeln" />
</Dependent>
</ReferentialConstraint>
</Association>
- <EntityContainer Name="ZDEMO09_SRV" m:IsDefaultEntityContainer="true">
<EntitySet Name="OrderHeaders" EntityType="ZDEMO09_SRV.Orderheader"
sap:pageable="false" sap:addressable="false" sap:content-version="1" />
<EntitySet Name="OrderItems" EntityType="ZDEMO09_SRV.OrderItem"
sap:pageable="false" sap:addressable="false" sap:content-version="1" />
- <AssociationSet Name="SalesOrderSet"
Association="ZDEMO09_SRV.SalesOrder" sap:creatable="false"
sap:updatable="false" sap:deletable="false" sap:content-version="1">
<End EntitySet="OrderHeaders" Role="FromRole_SalesOrder" />
<End EntitySet="OrderItems" Role="ToRole_SalesOrder" />
</AssociationSet>
</EntityContainer>
<atom:link rel="self"
href="http://sapcis01.citrite.net:8080/sap/opu/odata/sap/ZDEMO09_SRV/$metadata"
xmlns:atom="http://www.w3.org/2005/Atom" />
<atom:link rel="latest-version"
href="http://sapcis01.citrite.net:8080/sap/opu/odata/sap/ZDEMO09_SRV/$metadata"
xmlns:atom="http://www.w3.org/2005/Atom" />
</Schema>
</edmx:DataServices>
</edmx:Edmx>
Thanks
Vijay
converted by Web2PDFConvert.com
Like (0)
Shakeeluddin Khaja Nov 24, 2014 1:47 PM
Hi Volker,
Your Tutorial has been very helpful. I am learning Webservices from scratch.
I have a doubt.
I cant find the ASSOCIATION SETS block in my SEGW Project. Would there be a reason for this?
Thanks
Abraham
Like (0)
Volker Drees Dec 8, 2014 4:25 PM (in response to Starlet Abraham)
Hi Abraham,
I assume you are using a newer version of SAP NetWeaver Gateway (the blog was written
for SP5)?
The Gateway Framework is automatically generating the Association Sets based on the
defined Associations. That's the reason why the Service Builder is not showing them in the
navigation tree anymore. But you can still create own Association Sets if you want (RightClick on Data Model and choose Create -> Association Set).
Best Regards, Volker
Like (0)
Rahul Keshav May 25, 2015 10:28 AM
Very Informative..
Thanks.
Like (0)
Sara Zhang Sep 24, 2015 5:26 AM
Hi Volker,
It is a wonderful doc, I can not tell you how much I appreciate your work, thanks.
Like (0)
Site Index
Privacy
Contact Us
Terms of Use
Copyright
Follow SCN
converted by Web2PDFConvert.com