Working in a Modeling Project

Performing Practical Exercises

Objective

After completing this lesson, you will be able to performing practical exercises

Import, Rename and Copy Models

Exercise Objectives

After completing this exercise, you will be able to:

  • Import models

  • Manage models deployment

  • Rename a model

  • Identify common deployment errors when importing, moving, and copying models

Business Example

You are working as a modeler in SAP Business Application Studio, and need to make a few adjustments to the names or locations of your models, and also want to make a copy of models for testing purposes. Before that, you need to understand how to handle duplicate model names, multiple namespaces, and more generally avoid the most common deployment issues that can occur when deploying moved or copied objects.

Overview of Exercise Tasks

  • Task 1: Import and Build Models

  • Task 2: Rename a View

  • Task 3: Import a New Folder with a Namespace Specification

  • Task 4: Move a Model

Prerequisites

Prerequisites

Your SAP Business Application Studio development environment should have been set up and the HC300 project imported and deployed.

Task 1: Import and Build Models

You will import into your project a folder that contains two calculation views. One of these views,CVCS_SO, has the same name as an existing model in your resources folder, so the observations you will make on this imported view will be the same as if you had copied the view.

Steps

  1. If needed, launch SAP Business Application Studio and start your HCMOD development space.

  2. Clear the SAP Business Application Studio console.

    1. In the Terminal pane, choose the Views and More Actions icon (three dots) then choose Clear Terminal.

  3. In the Explorer view, drag and drop the import folder from your course files folder HC300 into your HC300_A####→db→src→exercises project folder.

    1. On your device, open the HC300 folder and select the import folder.

    2. Drag and drop it onto the exercises folder in Business Application Studio.

      Result

      An import folder is created in your project. It will be used specifically for this exercise.
  4. Deploy the import folder.

    1. In the SAP HANA Projects sub-pane of the Explorer view, choose the Deploy icon for the import folder.

    2. In the Console pane, check that the deployment completes successfully.

  5. Analyze the root cause by checking the log from the start of the deployment until you see an error report.

    Code Snippet
    1234
    Error: "calc.scenario://HC::CVCS_SO": the object cannot be provided more than once [8212002] "src/models/exercises/import/CVCS_SO.hdbcalculationview": the file would provide it "src/models/resources/CVCS_SO.hdbcalculationview": the deployed file already provides it
  6. In the SAP HANA Database Explorer view, check whether the view CVD_PD3 has been created in your HC300_A####_HDI_CONTAINER

    1. Switch to the SAP HANA Database Explorer view.

    2. Select your container HC300_A####_HDI_CONTAINER and choose Column Views.

    3. select the Apply Filter icon, enter CVD_PD3 and press Enter.

  7. Try to deploy the calculation view CVD_PD3 separately.

    1. Go back to the Explorer view.

    2. Choose the Deploy icon for the CVD_PD3 calculation view.

    3. In the Console pane, check that the deployment completes successfully.

Task 2: Rename a View

To solve the issue for the view CVCS_SO, you will rename it.

Steps

  1. Rename the imported CVCS_SO Calculation View as CVCS_SO2. You will only rename the design-time file and adjust the runtime object name accordingly.

    1. Right-click the CVCS_SO Calculation View and choose Rename.

    2. Modify the new name to CVCS_SO2.hdbcalculationview and press Enter.

    3. Choose Yes in the Confirmation dialog.

      Note

      If you don't get a confirmation, the runtime name of the calculation view should normally be adjusted. You can check that in the general properties of the calculation view, in the Semantics.
  2. Deploy the calculation view.

    1. Choose the Deploy icon for the CVCS_SO2 calculation view.

    2. In the Console pane, check that the deployment completes successfully.

  3. In the SAP HANA Database Explorer view, confirm that the view CVCS_SO2 is now created in your HC300_A####_HDI_CONTAINER.

    1. Switch to the SAP HANA Database Explorer view.

    2. Select your container HC300_A####_HDI_CONTAINER and choose Column Views.

    3. select the Apply Filter icon, enter CVCS_SO2 and press Enter.

  4. Clear the filter and close any open tabs in the SAP Business Application Studio.

    1. select the Apply Filter icon, remove any text and press Enter.

    2. Right-click any open tab and choose Close All.

