Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
In SAP Cloud ALM, we've been incrementally adding features to our APIs. We've reached a critical mass, allowing you to powerfully automate implementation projects and create new added value.

To help you get started, we recently published a Jupyter notebook containing example API calls for a scenario of interest to many SAP partners: taking a template project in one Cloud ALM tenant, and replicating it to one or more client tenants.

The notebook is in GitHub: calm-copy-template-project.ipynb

You can view the notebook directly in GitHub or download it and try it out in your own environment.

Even though this shows a tenant to tenant copy of a project, it works the same way if you have just one tenant and wish to replicate the contents of an existing project to a new one within your tenant.

What It Does

The notebook contains examples of the following:

  1. Authenticating to a source and to a target Cloud ALM tenant.

  2. Reading a template project from the source tenant.

  3. Creating a new project in the target tenant.

  4. Copying the scopes, solution processes, project tasks, user stories, defects, requirements, and sub-task from the template project to the target project.

  5. Recreating the references between project tasks, requirements, etc. to solution processes

Authentication and Authorization

As is so often the case, the hardest part is ensuring secure authentication and authorization. We cannot stress enough how important it is to protect your credentials, and to restrict the authorizations to the minimum you require for your use case.

In this example, we suggest providing only read-only access to the template project. In the target tenant, you'll have to provide sufficient authorization to read and write projects, tasks, and process management entities.

See the SAP Business Technology Platform documentation for more information.

The APIs

We use three sets of SAP Cloud ALM APIs in this example:

  1. Projects - for finding and reading the template project, and for creating the target project in the target tenant.

  2. Process Scopes - for reading scopes, solution scenario versions, and solution processes from the template project and writing them to the target project.

  3. Tasks - for similarly reading and writing tasks, user stories, requirements, defects, and subtasks.

The Notebook

In the notebook - which contains *examples*, not optimized code - we've provided explanations of what each API does. If you run the example code yourself, the Jupyter kernel will print out the results after each code cell.

An example from the notebook. At the top is the explanation of what the following code cell does. At the bottom is the output after the cell runs.

Use External IDs to Keep References to the Original Tasks

You'll note as we get further down in the examples, that we save the IDs of the template tasks in the "externalId" field of the target tasks. This establishes a link between the new task and its original.

This code reads the target tasks and shows the first ones which have external ids.

The external ID is a convenient way of tracking a task's origin, or keeping a link to a copy in another external system. This is useful for many cases, such as replicating tasks to and from another task management application.

Your Feedback is Welcome

We hope this example provides you help and ideas on getting started with creating your own applications. We are always improving our APIs in particular as well as our products in general.

See the SAP Cloud ALM home page for news and contacts:

Alongside this example, you can find others in our GitHub repository: