on 06-03-2015 12:16 PM
Hi all,
I created a list sap.m in XML VIEW,
and binded items from oData, i.e from ABAP table,
List items Generated fine.
i'm trying to perform Search Operation, but its throwing Error "Internal Server Error",
is there any issue with my below code:?
or the prblm is with backend?
if so how to resolve?
============ VIEW =============
<Page
showHeader="false" >
<subHeader>
<Toolbar>
<SearchField
liveChange="onSearch"
width="100%" />
</Toolbar>
</subHeader>
<content>
<List
id="idList"
items="{/flightdata2Set}"
selectionChange="onSelectionChange"
mode="MultiSelect"
includeItemInSelection="true" >
<infoToolbar>
<Toolbar
visible="false"
id="idInfoToolbar" >
<Label id="idFilterLabel" />
</Toolbar>
</infoToolbar>
<items>
<StandardListItem
title="{Carrid}"
description="{Carrid}"
iconDensityAware="false"
iconInset="false" />
</items>
</List>
</content>
</Page>
==================CONTROLLER=====================
var url;
if(window.location.hostname == 'localhost')
{
url = "proxy/" + "sap/opu/odata/sap/*************/";
}
else{
url = "/sap/opu/odata/sap/*************/";
}
var oModeldata = new sap.ui.model.odata.ODataModel(url);
sap.ui.getCore().setModel(oModeldata);
},
onSearch : function (oEvt) {
// add filter for search
var aFilters = [];
var sQuery = oEvt.getSource().getValue();
if (sQuery && sQuery.length > 0) {
var filter = new sap.ui.model.Filter("Carrid", sap.ui.model.FilterOperator.Contains, sQuery);
aFilters.push(filter);
}
// update list binding
var list = this.getView().byId("idList");
var binding = list.getBinding("items");
binding.filter(aFilters, "Application");
},
onSelectionChange : function (oEvt) {
var oList = oEvt.getSource();
var oLabel = this.getView().byId("idFilterLabel");
var oInfoToolbar = this.getView().byId("idInfoToolbar");
// With the 'getSelectedContexts' function you can access the context paths
// of all list items that have been selected, regardless of any current
// filter on the aggregation binding.
var aContexts = oList.getSelectedContexts(true);
// update UI
var bSelected = (aContexts && aContexts.length > 0);
var sText = (bSelected) ? aContexts.length + " selected" : null;
oInfoToolbar.setVisible(bSelected);
oLabel.setText(sText);
}
Can anyone help to resolve the issue,
thanks ,
CHANDRAN.
Back end problem,
check the metedata and that property, filterable property should be true for that.
example, for that go to your gateway system 'segw' t-code. goto properties, in entity types select your entity name and check filterable property as true.
<Property Name="Carrid"
Type="Edm.String"
sap:filterable="false"/>.(It should be true).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chandran,
Just to add in Santhosh's comment, merely checking the filterable checkbox does not implement filtering functionality in the gateway service. These checkboxes are just to well define the metadata document. To enable the functionality of filtering in the backend service, you need to implement the code (if it is not supported by your FM by default).
Regards,
Ekansh
HI, all
the problem is with backend
anyway thanks all...
Thanks ,
Chandran.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please mark this Discussion with a Correct Answer (closes, but does not lock the Discussion) and Helpful Answer where appropriate. See http://scn.sap.com/community/support/blog/2013/04/03/how-to-close-a-discussion-and-why Even if you discovered the solution without any outside contributions, it helps others to understand what the solution turned out to be.
Thanks, Mike (Moderator)
SAP Technology RIG
Hi Chandran,
Its error from backend only.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Put an external breakpoint in your backend gateway services and debug. I think this is due to runtime errors in the backend.
kind regards,
RW
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.