Saturday, 6 October 2018

Register XSOdata servies into SAP Gateway

Complete procedure for registering xsodata services which are developed in HANA to SAP Gateway.

For any requirement in which if we develop xsodata services and use it while creating UI5 application in web ide, We can directly take that xsodata service URL from WEB ide or we can also register the service into SAP gateway and select the specific URL as a odata service URL to avoid issues while deploying app to SAP UI5 repository.

there are two ways for registering xsodata services.

1. Using transaction code /n/iwbep/oci_srv_gen
2. Using transaction code SEGW)

Create SM59 RFC connection between SAP Gateway system and HANA db, Connection should be HTTP Connection to external server (Connection Type “G”).

Provide Host and port name.

Path prefix should be “/”

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Provide logon details under logon & security tab.

after creating click on connection test, it should be successful. 

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Create system Alias

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Click on create system alias, provide below information.

Enable both local gateway and for local app to avoid any further issue while registering services.

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Navigate to transaction /n/iwbep/oci_srv_gen

Provide below information.

Service namespace – XS Project name in HANA DB

service name – xs odata service name

Provide package and transport request details before execute itself otherwise dpc, mpc willnot be stored in TR

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Click on execute

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Gateway services are created ,now we need to activate and register the service.

Navigate to transaction    /n/IWFND/MAINT_SERVICE

Click on add service, Provide system created alias name and technical service name which we have created above and click on get services.

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Now click on ZTEST_SRV and activate it (Click OK).

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Go back and select the service , click on SAP Gateway Client and test the service.

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

You can also test the service by selecting Entitysets. If any mismatch in the datatypes while registering in sap system, it will show an error from that entity set.

2) Using Transaction Code SEGW


Create SEGW Project

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Redefine odata service

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Provide below details

Service namespace – XS project name in hana db

Service Name – XS Odata service name

Click on next

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Select required entity sets and click on finish

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Select the project and click on Generate run time objects

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

You can see the below screen after run time objects generated

NW ABAP Gateway (OData), SAP NetWeaver Application Server for ABAP, SAP ABAP Study Materials

Now the service (ZTEST_SRV_01) is created and we can activate it from transaction “/n/iwfnd/maint_service” as mentioned previously in step1 procedure.

Here we can also debug entire process of connecting to HANA DB and fetching the data into SAP Gateway.

To conclude, If we want to retrieve data from any other third party and display it in Fiori App, we can use the above procedure for registering the entire service data(which is developed in HANA) into SAP Gateway and there by we can use the same service in developing UI5 application.

No comments:

Post a Comment