Task 3: Import a New Folder with a Namespace Specification

You want to learn more about the way different namespaces impact the naming of runtime objects and the best practices to keep your content correctly organized.

Steps

  1. Switch back to the Explorer view.

  2. Clear the SAP Business Application Studio console.

    1. In the Terminal pane, choose the Views and More Actions icon (three dots) then choose Clear Terminal.

  3. In the Explorer view, drag and drop the import2 folder from your course files folder HC300 into your HC300_A####→db→src→exercises project folder.

    1. On your device, open the HC300 folder and select the import2 folder.

    2. Drag and drop it onto the exercises folder in Business Application Studio.

      Result

      An import2 folder is created in your project. It will be used specifically for this exercise.
  4. Deploy the import2 folder.

    1. Choose the Deploy icon for the import2 folder.

    2. In the Console pane, check that the deployment completes successfully.

  5. Observe carefully the content of the import2 folder.

    1. Select the import2→.hdinamespace file and observe its content.

    2. Select the import2→CVCS_SO calculation view and, in the View Properties tab of the Semantics node, check the assigned namespace in the Name field. This should be HC.import2.

    3. Alternatively, you can right-click the import2→CVCS_SO.hdbcalculationview and choose Open With→Text Editor. Then check the identifier of the runtime view in the second row.

      Note

      The .hdinamespace file must be deployed before, or at least at the same time as, the content of the corresponding folder. For example, if you had deployed the import2→CVCS_SO calculation view alone just after the import, it would have failed.

Task 4: Move a Model

You want to move the CVCS_SO2 view from the import to the import2 folder.

Note

The calculation view CVCS_SO2 is not referenced by any other object.

Steps

  1. Clear the SAP Business Application Studio console.

    1. In the Terminal pane, choose the Views and More Actions icon (three dots) then choose Clear Terminal.

  2. Move the calculation view CVCS_SO2 from the import to the import2 folder.

    Confirm the view renaming in the confirmation dialog box (choose Yes) .

    Hint

    You can use the Cut/Paste shortcuts or the context menu.

    1. In the Explorer view, select the CVCS_SO2 calculation view from the import folder.

    2. Press Ctrl+X (Cut).

    3. Select the import2 folder and press Ctrl+V (Paste).

    4. In the Confirmation dialog box, choose Yes.

  3. Deploy the calculation view.

    1. Choose the Deploy icon for the CVCS_SO2 calculation view.

    2. In the Console pane, check that the deployment completes successfully.

  4. In the SAP HANA Database Explorer view, confirm that the view HC.import2::CVCS_SO2 is now created in your HC300_A####_HDI_CONTAINER.

    1. Switch to the SAP HANA Database Explorer view.

    2. Select your container HC300_A####_HDI_CONTAINER and choose Column Views.

    3. select the Apply Filter icon, enter SO2 and press Enter.

    4. Make sure there is a view HC.import2::CVCS_SO2.

  5. To finalize the move of the view, that is, delete the original runtime object, deploy the import folder.

    Check the deployment status.

    1. Come back to the Explorer view.

    2. Choose the Deploy icon for the import2 folder.

    3. In the Console pane, check that the deployment completes successfully.

  6. In the SAP HANA Database Explorer view, confirm that the view HC::CVCS_SO2 has been deleted.

    1. Switch to the SAP HANA Database Explorer tool.

    2. Choose the Refresh icon of the CATALOG BROWSER pane.

      Note

      Alternatively, If needed, select your container HC300_A####_HDI_CONTAINER and choose Column Views then select the Apply Filter icon, enter SO2 and press Enter.
    3. Note that the view HC::CVCS_SO2 is no longer listed in the search results.

  7. Clear the filter and close any open tabs in the SAP Business Application Studio.

    1. select the Apply Filter icon, remove any text and press Enter.

    2. Right-click any open tab and choose Close All.