SAP Build Apps, formerly known as SAP AppGyver, is a service within the SAP Build product.
SAP has consolidated all of its low-code/no-code offerings under a single brand, aiming to streamline and unify the developer experience across its various development tools and platforms. SAP Build Apps enables users of all backgrounds to develop full-stack applications visually, eliminating the need for writing code. It offers drag-and-drop functionality that conceals the complexity typically associated with development, making the process accessible to a broader range of user.
In this blog post, we’ll touch on an overview on how to construct business logic in SAP Build Apps, focusing on the following two topics: application logic and functions.
Application Logic with the App Editor
Before we delve into the components of application logic in SAP Build Apps, it’s essential to understand two key concepts in application logic: the app state, which includes two different states, and the logic flows.
- App state – variable state: Consider this as the data stored in the device’s memory, analogous to the runtime variables in any programming language. The data can come from various sources such as user input, information fetched from APIs, device information, and more.
- App state – component state: The current state or condition of the view components, for example, the color or visibility of the UI element. The component state is connected with the variable state through the binding of a component property to a variable.
- Logic flows: These consist of a triggering event and attached flow functions, each represented as a node on the logic canvas. The execution sequences of the logic flow are determined by connecting wires between these nodes, as shown below.
Now that we understand the concept of app state and logic flow, we can start constructing the application logic in SAP Build Apps. To open up the application logic canvas, click on Add logic (circled in the box), located at the bottom half of the application builder view, as shown in this figure.
Application logic in SAP Build Apps comprises the following components, as shown in the next figure.
- Events (1): Events are classified into different categories, including component events, app or page lifecycle events, variable events, other events, and custom events, all of which can be triggered by either the user or the application to execute flow functions. A simple example is shown below; when a user clicks on a button, it triggers a component tab event received by the application to perform the next course of action.
- Flow functions (2): Flow function can be accessed through the flow function library panel, which is divided into three tabs: CORE, BY ME, and INSTALLED, as shown on the left-hand panel. These functions can be easily added to the application via a simple drag-and-drop process.
- Trigger events (3): Events can be invoked at anywhere within the application. However, if the same events are created multiple times within the application, it should be created on the global canvas for reusability. This allows accessibility from any points within the application and eliminates the need for repetitive event creation in multiple places. With the Trigger event flow function, developers can now call the event created at the global canvas. Detailed steps on how to create events at the global canvas for reusability can be found at http://s-prs.co/v591924.
- Custom JavaScript (4): Complex and advanced data operations can be achieved using the JavaScript flow function.
- Pull to refresh (5): Pull to refresh is an event source for the Receive event flow function on the UI page, allowing developers to incorporate custom responses to the application.
The Upload files flow function can be located in the service marketplace. Once installed, it will be available in the flow function library panel under the Installed tab, ready to be used.
Functions with the Backend Editor
Functions are a part of the core feature of visual cloud functions, facilitating the execution of logic flows in a visual manner. To create the function, you have to create an SAP Build Apps project from SAP Build lobby and choose the application backend type application. Next, navigate to the Functions tab at the top toolbar, and create the function via the CREATE NEW button at the top-right corner, as shown in this figure.
Once a function is created, its logic flow can be constructed and configured visually within the logic canvas, as depicted in the final figure. Each function begins with a start execution node on left and concludes with one or more nodes on the right. Additional nodes can be inserted in between to incorporate the function logic. To use the function, it must be enabled as a data source and be consumed within the logic canvas using a Run cloud function flow function.
Learn how to install SAP Build Apps in this post.
Editor’s note: This post has been adapted from a section of the book SAP Business Technology Platform by Smitha Banda, Shibaji Chandra, and Chun Aun Gooi.
Comments