Introduction: workingwith OData services on the SAP NetWeaver platform seems to be getting streamlined and simple. This is from an end-to-end perspective of developing an OData service in a SAP Backend system (with SAP Gateway component installed) as well exposing this OData service in SAP Process Orchestration. The advantages of this are enormous because, this already eliminates the use of SAP Gateway hub for exposing Gateway services. The existing SAP Backend system and SAP Process Orchestration can be leveraged, reducing the complexity of the landscape, while also reducing the total cost of ownership. Previously, developing OData services within the SAP Gateway platform seemed to be also a complex process. But also with the availability of the Gateway service builder tool (T-code: SEGW), a lot of the steps can also be easily automated. In this blog, I will try to achieve the following;

  1. Develop an OData service in SAP Backend (with Gateway component installed)
  2. Expose the developed OData service via the OData Provisioning Administration console in SAP PO.

Prerequisites:

  • v SAP Backend system (with SAP Gateway component installed: IW_BEP 200 )
  • v SAP NetWeaver 7.3 EHP 1 SP 13/ SAP NetWeaver 7.4 SP 08
  • Following Authorization to user: GW_ADMIN and GW_USER

A)  Developing OData Service in SAP Backend

Developing an OData service in SAP Backend requires that the gateway component mentioned earlier is installed on the backend system. The Service Builder Tool is used to kick-start the process of building the OData service and essentials steps required are mentioned explicitly.

     Create OData Service: The following actions will be performed to develop this service;

  1. Run the T-code: SEGW to access the service builder tool

Figure1.gif

2. Create a project and name it appropriately as “ZODATA_SERVICE” and save as local object,

Figure2.gif

Figure3.gif

After this, the following components are created within the project;

  • Data Model
  • Service Implementation
  • Runtime Artifacts
  • Service Maintenance

Figure4.gif

3.The Data Model for the OData service can be obtained/created in several ways; there is a possibility to create Entity types and entity set from scratch, but better still Data model can be imported in three ways taking advantage of existing data structures; DDIC, File (.edmx extension), RFC/BOR. Here, a DDIC will be imported. Click on the edit mode, right click on the Data Model component and select the option “Import DDIC”


Note: you could search the DDIC structure to be imported based on; View, ABAP structure or Database Table.

Figure5.gif

4. Select any existing ABAP Structure “/1BEA/FBCB_BDI”, provide object name “Z_BillingDetails”, Mark Client field property as Key and click ‘Continue’, It creates an Entity Type;

Figure6.gif

5. Create ‘Entity Set’ as below, with the name “BillingDetailsRequest” and select the Entity Type previously created;

Figure7.gif

6.  Open the ‘Entity Sets’  object and select the following properties Creatable, Updatable and Deletable;

Figure8.gif

7. After the previous step,  the following methods created for the “Service Implementation”

Figure9.gif

8. Now generate the “Runtime Artifacts” by clicking on the button shown below; this automatically generates the artifacts for the OData service with predefined classes which can be modified, but we keep it as default. The newly created classes are added as local objects.

Figure10.gif

Figure11.gif

Click continue and select the “Local Object” option in the next screen

9. The generated definition for the OData service is contained in this class: ZCL_ZODATA_SERVICE_MPC, however, to implement the desired logic, the ZCL_ZODATA_SERVICE_MPC_EXT class will be extended with the additional code. Right click on ZCL_ZODATA_SERVICE_MPC_EXT, choose the option below;

Figure12.gif

10. Switch to edit mode, select the “DEFINE” option and click on the Redefine button; add the following code below; then save and activate the class.

Figure13.gif

Figure14.gif

Register OData Service in the Gateway system: After the OData service has been created based on the previous steps described, the OData service needs to be registered in the Gateway system. To do this, perform the following actions

1. Run the T-Code in the backend system: /IWFND/MAINT_SERVICE to navigate to the service maintenance screen.

Figure15.gif

2. Choose the add service option to add the service created earlier in the backend system. Providing the following information shown in the screen and  ‘Enter’

Figure16.gif

