cancel
Showing results for 
Search instead for 
Did you mean: 

oModel Data and List BindItems message

Former Member
0 Kudos

I have an sap.m.List that I aggregate with data from an oModel.  But I am coming back with this message that I see from SMP 2.3 logs because my List is empty; I've validated that the query is correct and does return data when I run this same query from Chrome.

The error message from SMP 2.3 logs:

The request URI is not valid. The segment 'ApplicationServiceSet' refers to an entity set and not to a single entity


When run through the browser this is the result:


<entry xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"xml:base="http://MyService_SRV/">

<script id="tinyhippos-injected"/>

<title type="text">

ApplicationServiceSet(fld='0007',fld2='0007',fld3='65')

</title>

<updated>2014-06-05T13:39:15Z</updated>

<category term="MyService_SRV.ApplicationServiceSet" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>

<link href="ApplicationServiceSet(fld='0007',fld2='0007',fld3='65')" rel="self" title="applicationid"/>

<content type="application/xml">

<m:properties>

<d:fld1>0004</d:fld1>

<d:fld2>0007</d:fld2>

<d:fld3>My Loc</d:fld3>

</m:properties>

</content>

</entry>


My binding to my List is this:


.....var omodel = sap.ui.model.odata.ODataModel(serviceURL, false, username, pwd);

.....

var oCore = sap.ui.getCore().setModel(omodel);



myList.bindItems({


     path: /ApplicationServiceSet,

     template: mytemplate,

     filters: [f1, f2, f3]

});


I have this same setup on another application that uses this exact code but calling a different OData Model and that is working fine.  The difference is that the model on the other application is a list of fld3, in this case is a list of materials base on location and date.


In this issue, the user searches specifically for material#, location and date so I expect only one result. I was thinking that the code should work I just need to change the sPath, field names are even the same.  Only difference is that this List, though aggregated, should still work.  However, I get the above message of "refers to an entity set and not a single entity"......


So not sure if there's a different way of implementing how a record is returned when it comes to using the API or if this is something on the BAPI end?


Any help is greatly appreciated.  Thanks.


J

Accepted Solutions (0)

Answers (1)

Answers (1)

jamie_cawley
Advisor
Advisor
0 Kudos

Looks like your url should be using... $filter=

Are you defining your filters with sap.ui.model.Filter?

Regards,

Jamie

SAP - Customer Experience Group

Former Member
0 Kudos

Thanks Jamie.  I do have my filters defined and for testing, I have hard coded the values.  There's a few more info I should have added.

1. I have the same application using the same code for another service which works fine.  Since the query is essentially the same, I just needed to change the URL to point to the right service and the correct sPath

2. We are going through SMP 2.3 to get to Gateway so the alias or the end point is: http://mydomain:port/com.my.applicationID

3. I used RESTcClient to test the end point directly to GW and it is fine.  I don't think this is an SMP issue, but I'm not sure.

Thanks for the reply

jamie_cawley
Advisor
Advisor
0 Kudos

I would recommend using the chrome/firefox dev tools to check the request the application is sending in.  This should give you an indication of where the issue is occuring.

Regards,

Jamie

SAP - Customer Experience Group

Former Member
0 Kudos

thanks again for the reply.  It is fine in the browser.  I've ran the query that is direct from GW.  Maybe my List wont work for this data because it is aggregating and the query is returning only single result as there is a key input.