48
SAP Gateway Author- Gaurav Ahuwalia

DAY1- DAY2Netweaver gateway

Embed Size (px)

Citation preview

Page 1: DAY1- DAY2Netweaver gateway

SAP Gateway

Author- Gaurav Ahuwalia

Page 2: DAY1- DAY2Netweaver gateway

2 2 | 20-November-2015|

SAP Netweaver Gateway INTRODUCTION

SAP Netweaver Gateway based on ABAP to create ODAta Services

DAY - 1

Page 3: DAY1- DAY2Netweaver gateway

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

Page 4: DAY1- DAY2Netweaver gateway

4 4 | 20-November-2015|

SAP Gateway ( BOR / RFC )

DAY - 2

SAP Netweaver Gateway based on ABAP to create ODAta Services

Page 5: DAY1- DAY2Netweaver gateway

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

Page 6: DAY1- DAY2Netweaver gateway

6 6 | 20-November-2015|

Technical skills required for gateway development

ABAP

OOABAP

Page 7: DAY1- DAY2Netweaver gateway

7 7 | 20-November-2015|

SAP NetWeaver Gateway Architecture part 1

Page 8: DAY1- DAY2Netweaver gateway

8 8 | 20-November-2015|

SAP NetWeaver Gateway Architecture part 2

Page 9: DAY1- DAY2Netweaver gateway

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

Page 10: DAY1- DAY2Netweaver gateway

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

Page 11: DAY1- DAY2Netweaver gateway

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

Page 12: DAY1- DAY2Netweaver gateway

12 12 | 20-November-2015|

SAP Netweaver Gateway Development Life Cycle

Page 13: DAY1- DAY2Netweaver gateway

13 13 | 20-November-2015|

REST - The Foundation of the World Wide Web

Rest defines 6 architecture constrains

Page 14: DAY1- DAY2Netweaver gateway

14 14 | 20-November-2015|

REST - The Foundation of the World Wide Web

REST stands for Representational State TransferIt 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.

RepresentationalClients possess the information necessary to identify, modify, and/or delete a web resource.StateAll resource state information is stored on the client.TransferClient state is passed from the client to the service through HTTP.

Page 15: DAY1- DAY2Netweaver gateway

15 15 | 20-November-2015|

REST - The Foundation of the World Wide Web

The six characteristics of REST:

1.Uniform interface2.Decoupled client-server interaction3.Stateless4.Cacheable5.Layered6.Extensible through code on demand (optional)

•Services that do not conform to the above required contstraints are not strictly RESTful web services.

Page 16: DAY1- DAY2Netweaver gateway

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:

Page 17: DAY1- DAY2Netweaver gateway

17 17 | 20-November-2015|

Introduction to OData

Page 18: DAY1- DAY2Netweaver gateway

18 18 | 20-November-2015|

Introduction to OData

AtomAtom is the combination of two standards: Atom Syndication Format andAtom Publishing ProtocolAtom standards were originally created for publishing and subscribing to web basedcontent (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.

Page 19: DAY1- DAY2Netweaver gateway

19 19 | 20-November-2015|

Introduction to OData

OData can be used to access table like structures much the same way ODBCdoes.

•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

Page 20: DAY1- DAY2Netweaver gateway

20 20 | 20-November-2015|

Atom in OData Details

Introduction to OData

Page 21: DAY1- DAY2Netweaver gateway

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):

Page 22: DAY1- DAY2Netweaver gateway

22 22 | 20-November-2015|

Atom in OData Details

Introduction to OData

Page 23: DAY1- DAY2Netweaver gateway

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.

Page 24: DAY1- DAY2Netweaver gateway

24 24 | 20-November-2015|

Gateway Service Builder development options

Page 25: DAY1- DAY2Netweaver gateway

25 25 | 20-November-2015|

Gateway Service Builder Tcode SEGW

Step: Create a new project in the Service Builder (transaction SEGW)

Page 26: DAY1- DAY2Netweaver gateway

26 26 | 20-November-2015|

Creating/Implementing a Odata Service part 0.1

Page 27: DAY1- DAY2Netweaver gateway

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

Page 28: DAY1- DAY2Netweaver gateway

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

Page 29: DAY1- DAY2Netweaver gateway

29 29 | 20-November-2015|

Creating/Implementing a Odata Service part 0.4

Press continue . Press Save.

Page 30: DAY1- DAY2Netweaver gateway

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:

Page 31: DAY1- DAY2Netweaver gateway

31 31 | 20-November-2015|

Creating/Implementing a Odata Service part 0.6Enter the following values:

Page 32: DAY1- DAY2Netweaver gateway

32 32 | 20-November-2015|

Creating/Implementing a Odata Service part 0.7

Task 2: Generate runtime objects and register and activate the service

1. Choose the Generate pushbutton:

Page 33: DAY1- DAY2Netweaver gateway

33 33 | 20-November-2015|

Creating/Implementing a Odata Service part 0.8

2. Leave the default values and choose Enter:

Page 34: DAY1- DAY2Netweaver gateway

34 34 | 20-November-2015|

Creating/Implementing a Odata Service part 0.9

Choose Local Object:

Page 35: DAY1- DAY2Netweaver gateway

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:

Page 36: DAY1- DAY2Netweaver gateway

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

Page 37: DAY1- DAY2Netweaver gateway

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.

Page 38: DAY1- DAY2Netweaver gateway

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

Page 39: DAY1- DAY2Netweaver gateway

39 39 | 20-November-2015|

Operating BOR/RFC Generator 0.4Create an association

Page 40: DAY1- DAY2Netweaver gateway

40 40 | 20-November-2015|

Operating BOR/RFC Generator 0.5

Step 1: Create the Mapping for the EntitySet AttaendanceAbsenceTypeSe

GetEntityLeft click at CreateEntity of AttendanceAbsenceTypeSet in the section Service Implementation. At the context menu choose Map to Data Sourc

Page 41: DAY1- DAY2Netweaver gateway

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

Page 42: DAY1- DAY2Netweaver gateway

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, skipsthe first 5 results in the list.– Often combined with $top to page thru a list, example: $top=5&$skip=5 – returns the second 5 resultsin the list.Many others defined by OData. Note: not all supported by Gateway.

Page 43: DAY1- DAY2Netweaver 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:

Page 44: DAY1- DAY2Netweaver gateway

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:

Page 45: DAY1- DAY2Netweaver gateway

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:

Page 46: DAY1- DAY2Netweaver gateway

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:

Page 47: DAY1- DAY2Netweaver gateway

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:

Page 48: DAY1- DAY2Netweaver gateway

48 48 | 20-November-2015|

ANY QUESTIONS?

END OF DAY