Skip to Content
Author's profile photo Paul Aschmann

A peek inside xSync and the HANA XS Engine


On saturday I published a blog about a small app I wrote called xSync – basically a XS Engine app for Mac developers where you can sync a local development folder with your HANA repository. This is for rapid development and to encourage the “bring your own IDE” approach to application development on HANA. Here is a look behind the scenes on how the app works and some of the challenges of the project.


As mentioned in my previous blog – I started using the IDE Lightweight editor after doing the upgrade of my AWS HANA box last weekend. I enjoyed the experience but after working with it for nearly a full day was wanting a little more. Syntax highlighting, easy commenting, easy indentation, CSS autocomplete and hints, etc. etc. so I started doing some peaking around the editor itself and came to find the editor is something called ACE, a pretty nice little open source IDE (written in JS). This got me thinking … maybe I could insert text directly into the Lightweight IDE browser text box, and submit the form as a save …. hmmm …. not a terrible idea …. just need to scrape the page, find the elements and submit the form via some injected JS. Pretty simple …  I did some digging and found the HTML objects I needed by using Firebug when a lightbulb went off … instead of populating the form via a HTML page, why not rather check the HTTP methods it is calling when doing the actual save, since there must be some integration with HANA directly … which is when I came across the mother load … a small file called reposervice.xsjs ๐Ÿ™‚ It seemed that every time I was saving or modifying my objects through the IDE, it was calling this file. After checking out the parameters it was `, it was very clear that the methods and text were easy to simulate. I fired up REST Client and within a couple minutes the concept was POC’ed. Pass your file contents as your body with a path param and a POST and you were off to the races ๐Ÿ™‚

Screen Shot 2013-06-09 at 4.39.png

Using Firefox Rest Client to monitor system calls showed each save, create, delete operation was using a small file called reposervice.xsjs, which references the libraries needed for the repository modifications.


The diagram above displays the HTTP call made when saving/creating a file, and how the IDE initially does a HEAD request for the XSRF token, followed by the HTTP PUT.

The initial HEAD request is to fetch the CSRF Token, secondly the token along with the parameter of mode, path and activate are passed to the URL. Pending you are successful, a JSON message is returned with the status. For those of you are not familiar with Cross-Site-Request-Forgery, you can read about it here:

Once I had this done, I was wondering what the best integration option would be and weighed up a couple options of a simple check in type procedure, but wanted something faster, easier and “click free”. Being a bit of a highly iterative developer myself, I find it easier to develop “online”, which is why I decided it would be best to do a File System watch of a particular folder and save any changes automatically to my HANA instance. Similar to a dropbox type approach.

I had my POC working nicely, a integration goal defined and set out to start developing the UI/Application in Objective-C (Xcode). I had a template type of app from one of my little SAP Note Viewer applications which could act as a foundation. I threw some code out and pulled some very useful little open source packages in as helpers. Within a couple hours in my evenings each night the app was running nicely and doing what I had expected, modify a file or two in a predefined location and sync up to XS. easy.

Thats generally where development grinds to halt for me, as I envision feature after feature to build a Mac clone of HANA Studio ๐Ÿ™‚ Luckily my senses got the better of me, and I worked on doing a recursive package downloader, the ability to create, rename and delete files and folders and not a HANA Studio rewrite ๐Ÿ™‚ Once this was all done, ironing out the bugs was painful. The cocoa FSEvents stream (File System Events) Class on the mac is not easy to work with and a bear at best. Having to monitor a folder for any modifications, deletes and creates turned into a bit of a logic nightmare. One of the interesting challenges is that if you “delete” a file on the mac file system, it does not get a “delete” FS Event but rather a rename! (Since it goes to the trash/recycle bin!). This leads to having to do multiple … if exists then …. type statements around each file and folder event ๐Ÿ™‚

UI is another interesting one, I like apps to look somewhat decent … and I spent a good amount of time working on each of the elements in Adobe Photoshop as usual … (Whenever I do a mobile app development talk I mention that I spend close to 40% of entire project time in apps like Photoshop with design work! Most are surprised!)

If you are interested in incorporating some these types of features into your own app, I will be posting a copy of the integration classes on GitHub shortly.

PLEASE KEEP IN MIND: This is exploratory type work with undocumented API’s, I would not recommend using this in production, or any important production work (or your important opensap homework!). The reason I shared this was to encourage people to look under the hood and understand the how’s and why’s of how some of these great new tools work.

I would be interested to hear if anyone has any interesting use-cases for being able to manipulate both HANA repository and DB artifacts from outside of the Studio? Does anyone have any challenges with the HANA Studio today they would like to see changed?

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Sascha Wenninger
      Sascha Wenninger

      This is exploratory type work with undocumented API's, I would not recommend using this in production

      Isn't that the best work there is? Awesome work and a proper hack in the true sense of the word. Well done!! ๐Ÿ™‚

      Author's profile photo Graham Robinson
      Graham Robinson

      Great work Paul - definitely Demo Jam worthy using the original (non-marketing) definition of Demo Jam.

      And, just in case your readers don't fully appreciate it, I can now effectively use my favourite text editor as my HANA IDE. ๐Ÿ˜Ž


      Graham Robbo

      Author's profile photo Henrique Pinto
      Henrique Pinto

      HANA powerered by Notepad?

      Author's profile photo Paul Aschmann
      Paul Aschmann
      Blog Post Author

      Thanks to both of you for the feedback ๐Ÿ™‚

      Author's profile photo Aby Jacob
      Aby Jacob

      Thanks Paul !!

      Author's profile photo Richard Hirsch
      Richard Hirsch

      Great hacking


      Author's profile photo Joerg Latza
      Joerg Latza


      in case you want to rapidely deploy HTML/JS to HANA without HANA studio, I also recommend having a look at the deployment shell (

      Feel free to test and provide feedeback

      KR, Joerg

      Author's profile photo Former Member
      Former Member

      Awesome hack Paul! Eclipse me no like - Sublime Text rulez!!

      Could you look into the reposervice.xsjs that is used in revision 56 and beyond (HANA Developer Edition)? Seems a bit different, at least xsync turns into a xnosync for me ๐Ÿ™

      Or even better, can you share the code? Hint: we love github...



      Author's profile photo Graham Robinson
      Graham Robinson

      Are you allowed to say that? 😏

      Author's profile photo Henrique Pinto
      Henrique Pinto

      He's a super hero, he can say whatever he wants. ๐Ÿ˜€

      Author's profile photo Former Member
      Former Member

      Hahahaha! Not only a super hero, I'm also naive - so I don't even know what Graham Robinson meant ๐Ÿ˜‰

      Author's profile photo Paul Aschmann
      Paul Aschmann
      Blog Post Author

      Hi Juergen,

      Re: Rev 56 - odd since that is what this was developed against, could you check your console log and filter for xsync and see what errors are being thrown?

      Re: Github - I intended to post the integration classes a couple days ago but just have had no time, as soon as I do, I will let you know.

      Cheers, P

      Author's profile photo Former Member
      Former Member

      My bad - tried to sync into a structural package. All good ๐Ÿ™‚

      Author's profile photo Paul Aschmann
      Paul Aschmann
      Blog Post Author

      @Juergen - What path is repo service on your HANA instance?

      Currently xSync uses: http://xxxxx:xxxx/sap/hana/xs/editor/server/repo/reposervice.xsjs and might be the source of the issue.