SAP

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Create and Implement the Workflow Handler Class

Create and implement the workflow handler class to trigger the workflow and handle callbacks from SAP Build Process Automation to receive workflow completion notifications and outcome.

Overview

You will learn

  • ✔How to create a workflow handler class.
  • ✔How to enable it to receive callbacks.
  • ✔How to call RAP Façade for SBPA workflow trigger.
  • ✔Methods to use to get trigger data and process callbacks.
Ruchi Dobriyal R Ruchi Dobriyal August 21, 2026
Created on November 22, 2024
Contributors

More from Ruchi Dobriyal

See all 9 tutorials by Ruchi Dobriyal →

Prerequisites

Steps

Intro

Once you have created a basic RAP Travel Application by following steps in tutorial Generate a RAP Business Service with the wizard. You would now create a new class in the application package to handle workflow related implementations i.e., method to create workflow trigger and method to handle callbacks to receive outcome of workflow from SAP Build Process Automation once the process is completed.

In case of Travel Approval Workflow, the callback applies the accept / reject decision of the workflow to the Accept Travel /Reject Travel statuses of the related travel instance.

Step 1 Create a workflow handler class
—

The workflow handler class will contain all the method implementations, constants, interface data types to exchange information with SAP Build Process Automation for workflow.

To create the class, follow the below steps:

  1. Right click on your Package and select New > ABAP Class

    ABAPClass
    ABAPClass

  2. Enter the below values to create the class.

    Name: ZCL_R_RAP_WORKFLOW_####

    Description: Workflow Handler Class

  3. Click Add to enter Interface and search for callback Interface IF_SWF_CPWF_CALLBACK.

    Click OK once found.

    Interface
    Interface

  4. Click Next. Select the transport request for your application and click Finish.

  5. Class is now created. You can see that the interface addition came with the method workflow_instance_completed which would be triggered during callback post completion of workflow in SAP Build Process Automation.

    In the later steps we would implement this method to receive workflow decision/notification.

    CallbackClass
    CallbackClass

    Thus to enable a class to be callback class we need to add Interface IF_SWF_CPWF_CALLBACK to it.

    IF_SWF_CPWF_CALLBACK is the interface required to handle callbacks. The method WORKFLOW_INSTANCE_COMPLETED of this interface is triggered in background once the Action Workflow Completion Notification is triggered in SAP Build Process Automation Post Approval Form is acted upon by the Approver (Accepted/Rejected).

    To troubleshoot/debug this method you would use the Background workflow user SAP_WFRT.

Step 2 ### Enrich the class definition with Constants and Data Types and Methods
+
Step 3 Implement methods to trigger workflow in the Class Implementation Section.
+
Step 4 Implement methods to handle callback in the Class Implementation Section.
+
Step 5 Test yourself
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Create a workflow handler class 2. ### Enrich the class definition with Constants and Data Types and Methods 3. Implement methods to trigger workflow in the Class Implementation Section. 4. Implement methods to handle callback in the Class Implementation Section. 5. Test yourself