Skip to Content
Author's profile photo Ashish Kumar

How To Create SAP NetWeaver Gateway Service for SPI

Currently, SAP NetWeaver Gateway offers an extremely simple and easy way to expose data via the REST based Open Data (OData) format. Using Gateway, numerous services based on BOR objects, RFCs, GenIL, EasyQuery and Service Provider Infrastructure(SPI) can be generated. This blog is all about how to generate SAP NetWeaver Gateway service for SPI. Basically, the Service Provider Infrastructure (SPI) is an application and UI technology independent layer for business data exposure, which is used across the whole Business Suite to build timeless software.
For easy understanding, we have provided a business scenario here….
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Business Scenario

You as an enterprise are using SAP Product Lifecycle Management (PLM) to manage the lifecycle of your product and you focus more on the product data management. As Material Master Management allows creating, maintaining and viewing material master data records, you want to expose all of these operations as an OData Service in order to take advantage of the features of OData Service like Ease of consumption, Industry standard, Open specification promise etc.
Moreover, you have the material data and services exposed via Service Provider Infrastructure (SPI) application.
So let’s see how you can create an SAP NetWeaver Gateway service for SPI (as long as you know a little bit about OData specifications) without the need to know the mapping between SPI and OData, and bests of all, WITHOUT having to write a SINGLE LINE OF CODE!!!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Prerequisites

SPI  Integration with Gateway requires the following software components
• IW_SPI 100
• IW_BEP 200 SP4
• IW_FND 250(Gateway Hub) SP3
• SAP_BS_FND 7.02 SP4 (minimum release of SAP_BS_FND) along with the notes 1681356 and 1684534 installed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Step-by-Step Procedure

Following are steps which you need to follow
  • Configuration on SAP NetWeaver Gateway System
  • Configurations on Business Enablement Provisioning(BEP)
  • Generate SPI service
  • Registration and Activation of the Generated Service
  

Configuration on SAP NetWeaver Gateway System

This activity needs to be done in the system where software component IW_FND is installed

1. Manage RFC Destination

Create RFC Connection to the SAP Business Suite backend system.

  • In transaction SPRO open the SAP Reference IMG and navigate to: SAP NetWeaver -> Gateway -> OData Channel -> Configuration -> Connection Settings -> SAP NetWeaver Gateway to SAP System -> Manage RFC Destinations -> and click the Activity icon. For information on how to manage RFC destinations, click on the corresponding IMG documentation.

2. Manage SAP System Aliases

  • In transaction SPRO open the SAP Reference IMG and navigate to: SAP NetWeaver -> Gateway -> OData Channel -> Configuration -> Connection Settings -> SAP NetWeaver Gateway to SAP System -> Manage SAP System Aliases -> and click the Activity icon.
  • Choose New Entries.
  • Enter the following details for the system alias:
    Field Description
    SAP System Alias Name of the system alias, for example SPI_REMOTE
    Description Descriptive text for the system alias.
    Local GW Leave unchecked if the Backend system is not on the same system as the SAP NetWeaver Gateway system.
    For Local App Check if IW_BEP add-on is deployed on the SAP NetWeaver Gateway hub system.
    RFC Destination Specify the RFC destination that you created in the step above.
    WS Provider Leave it blank.
    Software Version Choose Default.

  • Save your settings.

This means if IW_FND and IW_BEP are co-deployed and Backend system is not on the same system as the SAP NetWeaver Gateway system, checkbox ‘For Local App’ should be checked.

new system alias.jpg

Configurations on Business Enablement Provisioning(BEP)

This activity needs to be done in the system where software component IW_BEP is installed.

1.Manage RFC Destination

Create RFC Connection to SAP NetWeaver Gateway System. For this, first you must identify the SAP NetWeaver Gateway landscape.

  • In transaction SPRO open the SAP Reference IMG and navigate to: SAP NetWeaver -> Gateway Service Enablement -> Backend OData Channel          –> Connection Settings to SAP NetWeaver Gateway->Create RFC Destination for Outbound Queues and click the Activity icon. For information on how to manage RFC destinations, click on the corresponding IMG documentation.

2.Manage SAP System Aliases

  • In transaction SPRO open the SAP Reference IMG and navigate to: SAP NetWeaver -> Gateway Service Enablement -> Backend OData Channel          –> Connection Settings to SAP NetWeaver Gateway->SAP NetWeaver Gateway Settings and click the Activity icon.

