Blog

  • How to create and deploy UI5 App based upon CAPM using BAS

    Preface – This post is part of the SAP CAPM series.

    Introduction

    SAP CAPM is the new and most efficient way to develop SAP Cloud Applications. SAP Business Application Studio is the appropriate IDE that should be used for CAP Application creation. In this article we will explore SAP BAS, CAP Development and CAP Deployment over SAP BTP. Let us explore how to create and deploy UI5 App based upon CAPM using BAS.

    Steps to get started with BAS

    Step 01: The very first step is to visit Business Application Studio using SAP BTP.

    Step 02: Create a Dev Space by clicking the button as shown below:

    Create a Dev Space

    Step 03:  Give a suitable name for your space and choose Full Stack Cloud Application

    Full Stack Cloud Application

    A CAPM space will be created as shown below. Click it.

    CAPM space

    It will open the Business Application Studio Editor (BAS).

    Business Application Studio Editor

    Steps to create a CAPM Project

    1. Click “Start from template” in welcome screen
      Start from template CAP
    2. Select CAP Project and click Start
      CAP Project Start
    3. Provide a name of the project and choose the one shown below:
      CAP Project Configuration
    4. Click Finish. This will generate a project and will open up the same.
    5. In case you get a popover to install recommended extension, click install.

     

    Steps to add Approuter in your CAPM

    The very next thing after CAPM App creation is to add an approuter. You can read more about it here. Follow below steps to create an App Router. You can create both standalone app router as well as SAP Managed App Router (needs additional subscription).

    How to add Standalone Approuter using BAS?

    To add a standalone approuter using BAS, follow the given steps:

    Step 01: Create a MTA or CAPM Application such that your project has a MTA.yaml file (We did this above).

    Step 02: Right click on the MTA file and click “Create MTA Module from Template”

    Open MTA Module from Template

    Step 03: Click “Approuter configuration” from the wizard

    Approuter configuration

    Step 04: Enter the details as shown below:

    App Router Details

    That’s it, an approuter will be added in your project with configuration in MTA file.

    How to add Managed Approuter using BAS?

    The creation of SAP Managed approuter is almost similar to Standalone approuter until step 03.
    In step 04, you need to choose “Managed Approuter” from the drop down, followed by a unique name for the approuter. That’s it, an approuter will be added in your project with configuration in MTA file. Read more about it here.

    Once deployed, you can visit HTML5 Applications under your subaccount. In case you see the given screen:

    Managed Approuter

    In this case you need to subscribe any of the above, then you will be able to see your Applications as shown below:

    HTML5 Applications

    How to add a UI5 project in CAPM

    Once you have a CAPM project with basic module, you will have a folder called app. This folder is meant for UI5 applications. In this use case it is empty. Now we will add MTA modules to create UI5 App.

    Step 01: Create a MTA or CAPM Application such that your project has a MTA.yaml file (We did this above).

    Step 02: Right click on the MTA file and click “Create MTA Module from Template”

    Open MTA Module from Template

    Step 03: Click “SAP Fiori application” from the wizard

    SAP Fiori application

    Step 04: Now, click the filter to choose “SAPUI5 freestyle” (In case you want a Fiori Elements based app, you can keep the first one)

    SAPUI5 freestyle

    Then choose “SAPUI5 Application”:

    SAPUI5 Application

    Step05: Now in next section, either choose your data source if you have or select “None” as below:

    data source for UI5

    Step 06: Now enter the name of the initial view (It can be changed later too):

    View of UI5

    Step 07: This is an important step, choose the folder “app” via project folder path and mark Yes against “Add deployment configuration to MTA project”. This will add all required deployment related configurations in MTA file.
    Deployment configuration of UI5

    Root folder of UI5

    That’s it. Once clicked on Finish will add a UI5 application within app folder.

    Steps to test and deploy whole CAPM project on SAP Cloud foundry (or SAP BTP)

    1. Open Terminal from the menu bar
    2. To test the App locally, write cds watch. You will see a pop up, press “Expose and Open”. You will see a new tab:
      local test of App in CAP
    3. Click on Web Applications link. It will open a blank UI5 App as shown below:
      local run ui5 app in BAS
      This confirms that the UI5 app is working fine.
      If you click the services endpoints link, then you will see an OData as shown below:
      Service in CAP
      This confirms even our services are working fine. This is a green signal for deployment.
    4. Now open a new terminal and write mbt build. This will generate a new folder “mta_archives” with a mtar file
      The above step will also generate new folders
      MTAR generation CAP
    5. Before we deploy to SAP Cloud foundry, we have to login in our environment. In terminal write cf login
      Enter API endpoint: https://api.cf.eu10.hana.ondemand.com/ (or whatever it is for you)
      followed by your login email and password
      You will be logged into your respective environment. In case you have multiple subaccount, then you might be asked to choose one of them (using a number)
    6. Now right click on the mtar file generated and click “Deploy MTA Archive”
      SAP CAP Deployment in BAS

    This will deploy the app in cloud foundry or SAP BTP. In the terminal you will get successful message that all the services were deployed.

    1. To test the deployed UI5 App, go to SAP BTP and reach your respective subaccount -> space. Here list of applications will appear, search for your approuter.
      Run UI5 using App Router
      Open it. You will find a link. You can even find it within the terminal after deployment, e.g.:
    2. Opening only App Router will give error “Not Found”. So, append your approuter as mentioned below:
      Extend the URL with the application ID “/<app ID>”:
      https://ps-scp-<space name>-mta-<app name>-approuter.cfapps.<region>.hana.ondemand.com/<app ID>Note! If the “<app ID>” contains dots e.g. “<app ID>” is “test2.test.1.test0”, dots should be ingnored and the URL should look as:https://ps-scp-<space name>-mta-<app name>-approuter.cfapps.<region>.hana.ondemand.com/test2test1test0

    In our use case the url will be: <app router>/nscap-test/index.html

    1. After login, you will see the below link:
      UI5 deployed App test

    Congratulations, you have successfully created your CAPM UI5 App and deployed the same. You can also check other ways to create a UI5 CAPM App.

  • AppRouter in SAP BTP

    Preface – This post is part of the SAP Multi-Target Application (MTA)  series.

    Introduction

    In the era of cloud applications, a single project has multiple UI5 applications and multiple microservices. In this use case either we can have individual urls to access these or a single url that can act as an entry point. An approuter helps developers to get a single url to access all their apps and microservices. In this article we will learn more about AppRouter in SAP.

    What is App Router in SAP?

    SAP Cloud Foundry provides a nodeJs library in the form of BTP instance that acts as a single point-of-entry for an application or microservice running in the Cloud Foundry. It is known as Application Router or App Router or AppRouter.

    We can perform following operations using App Router:

    • Serve static data: The index.html file within App Router can be used to display static content or welcome page of an application
    • Authenticate users: A user can be authenticated at approuter level, even before accessing any application
    • Rewrite URLs: It can be used to integrate destination, integrate business services and even perform logout for an application
    • Request to other microservices within same project

    Types of App Router in SAP

    SAP provides two types of approuter, they are:

    1.      Standalone Approuter

    A standalone approuter is a custom approuter that is created and maintained by developer. A developer has to update the xs-app.json and MTA.yaml files according to the project needs.

    2.      SAP Managed Approuter

    A SAP Managed Approuter enables a developer to execute HTML5 applications in SAP Cloud Platform. It is completely managed by SAP, hence you are not required to update any details further, once created.
    To use managed application router, SAP provides three options:

    • SAP Work Zone
    • SAP Launchpad service
    • SAP Cloud Portal

    Once the application is deployed, the apps are available under the tab HTML5Repository within sub-account.

    How to add Standalone Approuter using BAS?

    To add a standalone approuter using BAS, follow the given steps:

    Step 01: Create a MTA or CAPM Application such that your project has a MTA.yaml file.

    Step 02: Right click on the MTA file and click “Open MTA Module from Template”

    Open MTA Module from Template

    Step 03: Click “Approuter configuration” from the wizard

    Approuter configuration

    Step 04: Enter the details as shown below:

    App Router Details

    That’s it, an approuter will be added in your project with configuration in MTA file. Read more about it here.

    How to add Managed Approuter using BAS?

    The creation of SAP Managed approuter is almost similar to Standalone approuter until step 03.
    In step 04, you need to choose “Managed Approuter” from the drop down, followed by a unique name for the approuter. That’s it, an approuter will be added in your project with configuration in MTA file. Read more about it here.

    Once deployed, you can visit HTML5 Applications under your subaccount. In case you see the given screen:

    Managed Approuter

    In this case you need to subscribe any of the above, then you will be able to see your Applications as shown below:

    HTML5 Applications

  • How to create and deploy CAPM using BAS Extensions

    Preface – This post is part of the SAP CAPM series.

    Introduction

    SAP CAPM is the new and most efficient way to develop SAP Cloud Applications. SAP Business Application Studio is the appropriate IDE that should be used for CAP Application creation. In this article we will explore SAP BAS, CAP Development and CAP Deployment over SAP BTP. Let us explore how to create and deploy CAPM using BAS Extensions.

    Steps to get started with BAS

    Step 01: The very first step is to visit Business Application Studio using SAP BTP.

    Step 02: Create a Dev Space by clicking the button as shown below:

    Create a Dev Space

    Step 03:  Give a suitable name for your space and choose Full Stack Cloud Application

    Full Stack Cloud Application

    A CAPM space will be created as shown below. Click it.

    CAPM space

    It will open the Business Application Studio Editor (BAS).

    Business Application Studio Editor

    Extensions in BAS

    In this article we will learn how to use Extensions in BAS for application creation.

    1. Click on View -> Find command
      Find Command in BAS
    2. Search “Generators” and click on “Explore and Install Generators”
      Explore and Install Generators in CAP
    3. From the search shortcut, filter SAP UI5 and install “generator-sap-ui5-app”, “generator-easy-ui5” and “generator-ui5_to_mta” and other UI5/Fiori extensions.
      UI5 Generators in CAP

    The above will be helpful in creating UI5 projects and auto generate codes for us.

    Steps to create a CAPM Project

    1. Click “Start from template” in welcome screen
      Start from template CAP
    2. Select CAP Project and click Start
      CAP Project Start
    3. Provide a name of the project and choose the one shown below:
      CAP Project Configuration
    4. Click Finish. This will generate a project and will open up the same.
    5. In case you get a popover to install recommended extension, click install.

    How to add a UI5 project in CAPM using Extension

    The newly created CAP project will have empty app folder as shown below:

    CAP Project Structure

    1. Open View-> Find command (or ctrl+shift+P)
    2. Find “Run Generator”
      Run Generator in BAS
    3. Now find “fiori-module:app”. This will only appear if you install all the extensions that we have mentioned above.
      fiori module in BAS
    4. This will open a wizard. Choose the App folder and click Next
      UI5 wizard in BAS
    5. Enter Module name, it will be the name of your UI5 App, and click Next
      ui5 module in BAS
    6. Choose SAPUI5 Application and click Next
      UI5 template in BAS
    7. Choose the App Router
      App Router Configuration in BAS
    8. Choose Authentication option.
      Authentication for CAPM
    9. Choose View name
      View in UI5
    10. Now, you will see both UI5 and App router is generated
      UI5 app router cap

    Even in MTA you can see these added:
    cap-test-approuter
    cap-test_html_repo_runtime
    cap-test_ui_deployer
    ui5-test

    With all other important files that are mandatory for UI5 module deployment over BTP. Now we are ready to test it locally and deploy it over BTP.

    Steps to test and deploy whole CAPM project on SAP Cloud foundry (or SAP BTP)

    1. Open Terminal from the menu bar
    2. To test the App locally, write cds watch. You will see a pop up, press “Expose and Open”. You will see a new tab:
      local test of App in CAP
    3. Click on Web Applications link. It will open a blank UI5 App as shown below:
      local run ui5 app in BAS
      This confirms that the UI5 app is working fine.
      If you click the services endpoints link, then you will see an OData as shown below:
      Service in CAP
      This confirms even our services are working fine. This is a green signal for deployment.
    4. Now open a new terminal and write mbt build. This will generate a new folder “mta_archives” with a mtar file
      The above step will also generate new folders

    MTAR generation CAP

    1. Before we deploy to SAP Cloud foundry, we have to login in our environment. In terminal write cf login
      Enter API endpoint: https://api.cf.eu10.hana.ondemand.com/ (or whatever it is for you)
      followed by your login email and password
      You will be logged into your respective environment. In case you have multiple subaccount, then you might be asked to choose one of them (using a number)
    2. Now right click on the mtar file generated and click “Deploy MTA Archive”

    SAP CAP Deployment in BAS

    This will deploy the app in cloud foundry or SAP BTP. In the terminal you will get successful message that all the services were deployed.

    1. To test the deployed UI5 App, go to SAP BTP and reach your respective subaccount -> space. Here list of applications will appear, search for your approuter.Open it. You will find a link. You can even find it within the terminal after deployment, e.g.:
      Run UI5 using App Router
    2. Opening only App Router will give error “Not Found”. So, append your approuter as mentioned below:
      Extend the URL with the application ID “/<app ID>”:
      https://ps-scp-<space name>-mta-<app name>-approuter.cfapps.<region>.hana.ondemand.com/<app ID>Note! If the “<app ID>” contains dots e.g. “<app ID>” is “test2.test.1.test0”, dots should be ingnored and the URL should look as:https://ps-scp-<space name>-mta-<app name>-approuter.cfapps.<region>.hana.ondemand.com/test2test1test0

    In our use case the url will be: <app router>/nscap-test/index.html

    1. After login, you will see the below link:
      UI5 deployed App test

    Congratulations, you have successfully created your CAPM UI5 App and deployed the same. You can also check other ways to create a UI5 CAPM App.

  • Azure Pipeline Setup – Release (Continuous Deployment)

    Preface – This post is part of the SAP on Azure series.

    Introduction

    Azure DevOps provides an option to create a pipeline that can be configured in such a way that it can take the latest code from a branch, and build it into artifacts (deployable file) and then deploy the same in a specific cloud platform. This full process can be automated, and it is called Continuous Integration and Continuous Deployment (CI CD Pipeline). In this article, we will discuss the later part of pipeline that is Release and Continuous Deployment.

    Creating a Release Pipeline for Continuous Deployment

    1. Go to Releases, as shown below:

      Go to Releases

    2. Create or import a pipeline (for that you need to export the existing one and then import)
      import a pipeline
    3. When you create a new pipeline, choose Empty Job, as shown below:
      choose Empty Job
    4. Now, add your stage name
      add your stage name
    5. Change the name of the pipeline
      name of the pipeline
    6. Now click on “Add an artifact” and choose the source as the builder we have created above:
      Add an artifact
    7. Now, add a trigger for automation (Continuous Deployment), add your branch by following steps as shown below:
      Continuous Deployment
    8. Now, add artifact filter, just in case you don’t want every stage to run for all the builds:
      add artifact filterHere, you need to choose the branch for which this stage is meant to run the pipeline
    9. The pipeline can be easily copied from existing one by uploading pipeline json which has given code.
      Also, you must change given builder name with yours under Tasks (for each of the stages)
      change given builder name
    10. Once you are done with the above activities, then go to variables and given info there:
      Add variables in Release
    11. Now simply save and run the pipeline
      Run Release Pipeline

    Hence, we have successfully created an end to end CICD Pipeline.

    Continuous Deployment

    In CICD Pipeline, we can automate the deployment part with Continuous Deployment. We have shown how to do that in step 07, above.

  • Azure Pipeline Setup – Build (Continuous Integration)

    Preface – This post is part of the SAP on Azure series.

    Introduction

    Azure DevOps provides an option to create a pipeline that can be configured in such a way that it can take the latest code from a branch, and build it into artifacts (deployable file) and then deploy the same in a specific cloud platform. This full process can be automated, and it is called Continuous Integration and Continuous Deployment (CI CD Pipeline). In this article, we will discuss the first part of pipeline that is Build and Continuous Integration.

    Build Pipeline Creation based on YAML

    Click New Pipeline

    Click New Pipeline

    Click on Azure Repos Git

    Click on Azure Repos Git

    Select your Repository

    Select your Repository

    Choose Starter Pipeline

    Choose Starter Pipeline

    Save and Run (Just add comment: “Initial Configuration”)

    Save and Run

    Note: In case you get error “Pushes to this branch are not permitted; you must use a pull request to update this branch.”  Then you need the permission to Push directly.
    Now you can see the newly created pipeline.

    newly created pipeline

    1. Now, we have a pipeline. The next thing we can do is to manually setup the whole pipeline or use the existing pipeline code. Here, we will use from the existing one.
      Click on the three dots next to the newly created pipeline:

    Edit Pipeline

    Add variables here:

    Add variables in Pipeline

    Add following variables:

    version.major = 1
    
    version.minor = 4
    version.patch = $[counter(variables['version.minor'], 0)]

    Add following variables

    Then add the given code in your yaml now(you can edit as per your branch name):

    # Variable 'version.major' was defined in the Variables tab
    # Variable 'version.minor' was defined in the Variables tab
    # Variable 'version.patch' was defined in the Variables tab
    # Cron Schedules have been converted using UTC Time Zone and may need to be updated for your location
    trigger:
      branches:
        include:
        - refs/heads/dev
        - refs/heads/release
      batch: True
    schedules:
    - cron: 0 0 * * *
      branches:
        include:
        - refs/heads/dev
    - cron: 0 8 * * *
      branches:
        include:
        - refs/heads/devui
    - cron: 0 16 * * *
      branches:
        include:
        - refs/heads/devui
    name: v$(version.major).$(version.minor).$(version.patch)__$(SourceBranchName)
    jobs:
    - job: Job_1
      displayName: Agent job 1
      pool:
        vmImage: ubuntu-18.04
      steps:
      - checkout: self
      - task: Bash@3
        displayName: Generate semantic version variable with value
        inputs:
          targetType: inline
          script: 
            if [ '$(Build.SourceBranchName)' == 'dev'];
    
            then
                echo "##vso[task.setvariable variable=semanticversion]dev_$(version.major).$(( $VERSION_MINOR +1 )).$(version.patch)"
            elif [  '$(Build.SourceBranchName)' == 'release']
    
            then
                echo "##vso[task.setvariable variable=semanticversion]v$(version.major).$(version.minor).$(version.patch)"
            else
                echo "##vso[task.setvariable variable=semanticversion]tmp_$(version.major).$(( $VERSION_MINOR +1 )).$(version.patch)"
            fi
      - task: NodeTool@0
        displayName: Use Node 10.x
        inputs:
          versionSpec: 10.x
      - task: CmdLine@2
        displayName: Build MBT Command
        inputs:
          script: >-
            npm install -g mbt
    
            npm config set @sap:registry https://registry.npmjs.org/
    
            mbt build
      - task: CopyFiles@2
        displayName: Copy Artifact to Staging Directory
        inputs:
          SourceFolder: $(agent.builddirectory)/s/mta_archives
          TargetFolder: $(Build.ArtifactStagingDirectory)
      - task: CmdLine@2
        displayName: Rename MTAR by the semantic versioning
        inputs:
          script: >+
            mv $(Build.ArtifactStagingDirectory)/*.mtar $(Build.ArtifactStagingDirectory)/TEST_$(semanticversion).mtar
    
      - task: file-creator@6
        displayName: Create file with variables
        inputs:
          filepath: $(Build.ArtifactStagingDirectory)/variables.json
          filecontent: >-
            {
                "semanticversion": "$(semanticversion)"
            }
      - task: PublishBuildArtifacts@1
        displayName: 'Publish Artifact: drop'
      - task: git-tag-on-release-task@9
        displayName: Tag Artifacts
        enabled: False
        inputs:
          staticTagName: $(semanticversion)
    ...
    
    
    

     

    Now, save your pipeline and run it. It will fetch the latest code from the base branch (here devui) and create a fresh build.

    Build Pipeline Creation based on tasks

    In this method, we will create a blank pipeline and tasks manually as shown below.

    1. Click on Create a new pipeline
    2. Click “Use the classic editor” from the bottom
    3. Now select a source and other details as shown below:
      select a source
    4. Select “Empty Job” from the next step:
      Select Empty Job
    5. Now you have reached to the main screen where all other information for the pipeline builder will be added:
      Builder configurationHere you can change the project name initially and add the variables in the variable tab as we did earlier. For example I changed the builder name and added a test variable.
      change the project name

      In our use case, add these variable with given value:

      1. major = 1
      2. minor = 4
      3. patch = $[counter(variables[‘version.minor’], 0)]
    6. Now, One by one add given tasks:
      Add tasks in DevOps Builder
    7. For Bash, these are the values, we have added:
      Display name: Generate semantic version variable with value
      Type: Inline
      Script:

      if [ '$(Build.SourceBranchName)' == 'dev'];
      
      then
          echo "##vso[task.setvariable variable=semanticversion]dev_$(version.major).$(( $VERSION_MINOR +1 )).$(version.patch)"
      elif [  '$(Build.SourceBranchName)' == 'release'  ]
      
      then
          echo "##vso[task.setvariable variable=semanticversion]v$(version.major).$(version.minor).$(version.patch)"
      else
          echo "##vso[task.setvariable variable=semanticversion]tmp_$(version.major).$(( $VERSION_MINOR +1 )).$(version.patch)"
      fi
      

       

    8. For Node.js tool installer, make given changes:
      Display name: Use Node 10.x
      Version Spec:
      x
    9. For Command line, make given changes:
      Display name: Build MBT Command
      Script:

      npm install -g mbt
      npm config set @sap:registry https://registry.npmjs.org/
      npm i -g @sap/cds-dk
      mbt build

       

    10. For Copy files, add given changes:
      Display name: Copy Artifact to Staging Directory
      Source Folder: $(agent.builddirectory)/s/mta_archives
      Target Folder:
      $(Build.ArtifactStagingDirectory)
    11. For Command line, make given changes:
      Display name: Rename MTAR by the semantic versioning
      Script:

      mv $(Build.ArtifactStagingDirectory)/*.mtar $(Build.ArtifactStagingDirectory)/TEST_$(semanticversion).mtar
    12. For File Creator, add given changes:
      Display name: Create file with variables
      File path: $(Build.ArtifactStagingDirectory)/variables.json
      File content:
      { “semanticversion”: “$(semanticversion)”}
    1. For Publish Build Artifacts, add given changes:
      Display name: Publish Artifact: drop
      Path to publish:
      $(Build.ArtifactStagingDirectory)
      Artifact name:
      drop
      Artifact publish location:
      Azure Pipelines
    2. Till now, you have added items and variables, now you can add given Triggers:
      Continuous Integration
    3. Now go to Options tab, and make given changes:
      Add Build number format
      Build number format: v$(version.major).$(version.minor).$(version.patch)__$(SourceBranchName)
    4. Now save and queue your pipeline, you have successfully created a pipeline. Now run it with the branch you want.

    Enabling Continuous Integration in Azure Pipelines

    In the above steps, at step number 14, we have added triggers. This is exactly what is known as Continuous Integration. Here, you enable it with a checkbox and add branches for which it is applied. Once the branch is changed by a Pull Request in future then the CI is automatically triggered and build is created. In the next article we will discuss regarding Continuous Deployment, the next part in CICD pipeline.

  • SAP ABAP RAP CRUD operation

    Preface – This post is part of the SAP ABAP RAP series.

    Introduction

    To enable the CRUD operations in SAP ABAP RAP managed scenario, you need to enable the transactional behavior in Behavior Definition. There is no need to explicitly implement the CRUD operation in behavior implementation class, the RAP framework itself handles this.

    Steps for enabling CRUD in RAP Managed scenario

    1. Create CDS views
    2. Create Behavior Definition
    3. Enable transactional behavior of Business Object and activate.
    4. Test using EML (Entity Manipulation Language)

    Create CDS views

    Procedure

    1. Right-click on package
    2. Go to New >> Other Repository Objects >> Core Data Services >> Data Definition
    3. Provide the details (Name, Description).
    4. Select Next and provide the Transport Request number.
    5. Select Finish.

    Interface view SAP RAP

    Create Behavior Definition

    Procedure

    1. Right-click on root CDS view
    2. Select New Behavior Definition
    3. Provide the details (Name, Description).
    4. Select Next and provide the Transport Request number.
    5. Select Finish.

    Create Behavior Definition

    Enable transactional behaviour and activate

    Add transactional behaviour in Behavior Definition

    Test using EML

    In Report, implement EML statements to test the CRUD operations

  • OData Development using SAP ABAP RAP

    Preface – This post is part of the SAP ABAP RAP series.

    Introduction

    In SAP ABAP RESTful Application programming, the business service is RESTful service which is called by end-users/customers. It consists of two parts: Service Definition and service binding. The service binding implements the protocol such as OData and the services to be consumed by customers. In this article we will learn OData development using SAP ABAP RAP.

    Steps for OData development using SAP ABAP RAP

    1. Create Service Definition
    2. Expose Services
    3. Create Service Binding
    4. Select service type as OData while creation. Click Finish.
    5. Activate service

    Create Service Definition

    Right-click on Package >> New >> Other Repositories Objects >> Service Definition.
    Provide the details to create a Service Definition.

    Create Service Definition

    Once the Service Definition is created, expose the required entities and activate it.

    expose the required entities

    Create Service Binding

    Right-click on Package >> New >> Other Repositories Objects >> Service Binding.
    Provide Package details, Name, Description and Service Definition name. Select the Binding Type as ODATA to create OData Service Binding.

    SAP RAP Create Service Binding

    Verify the information and click on activate.

    OData Publish SAP RAP

  • Debugging Errors on Azure DevOps

    Preface – This post is part of the SAP on Azure series.

    Introduction

    Azure DevOps is a powerful version management tool. Its CI/CD pipeline keeps the work in flow without interruption. But sometimes, even Azure DevOps ends with errors. These error can be categorized as follows:

    • Build Definition based errors: It means the error is in the Pipeline build.
    • Release Definition based errors: It means the error is in pipeline release.
    • Build Artifacts based errors (Error in code): It means the error is in the code. Sometimes the code is converted successfully into build artifacts (or drop files), but generates error during deployment.
    • Deployment environment generated errors: It means the error is generated by external deployment environment. The error may be in pipeline configuration or the build code.

    Debugging and Troubleshooting Errors on Azure DevOps

    All the debugging and troubleshooting Errors on Azure DevOps starts from log. Once the deployment fails, you can see error directly in the console as shown below:

    Errors on Azure DevOps

    You can click the error above to read more or simply download the log and explore later, as shown below:

    Download log in Azure Devops

    You can further turn debugging mode on, and run pipeline again, and then download logs for debugging. To turn the debugging mode on, you need to enable system diagnostics as shown below:

    Enable Debugging in Azure DevOps

    In case something went wrong, then the environment too returns log for analysis. For example, in case deployments in SAP Environment fails, they give cloud foundry commands to download the logs, something like this:

    -> cf deploy -i f450e444-8632-11ea-abb3-eeee0a8f6ba7 -a monitor                                  
    
    Updating application "uiDeployer"...
    
    Application "uiDeployer" attributes are not modified and will not be updated                     
    
    Uploading application "uiDeployer"...
    
    Content of application "uiDeployer" is not changed - upload will be skipped.                     
    
    Starting application "uiDeployer"...
    
    Application "uiDeployer" started
    
    Application "uiDeployer" executed
    
    Stopping application "uiDeployer"...
    
    Deleting discontinued configuration entries for application "uiDeployer"...
    
    Service key "onboarding-workflow-credentials" for service "workflow" already exists
    
    Uploading content module "onboarding" in target service "workflow"...
    
    Deploying content module "onboarding" in target service "workflow"...
    
    Skipping deletion of services, because the command line option "--delete-services" is not specified.
    
    Process finished.
    
    Use "cf dmol -i f450e444-8632-11ea-abb3-eeee0a8f6ba7" to download the logs of the process.

     

    Then, you can use terminal/command prompt to download the logs using the command as mentioned above. This will only work, once you login into their environment using the CLI.

    Now, you have successfully downloaded the log and you need to identify the issue so that you can troubleshoot, you can follow below steps to do the same:

    • Download the log
    • Identify the type of error, as discussed in the introduction
    • In case it is a pipeline error, check where exactly it failed. If it failed during build extract, you can simply try redeployment. If security files or YAML has issues, then you need to Google and identify the fix of the same. If the pipeline itself has error like “Deployment YAML file is not found”, then again you need to check if you are providing the right configuration in the YAML or Release pipeline or not
    • In case it is an error related to the code, then identify if it is a part of Frontend, Backend or Database, then accordingly assign the bug to respective developer
    • In case it is an error related to the environment, then check if the environment configuration is correct or not, download the log provided by the environment to identify the root cause. In case, you are still unable to fix environment based error, then raise a ticket to respective Admin team

    Common Errors on Azure DevOps

    Pipeline won’t trigger

     

    Pipeline queues but never gets an agent

     

    Pipeline fails to complete

    References

    Troubleshoot common errors in Azure DevOps CLI

    DevOps: Common mistakes and how to avoid them

    Troubleshoot connecting to a project

    Troubleshoot pipeline runs

    Review logs to diagnose pipeline issues

  • Azure Repository and Branches

    Preface – This post is part of the SAP on Azure series.

    Introduction

    Azure DevOps pipeline configuration starts with Azure Repository and Branches. We firstly create an Azure DevOps Repo, and then create our branches within it. Then only we can configure Azure Pipelines. In this article we will explore both Azure Repository and Branches.

    Azure DevOps Repository

    Azure DevOps Repository is a space where all the branches are created. We create separate Repos for individual projects.

    Steps to Add Repository

    1. Create a new Repository (You need Authorization to do so)
      New Repository in Azure DevOps
    2. Assign a name to your Repository e.g. “Test Repo”, and choose Type as Git:
      Create a new Repository

    You can find your Repo, like mentioned below:

    Find Azure DevOps repository

    Azure Git Branches

    When a new Repository is created, it just has master branch. As per the requirement of your project, you can create multiple branches. A simple flow of code includes three branches i.e. Develop, Release and Production. The Develop is the one where all the development is done, Release is where all the testing is performed by the testers and the Production is the one that has stable code, available for end users.

    Adding Branches

    According to your use case you can create Develop, Release and Production branch with certain policies (The branch will be on top of Master)

    Adding a new Branch in Azure DevOps

    Enter required details:

    Create a new Branch in Azure DevOps

    Add in Favorite:

    Mark branch as favourite

    Adding Policies in DevOps branches

    To add or change branch policies, you need to click on the three dots next to the branch and then click on “Branch policies”.

    Adding Policies in DevOps branches

    Following are some ideal policies:
    1. Require a minimum number of reviewers
    minimum number of reviewers in Azure Branch

    2. Mark “Check for linked work items” as “Required”

    3. Mark “Check for comment resolution” as “Required”

    4. Set “Limit merge types” as below:

    Limit merge type in Azure DevOps

    We can make more changes as per the project requirement. We can read more about policies here.

    5. Now add reviewers

    add reviewers in Azure Branch

    And then add these:

    Add new Reviewer policy in Azure DevOps

  • SAP Cloud Platform (SAP Business Technology Platform) Overview

    Preface – This post is part of the SAP on Azure series.

    Introduction

    In SAP’s world, SAP Cloud Platform or SAP Business Technology Platform is a well-known term. After introduction of SAP MTA and SAP CAPm, it has gained a lot of attention. In this article we will try to explore it.

    What is SAP Cloud Platform (SAP Business Technology Platform)

    SAP Cloud Platform is a Platform as a Service (PaaS) offered by SAP to develop cloud business applications. SAP Business Technology Platform (SAP BTP) offers SAP Cloud Platform with additional services in the form of Infrastructure as a Service and Software as a Service. It can be accessed here.

    SAP Business Technology Platform

    You can create a trial account by just clicking the Sign in button at right top.

    Let us discuss some important concepts related to SAP Cloud Platform:

    Global Accounts

    When you visit first time SAP Cloud Platform, then it is the first thing that you will create. A Global Account is mainly created for a team of projects or sometimes for a project. In this way you keep multiple teams or projects separate from each other on Cloud Platform.

    Regions

    While creating a Global Account, you might be asked to choose regions. A region here simply donate the location of the Hosting or database. If you stay in Germany, then you should the nearest location based region, as it improves the call speed and hence product quality.

    Sub Accounts

    Inside a Global Account, you need to create sub accounts. The sub accounts can be either SAP Neo or SAP Cloud Foundry. The WebIDE services are mostly linked to SAP Neo, hence it gets mandatory to have it. If you just want to plan deployment of UI5/Fiori with backend in the form of ABAP OData (on premise) or non-HANA based services, then you can simply go with Neo, else for MTA, CAPM, or SAP Leonardo, you will have to go for SAP Cloud Foundry based Sub Accounts.
    Neo belongs to SAP while Cloud Foundry is based on either AWS, Azure, GCP or Alibaba Hosting.

    Spaces

    Within a sub account, you have an option to create multiple spaces. It is must to have one space. This is the place where all your code is deployed. A space is used to divide a single account for multiple use case, like one for Development, one for Testing and one for Production.

    Services

    At all level i.e. Global Account, Sub Account and Spaces, you will find option to add a service. A service in SAP Cloud Platform is like an extension where you can utilise multiple cloud services from SAP like Destination, AWS object store, malware scanner, Business objects, Blockchain services and much more.

    Instances

    When you choose a service, you need to create an instance that will be linked to your project. An instance basically means a preserved copy of service, just for our project or space linked with micro services running within space.

    Destinations

    Destination is a place where you can maintain third party API calls, or OData API or even SAP APIs. We can either create a Destination as an Instance (as discussed above) or directly within space.

    Cloud Connectors

    A cloud connector is an important link to connect an on-premise service to SAP Cloud Platform.

    Security in SAP Cloud Platform

    SAP Cloud Platform provides an option to access Apps and services based upon roles. For this use case, Users, Roles and Role Collections are maintained within the space.