OData and SAP Netweaver Gateway. Part I. Introduction
OData and SAP Netweaver Gateway. Part I. Introduction
Introduction
By Raju Shrestha - December 29, 2016
SAP HANA as the database, S/4 HANA and then SAP ABAP on HANA for technical
folks like us is one area which we need to keep ourselves abreast with. But there is another
cluster of OData, SAP NetWeaver Gateway, SAPUI5 and SAP Fiori which every ABAPer
will stumble upon in his/her projects sooner if not later. After the relatively exhaustive
“Fundamental Tutorial Series on SAP ABAP on HANA“ (hopefully, soon we will have
Advance Tutorial Series on ABAP on SAP HANA), we received numerous requests from our
readers to put a series on OData and NetWeaver Gateway.
As there are some really good tutorials on this subject in SCN and other blogs, initially we
deferred the idea to write on the same topic. But now, with the repetitive request from our
beloved subscribers, we would try our best to put the series on OData and NetWeaver
Gateway in a simple and systematic way so that all the beginners on this topic can learn
and benefit from our page.
BREAKING NEWS!!! – End To End Video Course on SAP OData – Absolutely FREE!!!!
Let’s start.
OData
As everyone says, OData is the acronym for “Open Data Protocol”. The protocol is a set
of rules which every player has to follow. To put it straight, OData interface is an open
standard that can be consumed by any application, program, software or device of the Non-
SAP World that can connect with SAP using the HTTP(s) protocol and can manipulate
(read, write, modify and understand i.e. parse and construct) an XML document. Since the
protocol is HTTP based, any programming language with HTTP stack can be used for
consuming OData services.
In other words, OData is a Web protocol for unlocking and sharing data; freeing it from silos
that exist in some software applications. The OData protocol supports serialization in
multiple popular formats, including JSON and Atom/XML. With OData, developers are able
to build cross-platform Web and mobile Applications.
With OData, organizations can develop services with the high levels of data integration and
cross-platform interoperability that are required by the modern day complex business.
Th below figure shows that SAP NetWeaver Gateway sits in SAP Application Layer. It is
the Window for outside world to peep into SAP and transfer data to/from SAP. Outer world
can send HTTP(s) message and SAP would provide them with OData. Also note, OData is
an open source to exchange data over the Internet. SAP Netweaver Gateway (blue box
within Application Layer in the below picture) is a technology that seamlessly connects
devices, platforms and environments to SAP Enterprise Data using the OData
services. SAP Netweaver Gateway offers connectivity to SAP Business data using any
programming language and without the need of strong SAP development knowledge.
Both Client side (Outer World) and Server side (SAP) development can be in completely
different programming languages as long as both are able to communicate with each other
via HTTP.
Clients that consume the service to query and manipulate the data from OData Services
are also called as “Consumers” of OData Service. Similarly, Servers that expose the
OData services via endpoints are known as “Producers” of OData services.
Prior to OData, external non-SAP developers have connected to SAP using RFC/BAPI or web
services. In those cases, the non-SAP developers (Web developers) needed to know before
hand the structures of the data passed from SAP. The non-SAP developers needed to have
at least a basic knowledge of the internal workings of an SAP system. But the scenario has
changed with OData.
i. The OData interface is implemented using XML or JSON. Both of these formats are well
known, plain text protocols for the transmission of information over the Web.
ii. OData message is self-describing. So any non-SAP Web developer can understand the
content of the OData message without the knowledge of ABAP or how SAP works.
It is understood by now that Server hosts the Data and Clients can call the Service to
retrieve the resources and manipulate them. Servers expose one or more endpoints which
are Services that refers to the Resources. Clients or non-SAP World developers only need to
know the Server side endpoints to call the service to query or manipulate the data.
With the advent of OData, the communication barrier between SAP and Non-SAP Web
Developers is removed. It is an Open book now. There is no cost or license agreement
needed for the use of OData.
FYI: Microsoft originally developed and introduced OData. Not SAP. Surprise for an
ABAPer. . Citrix Systems Inc., IBM Corp., Microsoft Corp., Progress Software, SAP AG,
WSO2 etc collaborated together to standardize the OData for implementation of a RESTful
API. Now OData is managed by the Oasis Organisation .
Ans: OData offers database-like access to server-side resources. Hence, OData is also
described as “ODBC for the Web”. Confused? Let’s simplify it.
ODBC is a standard API to access the DBMS, independent of the database management
systems or operating systems. ODBC achieves this by adding drivers between the
Application layer and the DBMS to translate the queries requested by the applications into
instructions which DBMS can understand. Similarly, OData acts like middleware between
producers and consumers to communicate data. There is a uniform way to consume data
and is independent of the producer (SAP or Non-SAP OData) much like ODBC.
Ans: Before the introduction of OData, there was the “Point-to-Point” solution for SAP to
Non-SAP integration. One application for two different organizations or platforms needed
two different design in SAP. This led to duplication of work, effort, time and money.
Check the below image. For pulling the same data from SAP, there are multiple interfaces
created to cater the need of multiple end users (browsers/mobile/cloud/custom
devices/software etc).
This mean there was poor scalability, increased system landscape complexity and
increased administration effort.
The alternative to Point-toPoint solution is “One Data Model -> One API -> Multiple
End-User Experiences”. Please check the image below. One OData service along with SAP
NetWeaver Gateway suffices all the needs of multiple end applications.
This approach provides one solution to any environment, any platform and any experience.
Moreover, no SAP knowledge required for consumption of OData.
OData’s extensibility feature was one of the most important reasons why SAP chose
OData over GData. This is particularly useful in cases where SAP specific values need to be
described in this protocol; for instance, currency fields. A currency field contains two
separate values, the currency amount and the currency code. These two values must
always be treated as a linked pair and OData’s extensibility allows for this.
HTTP (Hyper Text Transfer Protocol) is an integral part of OData. So it deserves a small
mention.
HTTP is based on Client-Server Architecture. The Browser is the Client which sends HTTP
request and Web Server is the Server which sends the response back to the browser. HTTP
defines “WHAT” can be transferred between Client and Server. “HOW” the data packets are
transferred via HTTP is handled by TCP/IP protocols.
What is stateless?
Ans: Every single HTTP request that is received by the Web Server is forgotten after a
response has been sent across. Web Servers do not remember or recall the previous
request. This is called stateless.
What is RESTful?
Ans: OData is REST-inspired technology for reading, writing, and modifying information on
the Web (not just SAP). REST = REpresenational State Transfer. REST is an architectural
style that uses simple and lightweight mechanism for inter-machine communication. It is
an alternative to the RPC (Remote Procedure Calls) and Web Services. REST is Resource-
based, unlike RPC or SOAP which are Action-based.
REST services are called as REST services because the Services are really working with
Resources instead of Operations. Any communication between client and services are
using URI (Unified Resource Identifier) over HTTP protocol using HTTP method. The URI is
really the representation of the Resources (like POHeader, POItem, Customer, Vendor etc).
Also, in RESTful service, once you identified the Resource, you will be working with a
uniform interface, because it uses HTTP methods (GET, PUT, POST and DELETE) to work
with the resource. So, the client does not need to know what the exact operation name
defined in the service contract to call that method. GET method is used whenever we need
to get the representation of an existing resource. POST is used to add new resource into the
system. PUT is to modify the existing resource and DELETE is to remove the resource from
the system. No matter what is the Service in whatever Platform, GET, PUT, POST, DELETE
remains the same.
Still confusing? Let us try to understand with the below real example (Do not worry, how we
created it. We will learn how to create them in our next post).
It is also important to note here that it is possible to have multiple URIs pointing to the
same Resource with the same output. Let us check it with the below example.
URI 1:
/sap/opu/odata/sap/ZGW_PURCHASE_SRV/POItemSet(Ebeln=’4500004723′,Ebelp=’00010′
)
URI 2:
/sap/opu/odata/sap/ZGW_PURCHASE_SRV/POHeaderSet(‘4500004723’)/HeaderToItemNav
Ans: At NW 7.3 and prior to NW 7.3, SAP Netweaver Gateway had three add-ons namely
GW_CORE, IW_FND and IW_BEP. The GW_CORE and IW_FND components were
required for Gateway Server functionalities, whereas IW_BEP was used for Gateway
Backend functionalities.
After 7.4 release, all the three components are bundled into a single component
SAP_GWFND called Gateway Foundation.
This is just the introduction of OData and SAP Netweaver Gateway along with some related
terminologies. In the subsequent parts, we will dive deeper in the actual practical scenarios
of OData. We will learn how to create OData services, play with the GET, POST, PUT etc
operations along with the backend methods which need to be re-defined to meet our
requirement. We will also check Navigations and Associations of Data Models and learn
how to handle them. At the end, we will build SAPUI5 Applications to consume our OData
service.
Next Post: SAP Netweaver Gateway and OData Tutorial Part II: Create your first OData
Service
This would be an interesting and hands-on learning series on OData and SAP Netweaver
Gateway. So get hold of your SAP systems and invest 20 minutes behind each Tutorial Part
and learn the fundamentals along with us.
If you want to get such useful articles directly to your inbox, please SUBSCRIBE. We
respect your privacy and take protecting it seriously.
If you liked this post, please hit the share buttons and like us on facebook.
Do you have anything to add to this article? Have you faced any issue understanding OData
or SAP Netweaver Gateway? Do you want to share any real project requirement or
solutions? Please do not hold back. Please leave your thoughts in the comment
section.
Call for Guest Authors and Contributors to write SAP Articles on our page and get
noticed.
Do you have any tips or tricks to share? Do you want to write some articles
at SAPYard? Please REGISTER and start posting and sharing your knowledge to the SAP
world and get connected to your readers.
OData and SAP Netweaver Gateway. Part II. Create your first OData Service
OData and SAP Netweaver Gateway. Part III. Query Options in OData Service URI
OData and SAP Netweaver Gateway. Part IV. Association and Navigation in OData Service
OData and SAP Netweaver Gateway. Part V. CRUD Operations in OData Services
OData and SAP Netweaver Gateway. Part VI. Frequently Asked Questions
OData and SAP Netweaver Gateway. Part VII. Debugging, Trace, Cache Cleanup and F4
Help
OData and SAP Netweaver Gateway. Part VIII. SAP’s Love for OData – a Tale of the
Friendly ABAPer
OData and SAP Netweaver Gateway. Part IX. How to Add Multiple Entities in One
Operation in OData Service
OData and SAP Netweaver Gateway. Part X. How to Delete OData Service from Service
Catalog?
OData and SAP Netweaver Gateway. Part XI. Query Options & HTTP Status Code
Summary
SAP Netweaver Gateway and OData. Part XII. Media Handling using OData Gateways
SAP Netweaver Gateway and OData. Part XIII. Entity Tags in SAP OData Gateways
SAP Netweaver Gateway and OData. Part XIV. OData Service using RFC
SAPUI5 for ABAPers – Consuming OData Service from SAPUI5 Application – CRUD
Operations
Advance SAPUI5 – 2- Push Notification in SAP – ABAP Push Channel, ABAP Messaging
Channel in SAPUI5 – a Real Time Interaction
CDS Part 11. How to Consume CDS View in Smart Business Service KPI Fiori Apps?
SAPUI5 Tutorial with WebIDE. Part I. How to Consume Custom OData in SAPUI5
Application
SAPUI5 Tutorial with WebIDE. Part II. Routing and Navigation in SAPUI5 Application
SAPUI5 Tutorial with WebIDE. Part III. Drop Down in SAPUI5 Applications (2 Methods)
SAPUI5 Tutorial with WebIDE. Part VI. Using Fragments in SAPUI5 Fiori Applications
SAPUI5 Tutorial with WebIDE. Part VII. An ABAPer’s First SAPUI5 App in SAP WebIDE
SAPUI5 Tutorial with WebIDE. Part VIII. Deploy my First SAPUI5 App in WebIDE
SAPUI5 Tutorial with WebIDE. Part X. Using Media Queries in UI5 Application
SAPUI5 Tutorial with WebIDE. Part XI. An ABAPer’s Second SAPUI5 App
SAPUI5 Tutorial with WebIDE. Part XII. SAPUI5 Basic Debugging for Beginners
Use of Third Party (or) External Resources in SAPUI5. Part II – Practical with Gauges
SAPUI5 for ABAPers – Consuming OData Service from SAPUI5 Application – CRUD
Operations
Advance SAPUI5 – 1- Trick to Send QR code or Barcode Data Remotely from Android to
PC for SAPUI5 App
Advance SAPUI5 – 2- Push Notification in SAP – ABAP Push Channel, ABAP Messaging
Channel in SAPUI5 – a Real Time Interaction
Advance SAPUI5 – 4 – How to Get Weight from the Weigh Scale/Weigh Bridge Bluetooth
Device using SAPUI5 Hybrid App?
SAPUI5 – How to Change the Master List Item Selection Based on Changes in Hash Tag
URL?
SAPUI5 – How to Load a Full Screen and Navigate to Master-Detail Application? Approach
1
We have a very active Telegram SAP Technical Group. Please join it using below link.
WhatsApp had the limitation of 256 members per group and we were finding a hard time
syncing and maintaining information in multiple WhatsApp group. Therefore we have moved
to Telegram as it can accommodate more than 10,000 users. Please join.
Raju Shrestha
https://zapyard.com/
Raju is hands-on SAP ABAP Consultant who started his SAP career with IBM in 2006. Worked in onshore
offshore model. Played the role of mentor, team lead, project lead and trainer in IBM. He has worked in
ECC, S/4HANA 1909 and SAP ISU-Retail boxes.
Experienced in Automation, Heavy Machinery, Pharma,
Energy and Retail Industries. Currently working in SAP IS-U Retail Project. Raju is the floater of this SAP
Knowledge sharing portal ZAPYard.com.
You may reach out to Raju if you are looking for Full Time SAP
Technical Architect for your organization. Currently he is stationed at Houston. Texas, USA.
He is Soccer
coach at YMCA during the weekends and follows Indian Football religiously.
Please check his detailed profile
on LinkedIn.