on 05-24-2017 12:10 AM
Hi,
I have a requirement where oData service is consuming a Function Module (FM). This FM is having a IMPORT, a EXPORT parameter along with a Table.
Scenario is, in UI5 application user will provide input in a input box and click on a button.
On click, it should fetch the export parameter and Table from the oData service.
In UI5 application, I am facing issues while sending input to oData and get the required items.
If I do hard-coding the import paramter of FM in oData service, I am getting the table values in entityset.
Any pointers to good way to achieve this will be helpful.
Thanks,
Saurabh
how you are passing parameter from ui ? post your code.....
you can give a try
"/entityset(param1='val1', param2='val2')"
or
var aFilters = [];
aFilters.push(new sap.ui.model.Filter("param1", sap.ui.model.FilterOperator.EQ, "val1") );
aFilters.push(new sap.ui.model.Filter("param2", sap.ui.model.FilterOperator.EQ, "val2") );
oModel1.read("/entityset", {
filters : aFilters,
...........
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Akhilesh for response.
To add here, I created a function import in oData and calling that in UI5 application.
Function import is returning the correct results where tested from Gateway client.
Now in UI5 application, binding of correct results is not happening. I need to fetch the items and display in a table.
Below is code from controller.js :-
oModel.callFunction("/TestFuncImport", {
method:"GET",
urlParameters: oUrlParams,
success: jQuery.proxy(this.successCall, this),
error: jQuery.proxy(this.errorCall,this)
});
},
successCall: function(oData) {
var oView = this.getView();
var oTable = oView.byId("idTable");
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(oData);
oTable.setModel(oModel, "ZResultSet"); // ZResultSet is entity set in oData service
oTable.getBinding("items");
},
But in above case table is always blank.
Can you please suggest what's going wrong here?
follow oData now,
successCall: function(oData) {
var oView = this.getView();
var oTable = oView.byId("idTable");
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(oData);
oTable.setModel(oModel);
//for example oData is:
oData = { "ZResultSet": [{ "id": "1", "name": "AAAA" }, { "id": "2", "name": "BBBB" }, { "id": "3", "name": "CCCC" }] };
},
//and in table declaration as below:
<Table id="idTable" items="{path: '/ZResultSet'}" >
if you dont have items property in table declaration then you need to bind table using aggregation. if above code didnt help you, paste your table code here
I got it Akhilesh, thanks for your inputs.
Regards,
Saurabh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.