SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Create an SAPUI5 Application for SAP Variant Configuration and Pricing

Build a basic UI5 application that loads a configuration and changes the value of one characteristic using the SAP Variant Configuration and Pricing APIs from SAP API Business Hub.

Overview

🎓 beginner 45 min. SAP Variant Configuration And PricingBeginnerSapui5SAP Web Ide

You will learn

  • How to use SAP API Business Hub’s productivity tools for developers (like sandbox environment and code snippet generator) to easily test cloud services
  • How to use SAP Business Technology Platform’s trial environment and SAP Business Application Studio to build a small SAPUI5 application
  • How to orchestrate and use the different APIs of the variant configuration and pricing services
Angelica Rodriguez A Angelica Rodriguez July 25, 2023
Created by August 27, 2019
Contributors

Prerequisites

Steps

Step 1 Create an SAPUI5 application

  1. Go to the SAP Business Application Studio. Accept the SAP Business Application Studio Trial Privacy Statement when it pops up. Click on Create Dev Space.

    step-1-numeral-1-dev-spaces
    step-1-numeral-1-dev-spaces

    In the name field, enter ProductConfigurationUI, choose SAP Fiori, and then choose Create Dev Space.

    step-1-numeral-1-create-a-new-dev-space
    step-1-numeral-1-create-a-new-dev-space

  2. When the status changes to Running, click on the space name created. Accept the SAP Business Application Studio Trial Privacy Statement when it pops up.

    step-1-numeral-2-space-name-created
    step-1-numeral-2-space-name-created

  3. In the Create Dev Space, create a new project from the template via menu File > New Project from Template.

    step-1-numeral-3-new-project-from-template
    step-1-numeral-3-new-project-from-template

    Choose the template SAP Fiori application and then Start.

    Choose Application Type SAPUI5 freestyle and the SAPUI5 Application floor plan, then choose Next.

    step-1-numeral-3-sapui5-application-template
    step-1-numeral-3-sapui5-application-template

    Choose Data source None, and then Next.

    step-1-numeral-3-data-source
    step-1-numeral-3-data-source

    You may want to rename the initial View name as Main, then choose Next.

    step-1-numeral-3-rename-initial-view
    step-1-numeral-3-rename-initial-view

    Provide the following:

    • Module name: such as product_configuration_api_tutorial

    • Application title: such as Product Configuration API Tutorial

    • Application namespace such as sap.tutorial

    • Description such as Product Configuration API Tutorial

    Keep the default for the other parameters, then choose Finish.

    step-1-numeral-3-parameters-new-project-from-template
    step-1-numeral-3-parameters-new-project-from-template

    Choose the project you created and click Open.

  4. The application is now created. It can be opened via the menu File > Open Workspace….

    step-1-numeral-4-open-workspace
    step-1-numeral-4-open-workspace

    Choose the project you created and click Open.

    step-1-numeral-4-choose-project-created
    step-1-numeral-4-choose-project-created

  5. The application will call the Variant Configuration service during the initialization of the form. The controller, can be found at ProductConfigurationAPITutorial > webapp > controller > Main.controller.js, in which the service APIs will be called.

    step-1-numeral-5-main-controller
    step-1-numeral-5-main-controller

    You will call the following cloud service APIs:

    • POST /api/v2/configurations to create a new product configuration.
    • GET /api/v2/knowledgebases/{kbId} to read static master data for display (descriptions of a characteristic and its values in our example).
    • PATCH /api/v2/configurations/{configurationId}/items/{itemId}/characteristics/{characteristicId} to change a characteristic value.
    • GET /api/v2/configurations/{configurationId} to read and displayed the changed configuration results.
    • POST /api/v1/statelesspricing to get the price based on the chosen characteristic value.
Step 2 Get pre-generated code
+
Step 3 Load configuration in your application
+
Step 4 Run your application
+
Step 5 Display characteristic value
+
Step 6 Change characteristic value
+
Step 7 Use value description
+
Step 8 Calculate pricing
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 8
1. Create an SAPUI5 application 2. Get pre-generated code 3. Load configuration in your application 4. Run your application 5. Display characteristic value 6. Change characteristic value 7. Use value description 8. Calculate pricing

Learn more →