gw settings.jpg

  • Choose Create and enter the following values:
    Field Description
    Destination System Specify the system name of the host of SAP NetWeaver Gateway. For example, GW_HUB
    Client Specify the system client ID of the host of SAP NetWeaver Gateway. The client ID you specify should be in the specified system.
    System Alias Enter a unique name for the host of SAP NetWeaver Gateway. For example,BEP2HUB
    RFC Destination Specify the name of the RFC destination that you created in the step above. For example GWCNT200.

  GW Connection.JPG

  • Save your settings

More details about configuration can be found in SAP Library – SAP NetWeaver Gateway

Generate SPI service

You can create an OData service from an SPI object using Gateway Service Builder tool (transaction ‘SEGW’).

1. Go to the transaction SEGW. Create a New Project by clicking on /wp-content/uploads/2012/11/4_157360.jpg
2. Enter the details for the Project, Description, and Generation Strategy. Note – In case the project needs to be transported the package should not be $TMP.
/wp-content/uploads/2012/11/1_157367.jpg
3. A new project is created. Right click on ‘Data Model’ and select the following hierarchy to generate an SPI service. Data Model → Redefine → SPI Service.
/wp-content/uploads/2012/11/2_157368.jpg
4. The Wizard to Redefine SPI service opens. Enter the details of the RFC destination from where the SPI content is fetched. Then select the Application Building Block ID using the value help. Let’s select PLM_MAT that is application ID for PLM Material Management.
Rfc.JPG
5. Click Next  to go to the second screen. The names of the Model Provider Class, Data Provider Class, Model Name, Version and Service Name and versions would be suggested by the wizard. Along with these the Description for the Model and the Service have to be entered.   
/wp-content/uploads/2012/11/6_160100.jpg     
6. Click Next to go to the third screen.
7. In the third screen the generated model is redefined. You can select the entities that you want to.
So in this case let us select Entity Type BASIC_DATA and DESCRIPTIONS.
/wp-content/uploads/2012/11/redefine_158354.jpg
Scroll down and you can see the associations.
So let us select the association DESCRIPTIONSofBASIC_DATA which is related to the enity selected above.
/wp-content/uploads/2012/11/8_157374.jpg
8. Click  /wp-content/uploads/2012/11/9_157375.jpg  to complete the wizard.
The message “Project ‘XXX’ has been checked; no errors were found” is displayed.
9. The next step is an optional step to Redefine Names and Labels.
Since the property MATNR is not very user friendly let us add a label to it.
Double click property MATNR and click Redefine/wp-content/uploads/2012/11/16_157378.jpg 
Add a label to MATNR as “Material Number“.
/wp-content/uploads/2012/11/14_157377.jpg

10. Click /wp-content/uploads/2012/11/17_157383.jpgto generate the runtime objects. The model and service definition screen opens. The Class Names for the Model Provider and Data Provider would be already entered by the wizard. The base class would be extended in the class name ending with ‘EXT’.

Under service registration, the Technical Model Name would already be entered. There is an option to overwrite the extended service.
/wp-content/uploads/2012/11/11_157379.jpg

Note:- If any operation is not implemented in SPI and you want to provide custom implementation for the same in SAP NetWeaver Gateway, you can do it by redefining the relevant method of  the generated extensibility Data Provider Class (DPC).

Registration and Activation of the Generated Service

Final step is to register the generated service on SAP NetWeaver Gateway System.
For this, double click Service Maintenance node. You can see the list of Gateway HUB systems connected .
Service Maintenace.JPG
1. Select the HUB system(e.g. GW_HUB) where this service needs to be registered and click Register icon to register the service.
2. Click ‘Yes‘ when the warning popup is displayed.
warning popup.jpg

3. Provide the system alias(e.g. SPI_REMOTE) configured on Gateway System. Click enter to continue.

/wp-content/uploads/2012/11/hubtobackend_160099.jpg
4. The Add Service screen opens. Enter the package as $TMP and enter to continue. In case the registered service needs to be transported any package other than $TMP has to be entered.
/wp-content/uploads/2012/11/12_157381.jpg

5. The registration status changes to a green node indicating the service is activated.

/wp-content/uploads/2012/11/13_160033.jpg
6. Click /wp-content/uploads/2012/11/18_157384.jpgto maintain the service. A new screen opens to Activate and Maintain Services.
7. Click Call Browser to open the service document in the browser.
/wp-content/uploads/2012/11/callbrowser_158356.jpg
Here are the Service and Metadata URLs.

