In this article, we will see how to create services in SAP RAP (RESTful Application Programming) and consume the same in UI5/Fiori using the given steps:
- Create service definition
- Expose entities in the Service Definition
- Create Service Binding
- Publish OData service
- Implement OData in UI5/Fiori
Create Service Definition
Right-click on Package >> New >> Other Repositories Objects >> Service Definition.
Provide the details to create a Service Definition.
Once the Service Definition is created, expose the required entities and activate it.
Create Service Binding
Right-click on Package >> New >> Other Repositories Objects >> Service Binding.
Provide Package details, Name, Description and Service Definition name. Additionally, select the Binding Type to create Service Binding.
Verify the information. To expose the service, click on activate.
You can access the metadata details by following the Service URL provided in Service Binding. To preview the application, click on provided Preview button.
How to consume OData create by SAP RAP
Like any other OData created by CDS or SEGW, the OData of SAP RAP can be used similarly in UI5/Fiori Applications. Read more about OData here.