logo

Are you need IT Support Engineer? Free Consultant

Trigger an SAP Build Process Automation Workflow f…

  • By sujay
  • 02/07/2026
  • 34 Views

Overview

 

Previously, triggering an SAP Build Process Automation (SBPA) workflow from a CAP application required direct REST API calls. On April 26, 2026, the Node.js plugin `@cap-js/process` was released as its first beta, offering a native CAP integration. This guide walks through the complete setup step by step.

 

Prerequisites

Procedure

 

Step 1 — Develop and Deploy a Process in SBPA

Create and deploy your process in the SAP Build Process Automation designer.

 

Capwf-2.Png

Capwf-4.PngCapwf-5.PngCapwf-3.PngCapwf-6.Png

 

After deployment, locate the workflow instance ID in the deployment details.

 

Capwf-7.PngCapwf-8.Png

 

In this example the process definition ID is:

ap10.iac-apj-workshop-i30jhz3m.wfcap1.wfcap1

 

Note this value — it is required in Steps 5 and 7.

 

Step 2 — Generate a Sample CAP Project

cds init capwf --nodejs --add sample
cd capwf

 

Capwf-10.Png

 

 

Step 3 — Add the `@cap-js/process` Plugin

npm add @cap-js/process

 

Capwf-11.Png

 

 

Step 4 — Bind the CAP Project to the SBPA Service Instance

 

Log in to Cloud Foundry and bind the `ProcessService` to your SBPA service instance.

cf login -a https://api.cf..hana.ondemand.com --sso
cds bind ProcessService -2 

 

> Replace `` with your Cloud Foundry region (e.g. `eu10`, `us10`) and `` with the name of your SBPA service instance.

Capwf-12.PngCapwf-13.PngCapwf-14.Png

 

 

Step 5 — Import the Process as a CDS Service

 

Use the `process_definition_id` from [Step 1].

cds import --from process --name 

 

Capwf-15.Png

 

 

Step 6 — Open the Project in VS Code

 

 

Capwf-16.Png

 

Step 7 — Annotate the CDS Service to Trigger the Workflow

 

Edit `srv/admin-service.cds` to add `@bpm.process` annotations to the `Books` entity.

 

**Before:**

using {sap.capire.bookshop as my} from '../db/schema';
service AdminService {
entity Authors as projection on my.Authors;
entity Books as projection on my.Books;
entity Genres as projection on my.Genres;
}

 

 

After:

 

 

 

“`cds

using {sap.capire.bookshop as my} from ‘../db/schema';

 

service AdminService {

 

entity Authors as projection on my.Authors;

 

id : ‘ap10.iac-apj-workshop-i30jhz3m.wfcap1.wfcap1',

on : ‘submit',

inputs: [

{ path: $self.idStr, as: ‘id' },

{ path: $self.authorName, as: ‘author' },

$self.title,

$self.descr,

{ path: $self.genreName, as: ‘genre' },

$self.stock,

$self.price,

{ path: $self.currencyCode, as: ‘currency' }

]

}

@BPM.process.cancel #one : {on: ‘DELETE'}
@BPM.process.businessKey #one: (title)
@BPM.process.businessKey : (ID)

entity Books as projection on my.Books {

*,

cast(ID as String) as idStr : String,

author.name as authorName : String,

genre.name as genreName : String,

currency.code as currencyCode: String

}

actions {

action submit();

};

 

entity Genres as projection on my.Genres;

 

}

“`

 

Key annotations explained:

 

| Annotation | Purpose |

| ————————– | —————————————————————————————————— |

| `@bpm.process.start` | Triggers the SBPA workflow when the `submit` action is called, mapping entity fields to process inputs |

| `@bpm.process.cancel` | Cancels the running workflow instance when the entity is deleted |

| `@bpm.process.businessKey` | Sets the business key used to correlate the workflow instance with the CAP entity |

 

Capwf-17.Png

 

Step 8 — Run the Application Locally

 

Start the application in hybrid mode so it connects to the bound SBPA service instance.

cds watch --profile hybrid

 

Capwf-18.Png

 

 

Step 9 — Test the `submit` Action

 

Create `test/http/AdminService.http` and send the following request to trigger the SBPA workflow for an existing active book.

 

@server=http://localhost:4004
@username=alice
@password=

### Books Submit action on an existing active Book (ID=201)
# @NAME Books_Submit_Existing
POST {{server}}/odata/v4/admin/Books(ID=201,IsActiveEntity=true)/AdminService.submit
Content-Type: application/json
Authorization: Basic {{username}}:{{password}}


{}

 

 

 

The terminal confirms the workflow was triggered — notice `[process] – Starting process ap10.iac-apj-workshop-i30jhz3m.wfcap1.wfcap1` and the book data passed as inputs.

Capwf-19.Png

 

 

Step 10 — Verify the Workflow Task in SBPA My Inbox

 

Open the SAP Build Process Automation **My Inbox**. The approval task appears with the book data (ID, author, title, description, genre, stock, price, currency) populated from the CAP entity.

Capwf-20.Png

 

 

The End!

 

Thank you for your time!

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *

Chat with us on WhatsApp!