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.
- Using transaction code /n/iwbep/oci_srv_gen
- 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 “/”
Provide logon details under logon & security tab.
after creating click on connection test, it should be successful.
-> Create system Alias
Click on create system alias, provide below information.
Enable both local gateway and for local app to avoid any further issue while registering services.
-> 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
Click on execute
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.
Now click on ZTEST_SRV and activate it (Click OK).
Go back and select the service , click on SAP Gateway Client and test the service.
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
-> Redefine odata service
Provide below details
Service namespace – XS project name in hana db
Service Name – XS Odata service name
Click on next
Select required entity sets and click on finish
Select the project and click on Generate run time objects
You can see the below screen after run time objects generated
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.
Hi Thanks for this helpful post. We have added XSOdata through both methods mentioned here – but we are facing an issue where the registered service is not working properly once added to gateway.
It registers with no errors, but the data does not retain the same data structure or response to URL query like it does on HANA service.
For example: ‘$show=Plant,Status,Count’ should return each plant with number of count per status – but it gives a line item for each single count and does not group them any longer.
Do you know why this would happen? I have tried adding the service multiple times with this same issue repeating each time. Is it something needed to be changed in original XSOdata?
Any advice is greatly appreciated, thanks
Hi Justin,
There are chances of xsodata service fail due to change in datatypes. Few datatypes which may not support in SAP when you register from HANA. Please cross check for the datatype of all fields. Hope this may help you.
Thanks,
Divi
Hi All,
I have created xsodata in hana and trying to Register XSOdata services into SAP Gateway using above blog. I have created RFC connection as mentioned above.
But while testing I am getting "Connection closed" message.
Can you please suggest if any prior configuration required or what can be possible error.
Hi Avinash,
Have you mentioned the path prefix? and please check for the correct host and port details. I didn't perform any additional prior configurations for creating RFC Connection.
Thanks,
Divi
Thanks Srilaxmi for reply.
Path prefix given as ' / ' which you have mentioned in Blog.
Regarding Port details I have used 4300 which is for HTTPS xsodata for this I am getting “Connection closed” message.
But If I will used 8000 port which is for HTTP port that time I am getting Status as 200 means RFC is generating.
My XSODATA has port 4300 and for this I am facing issue.
Is there any other configuration required for HTTPS based XSODATA?
Great Blog !
I have one question...If the HANA XSodata is Changed by adding one more entity it is not getting reflected in SAP gateway service.
How do I refresh the gateway service?
Thanks in advance!!
Hey Anand!
Try Reactivating from tcode - /n/iwbep/oci_srv_gen
It won't be automatically refreshed in gateway untill we regenerate.
Hi Srilaxmi,
Thanks for your Blog.
I have a similar requirement and trying to follow the same process but I am getting "Error in parsing the source metadata" when I am using transaction code /n/iwbep/oci_srv_gen. Could you please help what is wrong i am doing?
service namespace "test_odata_services"{
"CV_FUNCTION_TEST" as "getData" keys ("ID");
}
In the transaction code "/iwbep/oci_srv_gen" have given RFC Name, Name space as "test_odata_services" and Service Name as "TestService.xsodata".
Note: XSOdata is working fine.
Regards,
Rajesh
Hi Rajesh,
Please check all data types one more time. Are all datatypes are compatible with SAP? Usually I have seen parsing errors especially when there is datatype conflict.
Hi Srilaxmi,
Thank you for quick response. I have used all the fields with NVARCHAR type only. Will this have any conflicts?
NVARCHAR won't be having type conflict. Please Try out the second approach from SEGW as well.
Hi Srilaxmi,
Thanks for the advice. Now we are able to register the service and able to retrieve the metadata. But when we execute the entity set in gateway client we are getting 'Unable to perform Query operation :Format application/atom+xml;type=feed not support'. We have passed "?$format=json" in the request string and tried but still getting the same error.
Could please advice if any additional logic/setting needs to do in XSODATA side or Gateway side?
Regards,
Rajesh