2. 2 | 20-November-2015|
SAP Netweaver Gateway INTRODUCTION
SAP Netweaver Gateway based on ABAP
to create ODAta Services
DAY - 1
3. 3 | 20-November-2015|
Agenda for DAY 1
• Introduction to SAP NetWeaver Gateway
• Deployment Options
• Introduction to REST
• Introduction to OData
• Walkthrough SAP NetWeaver Gateway Service Builder
4. 4 | 20-November-2015|
SAP Gateway ( BOR / RFC )
DAY - 2
SAP Netweaver Gateway based on
ABAP to create ODAta Services
5. 5 | 20-November-2015|
Agenda for DAY 2
• Netweaver Gateway Road Map from SAP
• Creating a Odata Service from BOR/RFC
• Odata Query Options
9. 9 | 20-November-2015|
SAP Netweaver Gateway Deployment Options Part 1
1 Hub Deployment with Service Development in the SAP Business Suite Backend
Advantages of this scenario:
•Routing and composition of multiple systems is
supported
•Single point of access to backend systems
•Hub system can be based on a newer release
(7.31 or 7.40) that supports additional
authentication options (Kerberos, SAML Browser
protocol)
•Hub system can be based on a newer release
(7.31 or 7.40) that supports SAPUI5
•Enhanced security because of no direct access to
the backend system
•Direct local access to metadata (DDIC) and
business data, meaning easy reuse of data
10. 10 | 20-November-2015|
SAP Netweaver Gateway Deployment Options Part 2
Advantages of this scenario in addition
to the ones mentioned in the 1st
scenario:
No need to install (and upgrade) SAP
Gateway components in the backend
Services developed by partners do not
need any deployment in the backend
systems
Disadvantages:
Access is limited to remote-enabled
interfaces (RFC function modules, BAPIs,
BW Easy Queries, SPI Objects)
Remote-enabled interfaces might not be
optimally suited (e.g. they might not offer
appropriate filter options)
GENIL objects cannot be accessed
remotely
Additional server needed for SAP
Gateway
No direct local access to metadata
(DDIC) and business data, meaning reuse
of data is limited to remote access as
mentioned above
2.Hub Deployment with Service Development in the SAP Gateway Hub
11. 11 | 20-November-2015|
SAP Netweaver Gateway Deployment Options Part 3
Advantages:
•Less runtime overhead as remote calls
are reduced.
Disadvantages:
•If multiple SAP Business Suite
systems are used, SAP Gateway
system would have to be configured
multiple times
•If embedded deployment is chosen,
the system must not be used as a hub
for additional backend systems. As a
result Routing and composition cannot
be used.
•Upgrade of components in a SAP
Business Suite backend system is
usually only possible once or twice a
year for larger companies
Additional security component needed
for extranet scenarios.
3. Embedded SAP Business Suite Deployment and Service
Development
14. 14 | 20-November-2015|
REST - The Foundation of the World Wide Web
REST stands for Representational State Transfer
It is an architectural pattern for developing web services as opposed to a specification.
REST web services communicate over the HTTP specification, using HTTP vocabulary:
Methods (GET, POST, etc.)
HTTP URI syntax (paths, parameters, etc.)
Media types (xml, json, html, plain text, etc)
HTTP Response codes.
Representational
Clients possess the information necessary to identify, modify, and/or delete a web resource.
State
All resource state information is stored on the client.
Transfer
Client state is passed from the client to the service through HTTP.
15. 15 | 20-November-2015|
REST - The Foundation of the World Wide Web
The six characteristics of REST:
1.Uniform interface
2.Decoupled client-server interaction
3.Stateless
4.Cacheable
5.Layered
6.Extensible through code on demand (optional)
•Services that do not conform to the above required
contstraints are not strictly RESTful web services.
16. 16 | 20-November-2015|
HTTP - An Implementation of the Principles of REST
REST is a set of architectural principals that can be used to define Web Services. First introduced by Roy
Fielding in his doctorial dissertation in the year 2000. HTTP protocol is an example of a system that
implements the principles of REST. ! Uses HTTP verbs to communicate what action to take. Verbs map to
CRUD methods:
18. 18 | 20-November-2015|
Introduction to OData
Atom
Atom is the combination of two standards: Atom Syndication Format and
Atom Publishing Protocol
Atom standards were originally created for publishing and subscribing to web based
content (news reports, blogs, etc.).
Atom Syndication Format
Ÿ Defines the format for document feeds.
Ÿ In OData, the documents are the data being acted upon (Business Objects, etc).
Atom Publishing Protocol
Ÿ Defines how to read and maintain documents.
Ÿ Atom uses GET, POST, PUT, DELETE HTTP verbs as described the REST architecture.
19. 19 | 20-November-2015|
Introduction to OData
OData can be used to access table like structures much the same way ODBC
does.
•Entity Data Model (EDM) used to describe OData Services.
•EDM modeling tools available to model OData Services:
•Each entity can support Create,
•Read, Update, and Delete (CRUD)
•operations
•Can navigate relationships
•Complex Types supported
21. 21 | 20-November-2015|
Introduction to OData
OData defines a Metadata format based on the Entity Data Model in XML (edmx).
To access a service’s metadata document use the $metadata command:
The returned document is the service’s edmx metadata + SAP Metadata (S-Data):
23. 23 | 20-November-2015|
Introduction to OData
OData for SAP– Extra Metadata
OData for SAP is extra metadata that can be found in the service’s metadata
OData for SAP contains: labels, annotations, etc.Extra metadata that can be accessed
via SAP proxy generators.
27. 27 | 20-November-2015|
Creating/Implementing a Odata Service part 0.2
Step: Import DDIC Structure to create the entity - Product
1. Right-click Data Model and choose Import DDIC Structure
28. 28 | 20-November-2015|
Creating/Implementing a Odata Service part 0.3
Enter the following value in the wizard and then press Enter: ABAP Structure:
BAPI_EPM_PRODUCT_HEADER
and press ENTER.
Result:
The wizard will automatically fill the field ObjectName with the value BapiEpmProductHeader and
create an entity set based on the DDIC structure.
3. Change the default values such that
a. the property PRODUCT_ID becomes a key field
b. the name of the entity type is Product rather than BapiEpmProductHeader
30. 30 | 20-November-2015|
Creating/Implementing a Odata Service part 0.5
Step: Create an entity set for the previously created entity
1. Expand the node Data Model and double-click Entity Sets:
2. Click the Create button to a new line to the table:
35. 35 | 20-November-2015|
Creating/Implementing a Odata Service part 1.0
Verify that the runtime objects have been generated successfully:
The following objects have been generated:
36. 36 | 20-November-2015|
Operating BOR/RFC Generator 0.1
Step 1: Create EnityType and EntitySet for TimeConfirmation.
At task 1 you created a structure that reflects that contains all attributes of the entity time
confirmation. To create the EntityType and EntitySet TimeConfirmation left click on DataModel at
the navigation tree and choose import RFC/BOR Interface
37. 37 | 20-November-2015|
Operating BOR/RFC Generator 0.2
At the first step of the wizard you specify the name of the EnityType. Choose Remote Function Call and
use the Function Z_GW_TIMECONF_GET_ENTITY. Make sure that you have ticked “Create Default Entity
Set”. So you don’t need to create the entity set later on.
Choose all properties of ENTITY data source parameter.
38. 38 | 20-November-2015|
Operating BOR/RFC Generator 0.3
Repeat the same steps described at Step 1: Create EnityType and EntitySet of TimeConfirmation. to
create the EntityType and EntitySet for Attendance and Absence Types.
1.Use Context Menu of Data Model to choose import and RFC/BOR interface.
2.At the first step of the wizard specify AttendanceAbsenceType as EntityTypeName and
Z_GW_TIMECONF_GET_ATT_ABS as the function name.
3.At the second step of the wizard choose AWART and ATEXT of the parameter ATTENDANCE_ABSENCE
4.Choose a meaningful name for AWART and ATEXT like in the screenshot below.
5.Check “Is Key” for AWART
40. 40 | 20-November-2015|
Operating BOR/RFC Generator 0.5
Step 1: Create the Mapping for the EntitySet
AttaendanceAbsenceTypeSe
GetEntity
Left click at CreateEntity of AttendanceAbsenceTypeSet in the section Service Implementation. At the
context menu choose Map to Data Sourc
41. 41 | 20-November-2015|
Operating BOR/RFC Generator 0.6
Choose Remote Function Call and the function
Z_GW_TIMECONF_GET_ATT_ABS.
More On http://scn.sap.com/docs/DOC-55554 for BOR RFC Generators
42. 42 | 20-November-2015|
Odata Query Options part1
OData Operations – RetrieveEntitySet (QUERY)
OData defines a RetrieveEntitySet request to search for entities in an entity
set. It returns a list of matching entities. Use HTTP GET verb to retrieve a feed
of entities from an entity set. The URL only contains the name of the entity
set and any needed query string parameters:
Query string parameters defined by OData:
$filter – user for passing input parameters, example: $filter=airlineid EQ ‘US’
– Other operators supported, GT, LT, AND, OR, etc. Learn more on OData website.
$top – used for getting the top X results, example: $top=5 – returns the first 5 results
$skip – used to skip ahead X number of entities in the returned list, example: $skip=5, skips
the first 5 results in the list.
– Often combined with $top to page thru a list, example: $top=5&$skip=5 – returns the second 5
results
in the list.
Many others defined by OData. Note: not all supported by Gateway.
43. 43 | 20-November-2015|
Odata Query Options part2
OData Operations – RetrieveEntity (READ)
The RetrieveEntity operation returns the details of a specific entity.
Use HTTP GET verb to execute the RetrieveEntity operation.
The URL of the RetrieveEntity operation is just the RetrieveEntitySet
operation URL with the addition of the key properties
Note: Each Entity returned by the RetrieveEntitySet operation will contain an
HREF link to the RetrieveEntity operation for that entity:
44. 44 | 20-November-2015|
Odata Query Options part3
OData Operations – InsertEntity (CREATE)
The InsertEntity operation creates an entity.
Use HTTP POST verb to execute the InsertEntity operation.
The URL used to execute the InsertEntity operation is the exact same used for
executing the RetrieveEntitySet operation.
The Request Header most include the attribute x-requested-with:
The Body of the request must contain the Atom Entry that represents the business entity to be created:
45. 45 | 20-November-2015|
Odata Query Options part4
OData Operations – InsertEntity Continued
The InsertEntity operation creates an entity.
Successful execution of the operation returns HTTP 201 status code along with the location of the
newly created entity will be returned.
Successful Response Header:
Successful Response Body:
46. 46 | 20-November-2015|
Odata Query Options part4
OData Operations – UpdateEntity (UPDATE)
The UpdateEntity operation updates an entity.
Use HTTP PUT verb to execute the UpdateEntity operation.
The URL used to execute the UpdateEntity operation is the exact same used for executing the
RetrieveEntity operation.
The Request Header most include the attribute x-requested-with:
The Body of the request must contain the Atom Entry that represents the business entity to be
updated:
47. 47 | 20-November-2015|
OData Operations – UpdateEntity Continued
Odata Query Options part4
The UpdateEntity request changes an entity.
If the update is successful, the server responds with: Successful Response Header – 204 HTTP
Response Code:
As the response code text above signifies, no data is returned in the Response Body: