When working with Specification Management, specifications often have parent-child inheritance relationships. When you create a new version of a parent specification, you typically need to create corresponding new versions for all child specifications that inherit from it, and update their inheritance links to point to the new parent version.
This guide walks you through building a SAP Build Process Automation workflow that automates this process. By the end, you will have a fully functional workflow that, given a parent specification version ID, automatically creates new versions of the parent and all its child specifications, and updates the inheritance relationships to maintain the hierarchy with the new versions.
HOW IT WORKS
This workflow automates the cascading of specification versions through inheritance hierarchies. Here's the logic:
- Create New Parent Version
– The workflow receives a parent specification version ID as input
– It creates a new version of this parent specification - Find All Child Specifications
– Query the inheritance relationships to find all specifications that inherit from the original parent
– These are the “children” that need to be updated - For Each Child Specification (Loop)
– Create a new version of the child specification
– The new child version initially inherits from the OLD parent version (this is automatic)
– Find the inheritance relationship record for the new child version
– Delete the old inheritance link (pointing to old parent)
– Create a new inheritance link (pointing to new parent)
– Repeat for the next child - End
– Once all children have been processed, the workflow ends
– All new child versions now inherit from the new parent version
PREREQUISITES: IMPORTING THE API ACTIONS
Before building the workflow, you need to import the PLM Specification Management API actions into SAP Build Process Automation.
Step 1: Download the API Specification
- Navigate to SAP Business Accelerator Hub (https://api.sap.com)
2. Search for “Specification Management”
3. Open the Specification V1 API (https://api.sap.com/api/SpecificationV1/overview)
4. Click API Specification and download JSON format
Step 2: Upload to SAP Build Process Automation
- Open SAP Build and navigate to the Lobby
2. In the left sidebar, go to Connectors > Actions
3. Click the Create button
4. Select Upload API Specification
5. Upload the downloaded JSON file
6. Give the Action project a name (e.g., “Specification Management Actions”)
Step 3: Add Required Actions
After creating the Action project, you need to add the specific actions you'll use in the workflow:
- Open your Action project and go to the Actions tab
2. Click Add > Available Action
3. Add the following actions:
| Method | Action Description |
| POST | Create a new version from an existing specification |
| POST | Creates a single inheritance relationship between specification versions |
| DELETE | Deletes a single inheritance relationship between specification versions |
| GET | Returns a list of inheritance relationships between specification versions |
Step 4: Configure URL Prefix
The URL prefix must be configured for the actions to work correctly:
- In the Action project, click the Settings button (gear icon, top right, next to the Release button)
2. Go to Project Settings > URL Prefix
3. Set the Resource Path to: /odata/v4/api/specification/v1
This path will be added as a prefix to all action URLs and as a suffix to your destination.
Step 5: Release and Publish
- Click Release to create a version of your Action project
2. Click Publish to make the actions available in your processes
Note: When you add an action to your workflow, the Action project will be automatically added as a dependency to your Process project.
PREREQUISITES: CREATING THE PROCESS PROJECT
Before setting up the workflow, you need to create a Process project in SAP Build:
- Navigate to the SAP Build Lobby
2. Click the Create dropdown button
3. Select Process Automation
In the Create Project wizard:
Step 1 – Objective:
– Select Automated Process
– Click Next
Step 2 – Type:
– Select Process (Build a business process to automate a workflow)
– Click Next
Step 3 – Name:
– Enter a Name for your project (e.g., “Cascade Specification Versions”)
– Optionally add a Description
– Click Review, then Create
After creation, a Create Process dialog will automatically appear:
– Name: Enter a name for the process (e.g., “Cascade Versions”)
– Description: Optionally add a description
– Click Create
You will now be taken to the process editor where you can start building your workflow.
Note: Ensure your destination for the PLM Specification Management service is already configured in your SAP BTP subaccount. For more information, see the SAP Help Portal documentation on managing destinations: https://help.sap.com/docs/build-process-automation/sap-build-process-automation/manage-destinations
PREREQUISITES: SETTING UP CUSTOM VARIABLES
Before building the workflow steps, you must define the custom variables in Process Details > Variables > Custom Variables:
| Variable | Name | Type Description |
| currentChildSpecVersionId | String (T) | Stores the current child specification version ID during iteration |
| parentInheritanceFilter | String (T) | OData filter for finding inheritance records by source specification |
| childInheritanceFilter | String (T) | Combined OData filter for source and target specification |
| loopIndex | Number (#) | Loop counter for iterating through child specifications |
To add these variables:
1. Click on the process canvas background (not on any step)
2. Open Process Details panel
3. Go to the Variables tab
4. Expand Custom Variables
5. Add each variable with the appropriate type
STEP-BY-STEP IMPLEMENTATION
Overview
Step 1: Configure the Trigger
The workflow starts with a trigger that receives the specificationVersionId of the parent specification to be versioned.
To configure the trigger input:
1. Click on the Trigger node (start event) in the process canvas
2. In the General tab, open the Inputs section
3. Click Configure next to the Inputs field
4. Add a new input parameter:
– Name: specificationVersionId
– Type: String
5. Click Apply
Input Context:
{
"startEvent": {
"specificationVersionId": ""
}
} Step 2: Create Parent New Version (Action)
Create a new version of the parent specification.
Action: Create a new version from an existing specification (POST)
Inputs:
id = Specification Version Id from trigger (Process Input)
Step 3: Filter with Source Spec (Script Task)
Build an OData filter to find all inheritance records where the parent specification is the source.
Script:
var specVerId = $.context.startEvent.specificationVersionId;
var filter = "sourceSpecificationVersion_id eq " + specVerId;
$.context.custom.parentInheritanceFilter = filter;Step 4: Get Parent Inheritance Relationships (Action)
Retrieve all specifications that inherit from the parent specification.
Action: Returns a list of inheritance relationships between specification versions (GET)
Inputs:
$filter = parentInheritanceFilter (Custom Variable)
Step 5: Initialize Loop Variable (Script Task)
Set up a counter to iterate through the child specifications.
Script:
$.context.custom.loopIndex = 0;Step 6: Loop Condition
Configure a condition to check if there are more child specifications to process.
To add the condition:
1. Click the + button after the previous step
2. Select Controls > Condition
3. Give it a name (e.g., “Loop Condition”)
To configure the If branch:
1. Click on the If branch
2. Open the Branch Condition configuration (…)
3. Add the expression:
– First value: Parent inheritance relationships > result > value
– Operator: number of items is greater than
– Second value: loopIndex (Custom Variable)
The Default branch will automatically lead to the End event when there are no more items to process.
Step 7: Get Current ID (Script Task)
Extract the current child specification ID from the array.
Script:
$.context.custom.currentChildSpecVersionId = $.context.action_get_SpecificationVersionInheritanceSources_1.result.value[$.context.custom.loopIndex].specificationVersion_id;Note: The context variable name (e.g., “action_get_SpecificationVersionInheritanceSources_1”) is auto-generated by SAP Build based on the action name and order. To find the correct path in your workflow, use the variable picker on the left side of the script.
Step 8: Create Child New Version (Action)
Create a new version of the current child specification.
Action: Create a new version from an existing specification (POST)
Inputs:
id = currentChildSpecVersionId (Custom Variable)
Step 9: Filter with Source and Target Spec (Script Task)
Build a combined filter to find the specific inheritance record between the new child version and the parent.
Script:
var specId = $.context.action_post_postSpecificationVer__ceV1CopyToNewVersion_2.result.id;
var filter = " and specificationVersion_id eq " + specId;
$.context.custom.childInheritanceFilter = $.context.custom.parentInheritanceFilter + filter;Step 10: Get Child Inheritance Relationships (Action)
Retrieve the specific inheritance record for the newly created child version.
Action: Returns a list of inheritance relationships between specification versions (GET)
Inputs:
$filter = childInheritanceFilter (Custom Variable)
Step 11: Delete Old Inheritance (Action)
Remove the old inheritance link (which still points to the old parent version).
Action: Deletes a single inheritance relationship between specification versions (DELETE)
Inputs:
id = Child Inheritance Relationships > result > value (Item 1) > id
Note: “Item 1” refers to the first element in the array (index 0). Since our filter is specific, this array should contain exactly one result.
Step 12: Create New Inheritance (Action)
Create a new inheritance link pointing to the new parent version.
Action: Creates a single inheritance relationship between specification versions (POST)
Inputs:
id = (leave empty – auto-generated)
inheritanceTemplate_id = Child Inheritance Relationships > result > value (Item 1) > inheritanceTemplate_id
sourceSpecificationVersion_id = Parent New Version > result > id
specificationVersion_id = Child New Version > result > id
Step 13: Increment Loop Variable (Script Task)
Move to the next child specification.
Script:
$.context.custom.loopIndex += 1;Step 14: Go to Condition
Loop back to the condition check to process the next child specification, or exit if all children have been processed.
To add the Go to control:
1. Click the + button after the Increment Loop Variable step
2. Select Controls > Go to Step
3. In the configuration panel, select the target step: Loop Condition (from Step 6)
This creates the loop – after processing each child specification, the workflow returns to the condition to check if there are more children to process.



