Sample Book - SAP Build-SAP Press
Sample Book - SAP Build-SAP Press
Preface ....................................................................................................................................................... 17
PART I Introduction
7
Contents Contents
8 8
Contents
9
Contents Contents
10 10
Contents
12 UI Integration 373
11
11
Contents Contents
16 Administration 481
12 12
Contents
19 Processes 549
13
13
Contents Contents
14 14
Contents
23 Automation 715
24 My Inbox 755
15
15
Contents Contents
16 16
Chapter 5
Developing Applications
The development of applications can be very complex and sometimes
complicated. You not only have to take care of the user interface, but 5
also prepare the application logic, which is the magic behind the scenes.
The interplay of user interface, application logic, and later also data and
proper data management must be learned well. That sounds compli-
cated, doesn't it? Don't worry: SAP Build Apps provides sophisticated no-
code development objects that can usually be added by drag and drop.
App development and knowledge of the tools and techniques behind it play a major
role in SAP Build Apps. Although SAP Build Apps delivers a number of UI elements that
can of course be used directly via drag and drop, there are nonetheless various setting
options, display options, and layout options that need to be applied at the right time.
In this chapter, we’ll develop a simple app step by step to introduce the most important
building blocks and UI elements. We’ll also show you some tips for how to implement
certain requirements with regard to user interface development. In addition to build-
ing forms and tables, application logic and the so-called logic flow will also play a major
role. Section 5.1 deals with the first development steps toward a basic app. Corporate
design and the integration of self-developed apps into the existing product range play
a major role nowadays. For this reason, Section 5.2 also address the topic of theming. A
developed app must of course be tested and, after a successful development test, also
deployed and thus made available to end users. Building and testing will be discussed
in Section 5.3. An app will rarely function without data and application logic, which is
why we’ll take a closer look at these details in Section 5.4. This section also discusses
how the communication flow between the data and the UI takes place. Finally, Section
5.5 shows how you can work together with others on a project in SAP Build Apps and
thus promote collaboration during development.
135
135
5 Developing Applications 5 Developing Applications
As you can see in Figure 5.1, we are greeted in the lobby with a table of existing projects.
Above this, you will find templates and sample apps that you can try out as you wish.
On the left, you can navigate between the lobby and the available extensions, such as
connectors and the tenant configuration. The existing projects can be searched, fil-
tered, and sorted. Next to the search box, you can click the Create button to create a
new project.
First, you’re asked what type of project you want to create in SAP Build Apps. The fol-
lowing three options are available:
Build an Application
This involves the development of applications. These in turn are divided into two
subcategories, which we’ll discuss in a moment.
Build an Automated Process
You’ll get to know SAP Build Process Automation in detail in Part IV of this book. The
name is decisive here: the aim is to convert manual processes into automated pro-
cesses in no time at all.
Build a Business Site
The third type of application allows you to bring content into SAP Build Work Zone.
You can find out more about this in Part III of this book.
In this case, we want to develop a web application that falls into the Build an Applica-
tion category, so select this type. As already mentioned, application development is
divided into two parts:
136 136
5 Developing
5.1 DevelopingApplications
a Basic App
Web and mobile applications are applications that can be run in the browser (either
be hosted in house on a web server) or made available to end users via SAP Build
Work Zone. Mobile applications are installed directly on mobile devices and must
normally also be developed in a native programming language such as Java or Kotlin
for Android or Swift for iOS. In this case, SAP Build Apps offers a way to develop an
app more generically and thus also develop a mobile app independently of these 5
languages. This can either be installed directly or rolled out in a public app store or
via an internal mobile device management system.
Application backend refers to the corresponding no-code development of business
logic. We’ll show you how to work with these visual cloud functions in Chapter 7.
This business logic can then be called up by the web and mobile application.
For now, to start developing a web application, select Web & Mobile Application.
Once you have assigned a name for the project in a dedicated dialog, you will be taken
to the development environment. A first page has already been created, and you can
start developing a web application. Changes to the user interface are made in the UI
CANVAS tab menu, which is already preselected in the system. We’ll gradually intro-
duce the other menus.
The UI elements that are placed on a page can be selected and edited. As soon as you
have selected an element, a blue border appears, which marks the selected element.
Click the title UI element with the current content “Headline” and edit the Content
137
137
5 Developing Applications 5 Developing Applications
In addition to PROPERTIES, two other tabs are decisive for the display and further
description of a UI element. Before we talk about STYLE, we will first switch to LAYOUT
and show you the options that can be used. In the case of the text UI element, you can,
for example, set the width, height, and spacing (margin and padding) around the text,
and the text alignment on this tab. We have changed the value of Text Align from left
to center in Figure 5.4, which ensures that the text is always centered, regardless of the
device size the user is using.
Displaying UI elements next to each other requires the use of containers. Containers
are UI elements that in turn contain UI elements and can be displayed and formatted
together as a group. They are located in the UI element palette under the LAYOUT
group. One such container is a Row, which allows you to define several cells next to
each other as a container. You will need this UI element, as the name suggests, if you
want to display rows in a table. There is no UI element for a table per se; you have to get
creative and create your own table with the Row UI element.
138 138
5 Developing
5.1 DevelopingApplications
a Basic App
Figure 5.4 Layout Settings for Alignment, Width, and Height of UI Elements
As you can see in Figure 5.5, we have dragged a row from the left from the UI elements pal-
ette and dropped it into the workspace. Compare the changes to the PROPERTIES, STYLE,
and LAYOUT options to a title or text we already used. Under LAYOUT, for example, the
ROW CELLS option can be used to set how many cells you want to display in the currently
selected row. You can also change the horizontal alignment in the cells and the individual
cell widths. In this case, we have currently set two cells, each with 50% of the width.
Additional UI elements can now be dragged and dropped into the corresponding cells.
A cell is a generic container that can contain all possible UI elements. During the drag-
and-drop process, you can see from the border where the UI element will end up and
whether you have just hit the cell or whether the UI element will be placed outside the
cell on the page (see Figure 5.6).
139
139
5 Developing Applications 5 Developing Applications
140 140
5 Developing
5.1 DevelopingApplications
a Basic App
Displaying text is a good start, but you will often encounter the requirement to enable
data entry. Again, there are various options for input, but let's start with the simplest
and most obvious, an input field (added with the Input Field element from the Forms
area).
An input field offers other options under PROPERTIES. Value, for example, determines
which value should be in the input field. In other words, the value entered by a user 5
input is also saved in this property. Label can be used to determine the heading of the
input field, whereby the value of the Placeholder Text property is displayed in the input
field and is intended to provide the user with an input aid or reminder. Disabled can be
used to determine whether the input field can be filled by the user or whether it is only
available in read-only mode.
Other, less frequently used property settings determine, for example, whether the
input should always be capital letters (Auto-capitalize) or whether the input should be
restricted to certain characters such as numbers, letters, or a telephone number (Key-
board Type).
You can see in Figure 5.7 that we have changed both the label and the placeholder text.
We have not assigned anything to the Value property, so this input field will be empty
by default.
141
141
5 Developing Applications 5 Developing Applications
Next, let’s add a Button to the page (see Figure 5.8). Buttons allow users to perform
actions and have a trigger to initiate the corresponding application logic behind them.
You will find out what options you have for the application logic in the course of this
chapter, and we will also cover it in more detail in Chapter 6.
A button can and should have an appropriate style (set in the STYLE menu tab) depend-
ing on the corresponding action. Section 5.2 will cover color options in more detail, but
for now, let’s use a practical example to explain how the color scheme should be set.
Semantic colors are intended to give users a sense of the impact an action could have.
For example, the color green could stand for save, red is usually for cancel or delete, and
more neutral colors such as blue are for information buttons or for editing. Some of
these semantic colors are already provided and can also be selected under STYLE. But
you will see in the next section how you can change these and possibly also adapt them
to your corporate colors.
Figure 5.8 Buttons to Execute Actions Such as Saving Form Entries or Canceling Processes
As you can see in Figure 5.9, buttons take up the full screen width by default. Under LAY-
OUT, as with many other UI elements, you can change the width under Width and Height
to Fit Content. This sets the width exactly to the length of the respective content. You can
of course also assign a fixed size, but remember our earlier tip about relative sizes.
142 142
5 Developing
5.1 DevelopingApplications
a Basic App
Figure 5.10 Containers to Group UI Elements and Define Styles and Alignments of Container
Content
143
143
5 Developing Applications 5 Developing Applications
To display buttons (and of course other UI elements) next to each other, you can use
the Container UI element. Here you can group several UI elements and decide how they
should be arranged: next to each other or under each other, moved together or far
apart, with the same spacing, left-aligned, centered, or right-aligned. As you can see,
there are no limits to your imagination. We have aligned the two buttons to the right in
Figure 5.10 to be able to display a footer like this in the future.
Now you have all the means in hand to build a complete form, at least in the UI. To do
this, place two input fields on the page and name them with the labels First name and
Last name. Just below these, set two buttons in a container, which are aligned horizon-
tally and right-justified. These two buttons have been given the texts Save and Cancel.
All these changes are shown in Figure 5.11.
So that you can find UI elements in a technical sense and recognize them more easily,
technical names should be assigned to the Component Display Name property. If you
do not assign these yourself, all UI elements are automatically numbered and assigned
the names. In the course of this section, you will see how you can access the UI ele-
ments and their properties via these assigned technical names. Figure 5.12 shows that
we assigned the name “input_first_name” to the first input field.
144 144
5 Developing5.2
Applications
Theming
5.2 Theming
Before we continue on to testing and application logic, let's look at how to adapt an app
to your own corporate design. To do this, you first need to switch to the THEME tab, as
shown in Figure 5.13.
As you can see in this tab, there are basically three themes that can be selected. Two of
these themes correspond to SAP's own theme, with Morning Horizon being the latest
theme delivered in the SAP Fiori design system. SAP Quartz Light was the standard
theme for a long time and the predecessor of Horizon.
Horizon Theme
The Horizon theme was introduced as one of the last themes in the SAP Fiori design
system and is now the standard theme for all SAP apps, both on-premise and in the
cloud. Customer developments should also adhere to this design in the SAP environ-
ment so that the various applications are still coherent. You can learn more about this
theme on the official website of the SAP Fiori design guidelines:
https://experience.sap.com/fiori-design-web/look-feel-and-wording/
145
145
5 Developing Applications 5 Developing Applications
These themes are merely templates and are equipped with a standard set of colors and
design elements. You can select one of these themes and still make any color and tex-
tual changes. Let’s now take a closer look at these options.
On the left-hand side, under Colors, you can assign the individual colors for the respec-
tive semantic colors. There are color groups such as Primary, Secondary, Positive, Nega-
tive, and many more, which should generally apply to a uniform color in the program.
This is to ensure that if several UI elements use the color set for primary, they all
change automatically when a change is made. Nevertheless, you could also assign a
separate color for each UI element instead of using these general color groups. Such an
adjustment is also shown in Figure 5.14, where the basic colors can be defined on the
one hand, but the colors can also be adjusted again for each UI element and theme.
Technically speaking, we use Cascading Style Sheets (CSS) for changes and classes,
which are the technical descriptions of the layout. As colors have their own codes in
web development, we recommend that you use a CSS color picker, which is already
integrated into SAP Build Apps. With such a tool, you can easily find the corresponding
hex code for a color and then enter it.
146 146
5 Developing5.2
Applications
Theming
147
147
5 Developing Applications 5 Developing Applications
Not only colors but also fonts can increase recognition potential. Many companies
have their own fonts in use. With its newest theme, SAP has again put a lot of thought
into the font, font size, shadows, and color ratios to ensure accessibility in the web envi-
ronment. If you still need to import your own fonts, SAP Build Apps also offers this
option (see Figure 5.15).
However, we recommend that you at least take a look behind the scenes and realize
how much effort SAP has put into the right choice of font: https://experience.sap.com/
fiori-design-web/typography-horizon/.
In our example, we have adapted the primary color in our app and used the main color
of our company. Now all UI elements, such as buttons, are also set in this color by
changing and globally affecting the semantic color. If you still want to change the color
or make further adjustments to the style of a UI element, simply right-click the style
you want to edit in the STYLE menu tab (see Figure 5.16).
Edit takes you to the editing mode shown in Figure 5.17, where you can change the back-
ground color, color in general, font, border, special effects, width, height, padding, and
margin of a style.
148 148
5 5.3
Developing
BuildingApplications
and Testing
Figure 5.17 Local Style Class Changes to Change Colors, Font, Size, and More
Incidentally, if you have made unwanted changes or simply want to switch back to the
standard theme, you can reset the changes you have made under THEME.
149
149
5 Developing Applications 5 Developing Applications
respective app store, you can also connect it here with the code shown, which appears
in the native app, and test the app on a mobile device.
Figure 5.19 Different Preview Options for Displaying Apps in Browsers or on Mobile Devices
150 150
5 5.3
Developing
BuildingApplications
and Testing
For now, select the variant for testing in the browser (Open Web Preview). You’ll see all
the SAP Build Apps applications available that you have built (see Figure 5.20). If you
click OPEN, you’ll start the preview for the respective project.
OPEN opens a new tab in which the application is opened in preview mode and can be
tested, as shown in Figure 5.21. We’ll do extensive testing in Section 5.4 and in Chapter 6.
You’ll learn more about navigation in Chapter 6, but for now we want to show you how
to implement a single-page application. Single page means that no other pages are
used, so no navigation and therefore no navigation bar, menu, or anything else is
required.
You can do this under the NAVIGATION tab by deactivating both the Navigation Header
Bar and the Navigation Menu settings by selecting No under Enabled?. As shown in Fig-
ure 5.22, you can also see that by deactivating the navigation, a page must be set as the
initial page. The initial page is displayed by default when the app is opened.
151
151
5 Developing Applications 5 Developing Applications
To ensure that an application that you build in SAP Build Apps can also be accessed by
end users, you need to make the application available either on a server or hosted
somewhere in the cloud—for example, on SAP BTP. However, the application is not
copied over 1:1, but must first be put into an executable state. This process is called the
build process and ensures that the development files are converted into executable files
and into a so-called minified version.
Deployment Process
In this section, we show you a short excerpt of how to build an executable version of an
application. In Chapter 9, however, we will deal extensively with the topics of building
and deployment. Deployment means making the executable version of the application
available to end users.
If you click Open Build Service, as shown in Figure 5.18, you’ll see a separate screen, as
shown in Figure 5.23.
If you now scroll down this page, you’ll see the options to bring an application into an
executable form. Because different target systems require different types of such exe-
cutable programs, there are also different build processes that can be carried out. So, for
example, you can decide whether you want to run the application as a web application
(hosted somewhere on a web server or on SAP BTP) or as a native application (on iOS or
Android). Depending on your requirements, click BUILD to start the process, as shown
in Figure 5.24. In CONFIGURE, further settings can be made for the corresponding target
system, such as the file format of the build output, versioning, or naming.
152 152
5 5.3
Developing
BuildingApplications
and Testing
153
153
5 Developing Applications 5 Developing Applications
The respective build process can take some time, which is why it’s first queued in the
backlog. As soon as the process is complete, a button appears under the respective
build request to continue with the output. We’ll show you the options you have for this
output in Chapter 9.
154 154
5.4 5 Developing
App Logic, Variables, Applications
and Data Binding
Now, of course, the question arises: How can these variables help you? One possibility
is to bind one of these variables to a property of a UI element. This procedure is known
as data binding. The advantage of doing so is that if a property to which the variable is
bound changes because of user input, the new value is entered directly into the vari-
able. Conversely, if the value of the variable changes due to the application logic, this
has a direct effect on the user interface. 5
Let’s consider an example of how the data binding between the value_first_name vari-
able can be linked to the Value property of the input field of the first name. Start, as
shown in Figure 5.26, by clicking the data binding symbol for the Value property.
Data binding can have different sources, but only one per property. We’ll introduce a
few more sources in this and the following chapters, but for now we’ll start with vari-
ables. Clicking the data binding opens a dialog, in which you can select Data and Vari-
ables as the source in the first step (see Figure 5.27).
155
155
5 Developing Applications 5 Developing Applications
The dialog jumps one step further, like in a wizard, and now you’ll see a further restric-
tion based on your first selection. Here you have to select which type of variable we
want to use—in this case, Page Variable (see Figure 5.28).
156 156
5.4 5 Developing
App Logic, Variables, Applications
and Data Binding
In the next step, you’ll see all the variables of the respective type that you have created.
You can only select the variables that match the data type of the respective property.
For example, you will not be able to bind a variable of the text type to the Visible prop-
erty because Visible returns true/false values—that is, yes/no values. A text type can
store much more than true/false values, so data binding is not suitable here.
In Figure 5.29, we’ve already thought about this and created the two variables with the 5
corresponding data type. So, we selected the corresponding value_first_input variable
for the input field. Carry out the same steps for the input field for the last name.
Figure 5.29 Preferred Variable to Store and Provide Data for Selected Property
To add application logic to UI elements, first select the corresponding UI element and
click the black bar at the bottom with the Add Logic To ... title to open the logic canvas.
The UI canvas, where we have been so far, is for building the user interface. The logic
canvas is the counterpart to this and forms the corresponding application logic. Appli-
cation logic can either be added to the entire view or to a specific UI element.
Select your Save button and open the logic canvas. This interface is a graphical work-
bench of concatenations of prefabricated logic blocks. These logic blocks can be
dragged and dropped into the workspace from the left, and the sequence can be deter-
mined by connecting the blocks. The trigger is always an event, such as the component
tap event.
157
157
5 Developing Applications 5 Developing Applications
Now drag in an Alert logic block and link it to the event. An alert is a dialog that shows
a message to the user in the UI with a corresponding text. The displayed text can be
stored in the Dialog Title property. Instead of storing a static text, click Data Binding
again and assign the displayed text dynamically by using your two variables (see Figure
5.30).
Figure 5.30 Data Binding in Logic Canvas for Properties of Logic Blocks
With this data binding, you can establish that a dialog will open when clicking Save, in
which both the first name and last name are displayed concatenated as a text. In this
case, you cannot bind the variable directly, as only one variable can be used in this case.
So, you’ll use a formula. Formulas help to build nonexistent data yourself based on cal-
culations. Now go ahead and select Formula, as shown in Figure 5.31.
As a formula, store a calculation that does nothing other than concatenate a static text
with the two variables. In our case, this formula is as follows:
"Your name: " + pageVars.value_first_name + " " + value_last_name
This formula says that when you click the Save button, a dialog opens, and the first
name and last name from the two page variables are added to the "Your name: " text.
These variables can be accessed with pageVars.value_first_name and pageVars.value_
last_name, as shown in Figure 5.32.
158 158
5.4 5 Developing
App Logic, Variables, Applications
and Data Binding
159
159
5 Developing Applications 5 Developing Applications
Once you’ve saved both the data binding and your SAP Build Apps project, you can test
the app again. If you enter values in the input fields using keyboard input, these values
are written to the variables thanks to data binding. If you now click Save, the app action
logic behind it is executed and a dialog opens. In this dialog, a static text with the cur-
rent values from the two variables is displayed (see Figure 5.33).
What do you do now with your Cancel button? Well, let's get to know more logic blocks.
With the Set Page Variable block, you can change the value of a page variable from the
application logic. Just as a user can change the value using data binding by means of an
input, you can also make this change via the application logic. As shown in Figure 5.34,
we have inserted this block twice.
Figure 5.34 Data Binding to Ensure Input Fields Are Cleared if Variable Is Cleared
160 160
5.5 5 Developing
Lifecycle Management Applications
and Team Collaboration
First, we’ve selected the value_first_name variable as the source for the data binding
and the Variable Name property. We’ve left the Assigned Value property empty. This
resets the variable and, as already mentioned, also clears the input field thanks to data
binding. We’ve done the same for the input field for the last name. This means that
both variables and both input fields are reset when the Cancel button is clicked.
5
A dialog will now open for the corresponding project, in which you can add new project
members in the upper section (see Figure 5.36). You must enter the members' emails
yourself and also ensure that these members are maintained in SAP BTP with the cor-
responding authorization for SAP Build. You can choose from the following roles:
Administrator
Complete access, including editing, sharing, and deleting a project
161
161
5 Developing Applications 5 Developing Applications
Developer
Edit, deploy, release, manage dependencies in a project, and publish to the library
Viewer
View and deploy a project
In the lower area, you can view the existing members, change the authorizations, and
remove members. The only person who cannot be removed is the creator of a project.
From this point on, you can work together with all administrators and developers on
the SAP Build Apps project and jointly edit the pages, application logic, theming, and
variables and thus share the work.
Figure 5.36 Add or Remove Members and Define Their Project Roles
The following rules are specified by SAP Build Apps for collaborative work:
Unsaved changes are continuously applied on top of the latest saved version by
another user. In other words, nonconflicting changes will be immediately reflected
for all members, without interfering with their work.
Editing the same parts of the project, such as the page name or component style
class, will cause a conflict. Conflicts are resolved by reloading the page, whereupon
conflicting changes are discarded. Note that conflicts are resolved in favor of the lat-
est saved version.
User profile coloring in the top bar reflects the current state of the user. Grey
implies no unsaved changes, while orange denotes that the user is currently editing
the project.
162 162
5 Developing
5.6Applications
Summary
Especially when resolving conflicts, we unfortunately have no choice but to refresh the
app and thus discard the conflicts that occur in comparison with the last actively saved
version. A merge, as known to pro code developers from other source code–management
tools such as Git, unfortunately does not (yet) exist here.
5
5.6 Summary
In this chapter, we looked at many different topics relating to application develop-
ment. We started with the user interface, and you got to know the first UI elements.
You’ve seen how the properties, style, and layout of these UI elements can be custom-
ized so that they behave according to your wishes. On the subject of style and layout,
you saw that you can establish your own theme and integrate your corporate design.
We then turned our attention to the application logic and events as triggers. With appli-
cation logic, you can create all the magic behind the scenes, again using drag and drop.
You could use this to, for example, display a message box, change the values of vari-
ables, or access UI elements. Finally, we looked at how to work together with others on
a project and share responsibilities.
163
163
Glavanovits, Haider, Koch, Krancz
SAP Build
No-Code Development, Centralized
Access, and Process Automation
www.sap-press.com/5772