You are on page 1of 3

openSAP Building Mobile Applications with SAP

Screen Personas
Week 2 Unit 2: Accessing Native Device Capabilities

Topics Covered

1. The SAP Fiori Client application

2. Using a device’s camera as a barcode scanner

Unit Summary

The SAP Fiori Client application

To access the native capabilities of a mobile device (camera, GPS, etc.), the device
must have the SAP Fiori Client application installed. It is required to provide access to
the JavaScript interfaces that allow access to those features.

The SAP Fiori Client application can be downloaded from the Apple App Store and the
Google Play store.

Using the SAP Fiori Client application to access native device capabilities can improve
usability by simplifying business processes, as well as potentially improve efficiency by
reducing the time it takes to perform tasks.

Accessing your flavor in the SAP Fiori Client application only requires your flavor URL.
You can enter it manually into the field or scan the QR code for the flavor.

Using a device’s camera as a barcode scanner

Accessing native device capabilities requires the use of the SAP Screen Personas
Scripting Editor. In the course scenario, a script that allows access to a device’s
camera requires four things:

1. Ensuring that the Cordova variable is defined, which will only occur on a mobile
device using the SAP Fiori Client application. The script should also create a
message that native device access is not supported when accessed from a
2. Two callback functions: one if the scan is successful and the QR code is read,
and another if the scan failed.
3. In the event of a successful scan, a script that sets the value of the input field to
the scanner value.
4. The use of executeScriptAsync(). to synchronize the screen update once the
scan result is available. Otherwise, the scan and screen update will happen

Coding Samples
Any software coding or code lines/strings (“Code”) provided in this documentation are only examples and are not intended for use in a production system environment. The Code is only intended to better
explain and visualize the syntax and phrasing rules for certain SAP coding. SAP does not warrant the correctness or completeness of t he Code provided herein and SAP shall not be liable for errors or
damages cause by use of the Code, except where such damages were caused by SAP with intent or with gross negligence.
© 2018 SAP SE or an SAP affiliate company. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.

The information contained herein may be changed without prior notice. Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.
National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable
for errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are set forth in the express warranty statements
accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or t o develop or release any functionality
mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are
all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation
to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from e xpectations. Readers are
cautioned not to place undue reliance on these forward-looking statements, and they should not be relied upon in making purchasing decisions.

SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trade marks of SAP SE (or an SAP affiliate company) in Germany and other
countries. All other product and service names mentioned are the trademarks of their respective companies. See for additional trademark
information and notices.