Explaining Logic Foundations 


After completing this lesson, you will be able to:

  • Explain Functions.
  • Describe Events.


Flows, logic, and algorithms are other important capabilities of SAP Build Apps. Logic guides the flow of how an app behaves when a user interacts with it, and algorithms run the math that powers it. To better understand the logic, let's look into functions in more detail. Functions occur in almost all applications and are particularly useful for solving tasks and problems. When an event occurs, a function initiates an operation in which one or more inputs are processed, and an output is returned.

Logic is fundamentally based on business rules that are set to produce an outcome, and the requirements for those should be well understood during the planning process. Business rules are the specific ways of operating that arise from your business and are closely related to software requirements.

Consider an example where a person’s height and weight values are entered, and then the BMI value is calculated and returned. The BMI value is then passed on and appears in an info window. This creates SAP Build Apps without writing a single line of code and distinguishes between the two different types of functions, which, as in this example, can be used together to create a complete app logic:

  • Flow Functions

    A flow function can be found in the Logic tab with different categories. They can be used to perform actions that can be visually placed and combined in a sequence. For example, flow functions can store and retrieve data or activate hardware components. You can use input and output nodes to connect logic flow functions. 

  • Formula Functions

    The task of form functions is to process data so that you can, for example, filter and sort texts, edit values with operators and mathematical formulas, or obtain information from the sensors of the device and then give it to the output. It uses a powerful library with over 500 finished formulas to do this.

The potential of the Logic app arises in particular from the combination of flow and form functions, which means that SAP Build Apps can use simple to complex logic with countless application options. While working with logic flows, events acquire an important meaning. These are necessary so that logic can be triggered in the first place. Defining the logic of your application is about applying all the rules and requirements to make the app work accordingly, and is one of the longer and more involved aspects of the application development process.


SAP Build Apps Events

When executing logic, one thinks of pressing a button component in the case of a type of trigger, particularly considering the examples discussed earlier. Pressing a button or other component is an example of an event that can initiate the execution of various functions/actions. However, events are not restricted to a user's click on a button. There are more ways where they can also exist by the system with different types of start scenarios.

Events in SAP Build Apps

App loaded: This event is available when the app has finished loading. For example, a welcome message can be shown to the user, or necessary configurations can be set.Page mounted: This event is available when the app has finished loading and rendering. This can also be used to trigger a logic to render dynamically customized content and initialize components. This is shown in the exercise: Generate the Data of a Colleague With OData.
Component onFocus/Component onChange: OnFocus occurs, for example, when a certain component is selected or activated, which expects an action or input, as with the selection of an input field. The onChange event is triggered when, for example, the value in the input field changes or a checkbox is selected.Page focused: The event occurs when a page is focused, for example, opened using the navigation or logic components or navigated back to as the active page.
Component onBlur: Contrary to the focus, this triggers an action when it is dropped again, as with the active change to another component.Page blurred: Contrary to the focus, this triggers an action when it is dropped again, as with the active change to another page.
Component tap: This event is triggered by choosing a component and is possible for all components.Page nav bar item clicked: This is triggered by choosing the navigation header bar with various buttons and icons for navigation.

Log in to track your progress & complete quizzes