Skip to Content

Recently our company posted its first app based on Sybase Unwired Platform and SAP backend developed for SAP Mobile App challenge. In this blog we are sharing the roadblocks we faced during creation of our first app and lessons learned. The first part of blog explaining motivation, overall architecture and technology choise can be found here.

Challenges faced during development

Having such a nice tools for development as SUP’s HWC and mGWT we had also several roadblocks on our journey:


  • Calling MBO from JavaScript – event that SUP provides enough of documentation of how to use HWC with standard scenarios, for our special case (as we decided to write UI by our own and not use HWC UI framework built on JQuery) we had to go an extra step to understand how to call MBO from JavaScript. This part was not that much documented and required some amount of time for digging inside internal JavaScript files generated by SUP.
  • Linux/*nix machines support – generated HWC application can run in browser if you run generated index.html page just from folder on your drive as it is described in SUP documentation, but it only assumes windows machines when identifying desktop browser – so we had to modify some scripts to take into account *nix machines as well If you happen to require it as well – here is our tweak – replace content of JavaScript function isWindows() inside API.js with following

/**

  * Returns true iff the workflow application is being run on a Windows platform.

  * @returns True iff the workflow application is being run on a Windows platform.

  */

function isWindows() {   

     if (navigator.platform === "Win32" || (navigator.platform === "Win64") ||

                (navigator.platform === "MacIntel") ||           

               (navigator.platform === "Linux x86_64") { /* this line makes Linux happy */        

                    return true;

     }

    return false;

}


  • Debugging on real device/receiving logs from online device – there is a possibility to write into device console logs from HTML5 application and it is possible to retrieve such logs from device over SUP infrastructure. The procedure how to access these logs is described in SUP documentation, however, these logs are not online and are pulled from device by request with average data transfer duration of about one minute – not a very convenient way to investigate/monitor how your application is working on real device. We had to inject and use our own remote logging service that uses simple AJAX to send every log line back to server in order to have some ability to monitor behavior of application in real time.

Our solution is based on GWT-RPC approach, if it raises interest from community how we did it  I can elaborate more about it in next blog


  • Heavy scripts – initially HWC is supplied with many scripts for supporting a lot of functionality, which takes a lot of time to load and damages a feeling of quick and slim applications by end user – we had to learn what scripts we can take out without breaking HWC framework. In our case we could happily live without following scripts (just remove or comment them out from your index.html generated by SUP):
    • Camera.js
    • Certificate.js (we consider to include it back when we will work with SSO certificates)
    • ExternalResource.js
    • json2.js
    • SUPStorage.js
    • Timezone.js
    • jquery-1.6.4.js
    • jquery.mobile-1.0.js
    • sy.ui.iphone.customButton.js
    • sy.ui.iphone.customFixPositionForm.js
    • sy.ui.iphone.iscroll.js
    • sy.ui.iphone.listview.js
    • sy.ui.iphone.menuBars.js
    • sy.ui.iphone.menus.js
    • sy.ui.iphone.picker.js
    • sy.ui.iphone.signature.js
    • sy.ui.iphone.util.js
  • Modeling of complex relations in MBO – it was hard to find documentation or expertise in community how to properly model MBOs with complex relations like many-to-many or how to define caching of MBO objects or how to control it. Fortunately, SAP is helping partners get more knowledge in this area and we were benefiting from weekly info sessions with SAP experts, community to get this information as well as did a lot of try-and-pray test. At the end we decided not to do any many-to-many relations in MBO and stay with one-to-many relations only.

Lessons learned

Even that I listed so many topics as roadblocks we happily overcome all of them and were able to finish our application on time for SAP Mobile app challenge. We learned a lot, made ourselves even more curious in Sybase Unwired Platform and SAP mobile development topics and learned few lessons that we will bring with us to next SAP mobile project:

  • It is better to have real devices for application testing – emulators works very slow and can be real motivation killers for your team
  • When modeling your MBO and backend access – try to stay within a simple relations (1:n, simple lists)
  • Limit your MBO fields to minimum, if possible – limit your SAP interfaces to minimum as well – it will reduce the mess of data mapping and increase speed of data exchange
  • If you are building your own HTML5 app as we did – plan enough time to test how your application is working inside HWC, remove all parts you will not need (PhoneGap, local storage API, Camera API,…)
  • Pay attention to user logon procedure – you will need some set of HWC functions to make it work proper and secure

Conclusion

After all, we get very positive impression on usage of Sybase Unwired Platform and made our first app there relatively fast, giving that we started with zero knowledge about SUP. For sure we will use SUP for future and some app ideas are already in heads of developers.

Hope you found our feedback informative and helpful and can leverage on our experience, in case of any questions write to me or post in SCN forum – there is enough expertise available to figure an answer for almost any question.

And in case you are interested to see what have we made – here is short demo of our app.


To report this post you need to login first.

18 Comments

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

  1. John Moy

    Hi Artem,

    Great job!  Its really refreshing to see some full blown hands on experiences with SUP.  Looks like you did a great job.  And I hadn’t considered that you could use mGWT within the HWC, that is a revelation to me (I have seen examples of Sencha instead of jQuery Mobile, but not mGWT).

    This is a great example of what ‘long haired developers’ can bring to the SAP ecosystem, something I wrote about last year http://scn.sap.com/community/mobile/blog/2011/11/03/can-we-embrace-the-long-haired-developer

    Thanks for taking the time to share your experiences.  

    John

    (0) 
    1. Artem Ruzak Post author

      Thanks John,

          I am big fun of GWT/mGWT as I like comfort of Java instead of JavaScript 🙂 However recent release of chrome and findbug made development in Javascript also comfortable enough

      BR, Artem

      (0) 
  2. Vladislav Volodin

    Hello Artem,

    Thank you for the article. It was interesting for me to read it. But I have a small question regarding this sentence:

    In our case we could happily live without following scripts (just remove or comment them out from your index.html generated by SUP).

    At which stage of the development process, did you comment/remove scripts? Did you do this using the custom.js file (via JavaScript), or you generated the package, then changed its source code using a text editor and then upload to SUP?

    Kind regards,

    Vlad

    (0) 
    1. Artem Ruzak Post author

      Hello Vladislav,

         we just take them out of index.html. However you shall know that this file is re-generated by SUP every time you generate HWC code — so you had to turn off regenaration of HWC code when packaging app or manually, after generation, edit again index.html as it would be overwritten by new one

      The only file that is not updated during generation  is custom.js — all others would be changed.

      Hope that helps you, Artem

      (0) 
  3. David Brutman

    Artem,

    Thanks for sharing your experiences, it benefits the ecommunity.

    Will you be at TechEd Madrid? I would like to invite to share your learning in one of my sessions.

    Regards,

    David.

    (0) 
  4. Amitesh Kumar

    Hello All,

    I am new to HTML programming.

    I want to create an sample app with simple informations.

    and want to save it to backend and read it as well using SUP.

    Can some one guide me to achieve the same.

    (0) 
  5. Gianluca Tacchella

    Hi

    you wrote

    generated HWC application can run in browser if you run generated index.html page just from folder on your drive as it is described in SUP documentation

    From what I read you can run the app from chrome directly from the generated local index.html but you can’t use any network (at least not without forging the simulated network payload).

    do you know any way to access the webapp directly without the HWC? I mean, HWC is a backend to a webapp, is there a way to access this URL directly in order to properly debug and/or provide the client a way to use the app from their desktop browsers too?

    thanks

    (0) 
    1. Manuel Xiccato

      Really a brilliant question, Gianluca! I’ve got the same issue, could you please give me some news if you find a way to use app from browser without any limitations?

      Thank you so much!

      (0) 
    2. Artem Ruzak Post author

      Hi,

        you can run the HTML  code from your harddrive. What you need is to navigate to generated HTML code (usually it is inside folder ‘Generated Workflow’ for SUP 2.1.3 or ‘Generated Hybrid App’ for SUP 2.2 and there navigate to <your_project_name>\html\workflow_jQueryMobileLookAndFeel.html. Just double click on it in order to open it in browser.

      For SUP 2.2 the file would be called workflow_jQM.html, I guess.

      Use browser development tools to debug javaScript and CSS.

      Best regards, Artem

      (0) 
    1. Artem Ruzak Post author

      Hi,
        one more thing to add – in order to have some interaction and responses from server you shall create rmi.xml file that willcontain default response from SUP to your app – this file would be read when your HWC will call any SUP requests being started in browser.

      Here is more of how to debug the fiels in browser, where to get content for rmi.xml file and what Chrome switch to use in order to test it

      http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00835.0222/doc/html/mqu1327090909497.html

      Best regards, Artem

      (0) 
      1. Nicola Beghin

        Thanks Ruzak, but what I need is to get a fully-working webapp with real data and real network communications. I know about the rmi.xml but it’s good for debugging purposes only, not for a real webapp!

        (0) 
        1. Artem Ruzak Post author

          Well, than you had to do some coding yourself I guess.

          at the end it boils down to function doOnlineRequest in API.js file where you have to add your own handling of direct call over web to your server or something similar to it.

          so instead of SUP doing something like 
            xmlhttp.open(“POST”, “/sup.amp?querytype=rmi&” + hwc.versionURLParam, true ); 

          you will have to have fully quilified URL there like

            xmlhttp.open(“POST”, “http://<yourserver&gt;:<port>/<query>”, true ); 

          Regards, Artem

          (0) 
          1. Nicola Beghin

            Thanks a lot Artem!

            Do you know a way to get SUP external address in order to customize the API.js code?

            i already tried to get the address from javascript (Custom.js)

            alert(document.URL);

            alert(window.location.href);

            but it tells me that it’s a local content (see image)

            Do you know if SUP is exposed at all in a way that can be called in a normal ajax call?

            thanks

            nicola

            (0) 

Leave a Reply