
In this post, I will explain how to connect multiple databases and OData services to SAP BTP using BAS . This guide covers configuring UI5 applications to consume multiple OData services from both SAP S/4HANA (on-premise) and SAP BTP ABAP environment, ensuring seamless data integration.
I aim to integrate three different OData services from different database sources :
On-Premise S/4HANA OData V2 Services
SAP BTP ABAP Environment OData V4 Service
Create a UI5 application in VS Code.
While creating the application, provide the service URL to configure an OData service automatically.
Navigate to webapp/manifest.json.
Modify the dataSources section to include multiple OData services as follows:
"dataSources": {
"mainService": {
"uri": "/sap/opu/odata/sap/ZPR_EMP_DETAILS_SRV/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
},
"subService": {
"uri": "/sap/opu/odata/sap/ZFI_TEST_ODATA_SRV/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
},
"rapService": {
"uri": "/sap/opu/odata4/sap/zui_tab_travdat_o4_aks_001/",
"type": "OData",
"settings": {
"odataVersion": "4.0"
}
}
}
Each model corresponds to an OData service:
"models": {
"": {
"dataSource": "mainService",
"preload": true,
"settings": {}
},
"subModel": {
"dataSource": "subService",
"preload": true,
"settings": {}
},
"rapModel": {
"dataSource": "rapService",
"preload": true,
"settings": {
"operationMode": "Server",
"autoExpandSelect": true,
"earlyRequests": true
}
}
}
In ui5.yaml, configure the destinations for OData services:
server:
customMiddleware:
- name: ui5-middleware-simpleproxy
afterMiddleware: compression
configuration:
ui5:
path:
- /resources
- /test-resources
url: https://ui5.sap.com
backend:
# On-premise SAP System Destination 1 - Replace with your URL
- scp: true
path: /sap/opu/odata/sap/ZPR_EMP_DETAILS_SRV/
url: https://your-onpremise-system-hostname:port/
destination: SAHANA_CONN
client: 'your client ID'
authenticationType: BasicAuthentication
# On-premise SAP System Destination 2 - Replace with your URL
- scp: true
path: /sap/opu/odata/sap/ZFI_TEST_ODATA_SRV
url: https://your-onpremise-system-hostname:port/
destination: SAHANA_CONN
client: 'your client ID'
authenticationType: BasicAuthentication
# SAP BTP ABAP Environment Destination - Replace with your instance URL
- scp: true
path: /sap/opu/odata/sap/zui_tab_travdat_o4_aks_001/
url: https://your-abap-instance-guid.abap.region.hana.ondemand.com
destination: abap-cloud-default_abap-trial-9a87acc7trial-dev
client: 'your client ID'
authenticationType: OAuth2UserTokenExchange
Note :
Destination :
S4HANA_CONN is used for two OData V2 services hosted in the on-premise S/4HANA system as shown in below screenshot.
abap-cloud-default_abap-trial-9a87ace7trial-dev is for the RAP-based OData V4 service hosted on SAP BTP as shown in below screenshot.
Authentication Types:
All the Connected OData will be Listed in Service Manager as shown in below screenshot.
Important Note on OData Connection Methods:
Avoid connecting directly to OData services via the Service Manager, as it can lead to data inconsistency issues (e.g., all requests may unintentionally retrieve only the last edited destination). Instead, I prefer using the Destination Service (as shown in the configuration above) for:
By following these steps, you can successfully integrate multiple OData services in a SAP BTP-based Fiori application. This setup allows seamless data flow between on-premise S/4HANA and cloud-based SAP BTP ABAP environment, ensuring a modern, scalable architecture.
I hope this helps! Let me know your thoughts or if you have any questions.
Thanks,
Akshay Anil
Technical Consultant, SAP ABAP | BTP | Fiori | Ui5
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |