Deploying the SAM application in Business Application Studio

Procedure

  1. Import SAP Service Asset Manager project into the SAP Business Application Studio.
    1. Launch the Dev space in SAP Business Application Studio.
    2. Click Import on the welcome page, or select Import Project from the command palette.
    3. Select the desired ZIP or TAR file.
    4. Select Open.

      The project is added to your dev space in a new workspace or as part of a multi-root workspace, depending on the workspace preferences that you defined.

  2. Get familiar with the generated project structure.

    This is how the project structure looks like within the workspace.

    These are the metadata definitions available in the editor and the format in which these metadata definitions are stored in the editor:
    • InitializeOffline.action: For Mobile applications, this action binds the application to the Mobile Services Offline OData server and downloads the required data to the offline store on the mobile device. For Web applications, it will initialize the service to be consumed in online mode.

    • DownloadOffline.action and UploadOffline.action: These actions are applicable to Mobile client only. Using app initialization, data is downloaded to the offline store. If you want to have the application download any updated data from the backend server or upload changed data to the backend server, these actions will be needed.
    • Success & Failure Message action: Here are some messages showing up in the app on a successful or failure of data initialization, sync etc.
    • Main.page: This is the first page of your MDK application that is shown. For this application you will use this as a launching page to get to application functionality.
    • OnWillUpdate.js: This rule is applicable to Mobile client only. MDK applications automatically download updates and apply them to the client without the end-user needing to take any action. The OnWillUpdate rule empowers the user to run business logic before the new definitions are applied. This allows the app designer to include logic to prompt the user to accept or defer applying the new definitions based on their current activity. For example, if the end-user is currently adding new customer details or in the middle of a transaction, they will be able to defer the update. The app will prompt again the next time it checks for updates.
    • Web: In this folder, you can provide web specific app resource files and configurations.
    • Application.app: this is the main configuration file for your application from within SAP Business Application Studio. Here you define your start page (here in this tutorial, it is main.page), action settings for different stages of the application session lifecycle, push notifications, and more.
    1. Open the application settings in the application editor by clicking the Application.app.
  3. Deploy the application.

    So far, you have learned how to build an MDK application in the SAP Business Application Studio editor. Now, you will deploy this application definition to Mobile Services and Cloud Foundry to consume it as Mobile and Web application respectively.

    1. Right-click Application.app and select MDK: Deploy.
    2. Select deploy target as Mobile & Cloud.

      2.1 Select the organization to which you want to connect. (we can skip this step in quick guide)

      2.2 Select the desired space within the organization. (we can skip this step in quick guide)

      2.3 Enter the application version (we can skip this step in quick guide)

      2.4 Include Source map file for debugging? (we can skip this step in quick guide)

      2.5 Select Web runtime Version (we can skip this step in quick guide)

    3. MDK editor will deploy the metadata to Mobile Services (for Mobile application) followed by to Cloud Foundry (for Web application).
    4. You should see successful messages for both deployments. (same image).
  4. Display the QR code for onboarding the Mobile app.

    SAP Business Application Studio has a feature to generate QR code for onboarding the mobile app.

    1. Click the Application.app to open it in MDK Application Editor and click Application QR Code icon.

      The On-boarding QR code is now displayed.

    2. Leave the Onboarding dialog box open for the next step.
  5. Run the app.