Skip to Content

I’ve been pulling my hair out for the last few hours trying to work out what was wrong with my SAPUI5 demo application. I finally worked it out and want to quickly share what the problem was in case others fall into the same issue.

Background

Back at the end of last year I had downloaded the SAPUI5 Trial version (at the time version 1.4.3) and had written a very basic MVC demo app to get familiar with how things worked in SAPUI5. I had the usual issues with CORS (Cross Origin Resource Sharing) – you will find lots of posts about solutions for that in the discussions on SCN, but finally got a basic example working, calling an ODATA service from the SAP Enterprise Workplace system. All was good, I was a happy chap 😀 . Then things got busy, and I only came back to this example a few days ago when I wanted to get the same example working from a “real” SAP system where we recently installed the SAP UI Add-On 1.0 and Gateway.

Problem

So I wanted to keep it simple, I used the same method to create a new SAPUI5 application to read a simple ODATA service from my SAP system and put the data into a table. Everything looked the same, I could see (in the developer tools) the first request being sent to the ODATA service on the SAP server and I could see the response coming back, it all looked good, but I was getting “No data” in my table…

/wp-content/uploads/2013/04/2013_04_18_0938_206664.png

So what was going on? I spent a while checking my code for stupid syntax mistakes… nothing. I had no idea. As far as I could tell the only difference between the new and the old app was the version of the SAPUI5 I was using. The version on my SAP server was 1.8.4 (the old one was 1.4.3). I then decided to set up a direct comparison. I updated my local Tomcat server with both the 1.8.4 and the older 1.4.3 versions of SAPUI5 and ran them side by side. I then switched the bootloader statement in my app to use one or the other. What I found was that when I used the 1.4.3 version my code worked fine and the table was populated with data:

/wp-content/uploads/2013/04/2013_04_18_1027_206672.png

When I then switched to use version 1.8.4 it stopped working and I got “No data” again. So I concluded it must be the version.

Solution

So how to fix it? I could find lots of posts about not getting any data into tables, but mostly it was due to the CORS issue, I knew that wasn’t the problem. So I went to the release notes in desperation 😏 . Now reading release notes isn’t that much fun, but I started with version 1.4.3 and worked up to see if anything might mention a change that was causing the problem… and there it was…

/wp-content/uploads/2013/04/2013_04_18_0948_206665.png

CHANGE: Databinding syntax changed, so that absolute bindings now must have a leading slash. For compatibility reasons, method setLegacySyntax() can be used to enable the old binding syntax.

What the hell I thought, lets try to add a forward slash to the oTable.bindRows(“/SOHeaders”) statement and what do you know, suddenly it worked and no more “No data”! 🙂

Here is a little video that shows the problem and the solution:

So if you are trying out SAPUI5 and you are following some of the older tutorials or blog posts from people here on SCN and you are getting “No data” in your tables it might be a CORS issue but it might also be that you are missing the leading slash “/” in your binding statement. I hope this post will save you some time and let you get on with more interesting bits of SAPUI5.

Please share your comments and thoughts below.

Thanks,
Simon

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

  1. John Patterson

    Hi Simon,

    We take backwards compatibility for granted in the ABAP AS. The first thing i do now with each version of SAPUI5 is read the Release Notes.

    John P

    (0) 
  2. Puran Khoeval

    Hi Simon,

    Thanks for sharing!!

    Even when the code gets auto generated from the gateway plugin , this leading “/” is missing and it was resulting in “No data”.

    I have one more question here, can we use the table control sap.ui.table.Table() for mobile app also. I did not see any table control element in sap.m library. I tried sap.ui.table.Table but it does not work in mobile app. Please share your thoughts for the same.

    Regards,

    Puran Khoeval.

    (0) 
    1. Simon Kemp Post author

      Hi Puran,

      Thanks for adding your input to this blog, interesting that the GW Plugin also misses the leading “/” – good to know!

      I am not sure with regards to the table control for mobile devices (I haven’t tried that). My only comment would be that most mobile UIs I have seen tend not to use tables (esp. for smartphones), but instead use lists that you then click/tap on an item in the list to get more details. The SAPUI5 also provides the List control.

      Perhaps someone else can provide more info on Tables in the mobile version.

      Cheers,

      Simon

      (0) 
  3. saurabh vakil

    Hi Simon,

    This No Data issue drove me almost nuts trying to find out what I had to do in order to get data in the table.

    Thanks for sharing this to the community!!!

    Regards,

    Saurabh

    (0) 

Leave a Reply