Paul Modderman, author of our book SAPUI5: The Comprehensive Guide, sat down last week to answer reader questions about the programming language on our LinkedIn page. Here's a recap of what was asked, and what Paul had to say.
Q: Why should I use SAPUI5 and not some other web technology to write apps?
If you’re doing web development with SAP as your backend, SAPUI5 is a powerful choice. It’s designed to work smoothly with OData, which SAP Gateway and SAP HANA output natively. It flows right into the SAP Fiori launchpad, and works quite well as single apps which are part of a larger experience of unified enterprise applications. If you’re doing web development and SAP is not your backend, SAPUI5 is probably not your first choice, and probably shouldn’t be. But I do not see that as a downside for SAPUI5!
Q: I have read SAPUI5: The Comprehensive Guide, 1st edition, and I found it a little confusing. First, you describe all four viewtypes and finally say SAP's preferred viewtype is XML. If that is the case, why not concentrate on XML from the very beginning, and not confuse readers by explaining one view first, then asking to replace it with XML at the end? By the time I got to XML, I was lost.
You are right. There are several options for creating views in SAPUI5, and XML is the preferred type. Two things I think you should keep in mind:
- This book is intended to be comprehensive (or as comprehensive as can fit into one volume), so explaining all view types is a necessary undertaking.
By the way, calling all authors: there is room in the world for another book in this series, much shorter, called "SAPUI5: The Quick Start Guide".
Don’t despair! Our book attempts to put together the understanding that goes behind the scenes of automatically generated code tools. I suggest two things to make understanding easier:
- Walk through and take the time to play with the small examples at the beginning. The examples move from code-all-in-one-place to splitting up into controller/view files.
Q: It seems development in UI5 takes a very long time. Do you agree? We used to create screens in SE51 and code in a very short period of time. Now it takes weeks to develop in UI5, especially by the time you understand OData and code. What do you recommend to make the development faster?
To make development faster, I recommend a few things:
Make yourself faster. Get accustomed to source control so it’s easy to try something new without fear of destroying your old work. Always be writing code just to try something. My project files are littered with little apps that are intended only to teach me one new thing. That one new thing always comes in handy either right now or later on.
Make your team faster. Some folks have a better grasp of OData and others might lean toward front end work. For those who work on the front end, learn how to use mockserver.js so you can avoid having to wait for an OData service.
Give yourself permission to understand that this does take a little longer. SAPUI5 is geared toward making a better experience for the end user. Even if it’s easy to smash out an ALV report or something similar in ABAP, by using SAPUI5 you’re making a commitment to improving the work lives of many many people.
Q: Why does deploying to SAP Cloud Foundry take so long?
There is some good discussion in this SAP Blog post. A few points:
- Could partial deploys work for you?
- One commenter was experiencing long deployments because of long upload times. Is that part of your issue?
- I am no stranger to builds that seem to take longer than they should, and this happens in a lot of cloud environments (e.g. Google Cloud, with App Engine Flexible, can take similar amounts of time to deploy). I think part of the issue is that flexible provisioning of resources to do the deployment can be time-consuming.
Q: Is there a way to improve web IDE auto code completion?
You can do a couple things:
- Update es-lint rules to help with annoying warnings you don’t want, or warnings that you do want. Check out this SAP Blog post.
Q: The project I'm currently working for is planning to switch the SAPUI5 major version (from 1.52 to 1.71). Do you have any tips for updating the SAPUI5 major version? In this specific situation (update from 1.52 to 1.71) should we expect major compatibility issues within custom developed apps?
You should not expect major compatibility issues. As a general statement, SAPUI5 is very good about maintaining compatibility across minor versions. (Using SAP’s terminology as shown here, 1.52 to 1.71 is a “minor” version upgrade.) If you stick with the public APIs and don’t use sap.ui.extend very much, you will almost certainly be safe. You should, of course, absolutely test your apps when you switch to the new version. If you can get buy-in from your project, use it as an opportunity to automate some of your testing!
Q: For the SAP Fiori desktop app should we use the sap.m controls or the sap.uxap?
They're both well-enough supported and powerful that your choice should really depend on the experience you're planning to make for your users. If the Object Page layout is the best choice for your app, then move toward those uxap controls. But there's no reason you can't mix and match. The sections of the Object Page can certainly contain sap.m controls.
Q: The sap.ui.cor.util.Export control is deprecated. Is there a replacement?
Not a quick and easy one I've seen. Looking for some examples in my old code, I will reply again if I find a nice slick example.
Q: What do you think about wrapping all SAPUI5 CRUD calls in JS Promises? Is it worth it (considering the overuse of Promises increases CPU usage)?
I don't know about all of them. I think the current CRUD style with the success and error callbacks works pretty well. But I have seen some cool things where you go "I want these 6 requests to happen, and then I want to do something after they're all done" that Promises helped with. It was a little more elegant than $batch handling.
Q: What is the status of the new Business Application Studio IDE?
Q: SAP Cloud Platform Site for Cloud Foundry is so limited compare to site for NEO, should we continue to use NEO?
Cloud Foundry is where innovations happen; I would go to Neo wherever I can.
Q: Apart from your book, openSAP website, and SAP's SAPUI5 site, what other websites or resources do you recommend so we can learn more?
Here are a few resources I recommend:
- Use https://glitch.com to prototype and share quickly.
- Use an XML format checking site for quick troubleshooting XML view issues, like https://www.xmlvalidation.com/.
- Review the SAP Fiori design guidelines. They will make you a better developer.
- Get really good at the debugger in your browser. The number of bugs I can fix by prototyping in the debugger is just insane.
- A quick tool I love for inspecting JSON results of OData calls: https://jsonformatter.org/