Show TOC

CLI Packager for SAP Fiori AppsLocate this document in the navigation structure

The CLI packager for SAP Fiori apps is a Node.js application that is delivered with the SAP Mobile Platform SDK. It enables you to download existing SAP Fiori apps and package them into a Cordova container for iOS or Android. Packaged apps are presented as tiles within a local launchpad.

The packaged app contains the JavaScript and HTML assets (plus images, message strings, and so on) as local resources that are loaded directly into the Cordova WebView. Because only the business data requires network resources, packaging delivers a more robust user experience. Packaging also allows certain SAP Fiori apps be used in offline mode. In this case, SAP Mobile Platform initializes the creation of the local offline store and provides the offline OData service that periodically synchronizes the business data between the back end and the client offline store.

The packager uses the SAP Mobile Secure cloud build service API to drive a Cordova-style build. The apps can be distributed to users and mobile devices using SAP Mobile Secure and SAP Mobile Place. Alternatively, developers with Cordova knowledge may choose to create and build their own local Cordova project using the packager output.

Prerequisites
  • Install a recent version of Node.js. For more information, see http://nodejs.org/Information published on non-SAP site.

  • Install the packager dependencies listed in package.json using the package manager (npm). To install them, simply run the following commands in your normal shell:

    cd /<path to SDK directory>/apps/packager

    npm install

  • You know the URL and login credentials for the Fiori front-end server where the SAP Fiori web apps are installed.

  • To use the SAP Mobile Secure cloud build service, you need a current SAP Mobile Secure account, and a user name and password for the SAP Mobile Secure product API services. You can generate an API password for your user name in the SAP Mobile Secure Admin portal, in Account> My Profile>API Credentials. For more information, see the SAP Mobile Secure Administration Guide.

  • If you want the packager to sign apps, create valid signing profiles in the SAP Mobile Secure Admin portal. For Android signing, the profile consists of a keystore file, that has a suitable signing key installed in the keystore. For iOS signing, the profile consists of a signing certificate (with a password-protected private key) and a provisioning profile. For information about creating the necessary artifacts, see the iOS and Android documentation. For information about uploading the artifacts and creating signing profiles in SAP Mobile Secure, see the SAP Mobile Secure Administration Guide.

  • Offline-enabled apps require SAP Mobile Platform; SAP recommends that you use it to manage all of your apps. You can use SAP HANA Cloud Platform mobile services, or SAP Mobile Platform Server SP08 PL01 (or higher). The hybrid application must be defined in the admin cockpit before the app is launched on the client device.

Process Overview
  1. Define the package properties in appConfig.js:

    • SAP Fiori applications and SAPUI5 reuse libraries to include in the package

    • Globally unique application identifier

    • Display names for the container app and the launchpad tiles

    • SAP Mobile Secure signing profiles to be used to sign the app

    • SAP Mobile Platform registration settings

  2. Use the packager commands to do the following:

    • Download the specified application assets and reuse libraries from the Fiori front-end server to a local target directory.

    • Create a project ZIP on the SAP Mobile Secure cloud build server and upload the web assets, plugins, and other application metadata.

    • Start the cloud build service to package the application assets with the Cordova plugins and generate signed or unsigned application binary files for iOS (.ipa) and Android (.apk).

Defining Package Properties in appConfig.js

Update the appConfig.js file in <SDK directory>/apps/packager with the desired package properties.

Note

You must name your configuration file appConfig.js.

To make different groups of apps available to different user groups, create a separate appConfig.js for each package.

You can specify the following properties:

Property

Description

appId

Application identifier for SAP Mobile Platform registration; must be defined if "fioriURLIsSMP":true.

Note

The hybrid application must be configured in SAP Mobile Platform before the app is launched on the client device.

appName

Identifies the SAP Fiori application name shown on the logon screen and on the device. The default value is "SAP Fiori Client".

appVersion

Version identifier.

bundleId

Globally unique application identifier.

Select the bundle ID carefully to ensure that different applications do not overwrite each other, and to ensure that an updated application correctly replaces an existing application.

Use reverse domain name service (reverse DNS) notation, for example, com.acme.crm.app.

Note

For iOS app signing to work correctly, the bundle ID you use in appConfig.js must match the app ID/bundle ID of the iOS provisioning profile (created in the Apple portal or Xcode) that created the corresponding iOS signing profile in SAP Mobile Secure.

