Skip to Content
Technical Articles
Author's profile photo Priyanka Chakraborti

SAP Cloud Integration with Workflow and Business Rule


In this blog post, I will explain how to use cloud integration with workflow for a simple credit card request scenario. In this workflow, I will use business rule to get the credit card tier (i.e. Gold/Platinum/Silver) based on requestor’s level in organisation’s hierarchy.


  1. An employee will raise a credit card request. This is mimicked using Postman.
  2. The message will go to the cloud integration flow (capability within SAP Integration Suite). 
  3. The cloud integration flow will format the message as required by workflow and specify which particular workflow instance and business rule need to be executed.
  4. In this workflow, initial input context will contain only employee ID information.
  5. The first service task will fetch the required information for that employee (i.e. Name, Position, Contact no. etc.)
  6. The second service task will call the business rule (capability with SAP Workflow Management) to find which credit card tier the requestor is eligible for.
  7. A user task will be sent to the finance team for approval. Finance team can upgrade or downgrade the credit card tier. In case of rejection, it is recommended to specify reasons for rejection.
  8. A mail will be sent to the requestor regarding approval or rejection. Rejection mail will contain the reason for rejection. For this experiment, I am using my email id to get the mails.

Prerequisite Setup:

Three subscriptions are required in the BTP trial.

  1. SAP Business Application Studio: To create workflow (Reference Link:
  2. Workflow Management: To monitor deployed workflow/workflow instance and create Business Rule. (Reference Link:
  3. Integration Suite : To create Integration flow in Cloud Integration (Reference Link:

Design Solution:

Workflow Creation:



Step 1:

Create a service task to fetch employee details based on employee ID.


Service Task

Create a destination named ‘EmpServ’ in BTP Cockpit containing base URL and authentication details.

Step 2: 

Prepare required message format for calling Business Rule to get tier details based on Employee level using JS in ‘Script Task’.

var requestData = {
  request: {
    RuleServiceId: $.context.brmId,
    Vocabulary: [
        EmpLevel: {
          level: $.context.EmpDetails.ReportsTo,

$.context.requestData = requestData;

Step 3:

Call Business Rule using ‘Service Task’ step.


Service Task

Step 4:

Create a ‘User task’ step for finance team approval. User interface is of type ‘Form’.

Step 5:

Use below JS in ‘Script Task’ to set the decision in context.

var decision = $.usertasks.usertask1.last.decision;
$.context.decision = decision;

Step 6:

Use ‘Exclusive Gateway’ to execute the ‘Approve’ or ‘Reject’ path.

Condition for approval path: ${context.decision == “approve”}

Condition for rejection path: set as Default

Step 7:

Use ‘Mail Task’ to send approval or rejection mail.

In BTP cockpit, configure destination for Mail. Below is the template for mail destination.


Reference Link for Mail Destination creation:

Step 8:

Deploy MTA Archive.

Business Rule:

Step 1:

Go to Workflow Management -> Manage Project Rules (Under Development tools) -> Create Project

Step 2:

Create two local data objects: EmpLevel (Usage: Input) and Output (Usage: Result)


Local Data Object for Input


Local Data Object for Result

‘Tier’ attribute is associated with value help.


Value List for Tier

Step 3:

Create Rule to determine tier based on employee level.


Decision Table

Step 4:

Create RuleSet and Rule Service.

Step 5:

Deploy Rule Service to Cloud Runtime.

Reference Link for step by step creation of Business Rule and testing:

Cloud Integration:

Navigation Path:

Go to SAP Integration Suite -> Cloud Integration



Step 1:

Configure sender channel as below.


Sender Channel

Step 2:

Configure ‘Content Modifier’ as below.


Message Header


Exchange Property


Message Body

Step 3:

Configure Receiver Channel as below.


Receiver Channel

Step 4:

Create OAuth2 Client credentials in Security Material.


OAuth2 Client Credentials

Test Execution:

Step 1:

Trigger message using Postman tool to the cloud integration flow endpoint.



Step 2:

Approve/Reject Credit card request from Workflow Management -> Productivity tools -> My Inbox.



Before approving, let’s change the Tier to ‘Platinum’ from the dropdown list.

Step 3:

Mail notification is received.


Approval Email



  1. To initiate workflow from Cloud integration, ‘workflow_rest_url’ is used, which can be found by viewing the ‘Service Key’ details of the deployed workflow instance in BTP cockpit.
  2. ‘Rule Execution API for Cloud Foundry’ available in SAP API Business Hub is used to invoke Rule Service from Workflow Service Task.
  3. Rule Service ID and Workflow Definition ID are used as ‘Externalized Parameters’ in IFLOW to keep the flow dynamic.

Thank you for reading this blog post. Hope this helps. Please feel free to share your feedback or thoughts in a comment or ask questions in the below Q&A tag.


Priyanka Chakraborti


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Frank Li
      Frank Li

      Great blog, thanks a lot for sharing.

      Author's profile photo Priyanka Chakraborti
      Priyanka Chakraborti
      Blog Post Author

      Thank you 🙂

      Author's profile photo DEO DEO
      DEO DEO

      excellent blog can i get the code snippet

      Author's profile photo Priyanka Chakraborti
      Priyanka Chakraborti
      Blog Post Author

      Thanks. The code snippet is already present in the blogpost. Anything specific you are looking for? Sorry for late response.

      Author's profile photo Souymodip Chakraborty
      Souymodip Chakraborty

      good one

      Author's profile photo Priyanka Chakraborti
      Priyanka Chakraborti
      Blog Post Author


      Author's profile photo Tom Zhao
      Tom Zhao

      This is awesome blog/info, thank you!

      Author's profile photo Priyanka Chakraborti
      Priyanka Chakraborti
      Blog Post Author

      Thank you Tom 🙂