sap gateway

16
SAP Gateway Basic Overview Service Development 1. Data model definition 2. Service Implementation 3. Service Registration EDMX- Entity Data Model Xml Service Builder Used to centrally display and create definition of OData services Runtime artefacts 1. Model Provider Class – MCP 2. Data Provider Class – DCP 3. Model 4. Service OData artefacts 1. Entity Set 2. Entity type 3. Properties Used data sources and models Models can be created based on EDMX- Modelling

Upload: shibin-kumblat

Post on 06-Dec-2015

64 views

Category:

Documents


2 download

DESCRIPTION

A quick guide to create a SAP Gateway service for biginers.

TRANSCRIPT

SAP Gateway Basic Overview

Service Development

1. Data model definition2. Service Implementation3. Service Registration

EDMX- Entity Data Model Xml

Service Builder

Used to centrally display and create definition of OData services

Runtime artefacts

1. Model Provider Class – MCP2. Data Provider Class – DCP3. Model4. Service

OData artefacts

1. Entity Set2. Entity type3. Properties

Used data sources and models

Models can be created based on EDMX- Modelling

Data Model can be defined in three ways - MPC

1. Declarative Model Definition – Here we create the model from scratch2. Model Import as EDMX – Here we import the model as an edmx file3. Import DDIC structure or BOR or RFC interface

DPC – Service implementation is done using these classes, you could write the code or extend the extensions. Usually we do the mapping and use the generator to generate this class.

Building a Service using BOR – SEGW

1. Project creation

2. On project creation Data Model will be created. Project structure will be created as seen below

It will have

1. Data Mode2. Service Implementation3. Runtime Artifacts4. Service Maintenance

The Data Model folder will contain

1. Entity Type2. Entity Set3. Association

We could create these items under Data Model manually using the context menu or do an import which will automatically create them for you.

What can you import?

1. Data Model from File –such as an edmx file2. DDIC structure3. RFC/BOR Interface

Importing an RFC BOR interface

1. Using the context menu of Data Model folder choose Import RFC/BOR Interface option

2. A wizard will be displayed as below, enter a name for the Entity and select the Type as Business Object Repository under Data Source Attributes.Note that you could import from a remote system too, in which case you will have to specify the RFC Destination.

Search for a BOR object, select it and click on next.

The interface of the BAPI will be displayed on clicking next, choose some fields and click Next

You will be given a chance to provide meaningful named to the selected fields, Also if amongst the chose fields there are no Key fields we will have to choose one as the key.

After this clock on done, this will create the Entity type

Now, we create the Entity Set using the Entity Type. For this double click on the Entity Set Folder and click on Create

The moment we save the Entity Set the Service Implementation will show the CRUD operations which was previously not available.

Next, we click on the generate button from the Menu and the Service Builder will create the MPC and DCP classes and its extensions, also the Technical Model Name and Technical Service Name is created.

The Technical Service Name is the external name visible in the service url and registered on the Gateway Hub.

If the Model is based on an RFC you cannot change the DPC and MPC classes. But, you can redefine the extension classes.

Naming conventions

1. Model Provider class ends with MPC2. Data Provider class ends with DPC3. Extension for MPC ends with MPC_EXT4. Extension for DPC ends with DPC_EXT5. Technical Model name class ends with MDL6. Technical Service name class ends with SRV

Once the code is generated by service builder the Runtime Artifacts folder will be filled with all the classes

To view the class use the Context menus and choose Go to ABAP Workbench

The MCP class has a super class CL_MGW_PUSH_ABS_MODEL. It will contain a redefinition called DEFINE which in turn calls another method which will have all the code related to the model.

Next, we do service registration, we can see all the systems connected to Gateway under the Service Maintenance folder.

Registration status grey indicates that the service is not registered yet. Click on Register button, you will get a warning that you are leaving the system.

Next, we have to provide the system alias

Specify the package and finish, now the service is registered

Click on maintain and click on Call Browser to open a browser to test the service, basic authentication will be required.