iOSSigningID

androidSigningID

SAP Mobile Secure signing profile IDs used to sign the application binary for iOS and Android.

For more information, see the signingids command description (below).

fioriURL

Runtime endpoint for the application:

  • If "fioriURLIsSMP":true, enter the URL of the SAP Mobile Platform server.

  • If "fioriURLIsSMP":false, enter the URL of the Fiori front-end server.

The format is <protocol>://<host>:<port>.

fioriURLIsSMP

Defines whether the runtime endpoint is SAP Mobile Platform or the Fiori front-end server.

If "fioriURLIsSMP":true, the device registers with SAP Mobile Platform using the given appId.

prepackaged

Set to true to enable the boot logic to work correctly at runtime.

offline

Set to true to create offline OData stores.

Offline apps require SAP Mobile Platform ("fioriURLIsSMP":true).

singleApp

Not currently supported.

The applications property array defines the applications and components to download.

Note

If the application that you want to package does not have an application descriptor (also known as the application manifest file, manifest.json), you must specifiy the title, i18n, and icon properties. If the application has an application descriptor, then the packager obtains this information from the manifest file.

Example of an applications property array for an application that does not have an app descriptor (manifest.json):

   "applications":[
      {
         "id":"hcm.emp.payslip",
         "intent":"RemunerationStatement-displayPayslip",
         "title":"{{DISPLAY_NAME}}",
         "i18n": "i18n/i18n.properties”,
         "icon": "sap-icon://travel-expense-report",
         "url":"/sap/bc/ui5_ui5/sap/hcm_ps_mon"
      }
   ]

The following table describes the subproperties of the applications property array:

Property

Description

id

Fiori component ID (required in all cases).

intent

Applications that have an intent property are mapped to tiles in the launchpad.

The display name for the tile is derived from the title property, or from the application manifest file if no title is provided.

Icons shown on the tile are derived from the application manifest file.

title

Display name for the app's launchpad tile. This overrides any title obtained from the application manifest file (if present).

This property is required for applications that do not have a manifest file. If localized, use the locations tag. For example, {{shellTitle}}.

url

Location of the manifest file and resources files for the SAP Fiori application. See the example appConfig.js (below).

scenario

Indicates the component that provides the boot logic and offline store definitions for offline-enabled apps. When "scenario":true, the packager checks the application manifest file for the offline setup.

reuse

"reuse":true indicates that the component is a reuse component, such as a common library.

i18n

Path of the internationalization properties file, relative to the root of the application resource tree. For example, i18n/i18n.properties.

This property is only required for applications that do not have a manifest file.

icon

Name of the icon (as defined in the SAP Icon pool). For example, sap-icon://travel-expense-report.

This property is only required for applications that do not have a manifest file.

Example appConfig.js
{
   "appID":"com.acme.fiori.app",
   "appName":"CRM",
   "appVersion":"1.0",
   "bundleID":"com.acme.crm.app",
   "androidSigningID": "b72be503e22cacfaf671d0affe674b40",
   "iosSigningID": "1d253111d50ae538abab86063189b9a4",
   "fioriURL":"https://mo-a1c4fd27e.mo.sap.corp:8081",
   "fioriURLIsSMP":true,
   "prepackaged":true,
   "offline":true,
   "singleApp":"",
   "applications":[
      {
         "id":"cus.crm.mycontacts",
         "intent":"ContactPerson-MyContacts",
         "title":"My Contacts",
         "url":"/sap/bc/ui5_ui5/sap/crm_mycont"
      },
      {
         "id":"cus.crm.myaccounts",
         "intent":"Account-MyAccounts",
         "title":"My Accounts",
         "url":"/sap/bc/ui5_ui5/sap/crm_myaccounts"
      },
      {
         "id":"sap.cus.crm.lib.reuse",
         "url":"/sap/bc/ui5_ui5/sap/crm_lib_reuse/sap/cus/crm/lib/reuse",
         "reuse":true,
         "scenario":true
      }
   ]
}
Using Packager Commands

The typical command sequence for packaging is as follows:

  1. downloadfromfes

  2. createpackage

  3. uploadpackage

  4. startbuild

The packager uses the following syntax:

node <path to SDK directory>/apps/packager/bin/packager [options] [commands] ...

Note

If you don't specify a command, the packager runs downloadfromfes by default.

