Open Data Protocol
Open Data Protocol (OData) is a data access protocol initially defined by Microsoft. Versions 1.0, 2.0, and 3.0 are released under the Microsoft Open Specification Promise. Version 4.0 is being standardized at OASIS,[1] and was released in March 2014.[2]
The protocol was designed to provide standard CRUD access to a data source via a website. It is similar to JDBC and ODBC although OData is not limited to SQL databases.
Architecture
OData is built on the AtomPub protocol and JSON where the Atom structure is the envelope that contains the data returned from each OData request. An OData request uses theREST model for all requests. Each REST command is a POST, GET, PUT, PATCH, or DELETE http request (mapping to CRUD) where the specifics of the command are in the url.
- GET: Get a collection of entities (as a feed document) or a single entity(as an entry document).
- POST: Create a new entity from an entry document.
- PUT: Update an existing entity with an entry document.
- PATCH: Update an existing entity with a partial entry document.
- DELETE: Remove an entity.
Any platform that provides support for HTTP and XML is enough to form HTTP requests to interact with AtomPub. The OData specification defines how AtomPub is used to standardize a typed, resource-oriented CRUD interface for manipulating data sources.
Typical Workflow When Creating a New User Interface:-
For all browser based application data has to invoke from secure
Service Builder – Data Model:-
Create / Model OData
Artifacts --
- Entity Types
- Entity Sets
- Complex Types
- Associations
- Association Sets
- Function Imports
Can make association on principle to dependent entity with the key field (ex : cardinality 0 :M maintain )
-
Generation of runtime objects :-
After generation of odata artifacts it will create 4 class (1 model provider class and 2 data provider class) and 2 service (technical model and service name) .
Service implementation – CRUD methods:-
Direct navigation into the CRUD –
Methods--
- Create
- Read and Query
- Update
- Delete
On service implementation Node you can implement your business logic .
Service Builder – runtime artifacts:-
ABAP classes for
- Model definition
- Service implementation
Service registration in the backend
Service registration in the backend. You need to maintain system alias In transaction SPRO open theSAP Reference IMG and navigate to SAP NetWeaverGateway Service Enablement -Backend OData Channel -Service Development for Backend OData Channel-Maintain Modelsand Maintain Services.
/iwfnd/maint_service :-
Can call your service directly on browser and also on gateway client
Service document in the browser and entity types in
SEGW
There are 5 method you can use as per your business logic and execute .
As you see in below result association on ID . for more information on Odata links
you can open your service on browser
http://<host>:<port>/sap/opu/odata/sap/<Service Name >
Summary - Transactions you should know as a developer:-
Gateway Node Activation | SICF | Includes various functions for monitoring, analysis, and troubleshooting in the ICF environment. You can also make use of the central Application Server analysis functions to identify issues such as performance problems in ICF applications. |
Gateway Client | /IWFND/GW_CLIENT | SAP NetWeaver Gateway is a powerful tool that enhances the existing Error Log. Also allows you to simulate service execution. (Similar to tools like RESTClient for Firefox) |
Error Log | /IWFND/ERROR_LOG | The Error Log for SAP NetWeaver Gateway hub systems is a helpful addition to the existing Application Log Viewer and provides detailed context information about errors that have occurred at runtime. |
Gateway Service Builder | SEGW | A completely new design-time transaction, which provides developers with an easy-to-use set of tools for creating services. It has been conceived for the code-based OData Channel and supports developers throughout the entire development life cycle of a service. |
Register/Test Backend System | SM59 | Your backend system has to be registered as an SAP system alias in the SAP NetWeaver Gateway Implementation Guide (IMG) on your SAP NetWeaver Gateway system. In addition, an RFC destination has to be defined in transaction SM59. |
Gateway Service Builder - development flow in detail
this image reference : CD204 presentation Teched @ 2012