3. Select the Technical Service Name and click on the local object as package, the package is filled with $TMP which is a local package;

Figure17.gif

Figure18.gif

After successful registration of the service, the following message should be displayed;

Figure19.gif

4. The OData service has been registered and it can be viewed as one of the services in the service maintenance screen.

Figure20.gif

Test the OData Service: A quick test can be confirmed on the newly created OData service can be done by;

  1. Select ‘ZODATA_SERVICE_SRV’ and click ‘Call Browser’. This will open Service definition in browser.

Figure21.gif

2. The Details of this newly created OData service is shown below;

Figure22.gif

B.  Exposing OData Service in SAP Process Orchestration

In the previous section, a step by step guide was provided on how to create an OData service within the SAP Backend system with installed gateway component. This newly Created OData service will be exposed for consumption. Such that, this service can be consumed by Mobile Devices, by a receiver adapter (REST Adapter) in PO as well as by UIs within the SAP BPM deployed on AS Java. To expose the OData service as a Gateway service in PO, there are two essential activities to be performed;

  • Create HTTP Destination to the Backend System
  • Register OData Service in the OData Provisioning Admin

Create HTTP Destination to the Backend System: To create the http destination from SAP PO to the backend system where the OData service resides; perform the following actions;

1.Navigate to the NetWeaver Administrator URL

http://<hostname>:<port>/nwa

2. Navigate through the following to Configuration è Destinations

3. Click on the Create button; choose the Hosting System, assign a Destination Name and select the Destination Type “HTTP“:

Figure23.gif

4.Click on the next option from the wizard and provide the connection information to the SAP Gateway IW_BEP service;

Figure24.gif

5. Select the following option to access IW_BEP service in the SAP backend and provide the necessary logon credentials;

Figure25.gif

Click on the finish tab to complete the process of creating the http destination.

6. Additionally, the new created destination can be tested by clicking the Ping Destination button; if the configuration is done properly, the ping operation should return a successful message: “     Successfully connected to HTTP destination CRD with response code 200. Content type text/html”


Register OData Service in the OData Provisioning Administration: Once the http destination to the backend system where the OData service resides has been set up, then we are ready to register our OData service as a Gateway service. To do this, perform the following actions;

1. Navigate to the SAP PO Gateway OData Provisioning Administration via the url below:

http://<hostname>:<Port>/igwj/Admin 

NB: It is important to note that these two roles (GW_USER and GW_ADMIN) should be added to your user in order to be able access the OData Provisioning Administration and perform necessary actions

2. Once in the OData service cockpit, select the “Register a New Service”

Figure26.gif

3. Choose the http backend destination created earlier in the NetWeaver Administrator and do a wild card search, select the OData service created earlier in the Backend system from the list;

Figure27.gif

4. Click on the service to be registered and select the “Register” option, once this is done successfully, the following message is popped up;

Figure28.gif

5. The Service Document can be opened to view the details of this service in the browser, the metadata can also be accessed by providing the following information in the URL extension of the service: /$metadata eg;

http://<hostname>:<port>/igwj/odata/SAP/ZODATA_SERVICE_SRV;v=1/$metadata

The metadata URL contains the EDMX (Entity Data Model for XML) which contains the service definition for the OData service.

6. Click on the service name to view all the properties of this gateway service;

Figure29.gif

After all of the steps above have been performed, the Gateway service is ready and available for consumption by different devices and applications.

Conclusion:

Providing an entry point to consume complex enterprise services available in the SAP backend system is possible via the OData service. This extensive article has been able to provide an end-to-end overview of the steps and actions required to create an OData service in a SAP Backend system with the Gateway add-on component installed. It provides an overview on how to expose an OData service in the backend as a Gateway service with the SAP Process Orchestration Java Gateway component. Once this service has been registered, it is available for consumption by devices and applications.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Avinash Ayanala

    Hi,

    While trying to register the service in Odata Provisioning administration i am not able to find any HTTP destination in it even though i have created an HTTP destination for Gateway server.

    Please check the above screen shot.

    Regards,

    Avinash.

    (0) 

Leave a Reply