To display the full list of options and defaults, use:

node <path to SDK directory>/apps/packager/bin/packager --help

downloadfromfes

This command creates a local target directory and downloads the application assets and related components (as specified in appConfig.js) from the Fiori front-end server. The packager prompts you to enter the user name and password for the Fiori front-end server.

Required options:

--targetDir <path to local target directory>

--config <path to appConfig.js>

--host <Fiori front-end server host>

--port <Fiori front-end server port>

--proxy <host:port of proxy server> (if applicable)

Cache options:

By default, the packager caches Fiori front-end server content locally, which means that repeated runs of the packager use the cached content. There are two types of cached content: Fiori application items and SAP UI5 library items.

--noCache: Avoid using the cache altogether (that is, neither add to nor read from the cache).

--cleanCache: Completely erase the cache, and retrieve all content from the Fiori front-end server. The cache is refreshed with the new content.

--cleanAppCache: Erase only cached application content, but not SAP UI5 library content.

Additional options:

--https: Use HTTPS protocol.

--force: Overwrite an existing set of downloaded assets.

--client <client id>: Append sap-client=<client id> to all HTTP requests, both during download and at runtime. Use this option if the Fiori front-end server requires the sap-client URL parameter for HTTP requests.

--maxReqs <number of parallel requests>: Set a lower or higher limit for parallel requests when downloading assets from the Fiori front-end server. The packager normally tries to run up to 20 parallel HTTP requests.

Example:

node ~/SAP/SDK/apps/packager/bin/packager --targetDir packagedApp --config appConfig.js --host myfes.abc.com --port 443 --https downloadfromfes

createpackage

This command creates a package, reading for uploading and building, on the cloud build server. The packager prompts you to enter your SAP Mobile Secure user name and API password.

Required options:

--targetDir <path to local target directory>

--config <path to appConfig.js>

--cloudHost portal.sapmobilesecure.com

--cloudProxy <host:port of proxy server> (if applicable)

Example:

node ~/SAP/SDK/apps/packager/bin/packager --targetDir packagedApp --config appConfig.js --cloudHost portal.sapmobilesecure.com createpackage

uploadpackage

This command uploads the assets that have been downloaded from the Fiori front-end server to the cloud build server, including the splash screen definitions and icons that represent the application on the device home screen.

The required options are the same as for createpackage.

Example:

node ~/SAP/SDK/apps/packager/bin/packager --targetDir packagedApp --config appConfig.js --cloudHost portal.sapmobilesecure.com uploadpackage

signingids

This command returns a list of available signing profiles and their IDs from SAP Mobile Secure. If you want the cloud build service to sign your apps, use this information to set the appropriate signing IDs before running the build step.

Find the appropriate iOS and Android profile IDs in the list and add them to appConfig.js (androidSigningID and iOSSigningID). When you execute startbuild, these signing IDs are used to sign the apps.

Note

For iOS app signing to work correctly, the bundle ID you use in appConfig.js must match the app ID/bundle ID of the iOS provisioning profile (created in the Apple portal or Xcode) that created the corresponding iOS signing profile in SAP Mobile Secure.

The required options are the same as for createpackage.

Example:

node ~/SAP/SDK/apps/packager/bin/packager --targetDir packagedApp --config appConfig.js --cloudHost portal.sapmobilesecure.com signingids --verbose

startbuild

This command initiates the build on the SAP Mobile Secure cloud build server.

The required options are the same as for createpackage.

When the build is completed (successfully or otherwise), a message is sent to the email account that is associated with the credentials provided for the build.

Example:

node ~/SAP/SDK/apps/packager/bin/packager --targetDir packagedApp --config appConfig.js --cloudHost portal.sapmobilesecure.com startbuild

status

Use this command during a build to check the build status.

The required options are the same as for createpackage.

Example:

node ~/SAP/SDK/apps/packager/bin/packager --targetDir packagedApp --config appConfig.js --cloudHost portal.sapmobilesecure.com status

downloadapp

Use this command to download the application binary to a local directory, if necessary.

The required options are the same as for createpackage.

The output is placed in a build folder under the target directory where the content from the Fiori front-end server has been placed.

Example:

node ~/SAP/SDK/apps/packager/bin/packager --targetDir packagedApp --config appConfig.js --cloudHost portal.sapmobilesecure.com downloadapp