/wp-content/uploads/2012/11/servicedocument_160032.jpg

Now you can easily consume this service from any device, any platform or any technology and start creating, maintaining, and viewing data.

Apart from PLM, SPI is extensively being used in several applications of different areas across the whole SAP Business Suite.

You can find below the list of some of the applications that use SPI.

Area Reference Applications
Product Lifecycle Management (PLM) Bill of Material, Classification, Variant Configuration, Recipe, Specification, …
Business Context Viewer (BCV) Business Context Viewer (only uses SPI services for DMZ enablement)
Industries & Assets (EAM) Equipment, Functional Location, Maintenance Order & Notification, Job Confirmation
Oil & Gas (GHO) Network Objects, Allocation Rules, Allocation Workbench
Material Management (MM) Purchase Requisition
Production Planning (PP) Consumer Products for Food and Beverage
Financial Accounting (FI) Sustainability Enhancements for Vendor
Solution Manager (SolMan) Landscape Management
Master Data Governance (MDG) Material
Sustainability OnPremise NWA Global Batch Traceability (GBT)
HANA Application Development Demand Signal Management (DSM)
TIP Gateway 2.0 (SP4) offers a generator from SPI to OData Models

Expect new blogs on any new features/enhancements on integration of SAP NetWeaver Gateway with SPI, so stay tuned!!!

If you have any queries, shoot an email to either Ashish Kumar(ashish08.kumar@sap.com) and/or Sai Harish Balantrapu(sai.harish.balantrapu@sap.com).

========================================================================================================================

Assigned Tags

      13 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Goutham Nagaraj Naidu
      Goutham Nagaraj Naidu

      nice blog....

      Author's profile photo Wolfgang Walter
      Wolfgang Walter

      Thanks, very helpful!

      Author's profile photo Carlos Roggan
      Carlos Roggan

      Thanks a lot, Ashish!

      We've really been waiting for such blog...

      Author's profile photo Syambabu Allu
      Syambabu Allu

      Hi Ashish,

      Nice Blog.

      Thanks,

      Syam

      Author's profile photo Former Member
      Former Member

      Hello Ashish/Sai,

      I have gone through this documents

      Which is really Useful.

      Now we are working with MDG(MDGM/MDGC/MDGS)with Fiori.

      Could you please guide us - How To Create SAP Net Weaver
      Gateway Service for MDG(MDGM/MDGC/MDGS)

      It would be great if you can share some documentation related
      to SAP Net Weaver Gateway Service for MDG(MDGM/MDGC/MDGS)

      Thanks & Regards,

      Rakesh

      Author's profile photo Former Member
      Former Member

      Hello Ashish ,

      I am getting an Error "Failed to get SPI information"

      After doing 5th step,

      I want to know what might be the mistake ,

      Thanks & Regards,

      Dikshith

      Author's profile photo Vijay Vegesana
      Vijay Vegesana

      Good one Ashish

      Author's profile photo Devanand L
      Devanand L

      Hi Dikshith,
      How did you solve this error? ("Failed to get SPI information"). I am stuck with the same error for some time now. We have a hub configuration with IW_SPI installed in Gateway system.

      Appreciate your help.

      regards,

      Devanand L

      Author's profile photo Sai Harish Balantrapu
      Sai Harish Balantrapu

      Hi,

      The system alias configuration may have been incorrect. Please check the blog http://scn.sap.com/community/gateway/blog/2013/05/30/system-alias-and-routing-of-request-in-sap-netweaver-gateway .

      Regards,

      Harish

      Author's profile photo Devanand L
      Devanand L

      Hi Harish,

      Thanks for the reply. I have checked the configurations and they are all ok. While debugging i found that the metadata node info exported from Backend system to the buffer is found empty when the same is imported in the Gateway system. Also i am getting an exception while importing as 'CX_SY_IMPORT_MISMATCH_ERROR'.

      Kindly help me with this issue.

      regards,

      Devanand

      Author's profile photo Former Member
      Former Member

      What is exactly Data and Model provider Classes are and their Differences

      Author's profile photo Sai Harish Balantrapu
      Sai Harish Balantrapu

      Hi Raghuram,

      The Model Provider class provides the metadata of the OData service. The Data Provider class maps the fields in the service to the data source in the backend ABAP system. Hope this clarifies.

      Regards,

      Harish

      Author's profile photo Former Member
      Former Member

      Thank u