Skip to Content
0
Former Member
Oct 21, 2013 at 01:18 PM

problem in consuming an entity read service in SAP UI 5

661 Views

Hi ,

i have developed a sample application to perform an item search and to view the details of the particular item

The item search operation is working fine .

But the item details operation is not working .

/* start code in connectivity.js */

var serviceUrl = getUrl('/sap/opu/odata/sap/ZSAMPLE_SERVICES_SRV');

/* end code in connectivity.js */

/* start code in controller for item search*/

var searchText = $("#searchItem").val();

var oModel = new sap.ui.model.odata.ODataModel(serviceUrl,true);

var oTable = sap.ui.getCore().byId("itemResultTable");

oTable.setVisible(true);

oTable.setModel(oModel);

oTable.bindRows({path: "/Items",filters: [new sap.ui.model.odata.Filter('IpStoreNo',[{operator:"EQ",value1:'2000'}]),new sap.ui.model.odata.Filter('IpArticleDesc',[{operator:"EQ",value1:searchText}])] } );

/* end code in controller for item search*/

/* start code in controller for item details*/

var itemResultTable = sap.ui.getCore().byId("itemResultTable");

var selectedItem= itemResultTable.getModel().getProperty("ArticleNo", selRowContext);

var oModel = new sap.ui.model.odata.ODataModel(serviceUrl,true);

var oTable = sap.ui.getCore().byId("itemDetailsResultTable");

oTable.setVisible(true);

oTable.setModel(oModel);

oTable.bindRows("/ItemDetails(IpArticleNo='"+selectedItem+"',IpStoreNo='2000')");

/* end code in controller for item details*/

Find below the error i am getting in my chrome javscript console when itemdetails operation fails.

GET http://localhost:8080/SPUI5/proxy/sap/opu/odata/sap/ZSTORE_POWER_SERVICES_SRV/ItemDetails(IpArticleNo='PCS-RE-000623',IpStoreNo='2000')?$skip=0&$top=1&$inlinecount=allpages 400 (Bad Request) resources/sap/ui/thirdparty/datajs.js:17

2013-10-21 18:43:12 The following problem occurred: HTTP request failed400,Bad Request,{"error":{"code":"005056A509B11EE1B9A8FEC11C23378E","message":{"lang":"en","value":"System query options '$orderby,$skip,$top,$skiptoken,$inlinecount,'

are not allowed in the requested URI"}}} -

The filter i applied on entity set is working but the entity read for itemDetails is not working .

Can anyone help me.

Regards,

Madhumitha S