Skip to main content
SAP BTP

Feasibility of the SAP BTP React Native Application

DP Dwipal Parmar, Dwipal works at Mindset Consulting as a developer 3 min read

The need for mobile applications has dramatically increased in recent years. React Native is one such framework that lets programmers create mobile apps that look like native ones using JavaScript. By combining the benefits of both technologies, we examine the feasibility of using React Native to create an SAP Fiori app.

Understanding SAP Fiori

SAP Fiori design framework offers a standardized and straightforward user interface across different SAP applications. It adheres to design rules emphasizing responsiveness, simplicity, and user-friendliness. The most common tool for creating SAP Fiori apps is SAPUI5, a JavaScript UI framework.

Possible Ways to Create React Native App for SAP

We know that SAP has made available the BTP SDK for Android and iOS applications, allowing us to develop native applications. In essence, Kotlin and Swift are two different technologies used to build two applications. Therefore, using React Native, we can create a single code base rather than maintaining two separate code structures.

The ability to write native code and then utilize it in cross-platform technologies is a feature of all cross-platform development. So, the fabric native component capability is also available in React Native.

We can create native code in a Fabric Native component and use it in React Native. Therefore, we will integrate the SAP BTP SDK in the same manner into native Android and use it in React Native.

How to Integrate SAP in a React Native App

I’ve listed a few of the stages we’ve taken for the SAP Fiori React Native App and presented the entire process in this blog.

  1. Create a React Native application using the command below.

Terminal command: npx react-native init SAPBTPApp

  1. After that, create a fabric component by following the documentation. Here, I’ve made fabric-native components using Java technologies.
  2. As directed in the fabric document, create the RTNLauncherScreen fabric component and add other folders.
  3. Next, open the project-level build.gradle file in the SAPBTPApp – React Native application’s Android folder, and type the code below.

Project-level build.gradle with Kotlin, SAP SDK 6.0.2, SDK and NDK versions, repositories and Gradle classpath entries

  1. Write the following code in the fabric component’s build.gradle file.

Fabric component build.gradle with Android library config and SAP Android SDK dependencies: fiori, onboarding, foundation, flowsv2

  1. Instead of creating a CenteredText, a CenteredTextManager, and a CenteredTextPackage as instructed in the fabric component document, create a LauncherScreen, a LauncherScreenPackage, and a LauncherScreenManager. Add the following code to the LauncherScreen file; the code for the other files will not change.

Java LauncherScreen class extending the SAP Fiori onboarding LaunchScreen, setting welcome label, button text and info view

  1. Add the fabric component to the native React app using the following command.

Commands: yarn add ../RTNLauncherScreen, cd android, ./gradlew generateCodegenArtifactsFromSchema

  1. Then launch it using following command.

Terminal command: npx react-native run-android

Android emulator showing the BTPApp SAP launch screen with Welcome text and a Get Started button

Besides this launcher screen, we used a SimplePropertyFormCell and got the results shown below.

Android emulator showing an SAP User Profile form with username, email, mobile number and password fields

Same form scrolled down, showing email, mobile number, password, confirm password and barcode fields and a Submit button

Android permission prompt asking to allow BTPApp to take pictures and record video

As an outcome of using the SAP SDK through the fabric native component in the react native app, we don’t have full access to all its properties and methods, or, in other words, we don’t have access to context and some necessary method parameters. The next step would be determining how to access specific parameters for the solution, as fabric components are still developing.

If you have an interest in viewing similar content, visit our blog, here.

View our LinkedIn, here.

Share