0% found this document useful (0 votes)
126 views41 pages

SAP ABAP OData

Odata

Uploaded by

Eugene
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views41 pages

SAP ABAP OData

Odata

Uploaded by

Eugene
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

SAP ABAP OO

OData Overview
www.zarantech.com

© Copyright 2022, ZaranTech LLC. All rights reserved.


2 Disclaimer

• This presentation, including examples, images, and references are provided


for informational purposes only.

• Complying with all applicable copyrights laws is the responsibility of the user.

• Without limiting the rights under copyright, no part of this document may be
reproduced, stored or introduced into a retrieval system, or transmitted in
any form or by any means.

• Credits shall be given to the images taken from the open-source and cannot
be used for promotional activities.

© Copyright 2022, ZaranTech LLC. All rights reserved.


3 Agenda
• Describe Representational State Transfer (REST)
• Examine an OData service
• Perform OData read operations
• Perform OData queries
• Describe patterns for UI-centric applications

© Copyright 2022, ZaranTech LLC. All rights reserved.


2 Explaining Representational State Transfer

REST – The Foundational Principles of the World Wide Web

4
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Explaining Representational State Transfer

• These constraints govern the large-scale


behavior of the participants within a networked
software system.
• The REST design constraints are fully
implemented by the HTTP protocol.
• The World Wide Web is an example of a fully
RESTful software system.

5
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Six Architectural Constraints of REST
Client Server
Architecture

Cacheability

Statelessness

Layered System

Uniform Interface

Code on demand
6
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Explaining Open Data Protocol (OData)

Architecture of the World Wide Web

7
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 JSON with Chrome or Firefox

• OData uses the HTTP protocol, any web browser


can be used to start exploring OData.
• OData currently supports the Atom and the
JSON formats.

8
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 JSON with Chrome or Firefox

• JSON has significantly less protocol overhead


than the Atom Publishing protocol, which is
used by default.
• JSON can easily be consumed with Java Script
and by SAPUI5.

9
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 JSON with Chrome or Firefox

10
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 JSON with Any Browser

11
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 ATOM Protocol with Query Option sap-ds-debug

12
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 ATOM Protocol with Query Option $format=xml

13
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Structure of an OData Service

14
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 OData Service Document Example

15
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 OData Service Document Resources

BusinessPartnerSet

SalesOrderSet

SalesOrderLineItemSet

ProductSet

ContactSet

16
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 OData Graphical Representation

17
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Entity Data Model Overview

18
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Performing OData Operations

GET …GWSAMPLE_BASIC/BusinessPartnerSet — Read the Service Document

19
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Read an Entity Set

GET …/BusinessPartnerSet – Read an Entity Set

20
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Sales Orders Navigation Properties

• A navigation property is tied to an association.


• An association is a named relationship between
two entity types.
• Every association includes two association ends,
which specify the entity types that are related
and the cardinality rules for each end of the
association.

21
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Sales Orders Navigation Properties

22
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 CRUD Operations

• One of the main features of OData is that it


uses the existing HTTP verbs GET, PUT, POST
and DELETE against addressable resources
identified in the URI.
• OData is a way of performing database-style
create, read, update, and delete operations
on resources by using HTTP verbs.

23
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 CRUD Operations Called on Entity Sets

24
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Operation Can Be Called On Entity Sets

A GET request to read a feed, or in other words a set of entries of


the same entity type as you have already seen with the Products
entity set.

To create a new entry of a specific entity type, you have to send a


post request to the corresponding entity set.

25
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Operation Can Be Called On Entities

• A single entry can be read by a GET request.


• If you choose to modify this single entry, you
can use PUT or PATCH.
• PUT is used for updating the whole entity.
• PATCH allows us to partially update the entity.

26
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Performing OData Queries

ODBC for the Web: Simple Query Language

27
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Patterns for UI-Centric Applications

• All of these query options can be used in patterns we frequently find in lightweight UIs.
Let’sfocus on the query option $count.
• The use case is to retrieve the number of entries of collection. This way the client develop can
show the user how many objects were found.

28
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 OData Query Options — $select

• $select is used to limit the result set for a consumer application by limiting the number of
columns that are retrieved by the consumer.

29
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 OData Query Options — $filter

• Get all business partners whose


company name starts with the letter
‘S’.
• Get all sales orders with a total sum
larger than €10,000.
• Only retrieve the business partner ID
and the name of a business partner

30
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 OData Query Options $top

31
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 OData Query Options — $skip

• When navigating to the second page


you have to use the $skip parameter.
• The client retrieves only six items
($top) but skips the first 6 and
therefore starts with Business Partner
No 0106

32
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 OData Query Options — $inlinecount

33
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Paged Results

• Using the query options $skip, $top, and $inlinecount, the results of a query can be
displayed in several pages through which the consumer can navigate.
• This functionality is called client side paging since the client forces the server to respond in a
certain way.

34
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 $expand Example

35
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 OData Service Requirements

3 entity sets

2 associations

2 navigation properties

36
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Use Cases for Navigation Properties

Get all sales


Get all sales Get all sales order orders and all
orders of a items of a sales sales order items
business partner order of a business
partner

37
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 Calls for Retrieve the data

First call /BusinessPartners(1)

Second call /BusinessPartners(1)/SalesOrders

38
© Copyright 2022, ZaranTech LLC. All rights reserved.
2 $expand Example

39
© Copyright 2022, ZaranTech LLC. All rights reserved.
2

Q&A Session

40
© Copyright 2022, ZaranTech LLC. All rights reserved.
© Copyright 2022, ZaranTech LLC. All rights reserved.
Thank you
Subscribe to our Channel for more Informative Videos.
https://www.youtube.com/user/ZaranTech

You might also like