Skip to Content

Internal Server Error :SAPUI5 consuming oData

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.

errror.png (153.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Jun 03, 2015 at 12:06 PM

    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).


    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • avatar image
    Former Member
    Jun 03, 2015 at 11:52 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 04, 2015 at 06:50 AM

    Hi Chandran,


    Its error from backend only.



    Add comment
    10|10000 characters needed characters exceeded

  • Jun 06, 2015 at 10:47 AM

    HI, all

    the problem is with backend

    anyway thanks all...

    Thanks ,

    Chandran.

    Add comment
    10|10000 characters needed characters exceeded