on 2016 May 11 1:15 PM
Hello
Premise:
I am trying to build a web site with WebIde that will be deployed for 2 different sap clients.
The two clients have data on the same sap server, but they have 2 different clients (300 and 500).
I have created an OData service http://myhosturl.de/sap/opu/odata/myservice with the SAP NetWeaver Gateway Service Builder on the server with client 100 and registered my service on the clients 300 and 500.
I am able to get the data from the clients if append the string "?sap-client=500" to the service URL but I would like to have it dynamic, based on some javascript variable.
The datasource part of my manifest.json is as follows:
"dataSources": {
"mainService": {
"uri": "/destinations/mydestination/sap/opu/odata/myservice/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri" : "localService/metadata.xml"
}
}
}
and the sap.ui5 model is as follows:
"": {
"dataSource": "mainService",
"settings": {
"serviceUrlParams": {
"sap-client": "500"
}
}
}
Is there a way to add the "sap-client" parameter dynamically without having to hardcode the property wih the "serviceUrlParams"?
Thank you for your help.
Adrian
Request clarification before answering.
Hello Shivam,
The manifest.json file doesn't get changed. That is a configuration file which is read and saved in an internal model. What I change are the values of this internal model.
Adrian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adrian,
Can we change the manifest file's query parameters at runtime in the controller file as suggested..? Will that trigger the manifest call again and load the data in the specified language?
Regards
Imtiaz N
var str = this.getOwnerComponent().getManifestObject()._oManifestBaseUri._string;
//sample url
/str = https://xyz/manifest.json?sap-language=EN
var str1 = str.split("?")[0] + "?sap-language=" + language.toLocaleUpperCase();
//expected url
//str1 = https://xyz/manifest.json?sap-language=DE
this.getOwnerComponent().getManifestObject()._oManifestBaseUri._string = str1;
User | Count |
---|---|
53 | |
8 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.